Ignore:
Timestamp:
May 23, 2021, 10:37:41 PM (4 years ago)
Author:
Chris Dumez
Message:

Make CheckedLock the default Lock
https://bugs.webkit.org/show_bug.cgi?id=226157

Reviewed by Darin Adler.

Make CheckedLock the default Lock so that we get more benefits from Clang
Thread Safety Analysis. Note that CheckedLock 100% relies on the existing
Source/JavaScriptCore:

Lock implementation and merely adds the clang anotations for thread
safety.

That this patch does is:

  1. Rename the Lock class to UncheckedLock
  2. Rename the CheckedLock class to Lock
  3. Rename the Condition class to UncheckedCondition
  4. Rename the CheckedCondition class to Condition
  5. Update the types of certain variables from Lock / Condition to UncheckedLock / UncheckedCondition if I got a build failure. Build failures are usually caused by the following facts:
    • Locker<CheckedLock> doesn't subclass AbstractLocker which a lot of JSC code passes as argument
    • Locker<CheckedLock> has no move constructor
    • Locker<CheckedLock> cannot be constructed from a lock pointer, only a reference

For now, CheckedLock and CheckedCondition remain as aliases to Lock and
Condition, in their respective CheckedLock.h / CheckedCondition.h headers.
I will drop them in a follow-up to reduce patch size.

I will also follow-up to try and get rid of as much usage of UncheckedLock
and UncheckedCondition as possible. I did not try very hard in this patch
to reduce patch size.

  • assembler/testmasm.cpp:
  • dfg/DFGCommon.cpp:
  • dfg/DFGThreadData.h:
  • dfg/DFGWorklist.cpp:

(JSC::DFG::Worklist::Worklist):

  • dfg/DFGWorklist.h:
  • dynbench.cpp:
  • heap/BlockDirectory.h:

(JSC::BlockDirectory::bitvectorLock):

  • heap/CodeBlockSet.h:

(JSC::CodeBlockSet::getLock):

  • heap/Heap.cpp:

(JSC::Heap::Heap):

  • heap/Heap.h:
  • heap/MarkedSpace.h:

(JSC::MarkedSpace::directoryLock):

  • heap/MarkingConstraintSolver.h:
  • heap/SlotVisitor.cpp:

(JSC::SlotVisitor::donateKnownParallel):

  • heap/SlotVisitor.h:
  • jit/ExecutableAllocator.cpp:

(JSC::ExecutableAllocator::getLock const):
(JSC::dumpJITMemory):

  • jit/ExecutableAllocator.h:

(JSC::ExecutableAllocatorBase::getLock const):

  • jit/JITWorklist.cpp:

(JSC::JITWorklist::JITWorklist):

  • jit/JITWorklist.h:
  • jsc.cpp:
  • profiler/ProfilerDatabase.h:
  • runtime/ConcurrentJSLock.h:
  • runtime/DeferredWorkTimer.h:
  • runtime/JSLock.h:
  • runtime/SamplingProfiler.cpp:

(JSC::FrameWalker::FrameWalker):
(JSC::CFrameWalker::CFrameWalker):
(JSC::SamplingProfiler::takeSample):

  • runtime/SamplingProfiler.h:

(JSC::SamplingProfiler::getLock):

  • runtime/VM.h:
  • runtime/VMTraps.cpp:

(JSC::VMTraps::invalidateCodeBlocksOnStack):
(JSC::VMTraps::VMTraps):

  • runtime/VMTraps.h:
  • tools/FunctionOverrides.h:
  • tools/VMInspector.cpp:

(JSC::ensureIsSafeToLock):

  • tools/VMInspector.h:

(JSC::VMInspector::getLock):

  • wasm/WasmCalleeRegistry.h:

(JSC::Wasm::CalleeRegistry::getLock):

  • wasm/WasmPlan.h:
  • wasm/WasmStreamingCompiler.h:
  • wasm/WasmThunks.h:
  • wasm/WasmWorklist.cpp:

(JSC::Wasm::Worklist::Worklist):

  • wasm/WasmWorklist.h:

Source/WebCore:

Lock implementation and merely adds the clang anotations for thread
safety.

That this patch does is:

  1. Rename the Lock class to UncheckedLock
  2. Rename the CheckedLock class to Lock
  3. Rename the Condition class to UncheckedCondition
  4. Rename the CheckedCondition class to Condition
  5. Update the types of certain variables from Lock / Condition to UncheckedLock / UncheckedCondition if I got a build failure. Build failures are usually caused by the following facts:
    • Locker<CheckedLock> doesn't subclass AbstractLocker which a lot of JSC code passes as argument
    • Locker<CheckedLock> has no move constructor
    • Locker<CheckedLock> cannot be constructed from a lock pointer, only a reference

For now, CheckedLock and CheckedCondition remain as aliases to Lock and
Condition, in their respective CheckedLock.h / CheckedCondition.h headers.
I will drop them in a follow-up to reduce patch size.

I will also follow-up to try and get rid of as much usage of UncheckedLock
and UncheckedCondition as possible. I did not try very hard in this patch
to reduce patch size.

  • Modules/indexeddb/server/IDBServer.cpp:
  • Modules/webaudio/MediaElementAudioSourceNode.h:
  • Modules/webdatabase/OriginLock.cpp:
  • bindings/js/JSDOMGlobalObject.h:
  • dom/Node.cpp:
  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::createMediaPlayer):

  • html/canvas/WebGLContextGroup.cpp:

(WebCore::WebGLContextGroup::objectGraphLockForAContext):

  • html/canvas/WebGLContextGroup.h:
  • html/canvas/WebGLContextObject.cpp:

(WebCore::WebGLContextObject::objectGraphLockForContext):

  • html/canvas/WebGLContextObject.h:
  • html/canvas/WebGLObject.h:
  • html/canvas/WebGLRenderingContextBase.cpp:

(WebCore::WebGLRenderingContextBase::objectGraphLock):

  • html/canvas/WebGLRenderingContextBase.h:
  • html/canvas/WebGLSharedObject.cpp:

(WebCore::WebGLSharedObject::objectGraphLockForContext):

  • html/canvas/WebGLSharedObject.h:
  • page/scrolling/mac/ScrollingTreeMac.h:
  • platform/audio/ReverbConvolver.cpp:

(WebCore::ReverbConvolver::backgroundThreadEntry):

  • platform/graphics/ShadowBlur.cpp:

(WebCore::ScratchBuffer::lock):
(WebCore::ShadowBlur::drawRectShadowWithTiling):
(WebCore::ShadowBlur::drawInsetShadowWithTiling):

  • platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
  • platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:

Source/WebKit:

Lock implementation and merely adds the clang anotations for thread
safety.

That this patch does is:

  1. Rename the Lock class to UncheckedLock
  2. Rename the CheckedLock class to Lock
  3. Rename the Condition class to UncheckedCondition
  4. Rename the CheckedCondition class to Condition
  5. Update the types of certain variables from Lock / Condition to UncheckedLock / UncheckedCondition if I got a build failure. Build failures are usually caused by the following facts:
    • Locker<CheckedLock> doesn't subclass AbstractLocker which a lot of JSC code passes as argument
    • Locker<CheckedLock> has no move constructor
    • Locker<CheckedLock> cannot be constructed from a lock pointer, only a reference

For now, CheckedLock and CheckedCondition remain as aliases to Lock and
Condition, in their respective CheckedLock.h / CheckedCondition.h headers.
I will drop them in a follow-up to reduce patch size.

I will also follow-up to try and get rid of as much usage of UncheckedLock
and UncheckedCondition as possible. I did not try very hard in this patch
to reduce patch size.

  • GPUProcess/graphics/RemoteGraphicsContextGL.cpp:

(WebKit::RemoteGraphicsContextGL::paintPixelBufferToImageBuffer):

  • NetworkProcess/IndexedDB/WebIDBServer.cpp:
  • UIProcess/API/glib/IconDatabase.h:
  • UIProcess/mac/WKPrintingView.mm:

(-[WKPrintingView knowsPageRange:]):

Source/WTF:

Lock implementation and merely adds the clang anotations for thread
safety.

That this patch does is:

  1. Rename the Lock class to UncheckedLock
  2. Rename the CheckedLock class to Lock
  3. Rename the Condition class to UncheckedCondition
  4. Rename the CheckedCondition class to Condition
  5. Update the types of certain variables from Lock / Condition to UncheckedLock / UncheckedCondition if I got a build failure. Build failures are usually caused by the following facts:
    • Locker<CheckedLock> doesn't subclass AbstractLocker which a lot of JSC code passes as argument
    • Locker<CheckedLock> has no move constructor
    • Locker<CheckedLock> cannot be constructed from a lock pointer, only a reference

For now, CheckedLock and CheckedCondition remain as aliases to Lock and
Condition, in their respective CheckedLock.h / CheckedCondition.h headers.
I will drop them in a follow-up to reduce patch size.

I will also follow-up to try and get rid of as much usage of UncheckedLock
and UncheckedCondition as possible. I did not try very hard in this patch
to reduce patch size.

  • wtf/AutomaticThread.cpp:

(WTF::AutomaticThreadCondition::wait):
(WTF::AutomaticThreadCondition::waitFor):
(WTF::AutomaticThread::AutomaticThread):

  • wtf/AutomaticThread.h:
  • wtf/CheckedCondition.h:
  • wtf/CheckedLock.h:
  • wtf/Condition.h:
  • wtf/Lock.cpp:

(WTF::UncheckedLock::lockSlow):
(WTF::UncheckedLock::unlockSlow):
(WTF::UncheckedLock::unlockFairlySlow):
(WTF::UncheckedLock::safepointSlow):

  • wtf/Lock.h:

(WTF::WTF_ASSERTS_ACQUIRED_LOCK):

  • wtf/MetaAllocator.cpp:

(WTF::MetaAllocator::release):
(WTF::MetaAllocator::MetaAllocator):
(WTF::MetaAllocator::allocate):
(WTF::MetaAllocator::currentStatistics):

  • wtf/MetaAllocator.h:
  • wtf/ParallelHelperPool.cpp:

(WTF::ParallelHelperPool::ParallelHelperPool):

  • wtf/ParallelHelperPool.h:
  • wtf/RecursiveLockAdapter.h:
  • wtf/WorkerPool.cpp:

(WTF::WorkerPool::WorkerPool):

  • wtf/WorkerPool.h:

Tools:

Lock implementation and merely adds the clang anotations for thread
safety.

That this patch does is:

  1. Rename the Lock class to UncheckedLock
  2. Rename the CheckedLock class to Lock
  3. Rename the Condition class to UncheckedCondition
  4. Rename the CheckedCondition class to Condition
  5. Update the types of certain variables from Lock / Condition to UncheckedLock / UncheckedCondition if I got a build failure. Build failures are usually caused by the following facts:
    • Locker<CheckedLock> doesn't subclass AbstractLocker which a lot of JSC code passes as argument
    • Locker<CheckedLock> has no move constructor
    • Locker<CheckedLock> cannot be constructed from a lock pointer, only a reference

For now, CheckedLock and CheckedCondition remain as aliases to Lock and
Condition, in their respective CheckedLock.h / CheckedCondition.h headers.
I will drop them in a follow-up to reduce patch size.

I will also follow-up to try and get rid of as much usage of UncheckedLock
and UncheckedCondition as possible. I did not try very hard in this patch
to reduce patch size.

  • TestWebKitAPI/Tests/WTF/CheckedConditionTest.cpp:
  • TestWebKitAPI/Tests/WTF/Condition.cpp:
  • TestWebKitAPI/Tests/WTF/MetaAllocator.cpp:
  • WebKitTestRunner/InjectedBundle/AccessibilityController.cpp:

(WTR::AXThread::createThreadIfNeeded):

File:
1 edited

Legend:

Unmodified
Added
Removed
Note: See TracChangeset for help on using the changeset viewer.