Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
24366930
Commit
24366930
authored
Mar 15, 2013
by
Yukihiro Matz Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
obsolete mrb_object; opposite of bc870ce
parent
c5db1397
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
24 additions
and
19 deletions
+24
-19
include/mruby.h
include/mruby.h
+2
-2
include/mruby/class.h
include/mruby/class.h
+1
-1
include/mruby/value.h
include/mruby/value.h
+2
-1
src/class.c
src/class.c
+1
-1
src/error.c
src/error.c
+1
-1
src/hash.c
src/hash.c
+7
-3
src/load.c
src/load.c
+1
-1
src/parse.y
src/parse.y
+3
-3
src/vm.c
src/vm.c
+6
-6
No files found.
include/mruby.h
View file @
24366930
...
...
@@ -232,11 +232,11 @@ int mrb_gc_arena_save(mrb_state*);
void
mrb_gc_arena_restore
(
mrb_state
*
,
int
);
void
mrb_gc_mark
(
mrb_state
*
,
struct
RBasic
*
);
#define mrb_gc_mark_value(mrb,val) do {\
if (mrb_type(val) >= MRB_TT_OBJECT) mrb_gc_mark((mrb), mrb_
object
(val));\
if (mrb_type(val) >= MRB_TT_OBJECT) mrb_gc_mark((mrb), mrb_
basic
(val));\
} while (0)
void
mrb_field_write_barrier
(
mrb_state
*
,
struct
RBasic
*
,
struct
RBasic
*
);
#define mrb_field_write_barrier_value(mrb, obj, val) do{\
if ((val.tt >= MRB_TT_OBJECT)) mrb_field_write_barrier((mrb), (obj), mrb_
object
(val));\
if ((val.tt >= MRB_TT_OBJECT)) mrb_field_write_barrier((mrb), (obj), mrb_
basic
(val));\
} while (0)
void
mrb_write_barrier
(
mrb_state
*
,
struct
RBasic
*
);
...
...
include/mruby/class.h
View file @
24366930
...
...
@@ -42,7 +42,7 @@ mrb_class(mrb_state *mrb, mrb_value v)
case
MRB_TT_MAIN
:
return
mrb
->
object_class
;
default:
return
mrb_obj
ect
(
v
)
->
c
;
return
mrb_obj
_ptr
(
v
)
->
c
;
}
}
...
...
include/mruby/value.h
View file @
24366930
...
...
@@ -144,7 +144,6 @@ mrb_float_value(mrb_float f)
#define mrb_fixnum(o) (o).value.i
#define mrb_symbol(o) (o).value.sym
#define mrb_object(o) ((struct RBasic *) (o).value.p)
#define mrb_voidp(o) (o).value.p
#define mrb_fixnum_p(o) (mrb_type(o) == MRB_TT_FIXNUM)
#define mrb_float_p(o) (mrb_type(o) == MRB_TT_FLOAT)
...
...
@@ -195,6 +194,8 @@ struct RObject {
};
#define mrb_obj_ptr(v) ((struct RObject*)((v).value.p))
/* obsolete macro mrb_object; will be removed soon */
#define mrb_object(o) mrb_obj_ptr(o)
#define mrb_immediate_p(x) (mrb_type(x) <= MRB_TT_MAIN)
#define mrb_special_const_p(x) mrb_immediate_p(x)
...
...
src/class.c
View file @
24366930
...
...
@@ -921,7 +921,7 @@ mrb_singleton_class(mrb_state *mrb, mrb_value v)
default:
break
;
}
obj
=
mrb_
object
(
v
);
obj
=
mrb_
basic
(
v
);
prepare_singleton_class
(
mrb
,
obj
);
return
mrb_obj_value
(
obj
->
c
);
}
...
...
src/error.c
View file @
24366930
...
...
@@ -206,7 +206,7 @@ exc_debug_info(mrb_state *mrb, struct RObject *exc)
void
mrb_exc_raise
(
mrb_state
*
mrb
,
mrb_value
exc
)
{
mrb
->
exc
=
(
struct
RObject
*
)
mrb_object
(
exc
);
mrb
->
exc
=
mrb_obj_ptr
(
exc
);
exc_debug_info
(
mrb
,
mrb
->
exc
);
if
(
!
mrb
->
jmp
)
{
mrb_p
(
mrb
,
exc
);
...
...
src/hash.c
View file @
24366930
...
...
@@ -52,11 +52,15 @@ mrb_gc_mark_ht(mrb_state *mrb, struct RHash *hash)
khash_t
(
ht
)
*
h
=
hash
->
ht
;
if
(
!
h
)
return
;
for
(
k
=
kh_begin
(
h
);
k
!=
kh_end
(
h
);
k
++
)
for
(
k
=
kh_begin
(
h
);
k
!=
kh_end
(
h
);
k
++
)
{
if
(
kh_exist
(
h
,
k
))
{
mrb_gc_mark_value
(
mrb
,
kh_key
(
h
,
k
));
mrb_gc_mark_value
(
mrb
,
kh_value
(
h
,
k
));
mrb_value
key
=
kh_key
(
h
,
k
);
mrb_value
val
=
kh_value
(
h
,
k
);
mrb_gc_mark_value
(
mrb
,
key
);
mrb_gc_mark_value
(
mrb
,
val
);
}
}
}
size_t
...
...
src/load.c
View file @
24366930
...
...
@@ -683,7 +683,7 @@ static void
irep_error
(
mrb_state
*
mrb
,
int
n
)
{
static
const
char
msg
[]
=
"irep load error"
;
mrb
->
exc
=
(
struct
RObject
*
)
mrb_object
(
mrb_exc_new
(
mrb
,
E_SCRIPT_ERROR
,
msg
,
sizeof
(
msg
)
-
1
));
mrb
->
exc
=
mrb_obj_ptr
(
mrb_exc_new
(
mrb
,
E_SCRIPT_ERROR
,
msg
,
sizeof
(
msg
)
-
1
));
}
#ifdef ENABLE_STDIO
...
...
src/parse.y
View file @
24366930
...
...
@@ -5157,13 +5157,13 @@ load_exec(mrb_state *mrb, parser_state *p, mrbc_context *c)
n = snprintf(buf, sizeof(buf), "line %d: %s\n",
p->error_buffer[0].lineno, p->error_buffer[0].message);
mrb->exc =
(struct RObject*)mrb_object
(mrb_exc_new(mrb, E_SYNTAX_ERROR, buf, n));
mrb->exc =
mrb_obj_ptr
(mrb_exc_new(mrb, E_SYNTAX_ERROR, buf, n));
mrb_parser_free(p);
return mrb_undef_value();
}
else {
static const char msg[] = "syntax error";
mrb->exc =
(struct RObject*)mrb_object
(mrb_exc_new(mrb, E_SYNTAX_ERROR, msg, sizeof(msg) - 1));
mrb->exc =
mrb_obj_ptr
(mrb_exc_new(mrb, E_SYNTAX_ERROR, msg, sizeof(msg) - 1));
mrb_parser_free(p);
return mrb_undef_value();
}
...
...
@@ -5172,7 +5172,7 @@ load_exec(mrb_state *mrb, parser_state *p, mrbc_context *c)
mrb_parser_free(p);
if (n < 0) {
static const char msg[] = "codegen error";
mrb->exc =
(struct RObject*)mrb_object
(mrb_exc_new(mrb, E_SCRIPT_ERROR, msg, sizeof(msg) - 1));
mrb->exc =
mrb_obj_ptr
(mrb_exc_new(mrb, E_SCRIPT_ERROR, msg, sizeof(msg) - 1));
return mrb_nil_value();
}
if (c) {
...
...
src/vm.c
View file @
24366930
...
...
@@ -478,7 +478,7 @@ localjump_error(mrb_state *mrb, localjump_error_kind kind)
mrb_str_buf_cat
(
mrb
,
msg
,
lead
,
sizeof
(
lead
)
-
1
);
mrb_str_buf_cat
(
mrb
,
msg
,
kind_str
[
kind
],
kind_str_len
[
kind
]);
exc
=
mrb_exc_new3
(
mrb
,
E_LOCALJUMP_ERROR
,
msg
);
mrb
->
exc
=
(
struct
RObject
*
)
mrb_object
(
exc
);
mrb
->
exc
=
mrb_obj_ptr
(
exc
);
}
static
void
...
...
@@ -498,7 +498,7 @@ argnum_error(mrb_state *mrb, int num)
mrb
->
ci
->
argc
,
num
);
}
exc
=
mrb_exc_new
(
mrb
,
E_ARGUMENT_ERROR
,
buf
,
len
);
mrb
->
exc
=
(
struct
RObject
*
)
mrb_object
(
exc
);
mrb
->
exc
=
mrb_obj_ptr
(
exc
);
}
#ifdef ENABLE_DEBUG
...
...
@@ -780,7 +780,7 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
CASE
(
OP_RAISE
)
{
/* A raise(R(A)) */
mrb
->
exc
=
(
struct
RObject
*
)
mrb_object
(
regs
[
GETARG_A
(
i
)]);
mrb
->
exc
=
mrb_obj_ptr
(
regs
[
GETARG_A
(
i
)]);
goto
L_RAISE
;
}
...
...
@@ -1062,7 +1062,7 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
mrb_value
exc
;
static
const
char
m
[]
=
"super called outside of method"
;
exc
=
mrb_exc_new
(
mrb
,
E_NOMETHOD_ERROR
,
m
,
sizeof
(
m
)
-
1
);
mrb
->
exc
=
(
struct
RObject
*
)
mrb_object
(
exc
);
mrb
->
exc
=
mrb_obj_ptr
(
exc
);
goto
L_RAISE
;
}
stack
=
e
->
stack
+
1
;
...
...
@@ -1911,7 +1911,7 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
if
(
!
mrb
->
ci
->
target_class
)
{
static
const
char
msg
[]
=
"no target class or module"
;
mrb_value
exc
=
mrb_exc_new
(
mrb
,
E_TYPE_ERROR
,
msg
,
sizeof
(
msg
)
-
1
);
mrb
->
exc
=
(
struct
RObject
*
)
mrb_object
(
exc
);
mrb
->
exc
=
mrb_obj_ptr
(
exc
);
goto
L_RAISE
;
}
regs
[
GETARG_A
(
i
)]
=
mrb_obj_value
(
mrb
->
ci
->
target_class
);
...
...
@@ -1964,7 +1964,7 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
else
{
exc
=
mrb_exc_new3
(
mrb
,
E_LOCALJUMP_ERROR
,
msg
);
}
mrb
->
exc
=
(
struct
RObject
*
)
mrb_object
(
exc
);
mrb
->
exc
=
mrb_obj_ptr
(
exc
);
goto
L_RAISE
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment