Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions gc/gc.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@
*/
#include "ruby/ruby.h"

#if USE_MODULAR_GC
#include "ruby/thread_native.h"

struct rb_gc_vm_context {
rb_nativethread_lock_t lock;

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);
Expand Down
1 change: 1 addition & 0 deletions gc/gc_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 8 additions & 4 deletions gc/mmtk/mmtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading