Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 1661ae2e3ef420aa495e0eb0c6c52c116ff9a94f
https://github.com/WebKit/WebKit/commit/1661ae2e3ef420aa495e0eb0c6c52c116ff9a94f
Author: Yusuke Suzuki <[email protected]>
Date: 2026-05-11 (Mon, 11 May 2026)
Changed paths:
M Source/JavaScriptCore/wasm/WasmTypeDefinition.cpp
M Source/JavaScriptCore/wasm/WasmTypeDefinition.h
M Source/WTF/WTF.xcodeproj/project.pbxproj
M Source/WTF/wtf/CMakeLists.txt
A Source/WTF/wtf/ThreadSafeLazyUniquePtr.h
Log Message:
-----------
[WTF] Add ThreadSafeLazyUniquePtr
https://bugs.webkit.org/show_bug.cgi?id=314487
rdar://176696158
Reviewed by Keith Miller.
Point of this class is adding handy class which uses the pattern,
if (oldValue)
return oldValue;
newValue = factory();
if (oldValue = Strong-CAS-with-release(oldValue, nullptr, newValue)) {
destroy newValue;
return oldValue;
}
return newValue;
This removes necessity of locking to publish a new value to the other
thread. We speculatively create a new value and attempt to publish it,
if it failed, we use the already published one. But otherwise, we
install a newly created one. This is ownership wrapped version of
Atomics.h's ensurePointer.
This is something similar to standard C++'s
`std::atomic<std::shared_ptr<T>>`. But it does not offer
`std::atomic<std::unique_ptr<T>>`, so this is why this class exists.
We use this class for IPIntSharedBytecode in RTT. We also remove
storeStoreFence() since now we use "release" to publish a value via strong-CAS.
* Source/JavaScriptCore/wasm/WasmTypeDefinition.cpp:
(JSC::Wasm::RTT::ensureArgumINTBytecode const):
(JSC::Wasm::RTT::ensureUINTBytecode const):
(JSC::Wasm::RTT::ensureCallBytecode const):
(JSC::Wasm::RTT::ensureTailCallBytecode const):
* Source/JavaScriptCore/wasm/WasmTypeDefinition.h:
* Source/WTF/WTF.xcodeproj/project.pbxproj:
* Source/WTF/wtf/CMakeLists.txt:
* Source/WTF/wtf/ThreadSafeLazyUniquePtr.h: Added.
Canonical link: https://commits.webkit.org/313019@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications