perf: inherited reads answered from the holder's shape (A1) - #11681
Merged
Merged
Conversation
added 7 commits
September 29, 2026 15:16
…r-shape facts (A1, WIP) The read site cache gains a holder entry (receiver ShapeId, holder root, holder ShapeId, slot or absent, up to three hop roots and their ShapeIds), primed from get_field_ic_miss_impl after the generic getter confirms it and checked by the emitted tower where the MRU word and the ways miss: depth 1 inline, depth 2-4 through the GC-leaf stub js_read_site_holder_hit. Exotic read receivers now carry a per-object prototype identity in their shape. The emitted call to js_inherited_read_cache_hit_f64 is gone; the table itself stays until A2.
…e inherited-read hook - The class-field read miss arm (`this.k` in a literal method) asks the site holder entry after the MRU word, and a miss the live entry answers primes nothing: the `this` cells re-primed on every read (292 -> 4383). - The inherited-read hook is kept on the never-primed edge and on a miss at a site whose ways never primed, for receivers the entry does not describe (a compiled-class instance: absent 334 -> 434). - A site that refused once, or was re-primed for four receiver shapes, is latched in its cache state word and never walks or primes again. - The emitted tower asks the holder entry first on the MRU miss edge, before the way state and the ways; the absent kind is a bit test and the holder load has no TAG_HOLE compare (a delete is a shape transition, #10826). - Codegen tests follow the new block graph. - gc_runtime_root_holders: PASS1_MARKED re-audited and re-pinned for the new reg_scanner!; thread_exit_address_globals: HOLDER_SITES holds PIC-arena addresses (process_global_allocation).
…ched site asks the inherited-read hook Asking the holder before the way-state branch cost every polymorphic way hit a load and a compare, and sending every fresh-ways miss to the hook cost sites whose receivers the miss handler never learns an extra lookup: Zod +0.66% median. Now a fresh site asks the holder, a way miss asks it, a megamorphic site goes straight to the call, and a holder miss asks the hook only when the site's state word says LATCHED (perry-abi PIC_HOLDER_STATE_WORD / PIC_HOLDER_STATE_LATCHED). Codegen tests follow.
The holder entry is answered by the read site GC-leaf front (step 4 after the ways, the spill entry and a latched confirm) instead of an inline block, since main moved the polymorphic and latched arms out of the emitted tower.
…pre-walk Since function objects stopped materializing the realm, a never-primed site whose chain ends at the default link walked before %Object.prototype% existed, refused, and stayed with the inherited-read cache for good. The walk after the getter (which resolves it) decides instead.
Object.prototype is minted OrdinaryUnmarked; reads treat it as Ordinary, so the walk admits every ordinary-layout kind.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (16)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
perf: an inherited read is answered from its holder's shape (A1).
A read site that misses on the receiver's own keys now remembers the holder: the prototype object that owns the key, with its shape and the slot. On a later miss, the GC-leaf read front checks the holder entry after the ways, the spill entry and a latched site's confirm. An own-key read pays nothing for this.
deletea shape transition, not a stable tombstone #10826).js_read_site_holder_hit.Instructions per loop iteration (base is main ed0d5b5)
thisthistsc and Zod (interleaved medians, n=7; output matches node)
Local verification at 4dbeb78
--test-threads=1read_holder_entrySabotage: removing the holder compare, removing the receiver compare, or skipping the hop words each turns the fixture red. Two sabotages don't yet: not rooting the holder, and admitting class proto ids. Fixture cases for them are follow-up work in A2/A3.