Skip to content

[pull] master from ruby:master - #1290

Merged
pull[bot] merged 12 commits into
turkdevops:masterfrom
ruby:master
Aug 8, 2026
Merged

[pull] master from ruby:master#1290
pull[bot] merged 12 commits into
turkdevops:masterfrom
ruby:master

Conversation

@pull

@pull pull Bot commented Aug 8, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

eregon and others added 12 commits August 7, 2026 21:50
* https://logs.rubyci.org/osx1400arm/ruby-master/log/20260807T174503Z.fail.html.gz
  1)
  File.setgid? accepts a path in a non-UTF-8, ASCII-compatible encoding containing non-ASCII characters FAILED
  Expected false == true
  to be truthy but was false
  /Users/hsbt/chkbuild/tmp/build/20260807T174503Z/ruby/spec/ruby/shared/file/setgid.rb:11:in 'block (3 levels) in <top (required)>'
  /Users/hsbt/chkbuild/tmp/build/20260807T174503Z/ruby/spec/ruby/core/file/setgid_spec.rb:4:in '<top (required)>'

  2)
  File::Stat#setgid? accepts a path in a non-UTF-8, ASCII-compatible encoding containing non-ASCII characters FAILED
  Expected false == true
  to be truthy but was false
  /Users/hsbt/chkbuild/tmp/build/20260807T174503Z/ruby/spec/ruby/shared/file/setgid.rb:11:in 'block (3 levels) in <top (required)>'
  /Users/hsbt/chkbuild/tmp/build/20260807T174503Z/ruby/spec/ruby/core/file/stat/setgid_spec.rb:5:in '<top (required)>'

  3)
  FileTest.setgid? accepts a path in a non-UTF-8, ASCII-compatible encoding containing non-ASCII characters FAILED
  Expected false == true
  to be truthy but was false
  /Users/hsbt/chkbuild/tmp/build/20260807T174503Z/ruby/spec/ruby/shared/file/setgid.rb:11:in 'block (3 levels) in <top (required)>'
  /Users/hsbt/chkbuild/tmp/build/20260807T174503Z/ruby/spec/ruby/core/filetest/setgid_spec.rb:4:in '<top (required)>'
This commit centralizes shape setting for objects in the ZJIT GC fastpath
into the rb_zjit_new_obj_shape function to avoid each type having to deal
with shapes individually.
Rewrite FixnumMod with a positive power-of-two constant divisor into
FixnumAnd, and FixnumDiv into FixnumRShift. The sign of Ruby's modulo
result follows the divisor, and Integer#/ rounds the quotient towards
negative infinity, so both rewrites hold for all fixnum dividends and
replace a C call with a single ALU instruction.
This also enables the alloc fastpath where it previously wasn't enabled
when `-DRUBY_DEBUG` is set in cflags during compilation. This will allow
us to test the ZJIT alloc fastpath in CI and when running ZJIT tests
locally in dev (--enable-zjit=dev) or debug mode (cflags="-DRUBY_DEBUG=1").
The allocation fastpath just advances the cursor and we don't want to
emit code that checks for this rare case. Emit a patchpoint instead and
invalidate the allocation fastpath code when NEWOBJ hooks are enabled
for the first time.
1) Remove copied code in gc_fastpath.rs

2) RbGcZjitDefaultNewObjFastpath and RbGcZjitMmtkNewObjFastpath structs were
copied from the cruby_bindings file.

3) Get MMTK to use the newobj hook patchpoint for ZJIT's alloc fastpath.
Previously only the default GC used this patchpoint. MMTK had to check if
newobj hooks were enabled in its fastpath, which it no longer does.

4) ractor_belonging_id has been removed
The Ractor root scan marked each thread's ec directly and then marked the
wrapper of the fiber that ec lives in.  Both reach rb_execution_context_mark,
so every thread's machine stack was scanned conservatively twice per
collection -- with 5000 threads, 750270 scans where 362326 were needed.

Marking the fiber wrapper is enough: th->ec is &fiber->cont.saved_ec (thread_mark
asserts as much), the wrapper goes on the mark stack during the root scan, and
the stack drains before anything is swept.  Only when there is no wrapper yet,
mid-creation or teardown, does the ec still need marking of its own.

benchmark/vm_thread_pass_flood.rb, which floods 5000 threads:

    collections           157      157      (unchanged)
    time in GC            0.84s -> 0.49s
    thread creation       1.17s -> 0.81s

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
gcc stopped inlining the small helpers gc_mark calls for every reference it
marks.  From -fopt-info-inline on gc.c, before and after the per-Ractor GC
landed:

    gc_mark_set           -> gc_mark    10 -> 2
    gc_mark_check_t_none  -> gc_mark     8 -> 0
    rgengc_check_relation -> gc_mark     8 -> 4
    RVALUE_AGE_INC        -> gc_aging    2 -> 0

gc.c is one translation unit -- it includes the whole default implementation --
so gcc's growth budget is spent across all of it, and the added code pushed
these out even though none of it runs on this path.  Marking then pays a call
per reference.

Pin them with ALWAYS_INLINE.  .text does not grow (5834940 -> 5834812 bytes):
what the inlining adds, the vanished call sequences take back.

Instructions retired, and wall clock as the best of seven runs:

    60 full collections, 207k live       3.74G -> 3.48G    0.39s -> 0.33s
    marking objects, hashes and classes  3.67G -> 3.43G
    allocation loop (40M [])            14.17G -> 13.85G   0.92s -> 0.86s
    allocation mixed with collection    18.06G -> 17.74G   1.28s -> 1.18s
    binary trees (depth 16)             34.42G -> 34.15G   3.06s -> 3.00s

Time moves more than the instruction count does: what goes away is a call and
its register traffic on every marked reference.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@pull pull Bot locked and limited conversation to collaborators Aug 8, 2026
@pull pull Bot added the ⤵️ pull label Aug 8, 2026
@pull
pull Bot merged commit 66c8e49 into turkdevops:master Aug 8, 2026
1 of 3 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants