haikuwebkit/Source/JavaScriptCore/jit/JITWorklistThread.h

67 lines
2.1 KiB
C
Raw Permalink Normal View History

GC blocks on FTL and then badness https://bugs.webkit.org/show_bug.cgi?id=128291 Reviewed by Oliver Hunt. Introduce the notion of a DFG::Safepoint, which allows you to unlock the rightToRun mutex for your JIT thread, while supplying the GC with all of the information it would need to scan you at that moment in time. The default way of using this is DFG::GraphSafepoint, where you just supply the Graph. There's a lot of machinery in this patch just to make the Graph scannable. We then use DFG::GraphSafepoint in just two places for now: (1) while initializing LLVM and (2) while invoking LLVM' optimizer and backend. This is a 30% speed-up on Octane/typescript and a 10% speed-up on Octane/gbemu. 2-3% speed-up overall on Octane. * CMakeLists.txt: * GNUmakefile.list.am: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::visitChildren): * dfg/DFGGraph.h: * dfg/DFGGraphSafepoint.cpp: Added. (JSC::DFG::GraphSafepoint::GraphSafepoint): (JSC::DFG::GraphSafepoint::~GraphSafepoint): * dfg/DFGGraphSafepoint.h: Added. * dfg/DFGOperations.h: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThread): (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPlan.h: * dfg/DFGSafepoint.cpp: Added. (JSC::DFG::Safepoint::Safepoint): (JSC::DFG::Safepoint::~Safepoint): (JSC::DFG::Safepoint::add): (JSC::DFG::Safepoint::begin): (JSC::DFG::Safepoint::visitChildren): * dfg/DFGSafepoint.h: Added. * dfg/DFGScannable.h: Added. (JSC::DFG::Scannable::Scannable): (JSC::DFG::Scannable::~Scannable): * dfg/DFGThreadData.cpp: Added. (JSC::DFG::ThreadData::ThreadData): (JSC::DFG::ThreadData::~ThreadData): * dfg/DFGThreadData.h: Added. * dfg/DFGWorklist.cpp: (JSC::DFG::Worklist::finishCreation): (JSC::DFG::Worklist::visitChildren): (JSC::DFG::Worklist::runThread): * dfg/DFGWorklist.h: * ftl/FTLCompile.cpp: (JSC::FTL::compile): * heap/SlotVisitor.h: * heap/SlotVisitorInlines.h: (JSC::SlotVisitor::appendUnbarrieredReadOnlyPointer): (JSC::SlotVisitor::appendUnbarrieredReadOnlyValue): Canonical link: https://commits.webkit.org/146533@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@163765 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-02-10 07:21:09 +00:00
/*
Merge all the JIT worklists into a shared worklist https://bugs.webkit.org/show_bug.cgi?id=226207 Reviewed by Saam Barati. Delete the DFG and FTL worklists and refactor JITWorklist to handle the compilation for all tiers. This reduces the total number of compiler threads while allowing each tier to use more threads whenever necessary. The default configuration is for the worklist to have 3 threads, baseline can use up to all 3 threads and DFG and FTL follow the previous limits set through JSC::Options. Right now, the worklist will only do work on upper tiers when all lower tiers have no pending tasks or have exceeded the maximum number of concurrent compilations. i.e. by default we only DFG compile when there are no baseline tasks in the queue and we only FTL compile when we either have no DFG tasks in the queue OR there are already 2 DFG compilations in progress. * API/JSVirtualMachine.mm: (+[JSVirtualMachine setNumberOfDFGCompilerThreads:]): (+[JSVirtualMachine setNumberOfFTLCompilerThreads:]): * API/tests/testapi.mm: (runJITThreadLimitTests): * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::checkIfOptimizationThresholdReached): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGCommon.h: (JSC::DFG::verboseCompilationEnabled): (JSC::DFG::logCompilationChanges): (JSC::DFG::shouldDumpGraphAtEachPhase): (JSC::DFG::shouldDumpDisassembly): * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): (JSC::DFG::compile): * dfg/DFGDriver.h: * dfg/DFGGraph.h: * dfg/DFGGraphSafepoint.h: * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: (JSC::DFG::OSRAvailabilityAnalysisPhase::run): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGOperations.cpp: (JSC::DFG::triggerFTLReplacementCompile): (JSC::DFG::tierUpCommon): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::Plan): (JSC::DFG::Plan::codeSize const): (JSC::DFG::Plan::finalizeInGC): (JSC::DFG::Plan::notifyReady): (JSC::DFG::Plan::cancel): (JSC::DFG::Plan::compileInThreadImpl): (JSC::DFG::Plan::finalize): (JSC::DFG::Plan::iterateCodeBlocksForGC): (JSC::DFG::Plan::checkLivenessAndVisitChildren): (JSC::DFG::Plan::isKnownToBeLiveDuringGC): (JSC::DFG::Plan::isKnownToBeLiveAfterGC): * dfg/DFGPlan.h: * dfg/DFGPlanInlines.h: Removed. * dfg/DFGTierUpCheckInjectionPhase.cpp: (JSC::DFG::TierUpCheckInjectionPhase::run): * dfg/DFGWorklist.cpp: Removed. * dfg/DFGWorklist.h: Removed. * dfg/DFGWorklistInlines.h: Removed. * ftl/FTLCompile.h: * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): (JSC::FTL::DFG::LowerDFGToB3::buildExitArguments): * ftl/FTLState.cpp: (JSC::FTL::State::State): * ftl/FTLState.h: (JSC::FTL::verboseCompilationEnabled): (JSC::FTL::shouldDumpDisassembly): * heap/Heap.cpp: (JSC::Heap::completeAllJITPlans): (JSC::Heap::iterateExecutingAndCompilingCodeBlocks): (JSC::Heap::removeDeadCompilerWorklistEntries): (JSC::Heap::stopThePeriphery): (JSC::Heap::suspendCompilerThreads): (JSC::Heap::resumeCompilerThreads): (JSC::Heap::addCoreConstraints): * heap/Heap.h: * heap/RootMarkReason.h: * jit/JIT.cpp: (JSC::JIT::compileAndLinkWithoutFinalizing): (JSC::JIT::codeSize const): (JSC::JIT::compileTimeStats): * jit/JIT.h: * jit/JITBaselinePlan.cpp: Copied from Source/JavaScriptCore/ftl/FTLState.cpp. (JSC::JITBaselinePlan::JITBaselinePlan): (JSC::JITBaselinePlan::compileInThreadImpl): (JSC::JITBaselinePlan::codeSize const): (JSC::JITBaselinePlan::finalize): * jit/JITBaselinePlan.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITCompilationKey.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.cpp. (JSC::JITCompilationKey::dump const): * jit/JITCompilationKey.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.h. (JSC::JITCompilationKey::JITCompilationKey): (JSC::JITCompilationKey::operator! const): (JSC::JITCompilationKey::isHashTableDeletedValue const): (JSC::JITCompilationKey::mode const): (JSC::JITCompilationKey::operator== const): (JSC::JITCompilationKey::hash const): (JSC::JITCompilationKeyHash::hash): (JSC::JITCompilationKeyHash::equal): * jit/JITCompilationMode.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.cpp. (WTF::printInternal): * jit/JITCompilationMode.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.h. (JSC::isFTL): * jit/JITOperations.cpp: (JSC::JSC_DEFINE_JIT_OPERATION): * jit/JITPlan.cpp: Added. (JSC::JITPlan::JITPlan): (JSC::JITPlan::cancel): (JSC::JITPlan::notifyCompiling): (JSC::JITPlan::notifyReady): (JSC::JITPlan::tier const): (JSC::JITPlan::key): (JSC::JITPlan::isKnownToBeLiveAfterGC): (JSC::JITPlan::isKnownToBeLiveDuringGC): (JSC::JITPlan::iterateCodeBlocksForGC): (JSC::JITPlan::checkLivenessAndVisitChildren): (JSC::JITPlan::computeCompileTimes const): (JSC::JITPlan::reportCompileTimes const): (JSC::JITPlan::compileInThread): * jit/JITPlan.h: Added. (JSC::JITPlan::~JITPlan): (JSC::JITPlan::vm const): (JSC::JITPlan::codeBlock const): (JSC::JITPlan::thread const): (JSC::JITPlan::mode const): (JSC::JITPlan::stage const): (JSC::JITPlan::isFTL const): (JSC::JITPlan::finalizeInGC): * jit/JITPlanStage.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.cpp. * jit/JITSafepoint.cpp: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.cpp. (JSC::Safepoint::Safepoint): (JSC::Safepoint::~Safepoint): (JSC::Safepoint::begin): (JSC::Safepoint::cancel): * jit/JITSafepoint.h: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.h. * jit/JITScannable.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITWorklist.cpp: (JSC::JITWorklist::JITWorklist): (JSC::JITWorklist::~JITWorklist): (JSC::JITWorklist::existingGlobalWorklistOrNull): (JSC::JITWorklist::ensureGlobalWorklist): (JSC::JITWorklist::enqueue): (JSC::JITWorklist::queueLength const): (JSC::JITWorklist::suspendAllThreads): (JSC::JITWorklist::resumeAllThreads): (JSC::JITWorklist::compilationState): (JSC::JITWorklist::completeAllReadyPlansForVM): (JSC::JITWorklist::waitUntilAllPlansForVMAreReady): (JSC::JITWorklist::completeAllPlansForVM): (JSC::JITWorklist::cancelAllPlansForVM): (JSC::JITWorklist::removeDeadPlans): (JSC::JITWorklist::setMaximumNumberOfConcurrentDFGCompilations): (JSC::JITWorklist::setMaximumNumberOfConcurrentFTLCompilations): (JSC::JITWorklist::visitWeakReferences): (JSC::JITWorklist::dump const): (JSC::JITWorklist::removeAllReadyPlansForVM): (JSC::JITWorklist::removeMatchingPlansForVM): * jit/JITWorklist.h: (JSC::JITWorklist::static_cast<size_t>): * jit/JITWorklistInlines.h: Renamed from Source/JavaScriptCore/dfg/DFGScannable.h. (JSC::JITWorklist::iterateCodeBlocksForGC): * jit/JITWorklistThread.cpp: Added. (JSC::JITWorklistThread::JITWorklistThread): (JSC::JITWorklistThread::name const): (JSC::JITWorklistThread::poll): (JSC::JITWorklistThread::work): (JSC::JITWorklistThread::threadDidStart): (JSC::JITWorklistThread::threadIsStopping): * jit/JITWorklistThread.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.h. * llint/LLIntSlowPaths.cpp: (JSC::LLInt::jitCompileAndSetHeuristics): * runtime/OptionsList.h: * runtime/VM.cpp: (JSC::VM::~VM): Canonical link: https://commits.webkit.org/238161@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278082 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-26 15:15:22 +00:00
* Copyright (C) 2021 Apple Inc. All rights reserved.
GC blocks on FTL and then badness https://bugs.webkit.org/show_bug.cgi?id=128291 Reviewed by Oliver Hunt. Introduce the notion of a DFG::Safepoint, which allows you to unlock the rightToRun mutex for your JIT thread, while supplying the GC with all of the information it would need to scan you at that moment in time. The default way of using this is DFG::GraphSafepoint, where you just supply the Graph. There's a lot of machinery in this patch just to make the Graph scannable. We then use DFG::GraphSafepoint in just two places for now: (1) while initializing LLVM and (2) while invoking LLVM' optimizer and backend. This is a 30% speed-up on Octane/typescript and a 10% speed-up on Octane/gbemu. 2-3% speed-up overall on Octane. * CMakeLists.txt: * GNUmakefile.list.am: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::visitChildren): * dfg/DFGGraph.h: * dfg/DFGGraphSafepoint.cpp: Added. (JSC::DFG::GraphSafepoint::GraphSafepoint): (JSC::DFG::GraphSafepoint::~GraphSafepoint): * dfg/DFGGraphSafepoint.h: Added. * dfg/DFGOperations.h: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThread): (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPlan.h: * dfg/DFGSafepoint.cpp: Added. (JSC::DFG::Safepoint::Safepoint): (JSC::DFG::Safepoint::~Safepoint): (JSC::DFG::Safepoint::add): (JSC::DFG::Safepoint::begin): (JSC::DFG::Safepoint::visitChildren): * dfg/DFGSafepoint.h: Added. * dfg/DFGScannable.h: Added. (JSC::DFG::Scannable::Scannable): (JSC::DFG::Scannable::~Scannable): * dfg/DFGThreadData.cpp: Added. (JSC::DFG::ThreadData::ThreadData): (JSC::DFG::ThreadData::~ThreadData): * dfg/DFGThreadData.h: Added. * dfg/DFGWorklist.cpp: (JSC::DFG::Worklist::finishCreation): (JSC::DFG::Worklist::visitChildren): (JSC::DFG::Worklist::runThread): * dfg/DFGWorklist.h: * ftl/FTLCompile.cpp: (JSC::FTL::compile): * heap/SlotVisitor.h: * heap/SlotVisitorInlines.h: (JSC::SlotVisitor::appendUnbarrieredReadOnlyPointer): (JSC::SlotVisitor::appendUnbarrieredReadOnlyValue): Canonical link: https://commits.webkit.org/146533@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@163765 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-02-10 07:21:09 +00:00
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Merge all the JIT worklists into a shared worklist https://bugs.webkit.org/show_bug.cgi?id=226207 Reviewed by Saam Barati. Delete the DFG and FTL worklists and refactor JITWorklist to handle the compilation for all tiers. This reduces the total number of compiler threads while allowing each tier to use more threads whenever necessary. The default configuration is for the worklist to have 3 threads, baseline can use up to all 3 threads and DFG and FTL follow the previous limits set through JSC::Options. Right now, the worklist will only do work on upper tiers when all lower tiers have no pending tasks or have exceeded the maximum number of concurrent compilations. i.e. by default we only DFG compile when there are no baseline tasks in the queue and we only FTL compile when we either have no DFG tasks in the queue OR there are already 2 DFG compilations in progress. * API/JSVirtualMachine.mm: (+[JSVirtualMachine setNumberOfDFGCompilerThreads:]): (+[JSVirtualMachine setNumberOfFTLCompilerThreads:]): * API/tests/testapi.mm: (runJITThreadLimitTests): * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::checkIfOptimizationThresholdReached): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGCommon.h: (JSC::DFG::verboseCompilationEnabled): (JSC::DFG::logCompilationChanges): (JSC::DFG::shouldDumpGraphAtEachPhase): (JSC::DFG::shouldDumpDisassembly): * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): (JSC::DFG::compile): * dfg/DFGDriver.h: * dfg/DFGGraph.h: * dfg/DFGGraphSafepoint.h: * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: (JSC::DFG::OSRAvailabilityAnalysisPhase::run): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGOperations.cpp: (JSC::DFG::triggerFTLReplacementCompile): (JSC::DFG::tierUpCommon): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::Plan): (JSC::DFG::Plan::codeSize const): (JSC::DFG::Plan::finalizeInGC): (JSC::DFG::Plan::notifyReady): (JSC::DFG::Plan::cancel): (JSC::DFG::Plan::compileInThreadImpl): (JSC::DFG::Plan::finalize): (JSC::DFG::Plan::iterateCodeBlocksForGC): (JSC::DFG::Plan::checkLivenessAndVisitChildren): (JSC::DFG::Plan::isKnownToBeLiveDuringGC): (JSC::DFG::Plan::isKnownToBeLiveAfterGC): * dfg/DFGPlan.h: * dfg/DFGPlanInlines.h: Removed. * dfg/DFGTierUpCheckInjectionPhase.cpp: (JSC::DFG::TierUpCheckInjectionPhase::run): * dfg/DFGWorklist.cpp: Removed. * dfg/DFGWorklist.h: Removed. * dfg/DFGWorklistInlines.h: Removed. * ftl/FTLCompile.h: * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): (JSC::FTL::DFG::LowerDFGToB3::buildExitArguments): * ftl/FTLState.cpp: (JSC::FTL::State::State): * ftl/FTLState.h: (JSC::FTL::verboseCompilationEnabled): (JSC::FTL::shouldDumpDisassembly): * heap/Heap.cpp: (JSC::Heap::completeAllJITPlans): (JSC::Heap::iterateExecutingAndCompilingCodeBlocks): (JSC::Heap::removeDeadCompilerWorklistEntries): (JSC::Heap::stopThePeriphery): (JSC::Heap::suspendCompilerThreads): (JSC::Heap::resumeCompilerThreads): (JSC::Heap::addCoreConstraints): * heap/Heap.h: * heap/RootMarkReason.h: * jit/JIT.cpp: (JSC::JIT::compileAndLinkWithoutFinalizing): (JSC::JIT::codeSize const): (JSC::JIT::compileTimeStats): * jit/JIT.h: * jit/JITBaselinePlan.cpp: Copied from Source/JavaScriptCore/ftl/FTLState.cpp. (JSC::JITBaselinePlan::JITBaselinePlan): (JSC::JITBaselinePlan::compileInThreadImpl): (JSC::JITBaselinePlan::codeSize const): (JSC::JITBaselinePlan::finalize): * jit/JITBaselinePlan.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITCompilationKey.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.cpp. (JSC::JITCompilationKey::dump const): * jit/JITCompilationKey.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.h. (JSC::JITCompilationKey::JITCompilationKey): (JSC::JITCompilationKey::operator! const): (JSC::JITCompilationKey::isHashTableDeletedValue const): (JSC::JITCompilationKey::mode const): (JSC::JITCompilationKey::operator== const): (JSC::JITCompilationKey::hash const): (JSC::JITCompilationKeyHash::hash): (JSC::JITCompilationKeyHash::equal): * jit/JITCompilationMode.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.cpp. (WTF::printInternal): * jit/JITCompilationMode.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.h. (JSC::isFTL): * jit/JITOperations.cpp: (JSC::JSC_DEFINE_JIT_OPERATION): * jit/JITPlan.cpp: Added. (JSC::JITPlan::JITPlan): (JSC::JITPlan::cancel): (JSC::JITPlan::notifyCompiling): (JSC::JITPlan::notifyReady): (JSC::JITPlan::tier const): (JSC::JITPlan::key): (JSC::JITPlan::isKnownToBeLiveAfterGC): (JSC::JITPlan::isKnownToBeLiveDuringGC): (JSC::JITPlan::iterateCodeBlocksForGC): (JSC::JITPlan::checkLivenessAndVisitChildren): (JSC::JITPlan::computeCompileTimes const): (JSC::JITPlan::reportCompileTimes const): (JSC::JITPlan::compileInThread): * jit/JITPlan.h: Added. (JSC::JITPlan::~JITPlan): (JSC::JITPlan::vm const): (JSC::JITPlan::codeBlock const): (JSC::JITPlan::thread const): (JSC::JITPlan::mode const): (JSC::JITPlan::stage const): (JSC::JITPlan::isFTL const): (JSC::JITPlan::finalizeInGC): * jit/JITPlanStage.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.cpp. * jit/JITSafepoint.cpp: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.cpp. (JSC::Safepoint::Safepoint): (JSC::Safepoint::~Safepoint): (JSC::Safepoint::begin): (JSC::Safepoint::cancel): * jit/JITSafepoint.h: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.h. * jit/JITScannable.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITWorklist.cpp: (JSC::JITWorklist::JITWorklist): (JSC::JITWorklist::~JITWorklist): (JSC::JITWorklist::existingGlobalWorklistOrNull): (JSC::JITWorklist::ensureGlobalWorklist): (JSC::JITWorklist::enqueue): (JSC::JITWorklist::queueLength const): (JSC::JITWorklist::suspendAllThreads): (JSC::JITWorklist::resumeAllThreads): (JSC::JITWorklist::compilationState): (JSC::JITWorklist::completeAllReadyPlansForVM): (JSC::JITWorklist::waitUntilAllPlansForVMAreReady): (JSC::JITWorklist::completeAllPlansForVM): (JSC::JITWorklist::cancelAllPlansForVM): (JSC::JITWorklist::removeDeadPlans): (JSC::JITWorklist::setMaximumNumberOfConcurrentDFGCompilations): (JSC::JITWorklist::setMaximumNumberOfConcurrentFTLCompilations): (JSC::JITWorklist::visitWeakReferences): (JSC::JITWorklist::dump const): (JSC::JITWorklist::removeAllReadyPlansForVM): (JSC::JITWorklist::removeMatchingPlansForVM): * jit/JITWorklist.h: (JSC::JITWorklist::static_cast<size_t>): * jit/JITWorklistInlines.h: Renamed from Source/JavaScriptCore/dfg/DFGScannable.h. (JSC::JITWorklist::iterateCodeBlocksForGC): * jit/JITWorklistThread.cpp: Added. (JSC::JITWorklistThread::JITWorklistThread): (JSC::JITWorklistThread::name const): (JSC::JITWorklistThread::poll): (JSC::JITWorklistThread::work): (JSC::JITWorklistThread::threadDidStart): (JSC::JITWorklistThread::threadIsStopping): * jit/JITWorklistThread.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.h. * llint/LLIntSlowPaths.cpp: (JSC::LLInt::jitCompileAndSetHeuristics): * runtime/OptionsList.h: * runtime/VM.cpp: (JSC::VM::~VM): Canonical link: https://commits.webkit.org/238161@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278082 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-26 15:15:22 +00:00
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
GC blocks on FTL and then badness https://bugs.webkit.org/show_bug.cgi?id=128291 Reviewed by Oliver Hunt. Introduce the notion of a DFG::Safepoint, which allows you to unlock the rightToRun mutex for your JIT thread, while supplying the GC with all of the information it would need to scan you at that moment in time. The default way of using this is DFG::GraphSafepoint, where you just supply the Graph. There's a lot of machinery in this patch just to make the Graph scannable. We then use DFG::GraphSafepoint in just two places for now: (1) while initializing LLVM and (2) while invoking LLVM' optimizer and backend. This is a 30% speed-up on Octane/typescript and a 10% speed-up on Octane/gbemu. 2-3% speed-up overall on Octane. * CMakeLists.txt: * GNUmakefile.list.am: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::visitChildren): * dfg/DFGGraph.h: * dfg/DFGGraphSafepoint.cpp: Added. (JSC::DFG::GraphSafepoint::GraphSafepoint): (JSC::DFG::GraphSafepoint::~GraphSafepoint): * dfg/DFGGraphSafepoint.h: Added. * dfg/DFGOperations.h: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThread): (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPlan.h: * dfg/DFGSafepoint.cpp: Added. (JSC::DFG::Safepoint::Safepoint): (JSC::DFG::Safepoint::~Safepoint): (JSC::DFG::Safepoint::add): (JSC::DFG::Safepoint::begin): (JSC::DFG::Safepoint::visitChildren): * dfg/DFGSafepoint.h: Added. * dfg/DFGScannable.h: Added. (JSC::DFG::Scannable::Scannable): (JSC::DFG::Scannable::~Scannable): * dfg/DFGThreadData.cpp: Added. (JSC::DFG::ThreadData::ThreadData): (JSC::DFG::ThreadData::~ThreadData): * dfg/DFGThreadData.h: Added. * dfg/DFGWorklist.cpp: (JSC::DFG::Worklist::finishCreation): (JSC::DFG::Worklist::visitChildren): (JSC::DFG::Worklist::runThread): * dfg/DFGWorklist.h: * ftl/FTLCompile.cpp: (JSC::FTL::compile): * heap/SlotVisitor.h: * heap/SlotVisitorInlines.h: (JSC::SlotVisitor::appendUnbarrieredReadOnlyPointer): (JSC::SlotVisitor::appendUnbarrieredReadOnlyValue): Canonical link: https://commits.webkit.org/146533@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@163765 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-02-10 07:21:09 +00:00
*/
#pragma once
GC blocks on FTL and then badness https://bugs.webkit.org/show_bug.cgi?id=128291 Reviewed by Oliver Hunt. Introduce the notion of a DFG::Safepoint, which allows you to unlock the rightToRun mutex for your JIT thread, while supplying the GC with all of the information it would need to scan you at that moment in time. The default way of using this is DFG::GraphSafepoint, where you just supply the Graph. There's a lot of machinery in this patch just to make the Graph scannable. We then use DFG::GraphSafepoint in just two places for now: (1) while initializing LLVM and (2) while invoking LLVM' optimizer and backend. This is a 30% speed-up on Octane/typescript and a 10% speed-up on Octane/gbemu. 2-3% speed-up overall on Octane. * CMakeLists.txt: * GNUmakefile.list.am: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::visitChildren): * dfg/DFGGraph.h: * dfg/DFGGraphSafepoint.cpp: Added. (JSC::DFG::GraphSafepoint::GraphSafepoint): (JSC::DFG::GraphSafepoint::~GraphSafepoint): * dfg/DFGGraphSafepoint.h: Added. * dfg/DFGOperations.h: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThread): (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPlan.h: * dfg/DFGSafepoint.cpp: Added. (JSC::DFG::Safepoint::Safepoint): (JSC::DFG::Safepoint::~Safepoint): (JSC::DFG::Safepoint::add): (JSC::DFG::Safepoint::begin): (JSC::DFG::Safepoint::visitChildren): * dfg/DFGSafepoint.h: Added. * dfg/DFGScannable.h: Added. (JSC::DFG::Scannable::Scannable): (JSC::DFG::Scannable::~Scannable): * dfg/DFGThreadData.cpp: Added. (JSC::DFG::ThreadData::ThreadData): (JSC::DFG::ThreadData::~ThreadData): * dfg/DFGThreadData.h: Added. * dfg/DFGWorklist.cpp: (JSC::DFG::Worklist::finishCreation): (JSC::DFG::Worklist::visitChildren): (JSC::DFG::Worklist::runThread): * dfg/DFGWorklist.h: * ftl/FTLCompile.cpp: (JSC::FTL::compile): * heap/SlotVisitor.h: * heap/SlotVisitorInlines.h: (JSC::SlotVisitor::appendUnbarrieredReadOnlyPointer): (JSC::SlotVisitor::appendUnbarrieredReadOnlyValue): Canonical link: https://commits.webkit.org/146533@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@163765 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-02-10 07:21:09 +00:00
Merge all the JIT worklists into a shared worklist https://bugs.webkit.org/show_bug.cgi?id=226207 Reviewed by Saam Barati. Delete the DFG and FTL worklists and refactor JITWorklist to handle the compilation for all tiers. This reduces the total number of compiler threads while allowing each tier to use more threads whenever necessary. The default configuration is for the worklist to have 3 threads, baseline can use up to all 3 threads and DFG and FTL follow the previous limits set through JSC::Options. Right now, the worklist will only do work on upper tiers when all lower tiers have no pending tasks or have exceeded the maximum number of concurrent compilations. i.e. by default we only DFG compile when there are no baseline tasks in the queue and we only FTL compile when we either have no DFG tasks in the queue OR there are already 2 DFG compilations in progress. * API/JSVirtualMachine.mm: (+[JSVirtualMachine setNumberOfDFGCompilerThreads:]): (+[JSVirtualMachine setNumberOfFTLCompilerThreads:]): * API/tests/testapi.mm: (runJITThreadLimitTests): * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::checkIfOptimizationThresholdReached): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGCommon.h: (JSC::DFG::verboseCompilationEnabled): (JSC::DFG::logCompilationChanges): (JSC::DFG::shouldDumpGraphAtEachPhase): (JSC::DFG::shouldDumpDisassembly): * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): (JSC::DFG::compile): * dfg/DFGDriver.h: * dfg/DFGGraph.h: * dfg/DFGGraphSafepoint.h: * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: (JSC::DFG::OSRAvailabilityAnalysisPhase::run): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGOperations.cpp: (JSC::DFG::triggerFTLReplacementCompile): (JSC::DFG::tierUpCommon): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::Plan): (JSC::DFG::Plan::codeSize const): (JSC::DFG::Plan::finalizeInGC): (JSC::DFG::Plan::notifyReady): (JSC::DFG::Plan::cancel): (JSC::DFG::Plan::compileInThreadImpl): (JSC::DFG::Plan::finalize): (JSC::DFG::Plan::iterateCodeBlocksForGC): (JSC::DFG::Plan::checkLivenessAndVisitChildren): (JSC::DFG::Plan::isKnownToBeLiveDuringGC): (JSC::DFG::Plan::isKnownToBeLiveAfterGC): * dfg/DFGPlan.h: * dfg/DFGPlanInlines.h: Removed. * dfg/DFGTierUpCheckInjectionPhase.cpp: (JSC::DFG::TierUpCheckInjectionPhase::run): * dfg/DFGWorklist.cpp: Removed. * dfg/DFGWorklist.h: Removed. * dfg/DFGWorklistInlines.h: Removed. * ftl/FTLCompile.h: * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): (JSC::FTL::DFG::LowerDFGToB3::buildExitArguments): * ftl/FTLState.cpp: (JSC::FTL::State::State): * ftl/FTLState.h: (JSC::FTL::verboseCompilationEnabled): (JSC::FTL::shouldDumpDisassembly): * heap/Heap.cpp: (JSC::Heap::completeAllJITPlans): (JSC::Heap::iterateExecutingAndCompilingCodeBlocks): (JSC::Heap::removeDeadCompilerWorklistEntries): (JSC::Heap::stopThePeriphery): (JSC::Heap::suspendCompilerThreads): (JSC::Heap::resumeCompilerThreads): (JSC::Heap::addCoreConstraints): * heap/Heap.h: * heap/RootMarkReason.h: * jit/JIT.cpp: (JSC::JIT::compileAndLinkWithoutFinalizing): (JSC::JIT::codeSize const): (JSC::JIT::compileTimeStats): * jit/JIT.h: * jit/JITBaselinePlan.cpp: Copied from Source/JavaScriptCore/ftl/FTLState.cpp. (JSC::JITBaselinePlan::JITBaselinePlan): (JSC::JITBaselinePlan::compileInThreadImpl): (JSC::JITBaselinePlan::codeSize const): (JSC::JITBaselinePlan::finalize): * jit/JITBaselinePlan.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITCompilationKey.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.cpp. (JSC::JITCompilationKey::dump const): * jit/JITCompilationKey.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.h. (JSC::JITCompilationKey::JITCompilationKey): (JSC::JITCompilationKey::operator! const): (JSC::JITCompilationKey::isHashTableDeletedValue const): (JSC::JITCompilationKey::mode const): (JSC::JITCompilationKey::operator== const): (JSC::JITCompilationKey::hash const): (JSC::JITCompilationKeyHash::hash): (JSC::JITCompilationKeyHash::equal): * jit/JITCompilationMode.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.cpp. (WTF::printInternal): * jit/JITCompilationMode.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.h. (JSC::isFTL): * jit/JITOperations.cpp: (JSC::JSC_DEFINE_JIT_OPERATION): * jit/JITPlan.cpp: Added. (JSC::JITPlan::JITPlan): (JSC::JITPlan::cancel): (JSC::JITPlan::notifyCompiling): (JSC::JITPlan::notifyReady): (JSC::JITPlan::tier const): (JSC::JITPlan::key): (JSC::JITPlan::isKnownToBeLiveAfterGC): (JSC::JITPlan::isKnownToBeLiveDuringGC): (JSC::JITPlan::iterateCodeBlocksForGC): (JSC::JITPlan::checkLivenessAndVisitChildren): (JSC::JITPlan::computeCompileTimes const): (JSC::JITPlan::reportCompileTimes const): (JSC::JITPlan::compileInThread): * jit/JITPlan.h: Added. (JSC::JITPlan::~JITPlan): (JSC::JITPlan::vm const): (JSC::JITPlan::codeBlock const): (JSC::JITPlan::thread const): (JSC::JITPlan::mode const): (JSC::JITPlan::stage const): (JSC::JITPlan::isFTL const): (JSC::JITPlan::finalizeInGC): * jit/JITPlanStage.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.cpp. * jit/JITSafepoint.cpp: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.cpp. (JSC::Safepoint::Safepoint): (JSC::Safepoint::~Safepoint): (JSC::Safepoint::begin): (JSC::Safepoint::cancel): * jit/JITSafepoint.h: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.h. * jit/JITScannable.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITWorklist.cpp: (JSC::JITWorklist::JITWorklist): (JSC::JITWorklist::~JITWorklist): (JSC::JITWorklist::existingGlobalWorklistOrNull): (JSC::JITWorklist::ensureGlobalWorklist): (JSC::JITWorklist::enqueue): (JSC::JITWorklist::queueLength const): (JSC::JITWorklist::suspendAllThreads): (JSC::JITWorklist::resumeAllThreads): (JSC::JITWorklist::compilationState): (JSC::JITWorklist::completeAllReadyPlansForVM): (JSC::JITWorklist::waitUntilAllPlansForVMAreReady): (JSC::JITWorklist::completeAllPlansForVM): (JSC::JITWorklist::cancelAllPlansForVM): (JSC::JITWorklist::removeDeadPlans): (JSC::JITWorklist::setMaximumNumberOfConcurrentDFGCompilations): (JSC::JITWorklist::setMaximumNumberOfConcurrentFTLCompilations): (JSC::JITWorklist::visitWeakReferences): (JSC::JITWorklist::dump const): (JSC::JITWorklist::removeAllReadyPlansForVM): (JSC::JITWorklist::removeMatchingPlansForVM): * jit/JITWorklist.h: (JSC::JITWorklist::static_cast<size_t>): * jit/JITWorklistInlines.h: Renamed from Source/JavaScriptCore/dfg/DFGScannable.h. (JSC::JITWorklist::iterateCodeBlocksForGC): * jit/JITWorklistThread.cpp: Added. (JSC::JITWorklistThread::JITWorklistThread): (JSC::JITWorklistThread::name const): (JSC::JITWorklistThread::poll): (JSC::JITWorklistThread::work): (JSC::JITWorklistThread::threadDidStart): (JSC::JITWorklistThread::threadIsStopping): * jit/JITWorklistThread.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.h. * llint/LLIntSlowPaths.cpp: (JSC::LLInt::jitCompileAndSetHeuristics): * runtime/OptionsList.h: * runtime/VM.cpp: (JSC::VM::~VM): Canonical link: https://commits.webkit.org/238161@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278082 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-26 15:15:22 +00:00
#if ENABLE(JIT)
GC blocks on FTL and then badness https://bugs.webkit.org/show_bug.cgi?id=128291 Reviewed by Oliver Hunt. Introduce the notion of a DFG::Safepoint, which allows you to unlock the rightToRun mutex for your JIT thread, while supplying the GC with all of the information it would need to scan you at that moment in time. The default way of using this is DFG::GraphSafepoint, where you just supply the Graph. There's a lot of machinery in this patch just to make the Graph scannable. We then use DFG::GraphSafepoint in just two places for now: (1) while initializing LLVM and (2) while invoking LLVM' optimizer and backend. This is a 30% speed-up on Octane/typescript and a 10% speed-up on Octane/gbemu. 2-3% speed-up overall on Octane. * CMakeLists.txt: * GNUmakefile.list.am: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::visitChildren): * dfg/DFGGraph.h: * dfg/DFGGraphSafepoint.cpp: Added. (JSC::DFG::GraphSafepoint::GraphSafepoint): (JSC::DFG::GraphSafepoint::~GraphSafepoint): * dfg/DFGGraphSafepoint.h: Added. * dfg/DFGOperations.h: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThread): (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPlan.h: * dfg/DFGSafepoint.cpp: Added. (JSC::DFG::Safepoint::Safepoint): (JSC::DFG::Safepoint::~Safepoint): (JSC::DFG::Safepoint::add): (JSC::DFG::Safepoint::begin): (JSC::DFG::Safepoint::visitChildren): * dfg/DFGSafepoint.h: Added. * dfg/DFGScannable.h: Added. (JSC::DFG::Scannable::Scannable): (JSC::DFG::Scannable::~Scannable): * dfg/DFGThreadData.cpp: Added. (JSC::DFG::ThreadData::ThreadData): (JSC::DFG::ThreadData::~ThreadData): * dfg/DFGThreadData.h: Added. * dfg/DFGWorklist.cpp: (JSC::DFG::Worklist::finishCreation): (JSC::DFG::Worklist::visitChildren): (JSC::DFG::Worklist::runThread): * dfg/DFGWorklist.h: * ftl/FTLCompile.cpp: (JSC::FTL::compile): * heap/SlotVisitor.h: * heap/SlotVisitorInlines.h: (JSC::SlotVisitor::appendUnbarrieredReadOnlyPointer): (JSC::SlotVisitor::appendUnbarrieredReadOnlyValue): Canonical link: https://commits.webkit.org/146533@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@163765 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-02-10 07:21:09 +00:00
Merge all the JIT worklists into a shared worklist https://bugs.webkit.org/show_bug.cgi?id=226207 Reviewed by Saam Barati. Delete the DFG and FTL worklists and refactor JITWorklist to handle the compilation for all tiers. This reduces the total number of compiler threads while allowing each tier to use more threads whenever necessary. The default configuration is for the worklist to have 3 threads, baseline can use up to all 3 threads and DFG and FTL follow the previous limits set through JSC::Options. Right now, the worklist will only do work on upper tiers when all lower tiers have no pending tasks or have exceeded the maximum number of concurrent compilations. i.e. by default we only DFG compile when there are no baseline tasks in the queue and we only FTL compile when we either have no DFG tasks in the queue OR there are already 2 DFG compilations in progress. * API/JSVirtualMachine.mm: (+[JSVirtualMachine setNumberOfDFGCompilerThreads:]): (+[JSVirtualMachine setNumberOfFTLCompilerThreads:]): * API/tests/testapi.mm: (runJITThreadLimitTests): * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::checkIfOptimizationThresholdReached): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGCommon.h: (JSC::DFG::verboseCompilationEnabled): (JSC::DFG::logCompilationChanges): (JSC::DFG::shouldDumpGraphAtEachPhase): (JSC::DFG::shouldDumpDisassembly): * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): (JSC::DFG::compile): * dfg/DFGDriver.h: * dfg/DFGGraph.h: * dfg/DFGGraphSafepoint.h: * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: (JSC::DFG::OSRAvailabilityAnalysisPhase::run): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGOperations.cpp: (JSC::DFG::triggerFTLReplacementCompile): (JSC::DFG::tierUpCommon): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::Plan): (JSC::DFG::Plan::codeSize const): (JSC::DFG::Plan::finalizeInGC): (JSC::DFG::Plan::notifyReady): (JSC::DFG::Plan::cancel): (JSC::DFG::Plan::compileInThreadImpl): (JSC::DFG::Plan::finalize): (JSC::DFG::Plan::iterateCodeBlocksForGC): (JSC::DFG::Plan::checkLivenessAndVisitChildren): (JSC::DFG::Plan::isKnownToBeLiveDuringGC): (JSC::DFG::Plan::isKnownToBeLiveAfterGC): * dfg/DFGPlan.h: * dfg/DFGPlanInlines.h: Removed. * dfg/DFGTierUpCheckInjectionPhase.cpp: (JSC::DFG::TierUpCheckInjectionPhase::run): * dfg/DFGWorklist.cpp: Removed. * dfg/DFGWorklist.h: Removed. * dfg/DFGWorklistInlines.h: Removed. * ftl/FTLCompile.h: * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): (JSC::FTL::DFG::LowerDFGToB3::buildExitArguments): * ftl/FTLState.cpp: (JSC::FTL::State::State): * ftl/FTLState.h: (JSC::FTL::verboseCompilationEnabled): (JSC::FTL::shouldDumpDisassembly): * heap/Heap.cpp: (JSC::Heap::completeAllJITPlans): (JSC::Heap::iterateExecutingAndCompilingCodeBlocks): (JSC::Heap::removeDeadCompilerWorklistEntries): (JSC::Heap::stopThePeriphery): (JSC::Heap::suspendCompilerThreads): (JSC::Heap::resumeCompilerThreads): (JSC::Heap::addCoreConstraints): * heap/Heap.h: * heap/RootMarkReason.h: * jit/JIT.cpp: (JSC::JIT::compileAndLinkWithoutFinalizing): (JSC::JIT::codeSize const): (JSC::JIT::compileTimeStats): * jit/JIT.h: * jit/JITBaselinePlan.cpp: Copied from Source/JavaScriptCore/ftl/FTLState.cpp. (JSC::JITBaselinePlan::JITBaselinePlan): (JSC::JITBaselinePlan::compileInThreadImpl): (JSC::JITBaselinePlan::codeSize const): (JSC::JITBaselinePlan::finalize): * jit/JITBaselinePlan.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITCompilationKey.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.cpp. (JSC::JITCompilationKey::dump const): * jit/JITCompilationKey.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.h. (JSC::JITCompilationKey::JITCompilationKey): (JSC::JITCompilationKey::operator! const): (JSC::JITCompilationKey::isHashTableDeletedValue const): (JSC::JITCompilationKey::mode const): (JSC::JITCompilationKey::operator== const): (JSC::JITCompilationKey::hash const): (JSC::JITCompilationKeyHash::hash): (JSC::JITCompilationKeyHash::equal): * jit/JITCompilationMode.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.cpp. (WTF::printInternal): * jit/JITCompilationMode.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.h. (JSC::isFTL): * jit/JITOperations.cpp: (JSC::JSC_DEFINE_JIT_OPERATION): * jit/JITPlan.cpp: Added. (JSC::JITPlan::JITPlan): (JSC::JITPlan::cancel): (JSC::JITPlan::notifyCompiling): (JSC::JITPlan::notifyReady): (JSC::JITPlan::tier const): (JSC::JITPlan::key): (JSC::JITPlan::isKnownToBeLiveAfterGC): (JSC::JITPlan::isKnownToBeLiveDuringGC): (JSC::JITPlan::iterateCodeBlocksForGC): (JSC::JITPlan::checkLivenessAndVisitChildren): (JSC::JITPlan::computeCompileTimes const): (JSC::JITPlan::reportCompileTimes const): (JSC::JITPlan::compileInThread): * jit/JITPlan.h: Added. (JSC::JITPlan::~JITPlan): (JSC::JITPlan::vm const): (JSC::JITPlan::codeBlock const): (JSC::JITPlan::thread const): (JSC::JITPlan::mode const): (JSC::JITPlan::stage const): (JSC::JITPlan::isFTL const): (JSC::JITPlan::finalizeInGC): * jit/JITPlanStage.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.cpp. * jit/JITSafepoint.cpp: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.cpp. (JSC::Safepoint::Safepoint): (JSC::Safepoint::~Safepoint): (JSC::Safepoint::begin): (JSC::Safepoint::cancel): * jit/JITSafepoint.h: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.h. * jit/JITScannable.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITWorklist.cpp: (JSC::JITWorklist::JITWorklist): (JSC::JITWorklist::~JITWorklist): (JSC::JITWorklist::existingGlobalWorklistOrNull): (JSC::JITWorklist::ensureGlobalWorklist): (JSC::JITWorklist::enqueue): (JSC::JITWorklist::queueLength const): (JSC::JITWorklist::suspendAllThreads): (JSC::JITWorklist::resumeAllThreads): (JSC::JITWorklist::compilationState): (JSC::JITWorklist::completeAllReadyPlansForVM): (JSC::JITWorklist::waitUntilAllPlansForVMAreReady): (JSC::JITWorklist::completeAllPlansForVM): (JSC::JITWorklist::cancelAllPlansForVM): (JSC::JITWorklist::removeDeadPlans): (JSC::JITWorklist::setMaximumNumberOfConcurrentDFGCompilations): (JSC::JITWorklist::setMaximumNumberOfConcurrentFTLCompilations): (JSC::JITWorklist::visitWeakReferences): (JSC::JITWorklist::dump const): (JSC::JITWorklist::removeAllReadyPlansForVM): (JSC::JITWorklist::removeMatchingPlansForVM): * jit/JITWorklist.h: (JSC::JITWorklist::static_cast<size_t>): * jit/JITWorklistInlines.h: Renamed from Source/JavaScriptCore/dfg/DFGScannable.h. (JSC::JITWorklist::iterateCodeBlocksForGC): * jit/JITWorklistThread.cpp: Added. (JSC::JITWorklistThread::JITWorklistThread): (JSC::JITWorklistThread::name const): (JSC::JITWorklistThread::poll): (JSC::JITWorklistThread::work): (JSC::JITWorklistThread::threadDidStart): (JSC::JITWorklistThread::threadIsStopping): * jit/JITWorklistThread.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.h. * llint/LLIntSlowPaths.cpp: (JSC::LLInt::jitCompileAndSetHeuristics): * runtime/OptionsList.h: * runtime/VM.cpp: (JSC::VM::~VM): Canonical link: https://commits.webkit.org/238161@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278082 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-26 15:15:22 +00:00
#include "JITPlan.h"
DFG worklist should use AutomaticThread https://bugs.webkit.org/show_bug.cgi?id=163615 Reviewed by Mark Lam. Source/JavaScriptCore: AutomaticThread is a new feature in WTF that allows you to easily create worker threads that shut down automatically. This changes DFG::Worklist to use AutomaticThread, so that its threads shut down automatically, too. This has the potential to save a lot of memory. This required some improvements to AutomaticThread: Worklist likes to be able to keep state around for the whole lifetime of a thread, and so it likes knowing when threads are born and when they die. I added virtual methods for that. Also, Worklist uses notifyOne() so I added that, too. This looks to be perf-neutral. * dfg/DFGThreadData.cpp: (JSC::DFG::ThreadData::ThreadData): * dfg/DFGThreadData.h: * dfg/DFGWorklist.cpp: (JSC::DFG::Worklist::ThreadBody::ThreadBody): (JSC::DFG::Worklist::Worklist): (JSC::DFG::Worklist::~Worklist): (JSC::DFG::Worklist::finishCreation): (JSC::DFG::Worklist::isActiveForVM): (JSC::DFG::Worklist::enqueue): (JSC::DFG::Worklist::compilationState): (JSC::DFG::Worklist::waitUntilAllPlansForVMAreReady): (JSC::DFG::Worklist::removeAllReadyPlansForVM): (JSC::DFG::Worklist::completeAllReadyPlansForVM): (JSC::DFG::Worklist::rememberCodeBlocks): (JSC::DFG::Worklist::visitWeakReferences): (JSC::DFG::Worklist::removeDeadPlans): (JSC::DFG::Worklist::removeNonCompilingPlansForVM): (JSC::DFG::Worklist::queueLength): (JSC::DFG::Worklist::dump): (JSC::DFG::Worklist::runThread): Deleted. (JSC::DFG::Worklist::threadFunction): Deleted. * dfg/DFGWorklist.h: Source/WTF: This adds new functionality to AutomaticThread to support DFG::Worklist: - AutomaticThread::threadDidStart/threadWillStop virtual methods called at the start and end of a thread's lifetime. This allows Worklist to tie some resources to the life of the thread, and also means that now those resources will naturally free up when the Worklist is not in use. - AutomaticThreadCondition::notifyOne(). This required changes to Condition::notifyOne(). We need to know if the Condition woke up anyone. If it didn't, then we need to launch one of our threads. * wtf/AutomaticThread.cpp: (WTF::AutomaticThreadCondition::notifyOne): (WTF::AutomaticThread::ThreadScope::ThreadScope): (WTF::AutomaticThread::ThreadScope::~ThreadScope): (WTF::AutomaticThread::start): (WTF::AutomaticThread::threadDidStart): (WTF::AutomaticThread::threadWillStop): * wtf/AutomaticThread.h: * wtf/Condition.h: (WTF::ConditionBase::notifyOne): Canonical link: https://commits.webkit.org/181455@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207545 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-19 17:47:30 +00:00
#include <wtf/AutomaticThread.h>
GC blocks on FTL and then badness https://bugs.webkit.org/show_bug.cgi?id=128291 Reviewed by Oliver Hunt. Introduce the notion of a DFG::Safepoint, which allows you to unlock the rightToRun mutex for your JIT thread, while supplying the GC with all of the information it would need to scan you at that moment in time. The default way of using this is DFG::GraphSafepoint, where you just supply the Graph. There's a lot of machinery in this patch just to make the Graph scannable. We then use DFG::GraphSafepoint in just two places for now: (1) while initializing LLVM and (2) while invoking LLVM' optimizer and backend. This is a 30% speed-up on Octane/typescript and a 10% speed-up on Octane/gbemu. 2-3% speed-up overall on Octane. * CMakeLists.txt: * GNUmakefile.list.am: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::visitChildren): * dfg/DFGGraph.h: * dfg/DFGGraphSafepoint.cpp: Added. (JSC::DFG::GraphSafepoint::GraphSafepoint): (JSC::DFG::GraphSafepoint::~GraphSafepoint): * dfg/DFGGraphSafepoint.h: Added. * dfg/DFGOperations.h: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThread): (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPlan.h: * dfg/DFGSafepoint.cpp: Added. (JSC::DFG::Safepoint::Safepoint): (JSC::DFG::Safepoint::~Safepoint): (JSC::DFG::Safepoint::add): (JSC::DFG::Safepoint::begin): (JSC::DFG::Safepoint::visitChildren): * dfg/DFGSafepoint.h: Added. * dfg/DFGScannable.h: Added. (JSC::DFG::Scannable::Scannable): (JSC::DFG::Scannable::~Scannable): * dfg/DFGThreadData.cpp: Added. (JSC::DFG::ThreadData::ThreadData): (JSC::DFG::ThreadData::~ThreadData): * dfg/DFGThreadData.h: Added. * dfg/DFGWorklist.cpp: (JSC::DFG::Worklist::finishCreation): (JSC::DFG::Worklist::visitChildren): (JSC::DFG::Worklist::runThread): * dfg/DFGWorklist.h: * ftl/FTLCompile.cpp: (JSC::FTL::compile): * heap/SlotVisitor.h: * heap/SlotVisitorInlines.h: (JSC::SlotVisitor::appendUnbarrieredReadOnlyPointer): (JSC::SlotVisitor::appendUnbarrieredReadOnlyValue): Canonical link: https://commits.webkit.org/146533@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@163765 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-02-10 07:21:09 +00:00
Merge all the JIT worklists into a shared worklist https://bugs.webkit.org/show_bug.cgi?id=226207 Reviewed by Saam Barati. Delete the DFG and FTL worklists and refactor JITWorklist to handle the compilation for all tiers. This reduces the total number of compiler threads while allowing each tier to use more threads whenever necessary. The default configuration is for the worklist to have 3 threads, baseline can use up to all 3 threads and DFG and FTL follow the previous limits set through JSC::Options. Right now, the worklist will only do work on upper tiers when all lower tiers have no pending tasks or have exceeded the maximum number of concurrent compilations. i.e. by default we only DFG compile when there are no baseline tasks in the queue and we only FTL compile when we either have no DFG tasks in the queue OR there are already 2 DFG compilations in progress. * API/JSVirtualMachine.mm: (+[JSVirtualMachine setNumberOfDFGCompilerThreads:]): (+[JSVirtualMachine setNumberOfFTLCompilerThreads:]): * API/tests/testapi.mm: (runJITThreadLimitTests): * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::checkIfOptimizationThresholdReached): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGCommon.h: (JSC::DFG::verboseCompilationEnabled): (JSC::DFG::logCompilationChanges): (JSC::DFG::shouldDumpGraphAtEachPhase): (JSC::DFG::shouldDumpDisassembly): * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): (JSC::DFG::compile): * dfg/DFGDriver.h: * dfg/DFGGraph.h: * dfg/DFGGraphSafepoint.h: * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: (JSC::DFG::OSRAvailabilityAnalysisPhase::run): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGOperations.cpp: (JSC::DFG::triggerFTLReplacementCompile): (JSC::DFG::tierUpCommon): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::Plan): (JSC::DFG::Plan::codeSize const): (JSC::DFG::Plan::finalizeInGC): (JSC::DFG::Plan::notifyReady): (JSC::DFG::Plan::cancel): (JSC::DFG::Plan::compileInThreadImpl): (JSC::DFG::Plan::finalize): (JSC::DFG::Plan::iterateCodeBlocksForGC): (JSC::DFG::Plan::checkLivenessAndVisitChildren): (JSC::DFG::Plan::isKnownToBeLiveDuringGC): (JSC::DFG::Plan::isKnownToBeLiveAfterGC): * dfg/DFGPlan.h: * dfg/DFGPlanInlines.h: Removed. * dfg/DFGTierUpCheckInjectionPhase.cpp: (JSC::DFG::TierUpCheckInjectionPhase::run): * dfg/DFGWorklist.cpp: Removed. * dfg/DFGWorklist.h: Removed. * dfg/DFGWorklistInlines.h: Removed. * ftl/FTLCompile.h: * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): (JSC::FTL::DFG::LowerDFGToB3::buildExitArguments): * ftl/FTLState.cpp: (JSC::FTL::State::State): * ftl/FTLState.h: (JSC::FTL::verboseCompilationEnabled): (JSC::FTL::shouldDumpDisassembly): * heap/Heap.cpp: (JSC::Heap::completeAllJITPlans): (JSC::Heap::iterateExecutingAndCompilingCodeBlocks): (JSC::Heap::removeDeadCompilerWorklistEntries): (JSC::Heap::stopThePeriphery): (JSC::Heap::suspendCompilerThreads): (JSC::Heap::resumeCompilerThreads): (JSC::Heap::addCoreConstraints): * heap/Heap.h: * heap/RootMarkReason.h: * jit/JIT.cpp: (JSC::JIT::compileAndLinkWithoutFinalizing): (JSC::JIT::codeSize const): (JSC::JIT::compileTimeStats): * jit/JIT.h: * jit/JITBaselinePlan.cpp: Copied from Source/JavaScriptCore/ftl/FTLState.cpp. (JSC::JITBaselinePlan::JITBaselinePlan): (JSC::JITBaselinePlan::compileInThreadImpl): (JSC::JITBaselinePlan::codeSize const): (JSC::JITBaselinePlan::finalize): * jit/JITBaselinePlan.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITCompilationKey.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.cpp. (JSC::JITCompilationKey::dump const): * jit/JITCompilationKey.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.h. (JSC::JITCompilationKey::JITCompilationKey): (JSC::JITCompilationKey::operator! const): (JSC::JITCompilationKey::isHashTableDeletedValue const): (JSC::JITCompilationKey::mode const): (JSC::JITCompilationKey::operator== const): (JSC::JITCompilationKey::hash const): (JSC::JITCompilationKeyHash::hash): (JSC::JITCompilationKeyHash::equal): * jit/JITCompilationMode.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.cpp. (WTF::printInternal): * jit/JITCompilationMode.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.h. (JSC::isFTL): * jit/JITOperations.cpp: (JSC::JSC_DEFINE_JIT_OPERATION): * jit/JITPlan.cpp: Added. (JSC::JITPlan::JITPlan): (JSC::JITPlan::cancel): (JSC::JITPlan::notifyCompiling): (JSC::JITPlan::notifyReady): (JSC::JITPlan::tier const): (JSC::JITPlan::key): (JSC::JITPlan::isKnownToBeLiveAfterGC): (JSC::JITPlan::isKnownToBeLiveDuringGC): (JSC::JITPlan::iterateCodeBlocksForGC): (JSC::JITPlan::checkLivenessAndVisitChildren): (JSC::JITPlan::computeCompileTimes const): (JSC::JITPlan::reportCompileTimes const): (JSC::JITPlan::compileInThread): * jit/JITPlan.h: Added. (JSC::JITPlan::~JITPlan): (JSC::JITPlan::vm const): (JSC::JITPlan::codeBlock const): (JSC::JITPlan::thread const): (JSC::JITPlan::mode const): (JSC::JITPlan::stage const): (JSC::JITPlan::isFTL const): (JSC::JITPlan::finalizeInGC): * jit/JITPlanStage.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.cpp. * jit/JITSafepoint.cpp: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.cpp. (JSC::Safepoint::Safepoint): (JSC::Safepoint::~Safepoint): (JSC::Safepoint::begin): (JSC::Safepoint::cancel): * jit/JITSafepoint.h: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.h. * jit/JITScannable.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITWorklist.cpp: (JSC::JITWorklist::JITWorklist): (JSC::JITWorklist::~JITWorklist): (JSC::JITWorklist::existingGlobalWorklistOrNull): (JSC::JITWorklist::ensureGlobalWorklist): (JSC::JITWorklist::enqueue): (JSC::JITWorklist::queueLength const): (JSC::JITWorklist::suspendAllThreads): (JSC::JITWorklist::resumeAllThreads): (JSC::JITWorklist::compilationState): (JSC::JITWorklist::completeAllReadyPlansForVM): (JSC::JITWorklist::waitUntilAllPlansForVMAreReady): (JSC::JITWorklist::completeAllPlansForVM): (JSC::JITWorklist::cancelAllPlansForVM): (JSC::JITWorklist::removeDeadPlans): (JSC::JITWorklist::setMaximumNumberOfConcurrentDFGCompilations): (JSC::JITWorklist::setMaximumNumberOfConcurrentFTLCompilations): (JSC::JITWorklist::visitWeakReferences): (JSC::JITWorklist::dump const): (JSC::JITWorklist::removeAllReadyPlansForVM): (JSC::JITWorklist::removeMatchingPlansForVM): * jit/JITWorklist.h: (JSC::JITWorklist::static_cast<size_t>): * jit/JITWorklistInlines.h: Renamed from Source/JavaScriptCore/dfg/DFGScannable.h. (JSC::JITWorklist::iterateCodeBlocksForGC): * jit/JITWorklistThread.cpp: Added. (JSC::JITWorklistThread::JITWorklistThread): (JSC::JITWorklistThread::name const): (JSC::JITWorklistThread::poll): (JSC::JITWorklistThread::work): (JSC::JITWorklistThread::threadDidStart): (JSC::JITWorklistThread::threadIsStopping): * jit/JITWorklistThread.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.h. * llint/LLIntSlowPaths.cpp: (JSC::LLInt::jitCompileAndSetHeuristics): * runtime/OptionsList.h: * runtime/VM.cpp: (JSC::VM::~VM): Canonical link: https://commits.webkit.org/238161@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278082 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-26 15:15:22 +00:00
namespace JSC {
GC blocks on FTL and then badness https://bugs.webkit.org/show_bug.cgi?id=128291 Reviewed by Oliver Hunt. Introduce the notion of a DFG::Safepoint, which allows you to unlock the rightToRun mutex for your JIT thread, while supplying the GC with all of the information it would need to scan you at that moment in time. The default way of using this is DFG::GraphSafepoint, where you just supply the Graph. There's a lot of machinery in this patch just to make the Graph scannable. We then use DFG::GraphSafepoint in just two places for now: (1) while initializing LLVM and (2) while invoking LLVM' optimizer and backend. This is a 30% speed-up on Octane/typescript and a 10% speed-up on Octane/gbemu. 2-3% speed-up overall on Octane. * CMakeLists.txt: * GNUmakefile.list.am: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::visitChildren): * dfg/DFGGraph.h: * dfg/DFGGraphSafepoint.cpp: Added. (JSC::DFG::GraphSafepoint::GraphSafepoint): (JSC::DFG::GraphSafepoint::~GraphSafepoint): * dfg/DFGGraphSafepoint.h: Added. * dfg/DFGOperations.h: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThread): (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPlan.h: * dfg/DFGSafepoint.cpp: Added. (JSC::DFG::Safepoint::Safepoint): (JSC::DFG::Safepoint::~Safepoint): (JSC::DFG::Safepoint::add): (JSC::DFG::Safepoint::begin): (JSC::DFG::Safepoint::visitChildren): * dfg/DFGSafepoint.h: Added. * dfg/DFGScannable.h: Added. (JSC::DFG::Scannable::Scannable): (JSC::DFG::Scannable::~Scannable): * dfg/DFGThreadData.cpp: Added. (JSC::DFG::ThreadData::ThreadData): (JSC::DFG::ThreadData::~ThreadData): * dfg/DFGThreadData.h: Added. * dfg/DFGWorklist.cpp: (JSC::DFG::Worklist::finishCreation): (JSC::DFG::Worklist::visitChildren): (JSC::DFG::Worklist::runThread): * dfg/DFGWorklist.h: * ftl/FTLCompile.cpp: (JSC::FTL::compile): * heap/SlotVisitor.h: * heap/SlotVisitorInlines.h: (JSC::SlotVisitor::appendUnbarrieredReadOnlyPointer): (JSC::SlotVisitor::appendUnbarrieredReadOnlyValue): Canonical link: https://commits.webkit.org/146533@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@163765 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-02-10 07:21:09 +00:00
Merge all the JIT worklists into a shared worklist https://bugs.webkit.org/show_bug.cgi?id=226207 Reviewed by Saam Barati. Delete the DFG and FTL worklists and refactor JITWorklist to handle the compilation for all tiers. This reduces the total number of compiler threads while allowing each tier to use more threads whenever necessary. The default configuration is for the worklist to have 3 threads, baseline can use up to all 3 threads and DFG and FTL follow the previous limits set through JSC::Options. Right now, the worklist will only do work on upper tiers when all lower tiers have no pending tasks or have exceeded the maximum number of concurrent compilations. i.e. by default we only DFG compile when there are no baseline tasks in the queue and we only FTL compile when we either have no DFG tasks in the queue OR there are already 2 DFG compilations in progress. * API/JSVirtualMachine.mm: (+[JSVirtualMachine setNumberOfDFGCompilerThreads:]): (+[JSVirtualMachine setNumberOfFTLCompilerThreads:]): * API/tests/testapi.mm: (runJITThreadLimitTests): * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::checkIfOptimizationThresholdReached): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGCommon.h: (JSC::DFG::verboseCompilationEnabled): (JSC::DFG::logCompilationChanges): (JSC::DFG::shouldDumpGraphAtEachPhase): (JSC::DFG::shouldDumpDisassembly): * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): (JSC::DFG::compile): * dfg/DFGDriver.h: * dfg/DFGGraph.h: * dfg/DFGGraphSafepoint.h: * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: (JSC::DFG::OSRAvailabilityAnalysisPhase::run): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGOperations.cpp: (JSC::DFG::triggerFTLReplacementCompile): (JSC::DFG::tierUpCommon): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::Plan): (JSC::DFG::Plan::codeSize const): (JSC::DFG::Plan::finalizeInGC): (JSC::DFG::Plan::notifyReady): (JSC::DFG::Plan::cancel): (JSC::DFG::Plan::compileInThreadImpl): (JSC::DFG::Plan::finalize): (JSC::DFG::Plan::iterateCodeBlocksForGC): (JSC::DFG::Plan::checkLivenessAndVisitChildren): (JSC::DFG::Plan::isKnownToBeLiveDuringGC): (JSC::DFG::Plan::isKnownToBeLiveAfterGC): * dfg/DFGPlan.h: * dfg/DFGPlanInlines.h: Removed. * dfg/DFGTierUpCheckInjectionPhase.cpp: (JSC::DFG::TierUpCheckInjectionPhase::run): * dfg/DFGWorklist.cpp: Removed. * dfg/DFGWorklist.h: Removed. * dfg/DFGWorklistInlines.h: Removed. * ftl/FTLCompile.h: * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): (JSC::FTL::DFG::LowerDFGToB3::buildExitArguments): * ftl/FTLState.cpp: (JSC::FTL::State::State): * ftl/FTLState.h: (JSC::FTL::verboseCompilationEnabled): (JSC::FTL::shouldDumpDisassembly): * heap/Heap.cpp: (JSC::Heap::completeAllJITPlans): (JSC::Heap::iterateExecutingAndCompilingCodeBlocks): (JSC::Heap::removeDeadCompilerWorklistEntries): (JSC::Heap::stopThePeriphery): (JSC::Heap::suspendCompilerThreads): (JSC::Heap::resumeCompilerThreads): (JSC::Heap::addCoreConstraints): * heap/Heap.h: * heap/RootMarkReason.h: * jit/JIT.cpp: (JSC::JIT::compileAndLinkWithoutFinalizing): (JSC::JIT::codeSize const): (JSC::JIT::compileTimeStats): * jit/JIT.h: * jit/JITBaselinePlan.cpp: Copied from Source/JavaScriptCore/ftl/FTLState.cpp. (JSC::JITBaselinePlan::JITBaselinePlan): (JSC::JITBaselinePlan::compileInThreadImpl): (JSC::JITBaselinePlan::codeSize const): (JSC::JITBaselinePlan::finalize): * jit/JITBaselinePlan.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITCompilationKey.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.cpp. (JSC::JITCompilationKey::dump const): * jit/JITCompilationKey.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.h. (JSC::JITCompilationKey::JITCompilationKey): (JSC::JITCompilationKey::operator! const): (JSC::JITCompilationKey::isHashTableDeletedValue const): (JSC::JITCompilationKey::mode const): (JSC::JITCompilationKey::operator== const): (JSC::JITCompilationKey::hash const): (JSC::JITCompilationKeyHash::hash): (JSC::JITCompilationKeyHash::equal): * jit/JITCompilationMode.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.cpp. (WTF::printInternal): * jit/JITCompilationMode.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.h. (JSC::isFTL): * jit/JITOperations.cpp: (JSC::JSC_DEFINE_JIT_OPERATION): * jit/JITPlan.cpp: Added. (JSC::JITPlan::JITPlan): (JSC::JITPlan::cancel): (JSC::JITPlan::notifyCompiling): (JSC::JITPlan::notifyReady): (JSC::JITPlan::tier const): (JSC::JITPlan::key): (JSC::JITPlan::isKnownToBeLiveAfterGC): (JSC::JITPlan::isKnownToBeLiveDuringGC): (JSC::JITPlan::iterateCodeBlocksForGC): (JSC::JITPlan::checkLivenessAndVisitChildren): (JSC::JITPlan::computeCompileTimes const): (JSC::JITPlan::reportCompileTimes const): (JSC::JITPlan::compileInThread): * jit/JITPlan.h: Added. (JSC::JITPlan::~JITPlan): (JSC::JITPlan::vm const): (JSC::JITPlan::codeBlock const): (JSC::JITPlan::thread const): (JSC::JITPlan::mode const): (JSC::JITPlan::stage const): (JSC::JITPlan::isFTL const): (JSC::JITPlan::finalizeInGC): * jit/JITPlanStage.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.cpp. * jit/JITSafepoint.cpp: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.cpp. (JSC::Safepoint::Safepoint): (JSC::Safepoint::~Safepoint): (JSC::Safepoint::begin): (JSC::Safepoint::cancel): * jit/JITSafepoint.h: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.h. * jit/JITScannable.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITWorklist.cpp: (JSC::JITWorklist::JITWorklist): (JSC::JITWorklist::~JITWorklist): (JSC::JITWorklist::existingGlobalWorklistOrNull): (JSC::JITWorklist::ensureGlobalWorklist): (JSC::JITWorklist::enqueue): (JSC::JITWorklist::queueLength const): (JSC::JITWorklist::suspendAllThreads): (JSC::JITWorklist::resumeAllThreads): (JSC::JITWorklist::compilationState): (JSC::JITWorklist::completeAllReadyPlansForVM): (JSC::JITWorklist::waitUntilAllPlansForVMAreReady): (JSC::JITWorklist::completeAllPlansForVM): (JSC::JITWorklist::cancelAllPlansForVM): (JSC::JITWorklist::removeDeadPlans): (JSC::JITWorklist::setMaximumNumberOfConcurrentDFGCompilations): (JSC::JITWorklist::setMaximumNumberOfConcurrentFTLCompilations): (JSC::JITWorklist::visitWeakReferences): (JSC::JITWorklist::dump const): (JSC::JITWorklist::removeAllReadyPlansForVM): (JSC::JITWorklist::removeMatchingPlansForVM): * jit/JITWorklist.h: (JSC::JITWorklist::static_cast<size_t>): * jit/JITWorklistInlines.h: Renamed from Source/JavaScriptCore/dfg/DFGScannable.h. (JSC::JITWorklist::iterateCodeBlocksForGC): * jit/JITWorklistThread.cpp: Added. (JSC::JITWorklistThread::JITWorklistThread): (JSC::JITWorklistThread::name const): (JSC::JITWorklistThread::poll): (JSC::JITWorklistThread::work): (JSC::JITWorklistThread::threadDidStart): (JSC::JITWorklistThread::threadIsStopping): * jit/JITWorklistThread.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.h. * llint/LLIntSlowPaths.cpp: (JSC::LLInt::jitCompileAndSetHeuristics): * runtime/OptionsList.h: * runtime/VM.cpp: (JSC::VM::~VM): Canonical link: https://commits.webkit.org/238161@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278082 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-26 15:15:22 +00:00
class JITWorklist;
GC blocks on FTL and then badness https://bugs.webkit.org/show_bug.cgi?id=128291 Reviewed by Oliver Hunt. Introduce the notion of a DFG::Safepoint, which allows you to unlock the rightToRun mutex for your JIT thread, while supplying the GC with all of the information it would need to scan you at that moment in time. The default way of using this is DFG::GraphSafepoint, where you just supply the Graph. There's a lot of machinery in this patch just to make the Graph scannable. We then use DFG::GraphSafepoint in just two places for now: (1) while initializing LLVM and (2) while invoking LLVM' optimizer and backend. This is a 30% speed-up on Octane/typescript and a 10% speed-up on Octane/gbemu. 2-3% speed-up overall on Octane. * CMakeLists.txt: * GNUmakefile.list.am: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::visitChildren): * dfg/DFGGraph.h: * dfg/DFGGraphSafepoint.cpp: Added. (JSC::DFG::GraphSafepoint::GraphSafepoint): (JSC::DFG::GraphSafepoint::~GraphSafepoint): * dfg/DFGGraphSafepoint.h: Added. * dfg/DFGOperations.h: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThread): (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPlan.h: * dfg/DFGSafepoint.cpp: Added. (JSC::DFG::Safepoint::Safepoint): (JSC::DFG::Safepoint::~Safepoint): (JSC::DFG::Safepoint::add): (JSC::DFG::Safepoint::begin): (JSC::DFG::Safepoint::visitChildren): * dfg/DFGSafepoint.h: Added. * dfg/DFGScannable.h: Added. (JSC::DFG::Scannable::Scannable): (JSC::DFG::Scannable::~Scannable): * dfg/DFGThreadData.cpp: Added. (JSC::DFG::ThreadData::ThreadData): (JSC::DFG::ThreadData::~ThreadData): * dfg/DFGThreadData.h: Added. * dfg/DFGWorklist.cpp: (JSC::DFG::Worklist::finishCreation): (JSC::DFG::Worklist::visitChildren): (JSC::DFG::Worklist::runThread): * dfg/DFGWorklist.h: * ftl/FTLCompile.cpp: (JSC::FTL::compile): * heap/SlotVisitor.h: * heap/SlotVisitorInlines.h: (JSC::SlotVisitor::appendUnbarrieredReadOnlyPointer): (JSC::SlotVisitor::appendUnbarrieredReadOnlyValue): Canonical link: https://commits.webkit.org/146533@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@163765 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-02-10 07:21:09 +00:00
class Safepoint;
Merge all the JIT worklists into a shared worklist https://bugs.webkit.org/show_bug.cgi?id=226207 Reviewed by Saam Barati. Delete the DFG and FTL worklists and refactor JITWorklist to handle the compilation for all tiers. This reduces the total number of compiler threads while allowing each tier to use more threads whenever necessary. The default configuration is for the worklist to have 3 threads, baseline can use up to all 3 threads and DFG and FTL follow the previous limits set through JSC::Options. Right now, the worklist will only do work on upper tiers when all lower tiers have no pending tasks or have exceeded the maximum number of concurrent compilations. i.e. by default we only DFG compile when there are no baseline tasks in the queue and we only FTL compile when we either have no DFG tasks in the queue OR there are already 2 DFG compilations in progress. * API/JSVirtualMachine.mm: (+[JSVirtualMachine setNumberOfDFGCompilerThreads:]): (+[JSVirtualMachine setNumberOfFTLCompilerThreads:]): * API/tests/testapi.mm: (runJITThreadLimitTests): * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::checkIfOptimizationThresholdReached): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGCommon.h: (JSC::DFG::verboseCompilationEnabled): (JSC::DFG::logCompilationChanges): (JSC::DFG::shouldDumpGraphAtEachPhase): (JSC::DFG::shouldDumpDisassembly): * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): (JSC::DFG::compile): * dfg/DFGDriver.h: * dfg/DFGGraph.h: * dfg/DFGGraphSafepoint.h: * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: (JSC::DFG::OSRAvailabilityAnalysisPhase::run): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGOperations.cpp: (JSC::DFG::triggerFTLReplacementCompile): (JSC::DFG::tierUpCommon): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::Plan): (JSC::DFG::Plan::codeSize const): (JSC::DFG::Plan::finalizeInGC): (JSC::DFG::Plan::notifyReady): (JSC::DFG::Plan::cancel): (JSC::DFG::Plan::compileInThreadImpl): (JSC::DFG::Plan::finalize): (JSC::DFG::Plan::iterateCodeBlocksForGC): (JSC::DFG::Plan::checkLivenessAndVisitChildren): (JSC::DFG::Plan::isKnownToBeLiveDuringGC): (JSC::DFG::Plan::isKnownToBeLiveAfterGC): * dfg/DFGPlan.h: * dfg/DFGPlanInlines.h: Removed. * dfg/DFGTierUpCheckInjectionPhase.cpp: (JSC::DFG::TierUpCheckInjectionPhase::run): * dfg/DFGWorklist.cpp: Removed. * dfg/DFGWorklist.h: Removed. * dfg/DFGWorklistInlines.h: Removed. * ftl/FTLCompile.h: * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): (JSC::FTL::DFG::LowerDFGToB3::buildExitArguments): * ftl/FTLState.cpp: (JSC::FTL::State::State): * ftl/FTLState.h: (JSC::FTL::verboseCompilationEnabled): (JSC::FTL::shouldDumpDisassembly): * heap/Heap.cpp: (JSC::Heap::completeAllJITPlans): (JSC::Heap::iterateExecutingAndCompilingCodeBlocks): (JSC::Heap::removeDeadCompilerWorklistEntries): (JSC::Heap::stopThePeriphery): (JSC::Heap::suspendCompilerThreads): (JSC::Heap::resumeCompilerThreads): (JSC::Heap::addCoreConstraints): * heap/Heap.h: * heap/RootMarkReason.h: * jit/JIT.cpp: (JSC::JIT::compileAndLinkWithoutFinalizing): (JSC::JIT::codeSize const): (JSC::JIT::compileTimeStats): * jit/JIT.h: * jit/JITBaselinePlan.cpp: Copied from Source/JavaScriptCore/ftl/FTLState.cpp. (JSC::JITBaselinePlan::JITBaselinePlan): (JSC::JITBaselinePlan::compileInThreadImpl): (JSC::JITBaselinePlan::codeSize const): (JSC::JITBaselinePlan::finalize): * jit/JITBaselinePlan.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITCompilationKey.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.cpp. (JSC::JITCompilationKey::dump const): * jit/JITCompilationKey.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.h. (JSC::JITCompilationKey::JITCompilationKey): (JSC::JITCompilationKey::operator! const): (JSC::JITCompilationKey::isHashTableDeletedValue const): (JSC::JITCompilationKey::mode const): (JSC::JITCompilationKey::operator== const): (JSC::JITCompilationKey::hash const): (JSC::JITCompilationKeyHash::hash): (JSC::JITCompilationKeyHash::equal): * jit/JITCompilationMode.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.cpp. (WTF::printInternal): * jit/JITCompilationMode.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.h. (JSC::isFTL): * jit/JITOperations.cpp: (JSC::JSC_DEFINE_JIT_OPERATION): * jit/JITPlan.cpp: Added. (JSC::JITPlan::JITPlan): (JSC::JITPlan::cancel): (JSC::JITPlan::notifyCompiling): (JSC::JITPlan::notifyReady): (JSC::JITPlan::tier const): (JSC::JITPlan::key): (JSC::JITPlan::isKnownToBeLiveAfterGC): (JSC::JITPlan::isKnownToBeLiveDuringGC): (JSC::JITPlan::iterateCodeBlocksForGC): (JSC::JITPlan::checkLivenessAndVisitChildren): (JSC::JITPlan::computeCompileTimes const): (JSC::JITPlan::reportCompileTimes const): (JSC::JITPlan::compileInThread): * jit/JITPlan.h: Added. (JSC::JITPlan::~JITPlan): (JSC::JITPlan::vm const): (JSC::JITPlan::codeBlock const): (JSC::JITPlan::thread const): (JSC::JITPlan::mode const): (JSC::JITPlan::stage const): (JSC::JITPlan::isFTL const): (JSC::JITPlan::finalizeInGC): * jit/JITPlanStage.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.cpp. * jit/JITSafepoint.cpp: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.cpp. (JSC::Safepoint::Safepoint): (JSC::Safepoint::~Safepoint): (JSC::Safepoint::begin): (JSC::Safepoint::cancel): * jit/JITSafepoint.h: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.h. * jit/JITScannable.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITWorklist.cpp: (JSC::JITWorklist::JITWorklist): (JSC::JITWorklist::~JITWorklist): (JSC::JITWorklist::existingGlobalWorklistOrNull): (JSC::JITWorklist::ensureGlobalWorklist): (JSC::JITWorklist::enqueue): (JSC::JITWorklist::queueLength const): (JSC::JITWorklist::suspendAllThreads): (JSC::JITWorklist::resumeAllThreads): (JSC::JITWorklist::compilationState): (JSC::JITWorklist::completeAllReadyPlansForVM): (JSC::JITWorklist::waitUntilAllPlansForVMAreReady): (JSC::JITWorklist::completeAllPlansForVM): (JSC::JITWorklist::cancelAllPlansForVM): (JSC::JITWorklist::removeDeadPlans): (JSC::JITWorklist::setMaximumNumberOfConcurrentDFGCompilations): (JSC::JITWorklist::setMaximumNumberOfConcurrentFTLCompilations): (JSC::JITWorklist::visitWeakReferences): (JSC::JITWorklist::dump const): (JSC::JITWorklist::removeAllReadyPlansForVM): (JSC::JITWorklist::removeMatchingPlansForVM): * jit/JITWorklist.h: (JSC::JITWorklist::static_cast<size_t>): * jit/JITWorklistInlines.h: Renamed from Source/JavaScriptCore/dfg/DFGScannable.h. (JSC::JITWorklist::iterateCodeBlocksForGC): * jit/JITWorklistThread.cpp: Added. (JSC::JITWorklistThread::JITWorklistThread): (JSC::JITWorklistThread::name const): (JSC::JITWorklistThread::poll): (JSC::JITWorklistThread::work): (JSC::JITWorklistThread::threadDidStart): (JSC::JITWorklistThread::threadIsStopping): * jit/JITWorklistThread.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.h. * llint/LLIntSlowPaths.cpp: (JSC::LLInt::jitCompileAndSetHeuristics): * runtime/OptionsList.h: * runtime/VM.cpp: (JSC::VM::~VM): Canonical link: https://commits.webkit.org/238161@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278082 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-26 15:15:22 +00:00
class JITWorklistThread final : public AutomaticThread {
class WorkScope;
friend class Safepoint;
friend class WorkScope;
friend class JITWorklist;
GC blocks on FTL and then badness https://bugs.webkit.org/show_bug.cgi?id=128291 Reviewed by Oliver Hunt. Introduce the notion of a DFG::Safepoint, which allows you to unlock the rightToRun mutex for your JIT thread, while supplying the GC with all of the information it would need to scan you at that moment in time. The default way of using this is DFG::GraphSafepoint, where you just supply the Graph. There's a lot of machinery in this patch just to make the Graph scannable. We then use DFG::GraphSafepoint in just two places for now: (1) while initializing LLVM and (2) while invoking LLVM' optimizer and backend. This is a 30% speed-up on Octane/typescript and a 10% speed-up on Octane/gbemu. 2-3% speed-up overall on Octane. * CMakeLists.txt: * GNUmakefile.list.am: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::visitChildren): * dfg/DFGGraph.h: * dfg/DFGGraphSafepoint.cpp: Added. (JSC::DFG::GraphSafepoint::GraphSafepoint): (JSC::DFG::GraphSafepoint::~GraphSafepoint): * dfg/DFGGraphSafepoint.h: Added. * dfg/DFGOperations.h: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThread): (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPlan.h: * dfg/DFGSafepoint.cpp: Added. (JSC::DFG::Safepoint::Safepoint): (JSC::DFG::Safepoint::~Safepoint): (JSC::DFG::Safepoint::add): (JSC::DFG::Safepoint::begin): (JSC::DFG::Safepoint::visitChildren): * dfg/DFGSafepoint.h: Added. * dfg/DFGScannable.h: Added. (JSC::DFG::Scannable::Scannable): (JSC::DFG::Scannable::~Scannable): * dfg/DFGThreadData.cpp: Added. (JSC::DFG::ThreadData::ThreadData): (JSC::DFG::ThreadData::~ThreadData): * dfg/DFGThreadData.h: Added. * dfg/DFGWorklist.cpp: (JSC::DFG::Worklist::finishCreation): (JSC::DFG::Worklist::visitChildren): (JSC::DFG::Worklist::runThread): * dfg/DFGWorklist.h: * ftl/FTLCompile.cpp: (JSC::FTL::compile): * heap/SlotVisitor.h: * heap/SlotVisitorInlines.h: (JSC::SlotVisitor::appendUnbarrieredReadOnlyPointer): (JSC::SlotVisitor::appendUnbarrieredReadOnlyValue): Canonical link: https://commits.webkit.org/146533@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@163765 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-02-10 07:21:09 +00:00
public:
Merge all the JIT worklists into a shared worklist https://bugs.webkit.org/show_bug.cgi?id=226207 Reviewed by Saam Barati. Delete the DFG and FTL worklists and refactor JITWorklist to handle the compilation for all tiers. This reduces the total number of compiler threads while allowing each tier to use more threads whenever necessary. The default configuration is for the worklist to have 3 threads, baseline can use up to all 3 threads and DFG and FTL follow the previous limits set through JSC::Options. Right now, the worklist will only do work on upper tiers when all lower tiers have no pending tasks or have exceeded the maximum number of concurrent compilations. i.e. by default we only DFG compile when there are no baseline tasks in the queue and we only FTL compile when we either have no DFG tasks in the queue OR there are already 2 DFG compilations in progress. * API/JSVirtualMachine.mm: (+[JSVirtualMachine setNumberOfDFGCompilerThreads:]): (+[JSVirtualMachine setNumberOfFTLCompilerThreads:]): * API/tests/testapi.mm: (runJITThreadLimitTests): * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::checkIfOptimizationThresholdReached): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGCommon.h: (JSC::DFG::verboseCompilationEnabled): (JSC::DFG::logCompilationChanges): (JSC::DFG::shouldDumpGraphAtEachPhase): (JSC::DFG::shouldDumpDisassembly): * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): (JSC::DFG::compile): * dfg/DFGDriver.h: * dfg/DFGGraph.h: * dfg/DFGGraphSafepoint.h: * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: (JSC::DFG::OSRAvailabilityAnalysisPhase::run): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGOperations.cpp: (JSC::DFG::triggerFTLReplacementCompile): (JSC::DFG::tierUpCommon): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::Plan): (JSC::DFG::Plan::codeSize const): (JSC::DFG::Plan::finalizeInGC): (JSC::DFG::Plan::notifyReady): (JSC::DFG::Plan::cancel): (JSC::DFG::Plan::compileInThreadImpl): (JSC::DFG::Plan::finalize): (JSC::DFG::Plan::iterateCodeBlocksForGC): (JSC::DFG::Plan::checkLivenessAndVisitChildren): (JSC::DFG::Plan::isKnownToBeLiveDuringGC): (JSC::DFG::Plan::isKnownToBeLiveAfterGC): * dfg/DFGPlan.h: * dfg/DFGPlanInlines.h: Removed. * dfg/DFGTierUpCheckInjectionPhase.cpp: (JSC::DFG::TierUpCheckInjectionPhase::run): * dfg/DFGWorklist.cpp: Removed. * dfg/DFGWorklist.h: Removed. * dfg/DFGWorklistInlines.h: Removed. * ftl/FTLCompile.h: * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): (JSC::FTL::DFG::LowerDFGToB3::buildExitArguments): * ftl/FTLState.cpp: (JSC::FTL::State::State): * ftl/FTLState.h: (JSC::FTL::verboseCompilationEnabled): (JSC::FTL::shouldDumpDisassembly): * heap/Heap.cpp: (JSC::Heap::completeAllJITPlans): (JSC::Heap::iterateExecutingAndCompilingCodeBlocks): (JSC::Heap::removeDeadCompilerWorklistEntries): (JSC::Heap::stopThePeriphery): (JSC::Heap::suspendCompilerThreads): (JSC::Heap::resumeCompilerThreads): (JSC::Heap::addCoreConstraints): * heap/Heap.h: * heap/RootMarkReason.h: * jit/JIT.cpp: (JSC::JIT::compileAndLinkWithoutFinalizing): (JSC::JIT::codeSize const): (JSC::JIT::compileTimeStats): * jit/JIT.h: * jit/JITBaselinePlan.cpp: Copied from Source/JavaScriptCore/ftl/FTLState.cpp. (JSC::JITBaselinePlan::JITBaselinePlan): (JSC::JITBaselinePlan::compileInThreadImpl): (JSC::JITBaselinePlan::codeSize const): (JSC::JITBaselinePlan::finalize): * jit/JITBaselinePlan.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITCompilationKey.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.cpp. (JSC::JITCompilationKey::dump const): * jit/JITCompilationKey.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.h. (JSC::JITCompilationKey::JITCompilationKey): (JSC::JITCompilationKey::operator! const): (JSC::JITCompilationKey::isHashTableDeletedValue const): (JSC::JITCompilationKey::mode const): (JSC::JITCompilationKey::operator== const): (JSC::JITCompilationKey::hash const): (JSC::JITCompilationKeyHash::hash): (JSC::JITCompilationKeyHash::equal): * jit/JITCompilationMode.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.cpp. (WTF::printInternal): * jit/JITCompilationMode.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.h. (JSC::isFTL): * jit/JITOperations.cpp: (JSC::JSC_DEFINE_JIT_OPERATION): * jit/JITPlan.cpp: Added. (JSC::JITPlan::JITPlan): (JSC::JITPlan::cancel): (JSC::JITPlan::notifyCompiling): (JSC::JITPlan::notifyReady): (JSC::JITPlan::tier const): (JSC::JITPlan::key): (JSC::JITPlan::isKnownToBeLiveAfterGC): (JSC::JITPlan::isKnownToBeLiveDuringGC): (JSC::JITPlan::iterateCodeBlocksForGC): (JSC::JITPlan::checkLivenessAndVisitChildren): (JSC::JITPlan::computeCompileTimes const): (JSC::JITPlan::reportCompileTimes const): (JSC::JITPlan::compileInThread): * jit/JITPlan.h: Added. (JSC::JITPlan::~JITPlan): (JSC::JITPlan::vm const): (JSC::JITPlan::codeBlock const): (JSC::JITPlan::thread const): (JSC::JITPlan::mode const): (JSC::JITPlan::stage const): (JSC::JITPlan::isFTL const): (JSC::JITPlan::finalizeInGC): * jit/JITPlanStage.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.cpp. * jit/JITSafepoint.cpp: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.cpp. (JSC::Safepoint::Safepoint): (JSC::Safepoint::~Safepoint): (JSC::Safepoint::begin): (JSC::Safepoint::cancel): * jit/JITSafepoint.h: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.h. * jit/JITScannable.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITWorklist.cpp: (JSC::JITWorklist::JITWorklist): (JSC::JITWorklist::~JITWorklist): (JSC::JITWorklist::existingGlobalWorklistOrNull): (JSC::JITWorklist::ensureGlobalWorklist): (JSC::JITWorklist::enqueue): (JSC::JITWorklist::queueLength const): (JSC::JITWorklist::suspendAllThreads): (JSC::JITWorklist::resumeAllThreads): (JSC::JITWorklist::compilationState): (JSC::JITWorklist::completeAllReadyPlansForVM): (JSC::JITWorklist::waitUntilAllPlansForVMAreReady): (JSC::JITWorklist::completeAllPlansForVM): (JSC::JITWorklist::cancelAllPlansForVM): (JSC::JITWorklist::removeDeadPlans): (JSC::JITWorklist::setMaximumNumberOfConcurrentDFGCompilations): (JSC::JITWorklist::setMaximumNumberOfConcurrentFTLCompilations): (JSC::JITWorklist::visitWeakReferences): (JSC::JITWorklist::dump const): (JSC::JITWorklist::removeAllReadyPlansForVM): (JSC::JITWorklist::removeMatchingPlansForVM): * jit/JITWorklist.h: (JSC::JITWorklist::static_cast<size_t>): * jit/JITWorklistInlines.h: Renamed from Source/JavaScriptCore/dfg/DFGScannable.h. (JSC::JITWorklist::iterateCodeBlocksForGC): * jit/JITWorklistThread.cpp: Added. (JSC::JITWorklistThread::JITWorklistThread): (JSC::JITWorklistThread::name const): (JSC::JITWorklistThread::poll): (JSC::JITWorklistThread::work): (JSC::JITWorklistThread::threadDidStart): (JSC::JITWorklistThread::threadIsStopping): * jit/JITWorklistThread.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.h. * llint/LLIntSlowPaths.cpp: (JSC::LLInt::jitCompileAndSetHeuristics): * runtime/OptionsList.h: * runtime/VM.cpp: (JSC::VM::~VM): Canonical link: https://commits.webkit.org/238161@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278082 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-26 15:15:22 +00:00
JITWorklistThread(const AbstractLocker&, JITWorklist&);
const char* name() const final;
GC blocks on FTL and then badness https://bugs.webkit.org/show_bug.cgi?id=128291 Reviewed by Oliver Hunt. Introduce the notion of a DFG::Safepoint, which allows you to unlock the rightToRun mutex for your JIT thread, while supplying the GC with all of the information it would need to scan you at that moment in time. The default way of using this is DFG::GraphSafepoint, where you just supply the Graph. There's a lot of machinery in this patch just to make the Graph scannable. We then use DFG::GraphSafepoint in just two places for now: (1) while initializing LLVM and (2) while invoking LLVM' optimizer and backend. This is a 30% speed-up on Octane/typescript and a 10% speed-up on Octane/gbemu. 2-3% speed-up overall on Octane. * CMakeLists.txt: * GNUmakefile.list.am: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::visitChildren): * dfg/DFGGraph.h: * dfg/DFGGraphSafepoint.cpp: Added. (JSC::DFG::GraphSafepoint::GraphSafepoint): (JSC::DFG::GraphSafepoint::~GraphSafepoint): * dfg/DFGGraphSafepoint.h: Added. * dfg/DFGOperations.h: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThread): (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPlan.h: * dfg/DFGSafepoint.cpp: Added. (JSC::DFG::Safepoint::Safepoint): (JSC::DFG::Safepoint::~Safepoint): (JSC::DFG::Safepoint::add): (JSC::DFG::Safepoint::begin): (JSC::DFG::Safepoint::visitChildren): * dfg/DFGSafepoint.h: Added. * dfg/DFGScannable.h: Added. (JSC::DFG::Scannable::Scannable): (JSC::DFG::Scannable::~Scannable): * dfg/DFGThreadData.cpp: Added. (JSC::DFG::ThreadData::ThreadData): (JSC::DFG::ThreadData::~ThreadData): * dfg/DFGThreadData.h: Added. * dfg/DFGWorklist.cpp: (JSC::DFG::Worklist::finishCreation): (JSC::DFG::Worklist::visitChildren): (JSC::DFG::Worklist::runThread): * dfg/DFGWorklist.h: * ftl/FTLCompile.cpp: (JSC::FTL::compile): * heap/SlotVisitor.h: * heap/SlotVisitorInlines.h: (JSC::SlotVisitor::appendUnbarrieredReadOnlyPointer): (JSC::SlotVisitor::appendUnbarrieredReadOnlyValue): Canonical link: https://commits.webkit.org/146533@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@163765 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-02-10 07:21:09 +00:00
private:
Merge all the JIT worklists into a shared worklist https://bugs.webkit.org/show_bug.cgi?id=226207 Reviewed by Saam Barati. Delete the DFG and FTL worklists and refactor JITWorklist to handle the compilation for all tiers. This reduces the total number of compiler threads while allowing each tier to use more threads whenever necessary. The default configuration is for the worklist to have 3 threads, baseline can use up to all 3 threads and DFG and FTL follow the previous limits set through JSC::Options. Right now, the worklist will only do work on upper tiers when all lower tiers have no pending tasks or have exceeded the maximum number of concurrent compilations. i.e. by default we only DFG compile when there are no baseline tasks in the queue and we only FTL compile when we either have no DFG tasks in the queue OR there are already 2 DFG compilations in progress. * API/JSVirtualMachine.mm: (+[JSVirtualMachine setNumberOfDFGCompilerThreads:]): (+[JSVirtualMachine setNumberOfFTLCompilerThreads:]): * API/tests/testapi.mm: (runJITThreadLimitTests): * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::checkIfOptimizationThresholdReached): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGCommon.h: (JSC::DFG::verboseCompilationEnabled): (JSC::DFG::logCompilationChanges): (JSC::DFG::shouldDumpGraphAtEachPhase): (JSC::DFG::shouldDumpDisassembly): * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): (JSC::DFG::compile): * dfg/DFGDriver.h: * dfg/DFGGraph.h: * dfg/DFGGraphSafepoint.h: * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: (JSC::DFG::OSRAvailabilityAnalysisPhase::run): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGOperations.cpp: (JSC::DFG::triggerFTLReplacementCompile): (JSC::DFG::tierUpCommon): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::Plan): (JSC::DFG::Plan::codeSize const): (JSC::DFG::Plan::finalizeInGC): (JSC::DFG::Plan::notifyReady): (JSC::DFG::Plan::cancel): (JSC::DFG::Plan::compileInThreadImpl): (JSC::DFG::Plan::finalize): (JSC::DFG::Plan::iterateCodeBlocksForGC): (JSC::DFG::Plan::checkLivenessAndVisitChildren): (JSC::DFG::Plan::isKnownToBeLiveDuringGC): (JSC::DFG::Plan::isKnownToBeLiveAfterGC): * dfg/DFGPlan.h: * dfg/DFGPlanInlines.h: Removed. * dfg/DFGTierUpCheckInjectionPhase.cpp: (JSC::DFG::TierUpCheckInjectionPhase::run): * dfg/DFGWorklist.cpp: Removed. * dfg/DFGWorklist.h: Removed. * dfg/DFGWorklistInlines.h: Removed. * ftl/FTLCompile.h: * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): (JSC::FTL::DFG::LowerDFGToB3::buildExitArguments): * ftl/FTLState.cpp: (JSC::FTL::State::State): * ftl/FTLState.h: (JSC::FTL::verboseCompilationEnabled): (JSC::FTL::shouldDumpDisassembly): * heap/Heap.cpp: (JSC::Heap::completeAllJITPlans): (JSC::Heap::iterateExecutingAndCompilingCodeBlocks): (JSC::Heap::removeDeadCompilerWorklistEntries): (JSC::Heap::stopThePeriphery): (JSC::Heap::suspendCompilerThreads): (JSC::Heap::resumeCompilerThreads): (JSC::Heap::addCoreConstraints): * heap/Heap.h: * heap/RootMarkReason.h: * jit/JIT.cpp: (JSC::JIT::compileAndLinkWithoutFinalizing): (JSC::JIT::codeSize const): (JSC::JIT::compileTimeStats): * jit/JIT.h: * jit/JITBaselinePlan.cpp: Copied from Source/JavaScriptCore/ftl/FTLState.cpp. (JSC::JITBaselinePlan::JITBaselinePlan): (JSC::JITBaselinePlan::compileInThreadImpl): (JSC::JITBaselinePlan::codeSize const): (JSC::JITBaselinePlan::finalize): * jit/JITBaselinePlan.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITCompilationKey.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.cpp. (JSC::JITCompilationKey::dump const): * jit/JITCompilationKey.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.h. (JSC::JITCompilationKey::JITCompilationKey): (JSC::JITCompilationKey::operator! const): (JSC::JITCompilationKey::isHashTableDeletedValue const): (JSC::JITCompilationKey::mode const): (JSC::JITCompilationKey::operator== const): (JSC::JITCompilationKey::hash const): (JSC::JITCompilationKeyHash::hash): (JSC::JITCompilationKeyHash::equal): * jit/JITCompilationMode.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.cpp. (WTF::printInternal): * jit/JITCompilationMode.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.h. (JSC::isFTL): * jit/JITOperations.cpp: (JSC::JSC_DEFINE_JIT_OPERATION): * jit/JITPlan.cpp: Added. (JSC::JITPlan::JITPlan): (JSC::JITPlan::cancel): (JSC::JITPlan::notifyCompiling): (JSC::JITPlan::notifyReady): (JSC::JITPlan::tier const): (JSC::JITPlan::key): (JSC::JITPlan::isKnownToBeLiveAfterGC): (JSC::JITPlan::isKnownToBeLiveDuringGC): (JSC::JITPlan::iterateCodeBlocksForGC): (JSC::JITPlan::checkLivenessAndVisitChildren): (JSC::JITPlan::computeCompileTimes const): (JSC::JITPlan::reportCompileTimes const): (JSC::JITPlan::compileInThread): * jit/JITPlan.h: Added. (JSC::JITPlan::~JITPlan): (JSC::JITPlan::vm const): (JSC::JITPlan::codeBlock const): (JSC::JITPlan::thread const): (JSC::JITPlan::mode const): (JSC::JITPlan::stage const): (JSC::JITPlan::isFTL const): (JSC::JITPlan::finalizeInGC): * jit/JITPlanStage.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.cpp. * jit/JITSafepoint.cpp: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.cpp. (JSC::Safepoint::Safepoint): (JSC::Safepoint::~Safepoint): (JSC::Safepoint::begin): (JSC::Safepoint::cancel): * jit/JITSafepoint.h: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.h. * jit/JITScannable.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITWorklist.cpp: (JSC::JITWorklist::JITWorklist): (JSC::JITWorklist::~JITWorklist): (JSC::JITWorklist::existingGlobalWorklistOrNull): (JSC::JITWorklist::ensureGlobalWorklist): (JSC::JITWorklist::enqueue): (JSC::JITWorklist::queueLength const): (JSC::JITWorklist::suspendAllThreads): (JSC::JITWorklist::resumeAllThreads): (JSC::JITWorklist::compilationState): (JSC::JITWorklist::completeAllReadyPlansForVM): (JSC::JITWorklist::waitUntilAllPlansForVMAreReady): (JSC::JITWorklist::completeAllPlansForVM): (JSC::JITWorklist::cancelAllPlansForVM): (JSC::JITWorklist::removeDeadPlans): (JSC::JITWorklist::setMaximumNumberOfConcurrentDFGCompilations): (JSC::JITWorklist::setMaximumNumberOfConcurrentFTLCompilations): (JSC::JITWorklist::visitWeakReferences): (JSC::JITWorklist::dump const): (JSC::JITWorklist::removeAllReadyPlansForVM): (JSC::JITWorklist::removeMatchingPlansForVM): * jit/JITWorklist.h: (JSC::JITWorklist::static_cast<size_t>): * jit/JITWorklistInlines.h: Renamed from Source/JavaScriptCore/dfg/DFGScannable.h. (JSC::JITWorklist::iterateCodeBlocksForGC): * jit/JITWorklistThread.cpp: Added. (JSC::JITWorklistThread::JITWorklistThread): (JSC::JITWorklistThread::name const): (JSC::JITWorklistThread::poll): (JSC::JITWorklistThread::work): (JSC::JITWorklistThread::threadDidStart): (JSC::JITWorklistThread::threadIsStopping): * jit/JITWorklistThread.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.h. * llint/LLIntSlowPaths.cpp: (JSC::LLInt::jitCompileAndSetHeuristics): * runtime/OptionsList.h: * runtime/VM.cpp: (JSC::VM::~VM): Canonical link: https://commits.webkit.org/238161@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278082 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-26 15:15:22 +00:00
PollResult poll(const AbstractLocker&) final;
WorkResult work() final;
void threadDidStart() final;
void threadIsStopping(const AbstractLocker&) final;
Lock m_rightToRun;
Merge all the JIT worklists into a shared worklist https://bugs.webkit.org/show_bug.cgi?id=226207 Reviewed by Saam Barati. Delete the DFG and FTL worklists and refactor JITWorklist to handle the compilation for all tiers. This reduces the total number of compiler threads while allowing each tier to use more threads whenever necessary. The default configuration is for the worklist to have 3 threads, baseline can use up to all 3 threads and DFG and FTL follow the previous limits set through JSC::Options. Right now, the worklist will only do work on upper tiers when all lower tiers have no pending tasks or have exceeded the maximum number of concurrent compilations. i.e. by default we only DFG compile when there are no baseline tasks in the queue and we only FTL compile when we either have no DFG tasks in the queue OR there are already 2 DFG compilations in progress. * API/JSVirtualMachine.mm: (+[JSVirtualMachine setNumberOfDFGCompilerThreads:]): (+[JSVirtualMachine setNumberOfFTLCompilerThreads:]): * API/tests/testapi.mm: (runJITThreadLimitTests): * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::checkIfOptimizationThresholdReached): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGCommon.h: (JSC::DFG::verboseCompilationEnabled): (JSC::DFG::logCompilationChanges): (JSC::DFG::shouldDumpGraphAtEachPhase): (JSC::DFG::shouldDumpDisassembly): * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): (JSC::DFG::compile): * dfg/DFGDriver.h: * dfg/DFGGraph.h: * dfg/DFGGraphSafepoint.h: * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: (JSC::DFG::OSRAvailabilityAnalysisPhase::run): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGOperations.cpp: (JSC::DFG::triggerFTLReplacementCompile): (JSC::DFG::tierUpCommon): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::Plan): (JSC::DFG::Plan::codeSize const): (JSC::DFG::Plan::finalizeInGC): (JSC::DFG::Plan::notifyReady): (JSC::DFG::Plan::cancel): (JSC::DFG::Plan::compileInThreadImpl): (JSC::DFG::Plan::finalize): (JSC::DFG::Plan::iterateCodeBlocksForGC): (JSC::DFG::Plan::checkLivenessAndVisitChildren): (JSC::DFG::Plan::isKnownToBeLiveDuringGC): (JSC::DFG::Plan::isKnownToBeLiveAfterGC): * dfg/DFGPlan.h: * dfg/DFGPlanInlines.h: Removed. * dfg/DFGTierUpCheckInjectionPhase.cpp: (JSC::DFG::TierUpCheckInjectionPhase::run): * dfg/DFGWorklist.cpp: Removed. * dfg/DFGWorklist.h: Removed. * dfg/DFGWorklistInlines.h: Removed. * ftl/FTLCompile.h: * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): (JSC::FTL::DFG::LowerDFGToB3::buildExitArguments): * ftl/FTLState.cpp: (JSC::FTL::State::State): * ftl/FTLState.h: (JSC::FTL::verboseCompilationEnabled): (JSC::FTL::shouldDumpDisassembly): * heap/Heap.cpp: (JSC::Heap::completeAllJITPlans): (JSC::Heap::iterateExecutingAndCompilingCodeBlocks): (JSC::Heap::removeDeadCompilerWorklistEntries): (JSC::Heap::stopThePeriphery): (JSC::Heap::suspendCompilerThreads): (JSC::Heap::resumeCompilerThreads): (JSC::Heap::addCoreConstraints): * heap/Heap.h: * heap/RootMarkReason.h: * jit/JIT.cpp: (JSC::JIT::compileAndLinkWithoutFinalizing): (JSC::JIT::codeSize const): (JSC::JIT::compileTimeStats): * jit/JIT.h: * jit/JITBaselinePlan.cpp: Copied from Source/JavaScriptCore/ftl/FTLState.cpp. (JSC::JITBaselinePlan::JITBaselinePlan): (JSC::JITBaselinePlan::compileInThreadImpl): (JSC::JITBaselinePlan::codeSize const): (JSC::JITBaselinePlan::finalize): * jit/JITBaselinePlan.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITCompilationKey.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.cpp. (JSC::JITCompilationKey::dump const): * jit/JITCompilationKey.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.h. (JSC::JITCompilationKey::JITCompilationKey): (JSC::JITCompilationKey::operator! const): (JSC::JITCompilationKey::isHashTableDeletedValue const): (JSC::JITCompilationKey::mode const): (JSC::JITCompilationKey::operator== const): (JSC::JITCompilationKey::hash const): (JSC::JITCompilationKeyHash::hash): (JSC::JITCompilationKeyHash::equal): * jit/JITCompilationMode.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.cpp. (WTF::printInternal): * jit/JITCompilationMode.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.h. (JSC::isFTL): * jit/JITOperations.cpp: (JSC::JSC_DEFINE_JIT_OPERATION): * jit/JITPlan.cpp: Added. (JSC::JITPlan::JITPlan): (JSC::JITPlan::cancel): (JSC::JITPlan::notifyCompiling): (JSC::JITPlan::notifyReady): (JSC::JITPlan::tier const): (JSC::JITPlan::key): (JSC::JITPlan::isKnownToBeLiveAfterGC): (JSC::JITPlan::isKnownToBeLiveDuringGC): (JSC::JITPlan::iterateCodeBlocksForGC): (JSC::JITPlan::checkLivenessAndVisitChildren): (JSC::JITPlan::computeCompileTimes const): (JSC::JITPlan::reportCompileTimes const): (JSC::JITPlan::compileInThread): * jit/JITPlan.h: Added. (JSC::JITPlan::~JITPlan): (JSC::JITPlan::vm const): (JSC::JITPlan::codeBlock const): (JSC::JITPlan::thread const): (JSC::JITPlan::mode const): (JSC::JITPlan::stage const): (JSC::JITPlan::isFTL const): (JSC::JITPlan::finalizeInGC): * jit/JITPlanStage.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.cpp. * jit/JITSafepoint.cpp: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.cpp. (JSC::Safepoint::Safepoint): (JSC::Safepoint::~Safepoint): (JSC::Safepoint::begin): (JSC::Safepoint::cancel): * jit/JITSafepoint.h: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.h. * jit/JITScannable.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITWorklist.cpp: (JSC::JITWorklist::JITWorklist): (JSC::JITWorklist::~JITWorklist): (JSC::JITWorklist::existingGlobalWorklistOrNull): (JSC::JITWorklist::ensureGlobalWorklist): (JSC::JITWorklist::enqueue): (JSC::JITWorklist::queueLength const): (JSC::JITWorklist::suspendAllThreads): (JSC::JITWorklist::resumeAllThreads): (JSC::JITWorklist::compilationState): (JSC::JITWorklist::completeAllReadyPlansForVM): (JSC::JITWorklist::waitUntilAllPlansForVMAreReady): (JSC::JITWorklist::completeAllPlansForVM): (JSC::JITWorklist::cancelAllPlansForVM): (JSC::JITWorklist::removeDeadPlans): (JSC::JITWorklist::setMaximumNumberOfConcurrentDFGCompilations): (JSC::JITWorklist::setMaximumNumberOfConcurrentFTLCompilations): (JSC::JITWorklist::visitWeakReferences): (JSC::JITWorklist::dump const): (JSC::JITWorklist::removeAllReadyPlansForVM): (JSC::JITWorklist::removeMatchingPlansForVM): * jit/JITWorklist.h: (JSC::JITWorklist::static_cast<size_t>): * jit/JITWorklistInlines.h: Renamed from Source/JavaScriptCore/dfg/DFGScannable.h. (JSC::JITWorklist::iterateCodeBlocksForGC): * jit/JITWorklistThread.cpp: Added. (JSC::JITWorklistThread::JITWorklistThread): (JSC::JITWorklistThread::name const): (JSC::JITWorklistThread::poll): (JSC::JITWorklistThread::work): (JSC::JITWorklistThread::threadDidStart): (JSC::JITWorklistThread::threadIsStopping): * jit/JITWorklistThread.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.h. * llint/LLIntSlowPaths.cpp: (JSC::LLInt::jitCompileAndSetHeuristics): * runtime/OptionsList.h: * runtime/VM.cpp: (JSC::VM::~VM): Canonical link: https://commits.webkit.org/238161@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278082 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-26 15:15:22 +00:00
JITWorklist& m_worklist;
RefPtr<JITPlan> m_plan { nullptr };
Safepoint* m_safepoint { nullptr };
GC blocks on FTL and then badness https://bugs.webkit.org/show_bug.cgi?id=128291 Reviewed by Oliver Hunt. Introduce the notion of a DFG::Safepoint, which allows you to unlock the rightToRun mutex for your JIT thread, while supplying the GC with all of the information it would need to scan you at that moment in time. The default way of using this is DFG::GraphSafepoint, where you just supply the Graph. There's a lot of machinery in this patch just to make the Graph scannable. We then use DFG::GraphSafepoint in just two places for now: (1) while initializing LLVM and (2) while invoking LLVM' optimizer and backend. This is a 30% speed-up on Octane/typescript and a 10% speed-up on Octane/gbemu. 2-3% speed-up overall on Octane. * CMakeLists.txt: * GNUmakefile.list.am: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::visitChildren): * dfg/DFGGraph.h: * dfg/DFGGraphSafepoint.cpp: Added. (JSC::DFG::GraphSafepoint::GraphSafepoint): (JSC::DFG::GraphSafepoint::~GraphSafepoint): * dfg/DFGGraphSafepoint.h: Added. * dfg/DFGOperations.h: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThread): (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPlan.h: * dfg/DFGSafepoint.cpp: Added. (JSC::DFG::Safepoint::Safepoint): (JSC::DFG::Safepoint::~Safepoint): (JSC::DFG::Safepoint::add): (JSC::DFG::Safepoint::begin): (JSC::DFG::Safepoint::visitChildren): * dfg/DFGSafepoint.h: Added. * dfg/DFGScannable.h: Added. (JSC::DFG::Scannable::Scannable): (JSC::DFG::Scannable::~Scannable): * dfg/DFGThreadData.cpp: Added. (JSC::DFG::ThreadData::ThreadData): (JSC::DFG::ThreadData::~ThreadData): * dfg/DFGThreadData.h: Added. * dfg/DFGWorklist.cpp: (JSC::DFG::Worklist::finishCreation): (JSC::DFG::Worklist::visitChildren): (JSC::DFG::Worklist::runThread): * dfg/DFGWorklist.h: * ftl/FTLCompile.cpp: (JSC::FTL::compile): * heap/SlotVisitor.h: * heap/SlotVisitorInlines.h: (JSC::SlotVisitor::appendUnbarrieredReadOnlyPointer): (JSC::SlotVisitor::appendUnbarrieredReadOnlyValue): Canonical link: https://commits.webkit.org/146533@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@163765 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-02-10 07:21:09 +00:00
};
Merge all the JIT worklists into a shared worklist https://bugs.webkit.org/show_bug.cgi?id=226207 Reviewed by Saam Barati. Delete the DFG and FTL worklists and refactor JITWorklist to handle the compilation for all tiers. This reduces the total number of compiler threads while allowing each tier to use more threads whenever necessary. The default configuration is for the worklist to have 3 threads, baseline can use up to all 3 threads and DFG and FTL follow the previous limits set through JSC::Options. Right now, the worklist will only do work on upper tiers when all lower tiers have no pending tasks or have exceeded the maximum number of concurrent compilations. i.e. by default we only DFG compile when there are no baseline tasks in the queue and we only FTL compile when we either have no DFG tasks in the queue OR there are already 2 DFG compilations in progress. * API/JSVirtualMachine.mm: (+[JSVirtualMachine setNumberOfDFGCompilerThreads:]): (+[JSVirtualMachine setNumberOfFTLCompilerThreads:]): * API/tests/testapi.mm: (runJITThreadLimitTests): * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::checkIfOptimizationThresholdReached): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGCommon.h: (JSC::DFG::verboseCompilationEnabled): (JSC::DFG::logCompilationChanges): (JSC::DFG::shouldDumpGraphAtEachPhase): (JSC::DFG::shouldDumpDisassembly): * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): (JSC::DFG::compile): * dfg/DFGDriver.h: * dfg/DFGGraph.h: * dfg/DFGGraphSafepoint.h: * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: (JSC::DFG::OSRAvailabilityAnalysisPhase::run): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGOperations.cpp: (JSC::DFG::triggerFTLReplacementCompile): (JSC::DFG::tierUpCommon): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::Plan): (JSC::DFG::Plan::codeSize const): (JSC::DFG::Plan::finalizeInGC): (JSC::DFG::Plan::notifyReady): (JSC::DFG::Plan::cancel): (JSC::DFG::Plan::compileInThreadImpl): (JSC::DFG::Plan::finalize): (JSC::DFG::Plan::iterateCodeBlocksForGC): (JSC::DFG::Plan::checkLivenessAndVisitChildren): (JSC::DFG::Plan::isKnownToBeLiveDuringGC): (JSC::DFG::Plan::isKnownToBeLiveAfterGC): * dfg/DFGPlan.h: * dfg/DFGPlanInlines.h: Removed. * dfg/DFGTierUpCheckInjectionPhase.cpp: (JSC::DFG::TierUpCheckInjectionPhase::run): * dfg/DFGWorklist.cpp: Removed. * dfg/DFGWorklist.h: Removed. * dfg/DFGWorklistInlines.h: Removed. * ftl/FTLCompile.h: * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): (JSC::FTL::DFG::LowerDFGToB3::buildExitArguments): * ftl/FTLState.cpp: (JSC::FTL::State::State): * ftl/FTLState.h: (JSC::FTL::verboseCompilationEnabled): (JSC::FTL::shouldDumpDisassembly): * heap/Heap.cpp: (JSC::Heap::completeAllJITPlans): (JSC::Heap::iterateExecutingAndCompilingCodeBlocks): (JSC::Heap::removeDeadCompilerWorklistEntries): (JSC::Heap::stopThePeriphery): (JSC::Heap::suspendCompilerThreads): (JSC::Heap::resumeCompilerThreads): (JSC::Heap::addCoreConstraints): * heap/Heap.h: * heap/RootMarkReason.h: * jit/JIT.cpp: (JSC::JIT::compileAndLinkWithoutFinalizing): (JSC::JIT::codeSize const): (JSC::JIT::compileTimeStats): * jit/JIT.h: * jit/JITBaselinePlan.cpp: Copied from Source/JavaScriptCore/ftl/FTLState.cpp. (JSC::JITBaselinePlan::JITBaselinePlan): (JSC::JITBaselinePlan::compileInThreadImpl): (JSC::JITBaselinePlan::codeSize const): (JSC::JITBaselinePlan::finalize): * jit/JITBaselinePlan.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITCompilationKey.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.cpp. (JSC::JITCompilationKey::dump const): * jit/JITCompilationKey.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.h. (JSC::JITCompilationKey::JITCompilationKey): (JSC::JITCompilationKey::operator! const): (JSC::JITCompilationKey::isHashTableDeletedValue const): (JSC::JITCompilationKey::mode const): (JSC::JITCompilationKey::operator== const): (JSC::JITCompilationKey::hash const): (JSC::JITCompilationKeyHash::hash): (JSC::JITCompilationKeyHash::equal): * jit/JITCompilationMode.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.cpp. (WTF::printInternal): * jit/JITCompilationMode.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.h. (JSC::isFTL): * jit/JITOperations.cpp: (JSC::JSC_DEFINE_JIT_OPERATION): * jit/JITPlan.cpp: Added. (JSC::JITPlan::JITPlan): (JSC::JITPlan::cancel): (JSC::JITPlan::notifyCompiling): (JSC::JITPlan::notifyReady): (JSC::JITPlan::tier const): (JSC::JITPlan::key): (JSC::JITPlan::isKnownToBeLiveAfterGC): (JSC::JITPlan::isKnownToBeLiveDuringGC): (JSC::JITPlan::iterateCodeBlocksForGC): (JSC::JITPlan::checkLivenessAndVisitChildren): (JSC::JITPlan::computeCompileTimes const): (JSC::JITPlan::reportCompileTimes const): (JSC::JITPlan::compileInThread): * jit/JITPlan.h: Added. (JSC::JITPlan::~JITPlan): (JSC::JITPlan::vm const): (JSC::JITPlan::codeBlock const): (JSC::JITPlan::thread const): (JSC::JITPlan::mode const): (JSC::JITPlan::stage const): (JSC::JITPlan::isFTL const): (JSC::JITPlan::finalizeInGC): * jit/JITPlanStage.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.cpp. * jit/JITSafepoint.cpp: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.cpp. (JSC::Safepoint::Safepoint): (JSC::Safepoint::~Safepoint): (JSC::Safepoint::begin): (JSC::Safepoint::cancel): * jit/JITSafepoint.h: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.h. * jit/JITScannable.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITWorklist.cpp: (JSC::JITWorklist::JITWorklist): (JSC::JITWorklist::~JITWorklist): (JSC::JITWorklist::existingGlobalWorklistOrNull): (JSC::JITWorklist::ensureGlobalWorklist): (JSC::JITWorklist::enqueue): (JSC::JITWorklist::queueLength const): (JSC::JITWorklist::suspendAllThreads): (JSC::JITWorklist::resumeAllThreads): (JSC::JITWorklist::compilationState): (JSC::JITWorklist::completeAllReadyPlansForVM): (JSC::JITWorklist::waitUntilAllPlansForVMAreReady): (JSC::JITWorklist::completeAllPlansForVM): (JSC::JITWorklist::cancelAllPlansForVM): (JSC::JITWorklist::removeDeadPlans): (JSC::JITWorklist::setMaximumNumberOfConcurrentDFGCompilations): (JSC::JITWorklist::setMaximumNumberOfConcurrentFTLCompilations): (JSC::JITWorklist::visitWeakReferences): (JSC::JITWorklist::dump const): (JSC::JITWorklist::removeAllReadyPlansForVM): (JSC::JITWorklist::removeMatchingPlansForVM): * jit/JITWorklist.h: (JSC::JITWorklist::static_cast<size_t>): * jit/JITWorklistInlines.h: Renamed from Source/JavaScriptCore/dfg/DFGScannable.h. (JSC::JITWorklist::iterateCodeBlocksForGC): * jit/JITWorklistThread.cpp: Added. (JSC::JITWorklistThread::JITWorklistThread): (JSC::JITWorklistThread::name const): (JSC::JITWorklistThread::poll): (JSC::JITWorklistThread::work): (JSC::JITWorklistThread::threadDidStart): (JSC::JITWorklistThread::threadIsStopping): * jit/JITWorklistThread.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.h. * llint/LLIntSlowPaths.cpp: (JSC::LLInt::jitCompileAndSetHeuristics): * runtime/OptionsList.h: * runtime/VM.cpp: (JSC::VM::~VM): Canonical link: https://commits.webkit.org/238161@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278082 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-26 15:15:22 +00:00
} // namespace JSC
GC blocks on FTL and then badness https://bugs.webkit.org/show_bug.cgi?id=128291 Reviewed by Oliver Hunt. Introduce the notion of a DFG::Safepoint, which allows you to unlock the rightToRun mutex for your JIT thread, while supplying the GC with all of the information it would need to scan you at that moment in time. The default way of using this is DFG::GraphSafepoint, where you just supply the Graph. There's a lot of machinery in this patch just to make the Graph scannable. We then use DFG::GraphSafepoint in just two places for now: (1) while initializing LLVM and (2) while invoking LLVM' optimizer and backend. This is a 30% speed-up on Octane/typescript and a 10% speed-up on Octane/gbemu. 2-3% speed-up overall on Octane. * CMakeLists.txt: * GNUmakefile.list.am: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: * JavaScriptCore.xcodeproj/project.pbxproj: * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::visitChildren): * dfg/DFGGraph.h: * dfg/DFGGraphSafepoint.cpp: Added. (JSC::DFG::GraphSafepoint::GraphSafepoint): (JSC::DFG::GraphSafepoint::~GraphSafepoint): * dfg/DFGGraphSafepoint.h: Added. * dfg/DFGOperations.h: * dfg/DFGPlan.cpp: (JSC::DFG::Plan::compileInThread): (JSC::DFG::Plan::compileInThreadImpl): * dfg/DFGPlan.h: * dfg/DFGSafepoint.cpp: Added. (JSC::DFG::Safepoint::Safepoint): (JSC::DFG::Safepoint::~Safepoint): (JSC::DFG::Safepoint::add): (JSC::DFG::Safepoint::begin): (JSC::DFG::Safepoint::visitChildren): * dfg/DFGSafepoint.h: Added. * dfg/DFGScannable.h: Added. (JSC::DFG::Scannable::Scannable): (JSC::DFG::Scannable::~Scannable): * dfg/DFGThreadData.cpp: Added. (JSC::DFG::ThreadData::ThreadData): (JSC::DFG::ThreadData::~ThreadData): * dfg/DFGThreadData.h: Added. * dfg/DFGWorklist.cpp: (JSC::DFG::Worklist::finishCreation): (JSC::DFG::Worklist::visitChildren): (JSC::DFG::Worklist::runThread): * dfg/DFGWorklist.h: * ftl/FTLCompile.cpp: (JSC::FTL::compile): * heap/SlotVisitor.h: * heap/SlotVisitorInlines.h: (JSC::SlotVisitor::appendUnbarrieredReadOnlyPointer): (JSC::SlotVisitor::appendUnbarrieredReadOnlyValue): Canonical link: https://commits.webkit.org/146533@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@163765 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-02-10 07:21:09 +00:00
Merge all the JIT worklists into a shared worklist https://bugs.webkit.org/show_bug.cgi?id=226207 Reviewed by Saam Barati. Delete the DFG and FTL worklists and refactor JITWorklist to handle the compilation for all tiers. This reduces the total number of compiler threads while allowing each tier to use more threads whenever necessary. The default configuration is for the worklist to have 3 threads, baseline can use up to all 3 threads and DFG and FTL follow the previous limits set through JSC::Options. Right now, the worklist will only do work on upper tiers when all lower tiers have no pending tasks or have exceeded the maximum number of concurrent compilations. i.e. by default we only DFG compile when there are no baseline tasks in the queue and we only FTL compile when we either have no DFG tasks in the queue OR there are already 2 DFG compilations in progress. * API/JSVirtualMachine.mm: (+[JSVirtualMachine setNumberOfDFGCompilerThreads:]): (+[JSVirtualMachine setNumberOfFTLCompilerThreads:]): * API/tests/testapi.mm: (runJITThreadLimitTests): * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::checkIfOptimizationThresholdReached): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGCommon.h: (JSC::DFG::verboseCompilationEnabled): (JSC::DFG::logCompilationChanges): (JSC::DFG::shouldDumpGraphAtEachPhase): (JSC::DFG::shouldDumpDisassembly): * dfg/DFGDriver.cpp: (JSC::DFG::compileImpl): (JSC::DFG::compile): * dfg/DFGDriver.h: * dfg/DFGGraph.h: * dfg/DFGGraphSafepoint.h: * dfg/DFGOSRAvailabilityAnalysisPhase.cpp: (JSC::DFG::OSRAvailabilityAnalysisPhase::run): * dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run): * dfg/DFGOperations.cpp: (JSC::DFG::triggerFTLReplacementCompile): (JSC::DFG::tierUpCommon): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::Plan): (JSC::DFG::Plan::codeSize const): (JSC::DFG::Plan::finalizeInGC): (JSC::DFG::Plan::notifyReady): (JSC::DFG::Plan::cancel): (JSC::DFG::Plan::compileInThreadImpl): (JSC::DFG::Plan::finalize): (JSC::DFG::Plan::iterateCodeBlocksForGC): (JSC::DFG::Plan::checkLivenessAndVisitChildren): (JSC::DFG::Plan::isKnownToBeLiveDuringGC): (JSC::DFG::Plan::isKnownToBeLiveAfterGC): * dfg/DFGPlan.h: * dfg/DFGPlanInlines.h: Removed. * dfg/DFGTierUpCheckInjectionPhase.cpp: (JSC::DFG::TierUpCheckInjectionPhase::run): * dfg/DFGWorklist.cpp: Removed. * dfg/DFGWorklist.h: Removed. * dfg/DFGWorklistInlines.h: Removed. * ftl/FTLCompile.h: * ftl/FTLLink.cpp: (JSC::FTL::link): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower): (JSC::FTL::DFG::LowerDFGToB3::buildExitArguments): * ftl/FTLState.cpp: (JSC::FTL::State::State): * ftl/FTLState.h: (JSC::FTL::verboseCompilationEnabled): (JSC::FTL::shouldDumpDisassembly): * heap/Heap.cpp: (JSC::Heap::completeAllJITPlans): (JSC::Heap::iterateExecutingAndCompilingCodeBlocks): (JSC::Heap::removeDeadCompilerWorklistEntries): (JSC::Heap::stopThePeriphery): (JSC::Heap::suspendCompilerThreads): (JSC::Heap::resumeCompilerThreads): (JSC::Heap::addCoreConstraints): * heap/Heap.h: * heap/RootMarkReason.h: * jit/JIT.cpp: (JSC::JIT::compileAndLinkWithoutFinalizing): (JSC::JIT::codeSize const): (JSC::JIT::compileTimeStats): * jit/JIT.h: * jit/JITBaselinePlan.cpp: Copied from Source/JavaScriptCore/ftl/FTLState.cpp. (JSC::JITBaselinePlan::JITBaselinePlan): (JSC::JITBaselinePlan::compileInThreadImpl): (JSC::JITBaselinePlan::codeSize const): (JSC::JITBaselinePlan::finalize): * jit/JITBaselinePlan.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITCompilationKey.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.cpp. (JSC::JITCompilationKey::dump const): * jit/JITCompilationKey.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationKey.h. (JSC::JITCompilationKey::JITCompilationKey): (JSC::JITCompilationKey::operator! const): (JSC::JITCompilationKey::isHashTableDeletedValue const): (JSC::JITCompilationKey::mode const): (JSC::JITCompilationKey::operator== const): (JSC::JITCompilationKey::hash const): (JSC::JITCompilationKeyHash::hash): (JSC::JITCompilationKeyHash::equal): * jit/JITCompilationMode.cpp: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.cpp. (WTF::printInternal): * jit/JITCompilationMode.h: Renamed from Source/JavaScriptCore/dfg/DFGCompilationMode.h. (JSC::isFTL): * jit/JITOperations.cpp: (JSC::JSC_DEFINE_JIT_OPERATION): * jit/JITPlan.cpp: Added. (JSC::JITPlan::JITPlan): (JSC::JITPlan::cancel): (JSC::JITPlan::notifyCompiling): (JSC::JITPlan::notifyReady): (JSC::JITPlan::tier const): (JSC::JITPlan::key): (JSC::JITPlan::isKnownToBeLiveAfterGC): (JSC::JITPlan::isKnownToBeLiveDuringGC): (JSC::JITPlan::iterateCodeBlocksForGC): (JSC::JITPlan::checkLivenessAndVisitChildren): (JSC::JITPlan::computeCompileTimes const): (JSC::JITPlan::reportCompileTimes const): (JSC::JITPlan::compileInThread): * jit/JITPlan.h: Added. (JSC::JITPlan::~JITPlan): (JSC::JITPlan::vm const): (JSC::JITPlan::codeBlock const): (JSC::JITPlan::thread const): (JSC::JITPlan::mode const): (JSC::JITPlan::stage const): (JSC::JITPlan::isFTL const): (JSC::JITPlan::finalizeInGC): * jit/JITPlanStage.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.cpp. * jit/JITSafepoint.cpp: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.cpp. (JSC::Safepoint::Safepoint): (JSC::Safepoint::~Safepoint): (JSC::Safepoint::begin): (JSC::Safepoint::cancel): * jit/JITSafepoint.h: Renamed from Source/JavaScriptCore/dfg/DFGSafepoint.h. * jit/JITScannable.h: Copied from Source/JavaScriptCore/dfg/DFGScannable.h. * jit/JITWorklist.cpp: (JSC::JITWorklist::JITWorklist): (JSC::JITWorklist::~JITWorklist): (JSC::JITWorklist::existingGlobalWorklistOrNull): (JSC::JITWorklist::ensureGlobalWorklist): (JSC::JITWorklist::enqueue): (JSC::JITWorklist::queueLength const): (JSC::JITWorklist::suspendAllThreads): (JSC::JITWorklist::resumeAllThreads): (JSC::JITWorklist::compilationState): (JSC::JITWorklist::completeAllReadyPlansForVM): (JSC::JITWorklist::waitUntilAllPlansForVMAreReady): (JSC::JITWorklist::completeAllPlansForVM): (JSC::JITWorklist::cancelAllPlansForVM): (JSC::JITWorklist::removeDeadPlans): (JSC::JITWorklist::setMaximumNumberOfConcurrentDFGCompilations): (JSC::JITWorklist::setMaximumNumberOfConcurrentFTLCompilations): (JSC::JITWorklist::visitWeakReferences): (JSC::JITWorklist::dump const): (JSC::JITWorklist::removeAllReadyPlansForVM): (JSC::JITWorklist::removeMatchingPlansForVM): * jit/JITWorklist.h: (JSC::JITWorklist::static_cast<size_t>): * jit/JITWorklistInlines.h: Renamed from Source/JavaScriptCore/dfg/DFGScannable.h. (JSC::JITWorklist::iterateCodeBlocksForGC): * jit/JITWorklistThread.cpp: Added. (JSC::JITWorklistThread::JITWorklistThread): (JSC::JITWorklistThread::name const): (JSC::JITWorklistThread::poll): (JSC::JITWorklistThread::work): (JSC::JITWorklistThread::threadDidStart): (JSC::JITWorklistThread::threadIsStopping): * jit/JITWorklistThread.h: Renamed from Source/JavaScriptCore/dfg/DFGThreadData.h. * llint/LLIntSlowPaths.cpp: (JSC::LLInt::jitCompileAndSetHeuristics): * runtime/OptionsList.h: * runtime/VM.cpp: (JSC::VM::~VM): Canonical link: https://commits.webkit.org/238161@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278082 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-26 15:15:22 +00:00
#endif // ENABLE(JIT)