Repository navigation
Conversation
Every inline allocation set the object's start bit, about nine instructions plus a dependent read-modify-write of the bitmap word, and every minor collection cleared the nursery's bits again. Only two things read those bits: - a major collection that compacts a non-empty nursery; - the heap tools. The nursery is bump-allocated without gaps, so both can walk it by object extents instead. - Allocation: the generational fast path on both backends and the allocator's slow path no longer set nursery start bits. The copying runtime keeps them. Old-space bits are unchanged (evacuation, direct-old allocation, compaction). - Collections: minors no longer clear any nursery bits. A compaction that covers the nursery (its survivors could not fit the old prefix) first records the nursery's object starts by walking it (recordObjectStarts). Compaction clears every start bit it passes, so they are zero again afterwards. - Heap tools: descriptor version 3. The old prefix is walked through its start bits and the nursery by extents, in tint_heap.py and in the snapshot graph. verify-heap-tools checks that the nursery's extents chain from its base exactly to its top. tools/native-gc-nursery-fallback.test.ts forces that compaction with serial marking (4 MiB heap) and pool marking (32 MiB): a nursery full of survivors that the old prefix cannot hold. LLDB counted 5 compactions through the nursery walk in each, and both checksums match Node. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The generational fast path formed each object's address from the young base offset (state word 2 or 7), the managed base read through the context, and the young top: two loads and two adds on arm64, one load and two adds on x86-64. The runtime now writes the nursery's absolute address (managed base plus old-prefix capacity) into state words 16/17 before publication, and both backends load it once and add the young top. - ABI: nativeGenerationalNurseryAddressOffset (64) and nativeGenerationalStateWords (18). Publication on both backends rejects a state block shorter than eighteen words, so the fast path never reads past it. - The copying runtime keeps its semispace-relative sequence unchanged, byte for byte. - allocation-throughput.md documents the eighteen-word block. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without nursery start bits and with the precomputed nursery address, the arm64 generational fast path is 12 instructions instead of 23, and x86-64's is 17 instead of 27. The allocating kernels drop 1-3.5% of cycles and 1-1.7% of peak RSS. Frozen v7 is neutral: cycles within the noise, instructions -0.5% in every round. An absolute cursor and limit would save three more instructions at a cost that spans the runtime, both backends, diagnostics and heap tools; it is assessed and not built. Co-Authored-By: Claude Opus 5.5 <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 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.
Stacked on #21; the base is
perf/collect-capacity. It shortens the generational inline allocation fast path. Report: docs/results/alloc-fast-path-v1.md.Changes
No object-start bits for the nursery (
4b9ecaca8):recordObjectStarts, which throws if the walk does not end exactly at the young top.tint_heap.py, the snapshot graph andverify-heap-tools.tools/native-gc-nursery-fallback.test.tsforces the fallback compaction with serial marking (4 MiB) and with pool marking (32 MiB).Precomputed nursery address (
612a13cc0):Fast path, instructions from the context load to the object address
Results (macOS arm64)
Frozen v7 (15 paired rounds, order alternating), against #21:
Allocating kernels, cycles against #21 (15 rotated rounds):
Records and pipelines are within their quartiles. Peak RSS is 1.0–1.7% lower in every kernel.
Absolute cursor and limit: assessed, not built
Gates
verify-heap-tools: passes.612a13cc0(dispatch run 45296580121), whose tree matches this head apart from the merges and docs.🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.