From 52c1331763d8b9b8d6362987e6f8847b65ed7f57 Mon Sep 17 00:00:00 2001 From: ko1 Date: Fri, 11 Oct 2013 18:27:18 +0000 Subject: * 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 --- vm.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'vm.c') 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 * -- cgit v1.2.3