Skip to content

Implement rb_gc_impl_during_gc_p #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions gc/gc.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ enum rb_gc_vm_weak_tables {
RB_GC_VM_ID2REF_TABLE,
RB_GC_VM_GENERIC_FIELDS_TABLE,
RB_GC_VM_FROZEN_STRINGS_TABLE,
RB_GC_VM_CC_REFINEMENT_TABLE,
RB_GC_VM_WEAK_TABLE_COUNT
};

Expand Down
3 changes: 1 addition & 2 deletions gc/mmtk/mmtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,7 @@ rb_gc_impl_start(void *objspace_ptr, bool full_mark, bool immediate_mark, bool i
bool
rb_gc_impl_during_gc_p(void *objspace_ptr)
{
// TODO
return false;
return mmtk_gc_in_progress_p();
}

static void
Expand Down
2 changes: 2 additions & 0 deletions gc/mmtk/mmtk.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ void mmtk_set_gc_enabled(bool enable);

bool mmtk_gc_enabled_p(void);

bool mmtk_gc_in_progress_p(void);

MMTk_Address mmtk_alloc(MMTk_Mutator *mutator,
size_t size,
size_t align,
Expand Down
5 changes: 5 additions & 0 deletions gc/mmtk/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ pub extern "C" fn mmtk_gc_enabled_p() -> bool {
crate::CONFIGURATION.gc_enabled.load(Ordering::Relaxed)
}

#[no_mangle]
pub extern "C" fn mmtk_gc_in_progress_p() -> bool {
crate::mmtk().gc_in_progress()
}

// =============== Object allocation ===============

#[no_mangle]
Expand Down
Loading