Repository navigation
[JSC] IsoCellSet::addSlow fences before storing a new bit set - #1075
Conversation
Build the bit set in a local, call storeStoreFence(), then store the pointer, as other lazily created members in JSC are stored.
There was a problem hiding this comment.
I reviewed this PR and didn't find any bugs. Because it changes memory ordering on a lock-free GC path in JavaScriptCore heap code, a human look would still be worthwhile.
What was reviewed:
- The new sequence in addSlow (zero-init -> storeStoreFence -> pointer store -> storeStoreFence -> m_blocksWithBits) against the lock-free readers in IsoCellSetInlines.h (add/remove/contains load m_bits[i] and dereference via address dependency) and sweepToFreeList (loadLoadFence after m_blocksWithBits) — the added fence only strengthens ordering; nothing is reordered weaker.
- Confirmed the pattern matches CodeBlock::createRareDataIfNecessary (local unique_ptr, storeStoreFence, move-assign).
- Checked the didRemoveBlock / sweepToFreeList clear paths still run under m_lock, so the move-assign under the same lock cannot race a concurrent reset.
- No build or test run was done in this review; it was conducted by reading only.
Extended reasoning...
The change is a 4-line edit to IsoCellSet::addSlow in Source/JavaScriptCore/heap/IsoCellSet.cpp that constructs the per-block BitSet in a local, issues a WTF::storeStoreFence, then move-assigns it into m_bits before the pre-existing fence and m_blocksWithBits store. It touches no security-sensitive surface (no injection, auth, or data exposure), only GC-internal memory ordering. The code is correct and strictly tightens ordering, and it mirrors an existing JSC pattern, but it sits on a concurrent GC path that is covered by the repository's CODEOWNERS entry for Source/JavaScriptCore and cannot be exercised by the TSan-free CI lanes, so a human look was preferred over automated approval.
|
No actionable comments were generated in the recent review. Walkthrough
ChangesBit-set publication
Merge Risk:
|
|
Preview build of 93e5472: |
### What does this PR do? Moves `WEBKIT_VERSION` from `a8d825d8a049` to `0befb64c5f30`, the head of oven-sh/WebKit `main`. The release for that commit is published, with every asset name of the previous one. oven-sh/WebKit changes picked up: - Build lto-hardened-aot-no-webassembly for Linux arm64 (oven-sh/WebKit#1073) - [JSC] IsoCellSet::addSlow fences before storing a new bit set (oven-sh/WebKit#1075) - AOT: fix localeCompare in hardened builds, and generators where loop polls do not fault (oven-sh/WebKit#1076) ### How did you verify your code works? A debug build on Linux x64, with WebKit compiled from that commit, reports it in `process.versions.webkit`. It passes `webkit-prebuilt-url.test.ts`, `internal-module-blob.test.ts`, `bun-jsc.test.ts`, `test/js/bun/gc/` and 20 programs of `test/aot/parallel` that use `localeCompare` or loop over generators. The prebuilt libraries and hardened builds were not run locally. CI is their check. No test is added. --- _Generated by [Claude Code](https://claude.ai/code)_ Co-authored-by: Claude <[email protected]>
IsoCellSet::addSlownow builds the bit set for a block in a local, callsWTF::storeStoreFence(), and then stores the pointer inm_bits. JSC stores other lazily created members in this order, for example inCodeBlock::createRareDataIfNecessary()and the dynamic subspaces inHeap.cpp. The fence beforem_blocksWithBitsstays.Cost
x86-64: no instruction. arm64: one
dmb ishstfor each new bit set.Checked
dmb ishst, pointer store,dmb ishst,m_blocksWithBitsstore.jscwith assertions, 7,926 files from JSTests (stress, modules, microbenchmarks) with GC stress options: same results with and without the change, except one file that is flaky on both.jscunder qemu, 2,500 of those files: same results, except one file that passes on both with--usePollingTraps=1.None of this ran on arm64 hardware. No test is added, since the change only orders stores.
Generated by Claude Code