You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Perf: add a same-heap managed-cell barrier fast path #9
The broad write barrier deliberately accepts wild, stale, arena-owned, and foreign pointers, so it validates each child and owner through the embedder's ownership classifier before reading a header. In zig-js's hot Object-to-Object store path, both pointers are known GC cells and the post-#67 object_churn profile attributes 20 top-of-stack samples to headerForPayload. Repeating slab membership classification at every dense replacement is avoidable.
Scope
retain the current broad barrier unchanged for maybe-managed inputs;
give each Heap instance a stable per-heap header cookie without increasing Header size;
add an explicitly trusted managed-cell barrier whose pointer contract permits direct header recovery and rejects cells owned by a different heap of the same type through that cookie;
preserve nursery old-to-young owner remembering, conservative child retention when an owner is foreign, incremental/concurrent marking handoff, and parallel locking;
expose the fast path to zig-js only at Object-to-Object stores whose allocation provenance is managed whenever a barrier is installed;
keep weak barriers and mixed Environment/Promise/side-record callers on the broad path until independently proven;
measure clean pinned downstream object_churn A/B with exact checksum equality.
Acceptance criteria
Broad barriers still reject wild, stale, arena, and foreign inputs safely.
Rejected after the required downstream A/B; both zig-gc and zig-js experiments were fully removed and no commit was made.
The candidate used a per-heap header cookie without increasing Header size, added a direct managed-cell barrier, preserved broad wild-pointer behavior, and passed:
managed same-heap/cross-heap nursery test;
broad non-heap pointer barrier test;
downstream nursery integration 7/7.
Pinned downstream object_churn, 12 order-balanced fresh warmed processes per binary:
baseline median: 617.213 ms
managed barrier median: 625.312 ms
regression: 1.31%
checksum: 1030552128 in every run.
The existing slab classifier's hot hint is cheaper than the additional barrier-mode branch and code-layout cost on this path. The broad barrier remains the better implementation; downstream work moves to repeated unsupported quickening probes in the VM dispatch loop.
Activity
chrisbbreuer commentedon Jul 14, 2026
Rejected after the required downstream A/B; both zig-gc and zig-js experiments were fully removed and no commit was made.
The candidate used a per-heap header cookie without increasing Header size, added a direct managed-cell barrier, preserved broad wild-pointer behavior, and passed:
Pinned downstream object_churn, 12 order-balanced fresh warmed processes per binary:
The existing slab classifier's hot hint is cheaper than the additional barrier-mode branch and code-layout cost on this path. The broad barrier remains the better implementation; downstream work moves to repeated unsupported quickening probes in the VM dispatch loop.