diff --git a/gc/gc_impl.h b/gc/gc_impl.h index 80da58d..1bcb744 100644 --- a/gc/gc_impl.h +++ b/gc/gc_impl.h @@ -89,14 +89,15 @@ GC_IMPL_FN VALUE rb_gc_impl_new_obj(void *objspace_ptr, void *cache_ptr, VALUE k * generated instruction sequence; see zjit/src/gc_fastpath.rs. */ GC_IMPL_FN bool rb_gc_impl_zjit_new_obj_fastpath(void *objspace_ptr, size_t alloc_size, VALUE flags, VALUE klass, struct rb_gc_zjit_fastpath *fastpath); -/* Returns a pointer to a word that is nonzero while incremental marking is in - * progress, or NULL if the implementation does not support ZJIT's inline write - * barrier fast path. ZJIT-generated code skips the call to rb_gc_writebarrier() - * when the receiver has neither RUBY_FL_PROMOTED nor RUBY_FL_SHAREABLE set and - * this word is zero, so only implementations whose write barrier is a no-op - * under exactly those conditions may return non-NULL. +/* Returns the offset of a word inside the objspace that is nonzero while that + * objspace is incremental-marking, or -1 if the implementation does not support + * ZJIT's inline write barrier fast path. ZJIT-generated code skips the call to + * rb_gc_writebarrier() when the receiver has neither RUBY_FL_PROMOTED nor + * RUBY_FL_SHAREABLE set and the word of the current Ractor's objspace is zero, + * so only implementations whose write barrier is a no-op under exactly those + * conditions may return a nonnegative offset. */ -GC_IMPL_FN const uintptr_t *rb_gc_impl_zjit_writebarrier_required_p_ptr(void *objspace_ptr); +GC_IMPL_FN int32_t rb_gc_impl_zjit_writebarrier_required_offset(void); GC_IMPL_FN size_t rb_gc_impl_obj_slot_size(VALUE obj); GC_IMPL_FN size_t rb_gc_impl_size_slot_size(void *objspace_ptr, size_t size); GC_IMPL_FN bool rb_gc_impl_size_allocatable_p(size_t size); @@ -152,7 +153,7 @@ GC_IMPL_FN bool rb_gc_impl_during_postmortem_p(void *objspace_ptr); * objspace impl. */ GC_IMPL_FN bool rb_gc_impl_obj_foreign_p(void *objspace_ptr, VALUE obj); GC_IMPL_FN bool rb_gc_impl_shref_marked_p(void *objspace_ptr, VALUE obj); -GC_IMPL_FN size_t rb_gc_impl_heap_page_count(void *objspace_ptr); +GC_IMPL_FN size_t rb_gc_impl_zombie_heap_page_count(void *objspace_ptr); GC_IMPL_FN void rb_gc_impl_objspace_absorb(void *dst_ptr, void *src_ptr); GC_IMPL_FN void rb_gc_impl_each_object(void *objspace_ptr, void (*func)(VALUE obj, void *data), void *data); // Finalizers diff --git a/gc/mmtk/mmtk.c b/gc/mmtk/mmtk.c index cf80d98..c379354 100644 --- a/gc/mmtk/mmtk.c +++ b/gc/mmtk/mmtk.c @@ -742,12 +742,12 @@ rb_gc_impl_zjit_new_obj_fastpath(void *objspace_ptr, size_t alloc_size, VALUE fl #endif } -const uintptr_t * -rb_gc_impl_zjit_writebarrier_required_p_ptr(void *objspace_ptr) +int32_t +rb_gc_impl_zjit_writebarrier_required_offset(void) { /* MMTk's write barrier is not a no-op for young, unshareable receivers, * so ZJIT must always call rb_gc_writebarrier(). */ - return NULL; + return -1; } void @@ -1859,7 +1859,7 @@ rb_gc_impl_shref_marked_p(void *objspace_ptr, VALUE obj) } size_t -rb_gc_impl_heap_page_count(void *objspace_ptr) +rb_gc_impl_zombie_heap_page_count(void *objspace_ptr) { /* With a single objspace zombie_objspaces is always empty. */ return 0;