[pull] master from ruby:master#1180
Merged
Merged
Conversation
This commit uses 7 shape bits to store the capacity of the object instead of the heap ID. This allows for slot sizes with up to capacity of 127. This removes the abstraction leak of slot sizes from the GC, which allows more flexibility in the GC. This implementation should currently make no difference for the default GC as it will end up creating the same root shapes. We can see that there is basically no change in benchmarks: -------------- ------------ ------------ ------------ ------------ -------------- ------------- ----------------- bench master (ms) RSS (MiB) branch (ms) RSS (MiB) branch 1st itr master/branch RSS master/branch activerecord 99.6 ± 3.9% 75.5 ± 0.3% 98.9 ± 2.4% 74.0 ± 1.3% 0.919 1.007 1.021 chunky-png 328.2 ± 0.6% 83.0 ± 3.9% 336.4 ± 0.7% 87.0 ± 2.2% 0.979 0.976 0.954 erubi-rails 440.4 ± 1.7% 138.1 ± 0.3% 431.0 ± 0.5% 135.2 ± 0.0% 0.992 1.022 1.022 hexapdf 855.6 ± 0.7% 577.0 ± 0.1% 856.7 ± 0.9% 649.0 ± 2.6% 0.993 0.999 0.889 liquid-c 21.6 ± 8.2% 69.6 ± 14.7% 23.2 ± 8.4% 64.6 ± 15.4% 0.993 0.930 1.077 liquid-compile 19.9 ± 7.9% 47.0 ± 5.7% 20.2 ± 8.7% 46.9 ± 5.1% 0.925 0.987 1.001 liquid-render 54.0 ± 2.7% 55.3 ± 8.6% 55.2 ± 2.7% 55.9 ± 9.0% 0.977 0.978 0.990 lobsters 351.6 ± 0.7% 336.8 ± 0.2% 357.0 ± 0.6% 335.4 ± 0.1% 0.997 0.985 1.004 mail 47.5 ± 3.1% 75.6 ± 2.7% 46.8 ± 1.3% 72.3 ± 0.5% 0.974 1.016 1.045 psych-load 829.1 ± 1.2% 55.0 ± 0.4% 832.9 ± 0.5% 55.3 ± 0.7% 1.006 0.995 0.995 railsbench 713.8 ± 0.4% 134.6 ± 1.1% 717.9 ± 1.0% 138.2 ± 1.2% 0.992 0.994 0.974 rubocop 73.1 ± 6.0% 106.7 ± 1.7% 73.2 ± 6.1% 106.4 ± 1.4% 0.997 0.998 1.003 ruby-lsp 69.0 ± 1.2% 78.3 ± 0.2% 67.8 ± 2.3% 74.2 ± 0.0% 1.043 1.017 1.055 sequel 21.7 ± 6.8% 56.1 ± 1.6% 21.0 ± 4.4% 55.9 ± 1.1% 0.873 1.032 1.003 shipit 608.9 ± 1.4% 160.2 ± 0.5% 619.2 ± 1.4% 157.3 ± 0.2% 1.012 0.983 1.018 -------------- ------------ ------------ ------------ ------------ -------------- ------------- -----------------
iseq->aux.loader.obj holds the ibf loader while an iseq is ISEQ_NOT_LOADED_YET, and iseq_mark marks it, so the store into it is a GC-managed reference and should go through the write barrier rather than a raw assignment. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Walking the heap needs a stable set of pages: a concurrent GC on another Ractor is stop-the-world and would otherwise pause the walk mid-iteration and free or move objects out from under the callback. Callers that mutate what they visit (rb_iseq_trace_set_all, rb_clear_attr_ccs, rb_clear_bf_ccs) also relied on the barrier for atomicity and took it by hand; move it into the callee so every caller is covered and drop the now-redundant wrappers. This also gives rb_iseq_remove_coverage_all the barrier it was missing -- it mutates iseqs (ISEQ_COVERAGE_SET) just like its siblings but walked without stopping other Ractors. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
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 : )