diff options
| author | Corey Powell <[email protected]> | 2015-07-14 09:44:04 -0500 |
|---|---|---|
| committer | Corey Powell <[email protected]> | 2015-07-14 09:44:04 -0500 |
| commit | eb172c28d79b4fdf978e78fc7e929caa855dd29b (patch) | |
| tree | 8303b34616c782fda76cef4c66a87b1cbd33b65c /include | |
| parent | f0e920baf07e17fd1073566d7e9605f9192d766d (diff) | |
| download | mruby-eb172c28d79b4fdf978e78fc7e929caa855dd29b.tar.gz mruby-eb172c28d79b4fdf978e78fc7e929caa855dd29b.zip | |
Applied gc patch to fix ORIGIN ICLASS method table leak
Based on the gc patch by ko1
https://github.com/ruby/ruby/commit/5922c954614e5947a548780bb3b894626affe6dd
Diffstat (limited to 'include')
| -rw-r--r-- | include/mruby/class.h | 7 | ||||
| -rw-r--r-- | include/mruby/object.h | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/include/mruby/class.h b/include/mruby/class.h index 60310ae9d..9f2c32bb0 100644 --- a/include/mruby/class.h +++ b/include/mruby/class.h @@ -49,8 +49,11 @@ mrb_class(mrb_state *mrb, mrb_value v) } } -#define MRB_SET_INSTANCE_TT(c, tt) c->flags = ((c->flags & ~0xff) | (char)tt) -#define MRB_INSTANCE_TT(c) (enum mrb_vtype)(c->flags & 0xff) +// TODO: figure out where to put user flags +#define MRB_FLAG_IS_ORIGIN (1 << 20) +#define MRB_FLAG_IS_INSTANCE (0xFF) +#define MRB_SET_INSTANCE_TT(c, tt) c->flags = ((c->flags & ~MRB_FLAG_IS_INSTANCE) | (char)tt) +#define MRB_INSTANCE_TT(c) (enum mrb_vtype)(c->flags & MRB_FLAG_IS_INSTANCE) MRB_API struct RClass* mrb_define_class_id(mrb_state*, mrb_sym, struct RClass*); MRB_API struct RClass* mrb_define_module_id(mrb_state*, mrb_sym); diff --git a/include/mruby/object.h b/include/mruby/object.h index fe55620fe..6633a23e8 100644 --- a/include/mruby/object.h +++ b/include/mruby/object.h @@ -14,6 +14,8 @@ struct RClass *c;\ struct RBasic *gcnext +#define MRB_FLAG_TEST(obj, flag) ((obj)->flags & flag) + /* white: 011, black: 100, gray: 000 */ #define MRB_GC_GRAY 0 #define MRB_GC_WHITE_A 1 |
