Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (278092 => 278093)
--- trunk/Source/_javascript_Core/ChangeLog 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/ChangeLog 2021-05-26 18:35:03 UTC (rev 278093)
@@ -1,5 +1,83 @@
2021-05-26 Chris Dumez <cdu...@apple.com>
+ Use UncheckedLock even less in _javascript_Core
+ https://bugs.webkit.org/show_bug.cgi?id=226278
+
+ Reviewed by Darin Adler.
+
+ Use UncheckedLock even less in _javascript_Core as it is being phased out in
+ favor of Lock, which supports Clang thread safety analysis.
+
+ * heap/BlockDirectory.h:
+ (JSC::BlockDirectory::WTF_RETURNS_LOCK):
+ * heap/CodeBlockSet.h:
+ (JSC::CodeBlockSet::WTF_RETURNS_LOCK):
+ * heap/Heap.h:
+ * heap/MarkedSpace.h:
+ (JSC::MarkedSpace::directoryLock):
+ * heap/MarkingConstraintSolver.h:
+ * heap/SlotVisitor.cpp:
+ (JSC::SlotVisitor::donateKnownParallel):
+ * heap/SlotVisitor.h:
+ * jit/JITWorklist.cpp:
+ * jit/JITWorklist.h:
+ * jsc.cpp:
+ * profiler/ProfilerDatabase.h:
+ * runtime/DeferredWorkTimer.h:
+ * runtime/VMTraps.cpp:
+ (JSC::VMTraps::invalidateCodeBlocksOnStack):
+ * runtime/VMTraps.h:
+ * tools/FunctionOverrides.cpp:
+ (JSC::FunctionOverrides::FunctionOverrides):
+ (JSC::FunctionOverrides::reinstallOverrides):
+ (JSC::FunctionOverrides::parseOverridesInFile):
+ * tools/FunctionOverrides.h:
+ (JSC::FunctionOverrides::WTF_REQUIRES_LOCK):
+ * tools/VMInspector.cpp:
+ (JSC::ensureIsSafeToLock):
+ (JSC::VMInspector::codeBlockForMachinePC):
+ * wasm/WasmBBQPlan.cpp:
+ (JSC::Wasm::BBQPlan::work):
+ (JSC::Wasm::BBQPlan::compileFunction):
+ (JSC::Wasm::BBQPlan::didCompleteCompilation):
+ * wasm/WasmBBQPlan.h:
+ * wasm/WasmEntryPlan.cpp:
+ (JSC::Wasm::EntryPlan::parseAndValidateModule):
+ (JSC::Wasm::EntryPlan::prepare):
+ (JSC::Wasm::EntryPlan::ThreadCountHolder::~ThreadCountHolder):
+ (JSC::Wasm::EntryPlan::complete):
+ * wasm/WasmEntryPlan.h:
+ (JSC::Wasm::EntryPlan::tryReserveCapacity):
+ * wasm/WasmLLIntPlan.cpp:
+ (JSC::Wasm::LLIntPlan::compileFunction):
+ (JSC::Wasm::LLIntPlan::didCompleteCompilation):
+ (JSC::Wasm::LLIntPlan::completeInStreaming):
+ (JSC::Wasm::LLIntPlan::didFailInStreaming):
+ * wasm/WasmLLIntPlan.h:
+ * wasm/WasmOMGForOSREntryPlan.cpp:
+ (JSC::Wasm::OMGForOSREntryPlan::work):
+ * wasm/WasmOMGForOSREntryPlan.h:
+ * wasm/WasmOMGPlan.cpp:
+ (JSC::Wasm::OMGPlan::work):
+ * wasm/WasmOMGPlan.h:
+ * wasm/WasmPlan.cpp:
+ (JSC::Wasm::Plan::runCompletionTasks):
+ (JSC::Wasm::Plan::tryRemoveContextAndCancelIfLast):
+ (JSC::Wasm::Plan::fail):
+ * wasm/WasmPlan.h:
+ * wasm/WasmStreamingCompiler.cpp:
+ (JSC::Wasm::StreamingCompiler::didCompileFunction):
+ (JSC::Wasm::StreamingCompiler::completeIfNecessary):
+ (JSC::Wasm::StreamingCompiler::didComplete):
+ (JSC::Wasm::StreamingCompiler::finalize):
+ * wasm/WasmStreamingCompiler.h:
+ * wasm/WasmStreamingPlan.cpp:
+ (JSC::Wasm::StreamingPlan::work):
+ * wasm/WasmStreamingPlan.h:
+ * wasm/WasmThunks.h:
+
+2021-05-26 Chris Dumez <cdu...@apple.com>
+
Stop using UncheckedLock in WTF::AutomaticThread
https://bugs.webkit.org/show_bug.cgi?id=226255
Modified: trunk/Source/_javascript_Core/heap/BlockDirectory.h (278092 => 278093)
--- trunk/Source/_javascript_Core/heap/BlockDirectory.h 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/heap/BlockDirectory.h 2021-05-26 18:35:03 UTC (rev 278093)
@@ -93,7 +93,7 @@
void updatePercentageOfPagedOutPages(WTF::SimpleStats&);
- UncheckedLock& bitvectorLock() { return m_bitvectorLock; }
+ Lock& bitvectorLock() WTF_RETURNS_LOCK(m_bitvectorLock) { return m_bitvectorLock; }
#define BLOCK_DIRECTORY_BIT_ACCESSORS(lowerBitName, capitalBitName) \
bool is ## capitalBitName(const AbstractLocker&, size_t index) const { return m_bits.is ## capitalBitName(index); } \
@@ -155,7 +155,7 @@
// Mutator uses this to guard resizing the bitvectors. Those things in the GC that may run
// concurrently to the mutator must lock this when accessing the bitvectors.
BlockDirectoryBits m_bits;
- UncheckedLock m_bitvectorLock;
+ Lock m_bitvectorLock;
Lock m_localAllocatorsLock;
CellAttributes m_attributes;
Modified: trunk/Source/_javascript_Core/heap/CodeBlockSet.h (278092 => 278093)
--- trunk/Source/_javascript_Core/heap/CodeBlockSet.h 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/heap/CodeBlockSet.h 2021-05-26 18:35:03 UTC (rev 278093)
@@ -54,7 +54,7 @@
void clearCurrentlyExecuting();
bool contains(const AbstractLocker&, void* candidateCodeBlock);
- UncheckedLock& getLock() { return m_lock; }
+ Lock& getLock() WTF_RETURNS_LOCK(m_lock) { return m_lock; }
// This is expected to run only when we're not adding to the set for now. If
// this needs to run concurrently in the future, we'll need to lock around this.
@@ -78,7 +78,7 @@
private:
HashSet<CodeBlock*> m_codeBlocks;
HashSet<CodeBlock*> m_currentlyExecuting;
- UncheckedLock m_lock;
+ Lock m_lock;
};
} // namespace JSC
Modified: trunk/Source/_javascript_Core/heap/Heap.h (278092 => 278093)
--- trunk/Source/_javascript_Core/heap/Heap.h 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/heap/Heap.h 2021-05-26 18:35:03 UTC (rev 278093)
@@ -716,8 +716,8 @@
Atomic<unsigned> m_worldState;
bool m_worldIsStopped { false };
Lock m_visitRaceLock;
- UncheckedLock m_markingMutex;
- UncheckedCondition m_markingConditionVariable;
+ Lock m_markingMutex;
+ Condition m_markingConditionVariable;
MonotonicTime m_beforeGC;
MonotonicTime m_afterGC;
Modified: trunk/Source/_javascript_Core/heap/MarkedSpace.h (278092 => 278093)
--- trunk/Source/_javascript_Core/heap/MarkedSpace.h 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/heap/MarkedSpace.h 2021-05-26 18:35:03 UTC (rev 278093)
@@ -168,7 +168,7 @@
BlockDirectory* firstDirectory() const { return m_directories.first(); }
- UncheckedLock& directoryLock() { return m_directoryLock; }
+ Lock& directoryLock() { return m_directoryLock; }
void addBlockDirectory(const AbstractLocker&, BlockDirectory*);
// When this is true it means that we have flipped but the mark bits haven't converged yet.
@@ -214,7 +214,7 @@
HeapVersion m_newlyAllocatedVersion { initialVersion };
bool m_isIterating { false };
bool m_isMarking { false };
- UncheckedLock m_directoryLock;
+ Lock m_directoryLock;
MarkedBlockSet m_blocks;
SentinelLinkedList<WeakSet, BasicRawSentinelNode<WeakSet>> m_activeWeakSets;
Modified: trunk/Source/_javascript_Core/heap/MarkingConstraintSolver.h (278092 => 278093)
--- trunk/Source/_javascript_Core/heap/MarkingConstraintSolver.h 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/heap/MarkingConstraintSolver.h 2021-05-26 18:35:03 UTC (rev 278093)
@@ -95,8 +95,8 @@
BitVector m_executed;
Deque<TaskWithConstraint, 32> m_toExecuteInParallel;
Vector<unsigned, 32> m_toExecuteSequentially;
- UncheckedLock m_lock;
- UncheckedCondition m_condition;
+ Lock m_lock;
+ Condition m_condition;
bool m_pickNextIsStillActive { true };
unsigned m_numThreadsThatMayProduceWork { 0 };
Vector<VisitCounter, 16> m_visitCounters;
Modified: trunk/Source/_javascript_Core/heap/SlotVisitor.cpp (278092 => 278093)
--- trunk/Source/_javascript_Core/heap/SlotVisitor.cpp 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/heap/SlotVisitor.cpp 2021-05-26 18:35:03 UTC (rev 278093)
@@ -436,9 +436,9 @@
// If we're contending on the lock, be conservative and assume that another
// thread is already donating.
- std::unique_lock<UncheckedLock> lock(m_heap.m_markingMutex, std::try_to_lock);
- if (!lock.owns_lock())
+ if (!m_heap.m_markingMutex.tryLock())
return;
+ Locker locker { AdoptLock, m_heap.m_markingMutex };
// Otherwise, assume that a thread will go idle soon, and donate.
from.donateSomeCellsTo(to);
Modified: trunk/Source/_javascript_Core/heap/SlotVisitor.h (278092 => 278093)
--- trunk/Source/_javascript_Core/heap/SlotVisitor.h 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/heap/SlotVisitor.h 2021-05-26 18:35:03 UTC (rev 278093)
@@ -161,7 +161,7 @@
bool mutatorIsStopped() const final { return m_mutatorIsStopped; }
- UncheckedLock& rightToRun() { return m_rightToRun; }
+ Lock& rightToRun() WTF_RETURNS_LOCK(m_rightToRun) { return m_rightToRun; }
void updateMutatorIsStopped(const AbstractLocker&);
void updateMutatorIsStopped();
@@ -232,7 +232,7 @@
bool m_mutatorIsStopped { false };
bool m_canOptimizeForStoppedMutator { false };
bool m_isInParallelMode { false };
- UncheckedLock m_rightToRun;
+ Lock m_rightToRun;
// Put padding here to mitigate false sharing between multiple SlotVisitors.
char padding[64];
Modified: trunk/Source/_javascript_Core/jit/JITWorklist.cpp (278092 => 278093)
--- trunk/Source/_javascript_Core/jit/JITWorklist.cpp 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/jit/JITWorklist.cpp 2021-05-26 18:35:03 UTC (rev 278093)
@@ -109,7 +109,7 @@
return queueLength;
}
-void JITWorklist::suspendAllThreads()
+void JITWorklist::suspendAllThreads() WTF_IGNORES_THREAD_SAFETY_ANALYSIS
{
m_suspensionLock.lock();
for (unsigned i = m_threads.size(); i--;)
@@ -116,7 +116,7 @@
m_threads[i]->m_rightToRun.lock();
}
-void JITWorklist::resumeAllThreads()
+void JITWorklist::resumeAllThreads() WTF_IGNORES_THREAD_SAFETY_ANALYSIS
{
for (unsigned i = m_threads.size(); i--;)
m_threads[i]->m_rightToRun.unlock();
Modified: trunk/Source/_javascript_Core/jit/JITWorklist.h (278092 => 278093)
--- trunk/Source/_javascript_Core/jit/JITWorklist.h 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/jit/JITWorklist.h 2021-05-26 18:35:03 UTC (rev 278093)
@@ -118,7 +118,7 @@
// be completed.
Vector<RefPtr<JITPlan>, 16> m_readyPlans;
- UncheckedLock m_suspensionLock;
+ Lock m_suspensionLock;
Box<Lock> m_lock;
Ref<AutomaticThreadCondition> m_planEnqueued;
Modified: trunk/Source/_javascript_Core/jsc.cpp (278092 => 278093)
--- trunk/Source/_javascript_Core/jsc.cpp 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/jsc.cpp 2021-05-26 18:35:03 UTC (rev 278093)
@@ -257,8 +257,8 @@
private:
friend class Worker;
- UncheckedLock m_lock;
- UncheckedCondition m_condition;
+ Lock m_lock;
+ Condition m_condition;
SentinelLinkedList<Worker, BasicRawSentinelNode<Worker>> m_workers;
Deque<String> m_reports;
};
Modified: trunk/Source/_javascript_Core/profiler/ProfilerDatabase.h (278092 => 278093)
--- trunk/Source/_javascript_Core/profiler/ProfilerDatabase.h 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/profiler/ProfilerDatabase.h 2021-05-26 18:35:03 UTC (rev 278093)
@@ -88,7 +88,7 @@
bool m_shouldSaveAtExit;
CString m_atExitSaveFilename;
Database* m_nextRegisteredDatabase;
- UncheckedLock m_lock;
+ Lock m_lock;
};
} } // namespace JSC::Profiler
Modified: trunk/Source/_javascript_Core/runtime/DeferredWorkTimer.h (278092 => 278093)
--- trunk/Source/_javascript_Core/runtime/DeferredWorkTimer.h 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/runtime/DeferredWorkTimer.h 2021-05-26 18:35:03 UTC (rev 278093)
@@ -72,11 +72,11 @@
private:
DeferredWorkTimer(VM&);
- UncheckedLock m_taskLock;
+ Lock m_taskLock;
bool m_runTasks { true };
bool m_shouldStopRunLoopWhenAllTicketsFinish { false };
bool m_currentlyRunningTask { false };
- Deque<std::tuple<Ticket, Task>> m_tasks;
+ Deque<std::tuple<Ticket, Task>> m_tasks WTF_GUARDED_BY_LOCK(m_taskLock);
HashMap<Ticket, TicketData> m_pendingTickets;
};
Modified: trunk/Source/_javascript_Core/runtime/VMTraps.cpp (278092 => 278093)
--- trunk/Source/_javascript_Core/runtime/VMTraps.cpp 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/runtime/VMTraps.cpp 2021-05-26 18:35:03 UTC (rev 278093)
@@ -163,7 +163,7 @@
invalidateCodeBlocksOnStack(codeBlockSetLocker, topCallFrame);
}
-void VMTraps::invalidateCodeBlocksOnStack(Locker<UncheckedLock>&, CallFrame* topCallFrame)
+void VMTraps::invalidateCodeBlocksOnStack(Locker<Lock>&, CallFrame* topCallFrame)
{
if (!m_needToInvalidatedCodeBlocks)
return;
Modified: trunk/Source/_javascript_Core/runtime/VMTraps.h (278092 => 278093)
--- trunk/Source/_javascript_Core/runtime/VMTraps.h 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/runtime/VMTraps.h 2021-05-26 18:35:03 UTC (rev 278093)
@@ -236,7 +236,7 @@
void invalidateCodeBlocksOnStack();
void invalidateCodeBlocksOnStack(CallFrame* topCallFrame);
- void invalidateCodeBlocksOnStack(Locker<UncheckedLock>& codeBlockSetLocker, CallFrame* topCallFrame);
+ void invalidateCodeBlocksOnStack(Locker<Lock>& codeBlockSetLocker, CallFrame* topCallFrame);
void addSignalSender(SignalSender*);
void removeSignalSender(SignalSender*);
Modified: trunk/Source/_javascript_Core/tools/FunctionOverrides.cpp (278092 => 278093)
--- trunk/Source/_javascript_Core/tools/FunctionOverrides.cpp 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/tools/FunctionOverrides.cpp 2021-05-26 18:35:03 UTC (rev 278093)
@@ -110,7 +110,8 @@
FunctionOverrides::FunctionOverrides(const char* overridesFileName)
{
FunctionOverridesAssertScope assertScope;
- parseOverridesInFile(Locker { m_lock }, overridesFileName);
+ Locker locker { m_lock };
+ parseOverridesInFile(overridesFileName);
}
void FunctionOverrides::reinstallOverrides()
@@ -119,8 +120,8 @@
FunctionOverrides& overrides = FunctionOverrides::overrides();
Locker locker { overrides.m_lock };
const char* overridesFileName = Options::functionOverrides();
- overrides.clear(locker);
- overrides.parseOverridesInFile(locker, overridesFileName);
+ overrides.clear();
+ overrides.parseOverridesInFile(overridesFileName);
}
static void initializeOverrideInfo(const SourceCode& origCode, const String& newBody, FunctionOverrides::OverrideInfo& info)
@@ -248,7 +249,7 @@
FAIL_WITH_ERROR(SYNTAX_ERROR, ("'", keyword, "' clause end delimiter '", delimiter, "' not found:\n", builder.toString(), "\n", "Are you missing a '}' before the delimiter?\n"));
}
-void FunctionOverrides::parseOverridesInFile(const AbstractLocker&, const char* fileName)
+void FunctionOverrides::parseOverridesInFile(const char* fileName)
{
FunctionOverridesAssertScope assertScope;
if (!fileName)
Modified: trunk/Source/_javascript_Core/tools/FunctionOverrides.h (278092 => 278093)
--- trunk/Source/_javascript_Core/tools/FunctionOverrides.h 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/tools/FunctionOverrides.h 2021-05-26 18:35:03 UTC (rev 278093)
@@ -57,11 +57,11 @@
JS_EXPORT_PRIVATE static void reinstallOverrides();
private:
- void parseOverridesInFile(const AbstractLocker&, const char* fileName);
- void clear(const AbstractLocker&) { m_entries.clear(); }
+ void parseOverridesInFile(const char* fileName) WTF_REQUIRES_LOCK(m_lock);
+ void clear() WTF_REQUIRES_LOCK(m_lock) { m_entries.clear(); }
- HashMap<String, String> m_entries;
- UncheckedLock m_lock;
+ HashMap<String, String> m_entries WTF_GUARDED_BY_LOCK(m_lock);
+ Lock m_lock;
};
} // namespace JSC
Modified: trunk/Source/_javascript_Core/tools/VMInspector.cpp (278092 => 278093)
--- trunk/Source/_javascript_Core/tools/VMInspector.cpp 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/tools/VMInspector.cpp 2021-05-26 18:35:03 UTC (rev 278093)
@@ -89,7 +89,8 @@
}
#if ENABLE(JIT)
-static bool ensureIsSafeToLock(UncheckedLock& lock)
+template<typename LockType>
+static bool ensureIsSafeToLock(LockType& lock)
{
unsigned maxRetries = 2;
unsigned tryCount = 0;
@@ -102,7 +103,7 @@
tryCount++;
}
return false;
-};
+}
#endif // ENABLE(JIT)
void VMInspector::forEachVM(Function<FunctorStatus(VM&)>&& func)
@@ -171,7 +172,7 @@
return FunctorStatus::Continue; // Skip this VM.
}
- Locker locker { codeBlockSetLock };
+ WTF::Locker locker { codeBlockSetLock };
vm.heap.forEachCodeBlockIgnoringJITPlans(locker, [&] (CodeBlock* cb) {
JITCode* jitCode = cb->jitCode().get();
if (!jitCode) {
Modified: trunk/Source/_javascript_Core/wasm/WasmBBQPlan.cpp (278092 => 278093)
--- trunk/Source/_javascript_Core/wasm/WasmBBQPlan.cpp 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/wasm/WasmBBQPlan.cpp 2021-05-26 18:35:03 UTC (rev 278093)
@@ -80,7 +80,8 @@
parseAndValidateModule();
if (!hasWork()) {
ASSERT(m_state == State::Validated);
- complete(Locker { m_lock });
+ Locker locker { m_lock };
+ complete();
break;
}
FALLTHROUGH;
@@ -103,7 +104,8 @@
LinkBuffer linkBuffer(*context.wasmEntrypointJIT, nullptr, LinkBuffer::Profile::Wasm, JITCompilationCanFail);
if (UNLIKELY(linkBuffer.didFailToAllocate())) {
- Base::fail(Locker { m_lock }, makeString("Out of executable memory while tiering up function at index ", String::number(m_functionIndex)));
+ Locker locker { m_lock };
+ Base::fail(makeString("Out of executable memory while tiering up function at index ", String::number(m_functionIndex)));
return;
}
@@ -153,7 +155,7 @@
Locker locker { m_lock };
moveToState(State::Completed);
- runCompletionTasks(locker);
+ runCompletionTasks();
}
void BBQPlan::compileFunction(uint32_t functionIndex)
@@ -202,7 +204,7 @@
Locker locker { m_lock };
if (!m_errorMessage) {
// Multiple compiles could fail simultaneously. We arbitrarily choose the first.
- fail(locker, makeString(parseAndCompileResult.error(), ", in function at index ", String::number(functionIndex))); // FIXME make this an Expected.
+ fail(makeString(parseAndCompileResult.error(), ", in function at index ", String::number(functionIndex))); // FIXME make this an Expected.
}
m_currentIndex = m_moduleInformation->functions.size();
return nullptr;
@@ -211,7 +213,7 @@
return WTFMove(*parseAndCompileResult);
}
-void BBQPlan::didCompleteCompilation(const AbstractLocker& locker)
+void BBQPlan::didCompleteCompilation()
{
for (uint32_t functionIndex = 0; functionIndex < m_moduleInformation->functions.size(); functionIndex++) {
CompilationContext& context = m_compilationContexts[functionIndex];
@@ -222,7 +224,7 @@
{
LinkBuffer linkBuffer(*context.wasmEntrypointJIT, nullptr, LinkBuffer::Profile::Wasm, JITCompilationCanFail);
if (UNLIKELY(linkBuffer.didFailToAllocate())) {
- Base::fail(locker, makeString("Out of executable memory in function at index ", String::number(functionIndex)));
+ Base::fail(makeString("Out of executable memory in function at index ", String::number(functionIndex)));
return;
}
@@ -234,7 +236,7 @@
if (const auto& embedderToWasmInternalFunction = m_embedderToWasmInternalFunctions.get(functionIndex)) {
LinkBuffer linkBuffer(*context.embedderEntrypointJIT, nullptr, LinkBuffer::Profile::Wasm, JITCompilationCanFail);
if (UNLIKELY(linkBuffer.didFailToAllocate())) {
- Base::fail(locker, makeString("Out of executable memory in function entrypoint at index ", String::number(functionIndex)));
+ Base::fail(makeString("Out of executable memory in function entrypoint at index ", String::number(functionIndex)));
return;
}
Modified: trunk/Source/_javascript_Core/wasm/WasmBBQPlan.h (278092 => 278093)
--- trunk/Source/_javascript_Core/wasm/WasmBBQPlan.h 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/wasm/WasmBBQPlan.h 2021-05-26 18:35:03 UTC (rev 278093)
@@ -78,7 +78,7 @@
private:
bool prepareImpl() final;
void compileFunction(uint32_t functionIndex) final;
- void didCompleteCompilation(const AbstractLocker&) final;
+ void didCompleteCompilation() WTF_REQUIRES_LOCK(m_lock) final;
std::unique_ptr<InternalFunction> compileFunction(uint32_t functionIndex, CompilationContext&, Vector<UnlinkedWasmToWasmCall>&, TierUpCount*);
Modified: trunk/Source/_javascript_Core/wasm/WasmEntryPlan.cpp (278092 => 278093)
--- trunk/Source/_javascript_Core/wasm/WasmEntryPlan.cpp 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/wasm/WasmEntryPlan.cpp 2021-05-26 18:35:03 UTC (rev 278093)
@@ -95,7 +95,8 @@
}
if (m_streamingParser.finalize() != StreamingParser::State::Finished) {
- fail(Locker { m_lock }, m_streamingParser.errorMessage());
+ Locker locker { m_lock };
+ fail(m_streamingParser.errorMessage());
return false;
}
@@ -128,9 +129,11 @@
auto binding = wasmToWasm(importFunctionIndex);
if (UNLIKELY(!binding)) {
switch (binding.error()) {
- case BindingFailure::OutOfMemory:
- return fail(Locker { m_lock }, makeString("Out of executable memory at import ", String::number(importIndex)));
+ case BindingFailure::OutOfMemory: {
+ Locker locker { m_lock };
+ return fail(makeString("Out of executable memory at import ", String::number(importIndex)));
}
+ }
RELEASE_ASSERT_NOT_REACHED();
}
m_wasmToWasmExitStubs.uncheckedAppend(binding.value());
@@ -174,7 +177,7 @@
m_plan.m_numberOfActiveThreads--;
if (!m_plan.m_numberOfActiveThreads && !m_plan.hasWork())
- m_plan.complete(locker);
+ m_plan.complete();
}
EntryPlan& m_plan;
@@ -216,17 +219,17 @@
}
}
-void EntryPlan::complete(const AbstractLocker& locker)
+void EntryPlan::complete()
{
ASSERT(m_state != State::Compiled || m_currentIndex >= m_moduleInformation->functions.size());
dataLogLnIf(WasmEntryPlanInternal::verbose, "Starting Completion");
if (!failed() && m_state == State::Compiled)
- didCompleteCompilation(locker);
+ didCompleteCompilation();
if (!isComplete()) {
moveToState(State::Completed);
- runCompletionTasks(locker);
+ runCompletionTasks();
}
}
Modified: trunk/Source/_javascript_Core/wasm/WasmEntryPlan.h (278092 => 278093)
--- trunk/Source/_javascript_Core/wasm/WasmEntryPlan.h 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/wasm/WasmEntryPlan.h 2021-05-26 18:35:03 UTC (rev 278093)
@@ -96,17 +96,18 @@
const char* stateString(State);
void moveToState(State);
bool isComplete() const override { return m_state == State::Completed; }
- void complete(const AbstractLocker&) override;
+ void complete() WTF_REQUIRES_LOCK(m_lock) override;
virtual bool prepareImpl() = 0;
virtual void compileFunction(uint32_t functionIndex) = 0;
- virtual void didCompleteCompilation(const AbstractLocker&) = 0;
+ virtual void didCompleteCompilation() WTF_REQUIRES_LOCK(m_lock) = 0;
template<typename T>
bool tryReserveCapacity(Vector<T>& vector, size_t size, const char* what)
{
if (UNLIKELY(!vector.tryReserveCapacity(size))) {
- fail(Locker { m_lock }, WTF::makeString("Failed allocating enough space for ", size, what));
+ Locker locker { m_lock };
+ fail(WTF::makeString("Failed allocating enough space for ", size, what));
return false;
}
return true;
Modified: trunk/Source/_javascript_Core/wasm/WasmLLIntPlan.cpp (278092 => 278093)
--- trunk/Source/_javascript_Core/wasm/WasmLLIntPlan.cpp 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/wasm/WasmLLIntPlan.cpp 2021-05-26 18:35:03 UTC (rev 278093)
@@ -90,7 +90,7 @@
Locker locker { m_lock };
if (!m_errorMessage) {
// Multiple compiles could fail simultaneously. We arbitrarily choose the first.
- fail(locker, makeString(parseAndCompileResult.error(), ", in function at index ", String::number(functionIndex))); // FIXME make this an Expected.
+ fail(makeString(parseAndCompileResult.error(), ", in function at index ", String::number(functionIndex))); // FIXME make this an Expected.
}
m_currentIndex = m_moduleInformation->functions.size();
return;
@@ -99,7 +99,7 @@
m_wasmInternalFunctions[functionIndex] = WTFMove(*parseAndCompileResult);
}
-void LLIntPlan::didCompleteCompilation(const AbstractLocker& locker)
+void LLIntPlan::didCompleteCompilation()
{
unsigned functionCount = m_wasmInternalFunctions.size();
if (!m_callees && functionCount) {
@@ -129,7 +129,7 @@
LinkBuffer linkBuffer(jit, GLOBAL_THUNK_ID, LinkBuffer::Profile::Wasm, JITCompilationCanFail);
if (UNLIKELY(linkBuffer.didFailToAllocate())) {
- Base::fail(locker, "Out of executable memory in Wasm LLInt entry thunks");
+ Base::fail("Out of executable memory in Wasm LLInt entry thunks");
return;
}
@@ -156,7 +156,7 @@
LinkBuffer linkBuffer(jit, nullptr, LinkBuffer::Profile::Wasm, JITCompilationCanFail);
if (UNLIKELY(linkBuffer.didFailToAllocate())) {
- Base::fail(locker, makeString("Out of executable memory in function entrypoint at index ", String::number(functionIndex)));
+ Base::fail(makeString("Out of executable memory in function entrypoint at index ", String::number(functionIndex)));
return;
}
@@ -191,7 +191,8 @@
void LLIntPlan::completeInStreaming()
{
- complete(Locker { m_lock });
+ Locker locker { m_lock };
+ complete();
}
void LLIntPlan::didCompileFunctionInStreaming()
@@ -204,7 +205,7 @@
{
Locker locker { m_lock };
if (!m_errorMessage)
- fail(locker, WTFMove(message));
+ fail(WTFMove(message));
}
void LLIntPlan::work(CompilationEffort effort)
Modified: trunk/Source/_javascript_Core/wasm/WasmLLIntPlan.h (278092 => 278093)
--- trunk/Source/_javascript_Core/wasm/WasmLLIntPlan.h 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/wasm/WasmLLIntPlan.h 2021-05-26 18:35:03 UTC (rev 278093)
@@ -85,7 +85,7 @@
private:
bool prepareImpl() final;
- void didCompleteCompilation(const AbstractLocker&) final;
+ void didCompleteCompilation() WTF_REQUIRES_LOCK(m_lock) final;
Vector<std::unique_ptr<FunctionCodeBlock>> m_wasmInternalFunctions;
const Ref<LLIntCallee>* m_callees { nullptr };
Modified: trunk/Source/_javascript_Core/wasm/WasmOMGForOSREntryPlan.cpp (278092 => 278093)
--- trunk/Source/_javascript_Core/wasm/WasmOMGForOSREntryPlan.cpp 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/wasm/WasmOMGForOSREntryPlan.cpp 2021-05-26 18:35:03 UTC (rev 278093)
@@ -78,7 +78,8 @@
auto parseAndCompileResult = parseAndCompile(context, function, signature, unlinkedCalls, osrEntryScratchBufferSize, m_moduleInformation.get(), m_mode, CompilationMode::OMGForOSREntryMode, m_functionIndex, m_loopIndex);
if (UNLIKELY(!parseAndCompileResult)) {
- fail(Locker { m_lock }, makeString(parseAndCompileResult.error(), "when trying to tier up ", String::number(m_functionIndex)));
+ Locker locker { m_lock };
+ fail(makeString(parseAndCompileResult.error(), "when trying to tier up ", String::number(m_functionIndex)));
return;
}
@@ -85,7 +86,8 @@
Entrypoint omgEntrypoint;
LinkBuffer linkBuffer(*context.wasmEntrypointJIT, nullptr, LinkBuffer::Profile::Wasm, JITCompilationCanFail);
if (UNLIKELY(linkBuffer.didFailToAllocate())) {
- Base::fail(Locker { m_lock }, makeString("Out of executable memory while tiering up function at index ", String::number(m_functionIndex)));
+ Locker locker { m_lock };
+ Base::fail(makeString("Out of executable memory while tiering up function at index ", String::number(m_functionIndex)));
return;
}
@@ -137,7 +139,8 @@
}
}
dataLogLnIf(WasmOMGForOSREntryPlanInternal::verbose, "Finished OMGForOSREntry ", m_functionIndex);
- complete(Locker { m_lock });
+ Locker locker { m_lock };
+ complete();
}
} } // namespace JSC::Wasm
Modified: trunk/Source/_javascript_Core/wasm/WasmOMGForOSREntryPlan.h (278092 => 278093)
--- trunk/Source/_javascript_Core/wasm/WasmOMGForOSREntryPlan.h 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/wasm/WasmOMGForOSREntryPlan.h 2021-05-26 18:35:03 UTC (rev 278093)
@@ -55,10 +55,10 @@
using Base::m_lock;
bool isComplete() const final { return m_completed; }
- void complete(const AbstractLocker& locker) final
+ void complete() WTF_REQUIRES_LOCK(m_lock) final
{
m_completed = true;
- runCompletionTasks(locker);
+ runCompletionTasks();
}
Ref<Module> m_module;
Modified: trunk/Source/_javascript_Core/wasm/WasmOMGPlan.cpp (278092 => 278093)
--- trunk/Source/_javascript_Core/wasm/WasmOMGPlan.cpp 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/wasm/WasmOMGPlan.cpp 2021-05-26 18:35:03 UTC (rev 278093)
@@ -75,7 +75,8 @@
auto parseAndCompileResult = parseAndCompile(context, function, signature, unlinkedCalls, osrEntryScratchBufferSize, m_moduleInformation.get(), m_mode, CompilationMode::OMGMode, m_functionIndex, UINT32_MAX);
if (UNLIKELY(!parseAndCompileResult)) {
- fail(Locker { m_lock }, makeString(parseAndCompileResult.error(), "when trying to tier up ", String::number(m_functionIndex)));
+ Locker locker { m_lock };
+ fail(makeString(parseAndCompileResult.error(), "when trying to tier up ", String::number(m_functionIndex)));
return;
}
@@ -82,7 +83,8 @@
Entrypoint omgEntrypoint;
LinkBuffer linkBuffer(*context.wasmEntrypointJIT, nullptr, LinkBuffer::Profile::Wasm, JITCompilationCanFail);
if (UNLIKELY(linkBuffer.didFailToAllocate())) {
- Base::fail(Locker { m_lock }, makeString("Out of executable memory while tiering up function at index ", String::number(m_functionIndex)));
+ Locker locker { m_lock };
+ Base::fail(makeString("Out of executable memory while tiering up function at index ", String::number(m_functionIndex)));
return;
}
@@ -136,7 +138,8 @@
}
dataLogLnIf(WasmOMGPlanInternal::verbose, "Finished OMG ", m_functionIndex);
- complete(Locker { m_lock });
+ Locker locker { m_lock };
+ complete();
}
} } // namespace JSC::Wasm
Modified: trunk/Source/_javascript_Core/wasm/WasmOMGPlan.h (278092 => 278093)
--- trunk/Source/_javascript_Core/wasm/WasmOMGPlan.h 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/wasm/WasmOMGPlan.h 2021-05-26 18:35:03 UTC (rev 278093)
@@ -53,10 +53,10 @@
using Base::m_lock;
bool isComplete() const final { return m_completed; }
- void complete(const AbstractLocker& locker) final
+ void complete() WTF_REQUIRES_LOCK(m_lock) final
{
m_completed = true;
- runCompletionTasks(locker);
+ runCompletionTasks();
}
Ref<Module> m_module;
Modified: trunk/Source/_javascript_Core/wasm/WasmPlan.cpp (278092 => 278093)
--- trunk/Source/_javascript_Core/wasm/WasmPlan.cpp 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/wasm/WasmPlan.cpp 2021-05-26 18:35:03 UTC (rev 278093)
@@ -52,7 +52,7 @@
m_completionTasks.append(std::make_pair(context, WTFMove(task)));
}
-void Plan::runCompletionTasks(const AbstractLocker&)
+void Plan::runCompletionTasks()
{
ASSERT(isComplete() && !hasWork());
@@ -106,7 +106,7 @@
// FIXME: Make 0 index not so magical: https://bugs.webkit.org/show_bug.cgi?id=171395
if (m_completionTasks.isEmpty() || (m_completionTasks.size() == 1 && !m_completionTasks[0].first)) {
- fail(locker, "WebAssembly Plan was cancelled. If you see this error message please file a bug at bugs.webkit.org!"_s);
+ fail("WebAssembly Plan was cancelled. If you see this error message please file a bug at bugs.webkit.org!"_s);
return true;
}
@@ -113,7 +113,7 @@
return false;
}
-void Plan::fail(const AbstractLocker& locker, String&& errorMessage)
+void Plan::fail(String&& errorMessage)
{
if (failed())
return;
@@ -120,7 +120,7 @@
ASSERT(errorMessage);
dataLogLnIf(WasmPlanInternal::verbose, "failing with message: ", errorMessage);
m_errorMessage = WTFMove(errorMessage);
- complete(locker);
+ complete();
}
#if ENABLE(WEBASSEMBLY_B3JIT)
Modified: trunk/Source/_javascript_Core/wasm/WasmPlan.h (278092 => 278093)
--- trunk/Source/_javascript_Core/wasm/WasmPlan.h 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/wasm/WasmPlan.h 2021-05-26 18:35:03 UTC (rev 278093)
@@ -78,11 +78,11 @@
bool tryRemoveContextAndCancelIfLast(Context&);
protected:
- void runCompletionTasks(const AbstractLocker&);
- void fail(const AbstractLocker&, String&& errorMessage);
+ void runCompletionTasks() WTF_REQUIRES_LOCK(m_lock);
+ void fail(String&& errorMessage) WTF_REQUIRES_LOCK(m_lock);
virtual bool isComplete() const = 0;
- virtual void complete(const AbstractLocker&) = 0;
+ virtual void complete() WTF_REQUIRES_LOCK(m_lock) = 0;
#if ENABLE(WEBASSEMBLY_B3JIT)
static void updateCallSitesToCallUs(CodeBlock&, CodeLocationLabel<WasmEntryPtrTag> entrypoint, uint32_t functionIndex, uint32_t functionIndexSpace);
@@ -94,8 +94,8 @@
String m_errorMessage;
MemoryMode m_mode { MemoryMode::BoundsChecking };
- UncheckedLock m_lock;
- UncheckedCondition m_completed;
+ Lock m_lock;
+ Condition m_completed;
};
Modified: trunk/Source/_javascript_Core/wasm/WasmStreamingCompiler.cpp (278092 => 278093)
--- trunk/Source/_javascript_Core/wasm/WasmStreamingCompiler.cpp 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/wasm/WasmStreamingCompiler.cpp 2021-05-26 18:35:03 UTC (rev 278093)
@@ -101,7 +101,7 @@
m_remainingCompilationRequests--;
if (!m_remainingCompilationRequests)
m_plan->didCompileFunctionInStreaming();
- completeIfNecessary(locker);
+ completeIfNecessary();
}
void StreamingCompiler::didFinishParsing()
@@ -115,7 +115,7 @@
}
}
-void StreamingCompiler::completeIfNecessary(const AbstractLocker& locker)
+void StreamingCompiler::completeIfNecessary()
{
if (m_eagerFailed)
return;
@@ -122,11 +122,11 @@
if (!m_remainingCompilationRequests && m_finalized) {
m_plan->completeInStreaming();
- didComplete(locker);
+ didComplete();
}
}
-void StreamingCompiler::didComplete(const AbstractLocker&)
+void StreamingCompiler::didComplete()
{
auto makeValidationResult = [](JSC::Wasm::LLIntPlan& plan) -> Module::ValidationResult {
@@ -193,7 +193,7 @@
{
Locker locker { m_lock };
m_finalized = true;
- completeIfNecessary(locker);
+ completeIfNecessary();
}
}
Modified: trunk/Source/_javascript_Core/wasm/WasmStreamingCompiler.h (278092 => 278093)
--- trunk/Source/_javascript_Core/wasm/WasmStreamingCompiler.h 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/wasm/WasmStreamingCompiler.h 2021-05-26 18:35:03 UTC (rev 278093)
@@ -62,15 +62,15 @@
bool didReceiveFunctionData(unsigned, const FunctionData&) final;
void didFinishParsing() final;
- void didComplete(const AbstractLocker&);
- void completeIfNecessary(const AbstractLocker&);
+ void didComplete() WTF_REQUIRES_LOCK(m_lock);
+ void completeIfNecessary() WTF_REQUIRES_LOCK(m_lock);
VM& m_vm;
CompilerMode m_compilerMode;
- bool m_eagerFailed { false };
- bool m_finalized { false };
+ bool m_eagerFailed WTF_GUARDED_BY_LOCK(m_lock) { false };
+ bool m_finalized WTF_GUARDED_BY_LOCK(m_lock) { false };
bool m_threadedCompilationStarted { false };
- UncheckedLock m_lock;
+ Lock m_lock;
unsigned m_remainingCompilationRequests { 0 };
JSPromise* m_promise; // Raw pointer, but held by DeferredWorkTimer.
Ref<Wasm::ModuleInformation> m_info;
Modified: trunk/Source/_javascript_Core/wasm/WasmStreamingPlan.cpp (278092 => 278093)
--- trunk/Source/_javascript_Core/wasm/WasmStreamingPlan.cpp 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/wasm/WasmStreamingPlan.cpp 2021-05-26 18:35:03 UTC (rev 278093)
@@ -54,7 +54,8 @@
{
m_plan->compileFunction(m_functionIndex);
dataLogLnIf(WasmStreamingPlanInternal::verbose, "Finished Streaming ", m_functionIndex);
- complete(Locker { m_lock });
+ Locker locker { m_lock };
+ complete();
}
} } // namespace JSC::Wasm
Modified: trunk/Source/_javascript_Core/wasm/WasmStreamingPlan.h (278092 => 278093)
--- trunk/Source/_javascript_Core/wasm/WasmStreamingPlan.h 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/wasm/WasmStreamingPlan.h 2021-05-26 18:35:03 UTC (rev 278093)
@@ -54,10 +54,10 @@
using Base::m_lock;
bool isComplete() const final { return m_completed; }
- void complete(const AbstractLocker& locker) final
+ void complete() WTF_REQUIRES_LOCK(m_lock) final
{
m_completed = true;
- runCompletionTasks(locker);
+ runCompletionTasks();
}
Ref<LLIntPlan> m_plan;
Modified: trunk/Source/_javascript_Core/wasm/WasmThunks.h (278092 => 278093)
--- trunk/Source/_javascript_Core/wasm/WasmThunks.h 2021-05-26 17:40:36 UTC (rev 278092)
+++ trunk/Source/_javascript_Core/wasm/WasmThunks.h 2021-05-26 18:35:03 UTC (rev 278093)
@@ -55,7 +55,7 @@
Thunks() = default;
HashMap<ThunkGenerator, MacroAssemblerCodeRef<JITThunkPtrTag>> m_stubs;
- UncheckedLock m_lock;
+ Lock m_lock;
};
} } // namespace JSC::Wasm