Applied gc patch to fix ORIGIN ICLASS method table leak

Based on the gc patch by ko1

https://github.com/ruby/ruby/commit/5922c954614e5947a548780bb3b894626affe6dd
This commit is contained in:
Corey Powell
2015-07-14 09:44:04 -05:00
parent f0e920baf0
commit eb172c28d7
4 changed files with 18 additions and 4 deletions
+5 -2
View File
@@ -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);
+2
View File
@@ -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