← All reports

Legacy worklist threads removed in favor of HelperThreadPool

Component: JSC Runtime | 6a719e0

Source/JavaScriptCore/heap/Collector.cpp

-auto Collector::createHelperClient(Collector& collector) -> HelperClient
-{
- if (Options::useSharedHelperThreadPool())
- return HelperClient(WTF::InPlaceType<std::unique_ptr<ParallelMarkingClient>>, makeUnique<ParallelMarkingClient>(collector));
- return HelperClient(WTF::InPlaceType<ParallelHelperClient>, &heapHelperPool());
-}
...
- , m_helperClient(createHelperClient(*this))
+ , m_helperClient(makeUnique<ParallelMarkingClient>(*this))
...
+ HelperThreadPool::singleton().registerClient(*m_helperClient, HelperThreadClass::GC, numberOfParallelThreads);

Source/JavaScriptCore/jit/JITWorklist.cpp

- while (m_numberOfActiveThreads < targetNumThreads) {
- if (!m_usesSharedHelperThreadPool)
- m_planEnqueued->notifyOne(locker);
- m_numberOfActiveThreads++;
- }
+ m_numberOfActiveThreads = std::max(m_numberOfActiveThreads, targetNumThreads);

JSC used to run background work on three separate thread sets: GC marker threads from HeapHelperPool, JITWorklistThread workers for Baseline/DFG/FTL plans, and dedicated Wasm compiler threads. The shared HelperThreadPool (added in 326499@main, default-on in 326992@main) replaces them with one pool. Each consumer registers a client and publishes demand, and JIT and Wasm consumers hand out worker slots to run plans.

This commit deletes the legacy paths and the useSharedHelperThreadPool option. JITWorkerSlot moves into JITWorklist, and the unused maxNumberOfWorklistThreads and priorityDeltaOf{DFG,FTL,Wasm}CompilerThreads options go away. Per-tier compiler thread limits are set directly to maxJITCompilerThreads only where maximumNumberOfConcurrentCompilations previously scaled them up.

GC marking, JIT and Wasm compilation now run only on the shared pool, so code that was previously behind a flag is the sole default path.

Concurrent compilation and marking interact through plan lifetimes and GC visiting of in-flight plans, which makes this scheduling logic security-relevant. In JITWorklist, check enqueue, runOneTask, compileOnSlot and removeMatchingPlansForVM for races between plan removal or VM teardown and a worker running the plan. Confirm visitWeakReferences and iterateCodeBlocksForGC still see in-flight plans under the new scheduling. Wasm::Worklist::completePlanSynchronously and stopAllPlansForContext are at risk of deadlock or of running a plan concurrently with teardown when synchronous compilation happens during GC at pool capacity 1; shared-helper-thread-pool-sync-compile-during-gc.js now runs without the flag. Review HelperThreadPool::BlockingScope and the VMEntryScope setUpSlow/tearDownSlow changes for capacity accounting and lock ordering. Check how the new per-tier defaults interact with the DFG/FTL setMaximumNumberOfConcurrent*Compilations setters and the simplified wakeThreads accounting.