Skip to content

Commit b0f7cb4

Browse files
authored
Merge pull request #75 from ruby/pz-sync-16830
Reverse sync ruby/ruby@06fc5c2
2 parents 50e2018 + b0bf0c3 commit b0f7cb4

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

gc/gc.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,13 @@
1111
*/
1212
#include "ruby/ruby.h"
1313

14-
#if USE_MODULAR_GC
1514
#include "ruby/thread_native.h"
1615

1716
struct rb_gc_vm_context {
1817
rb_nativethread_lock_t lock;
1918

2019
struct rb_execution_context_struct *ec;
2120
};
22-
#endif
2321

2422
typedef int (*vm_table_foreach_callback_func)(VALUE value, void *data);
2523
typedef int (*vm_table_update_callback_func)(VALUE *value, void *data);

gc/gc_impl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ GC_IMPL_FN void rb_gc_impl_stress_set(void *objspace_ptr, VALUE flag);
5454
GC_IMPL_FN VALUE rb_gc_impl_stress_get(void *objspace_ptr);
5555
GC_IMPL_FN VALUE rb_gc_impl_config_get(void *objspace_ptr);
5656
GC_IMPL_FN void rb_gc_impl_config_set(void *objspace_ptr, VALUE hash);
57+
GC_IMPL_FN struct rb_gc_vm_context *rb_gc_impl_get_vm_context(void *objspace_ptr);
5758
// Object allocation
5859
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);
5960
GC_IMPL_FN size_t rb_gc_impl_obj_slot_size(VALUE obj);

gc/mmtk/mmtk.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,7 @@ rb_mmtk_scan_gc_roots(void)
253253
{
254254
struct objspace *objspace = rb_gc_get_objspace();
255255

256-
// FIXME: Make `rb_gc_mark_roots` aware that the current thread may not have EC.
257-
// See: https://github.com/ruby/mmtk/issues/22
258-
rb_gc_worker_thread_set_vm_context(&objspace->vm_context);
259256
rb_gc_mark_roots(objspace, NULL);
260-
rb_gc_worker_thread_unset_vm_context(&objspace->vm_context);
261257
}
262258

263259
static int
@@ -784,6 +780,14 @@ rb_gc_impl_config_set(void *objspace_ptr, VALUE hash)
784780
// TODO
785781
}
786782

783+
struct rb_gc_vm_context *
784+
rb_gc_impl_get_vm_context(void *objspace_ptr)
785+
{
786+
struct objspace *objspace = objspace_ptr;
787+
788+
return &objspace->vm_context;
789+
}
790+
787791
// Object allocation
788792

789793
static VALUE

0 commit comments

Comments
 (0)