Repository navigation
Conversation
Notify the marking condition under its mutex after the mutator sets its waiting bit and releases the collector thread lock. Recheck the waiting bit inside passive draining so the collector can take over marking when shared helper threads are busy with another heap. Add a standalone native API regression that observes the collector parked before starting the synchronous wait. The unpatched engine positively exhibits the wait cycle; the fixed engine completes before helper release. Both paths preserve the rooted object graph. Validation: Linux x86-64 positive control, 20 fixed-engine regression runs, 55 GC stress configurations, WebKit style check, and scoped P2 review.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (4)
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review. WalkthroughThe change updates passive GC draining to respond to a mutator-waiting state that appears during termination waits. It adds a standalone ChangesGC Progress
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to No confirmed issue blocks merging after normal build and test checks. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Warning Git: CodeRabbit could not clone the repository, so clone-backed analysis was skipped and this review may be incomplete. Verify repository clone access, such as SSH credentials, before requesting another full review. If clone access is intentionally unavailable, use Comment |
A synchronous collection can stop making progress when multiple worker heaps share the GC helper pool. This showed up in a multi-worker server workload as a worker's synchronous GC stalling for tens of seconds while other heaps occupied the shared marking helpers.
SlotVisitor::drainInParallelPassively()checksmutatorWaitingBiton entry. If the collector has already donated its work and parked when the mutator subsequently entersHeap::waitForCollector(), setting that bit does not wake the collector. The mutator waits for collection to finish, while its collector waits for helpers that are busy elsewhere.Wake the marking condition after setting the waiting bit, under the marking mutex and after releasing the thread mutex. Recheck the bit inside the passive loop and switch to active draining. The marking mutex pairs the predicate check and wait with the notification, while keeping the two mutexes unnested. This follows the current
Collectorownership of marking state.The native regression in
Source/JavaScriptCore/API/tests/testGCProgress.cppuses real Heap operations. It occupies the shared helpers, requests asynchronous collection, observes the target collector parked throughParkingLot, and only then starts the mutator's synchronous wait. The unpatched control must positively exhibit both waiters, recover after releasing helpers, and retain its roots. The fixed engine must finish before helper release and retain the same roots. Setup timeout is a distinct failure. The test runs in its own executable because its scheduler settings and helper-pool gate are process-wide.Built and tested on Linux x86-64 against
7012d42e55da294d8996f2dece6911aa9f0b7b6b, with Bun JSC additions, the Bun event loop, FTL, and external mimalloc enabled. With the same final test source, the unpatched engine exits 1 with a positive wait-cycle witness (no timeout, roots intact). The fixed engine passes 20/20 fresh-process runs, always completing before helper release with roots intact. All 55 selected GC stress configurations also pass, coveringgc-b3,gc-invocation-with-transfer,gc-should-reap-dead-watchpoints, and both splay heap-access tests. Build and run the regression withcmake --build build --target testGCProgressandbuild/bin/testGCProgress.The related WebKit change #72377 removes broadcasts at marking termination, when no work remains. This fixes the later mutator-wait transition while work remains, which is still present after that change and the
Collectorrefactor.