Remove gc_bump_pointer_heap - #17731
Merged
peterzhu2118 merged 1 commit intoJul 8, 2026
Merged
Conversation
It was leftover and we don't actually need it.
k0kubun
added a commit
to k0kubun/ruby
that referenced
this pull request
Aug 6, 2026
The inline allocation fastpath for the default GC mirrors only the
cursor bump of ractor_cache_allocate_slot(), skipping two pieces of
bookkeeping that the interpreter always performs:
* heap_cache->allocated_objects_count is not incremented, so
total_allocated_objects undercounts objects allocated from JIT code
and GC.verify_internal_consistency crashes with "inconsistent live
slot number". Reproducible on a dev_nodebug build with:
ruby --zjit-call-threshold=1 test/ruby/test_array.rb \
-n test_replace_wb_variable_width_alloc
Incremental marking step pacing also reads this counter.
* RUBY_INTERNAL_EVENT_NEWOBJ hooks are bypassed entirely, so
TracePoint/ObjectSpace tools miss objects allocated from JIT code.
Reproducible with test/-ext-/tracepoint/test_tracepoint.rb
-n test_tracks_objspace_count. Check ruby_vm_event_flags like
rb_gc_event_hook_required_p() and take the slow path while NEWOBJ
hooks are enabled, which is what the MMTk fastpath already does via
newobj_tracing_p_func.
Both regressed in 583668d ("Remove gc_bump_pointer_heap", rubyGH-17731).
The original fastpath from rubyGH-17277 handled both cases: allocations
were counted from cursor movement ((cursor - region_start) / slot_size),
which included JIT inline allocations, and a dedicated jit_cursor_end
window was kept closed by gc_ractor_jit_cursor_sync() while NEWOBJ
hooks were enabled. rubyGH-17731 switched counting to an explicit
allocated_objects_count++ that only the interpreter performs, and
removed jit_cursor_end without a replacement for the hook check.
Note that this fastpath is compiled out on RUBY_DEBUG builds because
of RACTOR_CHECK_MODE, which is why ZJIT CI (--enable-zjit=dev) does
not catch these.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It was leftover and we don't actually need it.