[pull] master from ruby:master - #1289
Merged
Merged
Conversation
rgengc_check_relation asks rgengc_remember to remember the parent for every child that is young or write-barrier unprotected. Remembering is idempotent -- it sets a bit and a page flag -- so an old array of freshly allocated elements pays a page lookup, a bitmap test and a store per element to reach a state the first element already reached. Clear parent_object_old_p once the parent is remembered. The flag is read only here and written only when a walk of one object's children starts and ends, so dropping it mid-walk skips the two bitmap reads for the remaining children and nothing else. Twenty minor collections over a 200k-element old array refilled with young arrays: 4.14G -> 4.02G instructions. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
gcc used to inline four vm_sendish calls into vm_exec_core; it now inlines
three. The fourth was a constprop clone -- the one specialised for the call
site whose block handler is a constant -- and at +70 size units it cost two
to three times what the others did, which made it the first thing to go once
the inliner ran out of budget.
Nothing about the call sites changed. vm.c pulls in vm.inc and
vm_insnhelper.c, so it is one enormous translation unit, and gcc's growth
budget is spent per unit: any line added anywhere in it can push out a
marginal decision elsewhere. That is what happened, and it costs about
twenty instructions on every ordinary method call.
Pin it with ALWAYS_INLINE, as vm_getivar and friends already are.
vm_exec_core grows from 5373 to 5668 instructions and .text by 0.7%.
fib(32) 2.169G -> 2.000G instructions
binary trees (D16) 34.42G -> 33.00G
so_binary_trees 51.00G -> 49.00G
Allocation and GC-bound benchmarks are unchanged.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Previously the embedded path allocated a full-size embedded string via str_alloc_heap plus STR_SET_EMBED, which capped the copy at the default struct RString slot whatever the substring length. Size the allocation to the substring with str_alloc_embed instead, and copy while it fits in a slot of 256 bytes, since larger slots are allocated less densely and increase garbage collection. Keep the default struct RString slot as the cap when the source is frozen or already shared, where sharing allocates the substring alone rather than a frozen root as well. [Feature #22186]
A char is more than large enough for counting rebuilds, and it's fine if it rolls over. The table being rebuilt exactly 255 times between two check seems impossible. On the other hand, if `Hash#shift` is abused, `entries_start` is more likely to reach MAX_UCHAR. So swapping the two members is preferable.
Follow-up on dd93d13 (#18071). Baking revision.h into dump_ast couples every builtin *.rbinc to the current commit: whenever HEAD changes, e.g. when switching between two branches that only differ under yjit/, revision.h is regenerated, dump_ast is relinked, all $(BUILTIN_RB_INCS) are regenerated with identical content but fresh timestamps, and every C file that includes one of them is recompiled, followed by relinking miniruby and ruby. The --version banner was the only use of revision.h in dump_ast, so print only the Prism version. Since dump_ast no longer includes revision.h, it is not relinked when HEAD changes, so $(BUILTIN_RB_INCS) and their dependents are no longer invalidated by commit-only changes.
Re-enable rb_gc_impl_zjit_new_obj_fastpath, was stubbed to "return false" by the recent rlgc merge. The bump-pointer state moved out of the deleted rb_ractor_newobj_cache_t into the per-objspace rb_heap_t.newobj, so the fastpath and the JIT codegen now index that struct and reach it through ractor->objspace instead of ractor->newobj_cache.
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 : )