summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-11 18:27:18 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-11 18:27:18 +0000
commit52c1331763d8b9b8d6362987e6f8847b65ed7f57 (patch)
tree428a90820733718a0a534bf25e8e626de5b2afb4 /vm.c
parent86b2e9d090e9a614400d2ca6f0d24ee5698ad1dd (diff)
* class.c, variable.c, gc.c (rb_class_tbl): removed.
* vm.c, vm_core.h (rb_vm_add_root_module): added to register as a defined root module or class. This guard helps mark miss from defined classes/modules they are only refered from C's global variables in C-exts. Basically, it is extension's bug. Register to hash object VM has. Marking a hash objects allows generational GC supports. * gc.c (RGENGC_PRINT_TICK): disable (revert). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/vm.c b/vm.c
index 0193b7b75a..287d1c311e 100644
--- a/vm.c
+++ b/vm.c
@@ -1611,6 +1611,7 @@ rb_vm_mark(void *ptr)
RUBY_MARK_UNLESS_NULL(vm->loaded_features_snapshot);
RUBY_MARK_UNLESS_NULL(vm->top_self);
RUBY_MARK_UNLESS_NULL(vm->coverages);
+ RUBY_MARK_UNLESS_NULL(vm->defined_module_hash);
rb_gc_mark_locations(vm->special_exceptions, vm->special_exceptions + ruby_special_error_count);
if (vm->loading_table) {
@@ -1634,6 +1635,17 @@ rb_vm_mark(void *ptr)
RUBY_MARK_LEAVE("vm");
}
+
+int
+rb_vm_add_root_module(ID id, VALUE module)
+{
+ rb_vm_t *vm = GET_VM();
+ if (vm->defined_module_hash) {
+ rb_hash_aset(vm->defined_module_hash, ID2SYM(id), module);
+ }
+ return TRUE;
+}
+
#define vm_free 0
int
@@ -2619,8 +2631,9 @@ Init_top_self(void)
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 */
+ /* initialize mark object array, hash */
vm->mark_object_ary = rb_ary_tmp_new(1);
+ vm->defined_module_hash = rb_hash_new();
}
VALUE *