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
d6b89868
Unverified
Commit
d6b89868
authored
Dec 25, 2019
by
Yukihiro "Matz" Matsumoto
Committed by
GitHub
Dec 25, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4907 from shuujii/fix-poteltially-use-of-wrong-method-cache
Fix potentially use of wrong method cache
parents
d4cbe627
0b2d54f4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
6 deletions
+12
-6
include/mruby/class.h
include/mruby/class.h
+6
-0
src/class.c
src/class.c
+4
-6
src/gc.c
src/gc.c
+2
-0
No files found.
include/mruby/class.h
View file @
d6b89868
...
...
@@ -95,6 +95,12 @@ void mrb_gc_mark_mt(mrb_state*, struct RClass*);
size_t
mrb_gc_mark_mt_size
(
mrb_state
*
,
struct
RClass
*
);
void
mrb_gc_free_mt
(
mrb_state
*
,
struct
RClass
*
);
#ifdef MRB_METHOD_CACHE
void
mrb_mc_clear_by_class
(
mrb_state
*
mrb
,
struct
RClass
*
c
);
#else
#define mrb_mc_clear_by_class(mrb,c)
#endif
MRB_END_DECL
#endif
/* MRUBY_CLASS_H */
src/class.c
View file @
d6b89868
...
...
@@ -285,11 +285,9 @@ mrb_define_class(mrb_state *mrb, const char *name, struct RClass *super)
static
mrb_value
mrb_bob_init
(
mrb_state
*
mrb
,
mrb_value
);
#ifdef MRB_METHOD_CACHE
static
void
mc_clear_all
(
mrb_state
*
mrb
);
static
void
mc_clear_by_class
(
mrb_state
*
mrb
,
struct
RClass
*
);
static
void
mc_clear_by_id
(
mrb_state
*
mrb
,
struct
RClass
*
,
mrb_sym
);
#else
#define mc_clear_all(mrb)
#define mc_clear_by_class(mrb,c)
#define mc_clear_by_id(mrb,c,s)
#endif
...
...
@@ -303,7 +301,7 @@ mrb_class_inherited(mrb_state *mrb, struct RClass *super, struct RClass *klass)
super
=
mrb
->
object_class
;
super
->
flags
|=
MRB_FL_CLASS_IS_INHERITED
;
s
=
mrb_obj_value
(
super
);
mc_clear_by_class
(
mrb
,
klass
);
m
rb_m
c_clear_by_class
(
mrb
,
klass
);
mid
=
mrb_intern_lit
(
mrb
,
"inherited"
);
if
(
!
mrb_func_basic_p
(
mrb
,
s
,
mid
,
mrb_bob_init
))
{
mrb_value
c
=
mrb_obj_value
(
klass
);
...
...
@@ -1109,7 +1107,7 @@ include_module_at(mrb_state *mrb, struct RClass *c, struct RClass *ins_pos, stru
m
->
flags
|=
MRB_FL_CLASS_IS_INHERITED
;
ins_pos
->
super
=
ic
;
mrb_field_write_barrier
(
mrb
,
(
struct
RBasic
*
)
ins_pos
,
(
struct
RBasic
*
)
ic
);
mc_clear_by_class
(
mrb
,
ins_pos
);
m
rb_m
c_clear_by_class
(
mrb
,
ins_pos
);
ins_pos
=
ic
;
skip:
m
=
m
->
super
;
...
...
@@ -1322,8 +1320,8 @@ mc_clear_all(mrb_state *mrb)
}
}
static
void
mc_clear_by_class
(
mrb_state
*
mrb
,
struct
RClass
*
c
)
void
m
rb_m
c_clear_by_class
(
mrb_state
*
mrb
,
struct
RClass
*
c
)
{
struct
mrb_cache_entry
*
mc
=
mrb
->
cache
;
int
i
;
...
...
src/gc.c
View file @
d6b89868
...
...
@@ -807,10 +807,12 @@ obj_free(mrb_state *mrb, struct RBasic *obj, int end)
case
MRB_TT_SCLASS
:
mrb_gc_free_mt
(
mrb
,
(
struct
RClass
*
)
obj
);
mrb_gc_free_iv
(
mrb
,
(
struct
RObject
*
)
obj
);
mrb_mc_clear_by_class
(
mrb
,
(
struct
RClass
*
)
obj
);
break
;
case
MRB_TT_ICLASS
:
if
(
MRB_FLAG_TEST
(
obj
,
MRB_FL_CLASS_IS_ORIGIN
))
mrb_gc_free_mt
(
mrb
,
(
struct
RClass
*
)
obj
);
mrb_mc_clear_by_class
(
mrb
,
(
struct
RClass
*
)
obj
);
break
;
case
MRB_TT_ENV
:
{
...
...
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