diff --git a/eval.c b/eval.c index e4c053c7fe..35397c2741 100644 --- a/eval.c +++ b/eval.c @@ -51,6 +51,7 @@ ruby_setup(void) ruby_init_stack((void *)&state); Init_BareVM(); Init_heap(); + Init_vm_objects(); PUSH_TAG(); if ((state = EXEC_TAG()) == 0) { diff --git a/internal.h b/internal.h index f93d3f7751..b02f926feb 100644 --- a/internal.h +++ b/internal.h @@ -889,6 +889,7 @@ rb_serial_t rb_next_class_serial(void); VALUE rb_obj_is_thread(VALUE obj); void rb_vm_mark(void *ptr); void Init_BareVM(void); +void Init_vm_objects(void); VALUE rb_vm_top_self(void); void rb_thread_recycle_stack_release(VALUE *); void rb_vm_change_state(void); diff --git a/vm.c b/vm.c index 82bf75bc44..c89d3a35f3 100644 --- a/vm.c +++ b/vm.c @@ -2726,7 +2726,17 @@ Init_BareVM(void) th->vm = vm; th_init(th, 0); ruby_thread_init_stack(th); +} + +void +Init_vm_objects(void) +{ + rb_vm_t *vm = GET_VM(); + vm->defined_module_hash = rb_hash_new(); + + /* initialize mark object array, hash */ + vm->mark_object_ary = rb_ary_tmp_new(1); } /* top self */ @@ -2751,9 +2761,6 @@ Init_top_self(void) vm->top_self = rb_obj_alloc(rb_cObject); rb_define_singleton_method(rb_vm_top_self(), "to_s", main_to_s, 0); rb_define_alias(rb_singleton_class(rb_vm_top_self()), "inspect", "to_s"); - - /* initialize mark object array, hash */ - vm->mark_object_ary = rb_ary_tmp_new(1); } VALUE *