|
28 | 28 | #include "ruby/util.h" |
29 | 29 | #include "ruby/vm.h" |
30 | 30 | #include "ruby/internal/encoding/string.h" |
| 31 | +#include "internal/object.h" |
31 | 32 | #include "ccan/list/list.h" |
32 | 33 | #include "darray.h" |
33 | 34 | #include "gc/gc.h" |
@@ -2123,6 +2124,9 @@ newobj_init(VALUE klass, VALUE flags, int wb_protected, rb_objspace_t *objspace, |
2123 | 2124 | GC_ASSERT((flags & FL_WB_PROTECTED) == 0); |
2124 | 2125 | RBASIC(obj)->flags = flags; |
2125 | 2126 | *((VALUE *)&RBASIC(obj)->klass) = klass; |
| 2127 | +#if RBASIC_SHAPE_ID_FIELD |
| 2128 | + RBASIC(obj)->shape_id = 0; |
| 2129 | +#endif |
2126 | 2130 |
|
2127 | 2131 | int t = flags & RUBY_T_MASK; |
2128 | 2132 | if (t == T_CLASS || t == T_MODULE || t == T_ICLASS) { |
@@ -2968,7 +2972,7 @@ rb_gc_impl_shutdown_free_objects(void *objspace_ptr) |
2968 | 2972 | if (RB_BUILTIN_TYPE(vp) != T_NONE) { |
2969 | 2973 | rb_gc_obj_free_vm_weak_references(vp); |
2970 | 2974 | if (rb_gc_obj_free(objspace, vp)) { |
2971 | | - RBASIC(vp)->flags = 0; |
| 2975 | + RBASIC_RESET_FLAGS(vp); |
2972 | 2976 | } |
2973 | 2977 | } |
2974 | 2978 | } |
@@ -3042,7 +3046,7 @@ rb_gc_impl_shutdown_call_finalizer(void *objspace_ptr) |
3042 | 3046 | if (rb_gc_shutdown_call_finalizer_p(vp)) { |
3043 | 3047 | rb_gc_obj_free_vm_weak_references(vp); |
3044 | 3048 | if (rb_gc_obj_free(objspace, vp)) { |
3045 | | - RBASIC(vp)->flags = 0; |
| 3049 | + RBASIC_RESET_FLAGS(vp); |
3046 | 3050 | } |
3047 | 3051 | } |
3048 | 3052 | } |
@@ -9361,6 +9365,7 @@ rb_gc_impl_init(void) |
9361 | 9365 | VALUE gc_constants = rb_hash_new(); |
9362 | 9366 | rb_hash_aset(gc_constants, ID2SYM(rb_intern("DEBUG")), GC_DEBUG ? Qtrue : Qfalse); |
9363 | 9367 | rb_hash_aset(gc_constants, ID2SYM(rb_intern("BASE_SLOT_SIZE")), SIZET2NUM(BASE_SLOT_SIZE - RVALUE_OVERHEAD)); |
| 9368 | + rb_hash_aset(gc_constants, ID2SYM(rb_intern("RBASIC_SIZE")), SIZET2NUM(sizeof(struct RBasic))); |
9364 | 9369 | rb_hash_aset(gc_constants, ID2SYM(rb_intern("RVALUE_OVERHEAD")), SIZET2NUM(RVALUE_OVERHEAD)); |
9365 | 9370 | rb_hash_aset(gc_constants, ID2SYM(rb_intern("HEAP_PAGE_OBJ_LIMIT")), SIZET2NUM(HEAP_PAGE_OBJ_LIMIT)); |
9366 | 9371 | rb_hash_aset(gc_constants, ID2SYM(rb_intern("HEAP_PAGE_BITMAP_SIZE")), SIZET2NUM(HEAP_PAGE_BITMAP_SIZE)); |
|
0 commit comments