summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--bootstraptest/test_class.rb10
-rw-r--r--vm.c2
3 files changed, 14 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 7519dfe..2f0d932 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2013-10-13 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm.c (Init_BareVM): initialize defined_module_hash here,
+ Init_top_self() is too late to register core classes/modules.
+
* compile.c (compile_array_): no hash to merge if it is empty.
* vm.c (m_core_hash_merge_kwd): just check keys if only one argument
diff --git a/bootstraptest/test_class.rb b/bootstraptest/test_class.rb
index 664dd2f..b7fe0a1 100644
--- a/bootstraptest/test_class.rb
+++ b/bootstraptest/test_class.rb
@@ -11,6 +11,16 @@ assert_equal 'C', %q( class C; end
C.new.class.name )
assert_equal 'Class', %q( class C; end
C.new.class.class )
+assert_equal 'true', %q( Object.__send__(:remove_const, :TrueClass)
+ GC.start
+ true.inspect)
+assert_equal 'false', %q( Object.__send__(:remove_const, :FalseClass)
+ GC.start
+ false.inspect)
+assert_equal 'nil', %q( Object.__send__(:remove_const, :NilClass)
+ GC.start
+ nil.inspect)
+
# inherited class
assert_equal 'true', %q( class A; end
diff --git a/vm.c b/vm.c
index 032bcdb..acae935 100644
--- a/vm.c
+++ b/vm.c
@@ -2617,6 +2617,7 @@ Init_BareVM(void)
th->vm = vm;
th_init(th, 0);
ruby_thread_init_stack(th);
+ vm->defined_module_hash = rb_hash_new();
}
/* top self */
@@ -2644,7 +2645,6 @@ Init_top_self(void)
/* initialize mark object array, hash */
vm->mark_object_ary = rb_ary_tmp_new(1);
- vm->defined_module_hash = rb_hash_new();
}
VALUE *