diff --git a/gc/gc.h b/gc/gc.h index 469a490..d38a129 100644 --- a/gc/gc.h +++ b/gc/gc.h @@ -11,7 +11,6 @@ */ #include "ruby/ruby.h" -#if USE_MODULAR_GC #include "ruby/thread_native.h" struct rb_gc_vm_context { @@ -19,7 +18,6 @@ struct rb_gc_vm_context { struct rb_execution_context_struct *ec; }; -#endif typedef int (*vm_table_foreach_callback_func)(VALUE value, void *data); typedef int (*vm_table_update_callback_func)(VALUE *value, void *data); diff --git a/gc/gc_impl.h b/gc/gc_impl.h index 7898316..d9e44cc 100644 --- a/gc/gc_impl.h +++ b/gc/gc_impl.h @@ -54,6 +54,7 @@ GC_IMPL_FN void rb_gc_impl_stress_set(void *objspace_ptr, VALUE flag); GC_IMPL_FN VALUE rb_gc_impl_stress_get(void *objspace_ptr); GC_IMPL_FN VALUE rb_gc_impl_config_get(void *objspace_ptr); GC_IMPL_FN void rb_gc_impl_config_set(void *objspace_ptr, VALUE hash); +GC_IMPL_FN struct rb_gc_vm_context *rb_gc_impl_get_vm_context(void *objspace_ptr); // Object allocation GC_IMPL_FN VALUE rb_gc_impl_new_obj(void *objspace_ptr, void *cache_ptr, VALUE klass, VALUE flags, bool wb_protected, size_t alloc_size); GC_IMPL_FN size_t rb_gc_impl_obj_slot_size(VALUE obj); diff --git a/gc/mmtk/mmtk.c b/gc/mmtk/mmtk.c index 3f680e7..e4cd719 100644 --- a/gc/mmtk/mmtk.c +++ b/gc/mmtk/mmtk.c @@ -253,11 +253,7 @@ rb_mmtk_scan_gc_roots(void) { struct objspace *objspace = rb_gc_get_objspace(); - // FIXME: Make `rb_gc_mark_roots` aware that the current thread may not have EC. - // See: https://github.com/ruby/mmtk/issues/22 - rb_gc_worker_thread_set_vm_context(&objspace->vm_context); rb_gc_mark_roots(objspace, NULL); - rb_gc_worker_thread_unset_vm_context(&objspace->vm_context); } static int @@ -784,6 +780,14 @@ rb_gc_impl_config_set(void *objspace_ptr, VALUE hash) // TODO } +struct rb_gc_vm_context * +rb_gc_impl_get_vm_context(void *objspace_ptr) +{ + struct objspace *objspace = objspace_ptr; + + return &objspace->vm_context; +} + // Object allocation static VALUE