Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 63bd9144ba3f5d941572d4f865b711b6f62d8e95
https://github.com/WebKit/WebKit/commit/63bd9144ba3f5d941572d4f865b711b6f62d8e95
Author: Chris Dumez <[email protected]>
Date: 2025-11-15 (Sat, 15 Nov 2025)
Changed paths:
M Source/JavaScriptCore/jit/ExecutableAllocator.cpp
M Source/WTF/SaferCPPExpectations/NoUncountedMemberCheckerExpectations
M Source/WTF/wtf/MetaAllocator.cpp
M Source/WTF/wtf/MetaAllocator.h
M Source/WTF/wtf/MetaAllocatorHandle.h
M Source/WTF/wtf/RedBlackTree.h
M Source/WTF/wtf/generic/RunLoopGeneric.cpp
M Tools/TestWebKitAPI/Tests/WTF/RedBlackTree.cpp
Log Message:
-----------
Address Safer CPP warnings in RedBlackTree.h
https://bugs.webkit.org/show_bug.cgi?id=302453
rdar://164670950
Reviewed by Yusuke Suzuki.
Have `RedBlackTree::Node` subclass CanMakeCheckedPtr so we can use CheckedPtr
for safety in RedBlackTree. Since some users are using the tree from multiple
threads (with locks), also introduce a new `RedBlackTree::ThreadSafeNode`
which subclasses CanMakeThreadSafeCheckedPtr.
In particular, the following RedBlackTree Node subclasses are used from multiple
threads:
- JSC::Islands in ExecutableAllocator.cpp is used from multiple threads while
holding
a lock:
```
void handleWillBeReleased(const Locker<Lock>& locker,
ExecutableMemoryHandle& handle)
{
if (m_islandsForJumpSourceLocation.isEmpty())
return;
```
with `m_islandsForJumpSourceLocation` being a RedBlackTree of `Islands`.
- WTF::FreeSpaceNode in MetaAllocator.h:
```
size_t MetaAllocator::debugFreeSpaceSize()
{
Locker locker { m_lock };
size_t result = 0;
for (CheckedPtr node = m_freeSpaceSizeMap.first(); node; node =
node->successor())
```
- WTF::MetaAllocatorHandle that is marked as `ThreadSafeRefCounted`.
- RunLoop::TimerBase::ScheduledTask in RunLoopGeneric.cpp that is marked as
`ThreadSafeRefCounted`.
```
inline bool RunLoop::populateTasks(RunMode runMode, Status& statusOfThisLoop,
Deque<Ref<TimerBase::ScheduledTask>>& firedTimers)
{
Locker locker { m_loopLock };
if (runMode == RunMode::Drain) {
MonotonicTime sleepUntil = MonotonicTime::infinity();
if (!m_schedules.isEmpty())
sleepUntil = m_schedules.first()->scheduledTimePoint();
```
with m_schedules being a RedBlackTree of `RunLoop::TimerBase::ScheduledTask`.
* Source/JavaScriptCore/jit/ExecutableAllocator.cpp:
* Source/WTF/SaferCPPExpectations/NoUncountedMemberCheckerExpectations:
* Source/WTF/wtf/MetaAllocator.cpp:
(WTF::MetaAllocator::~MetaAllocator):
(WTF::MetaAllocator::findAndRemoveFreeSpace):
(WTF::MetaAllocator::debugFreeSpaceSize):
(WTF::MetaAllocator::addFreeSpace):
* Source/WTF/wtf/MetaAllocator.h:
(WTF::MetaAllocator::FreeSpaceNode::sizeInBytes): Deleted.
(WTF::MetaAllocator::FreeSpaceNode::key): Deleted.
* Source/WTF/wtf/MetaAllocatorHandle.h:
(WTF::MetaAllocatorHandle::start const): Deleted.
(WTF::MetaAllocatorHandle::end const): Deleted.
(WTF::MetaAllocatorHandle::startAsInteger const): Deleted.
(WTF::MetaAllocatorHandle::endAsInteger const): Deleted.
(WTF::MetaAllocatorHandle::sizeInBytes const): Deleted.
(WTF::MetaAllocatorHandle::containsIntegerAddress const): Deleted.
(WTF::MetaAllocatorHandle::contains const): Deleted.
(WTF::MetaAllocatorHandle::allocator): Deleted.
(WTF::MetaAllocatorHandle::key): Deleted.
* Source/WTF/wtf/RedBlackTree.h:
* Source/WTF/wtf/generic/RunLoopGeneric.cpp:
(WTF::RunLoop::TimerBase::ScheduledTask::create): Deleted.
(WTF::RunLoop::TimerBase::ScheduledTask::ScheduledTask): Deleted.
(WTF::RunLoop::TimerBase::ScheduledTask::fired): Deleted.
(WTF::RunLoop::TimerBase::ScheduledTask::scheduledTimePoint const): Deleted.
(WTF::RunLoop::TimerBase::ScheduledTask::updateReadyTime): Deleted.
(WTF::RunLoop::TimerBase::ScheduledTask::key const): Deleted.
(WTF::RunLoop::TimerBase::ScheduledTask::isScheduled const): Deleted.
(WTF::RunLoop::TimerBase::ScheduledTask::setScheduled): Deleted.
(WTF::RunLoop::TimerBase::ScheduledTask::isActive const): Deleted.
(WTF::RunLoop::TimerBase::ScheduledTask::activate): Deleted.
(WTF::RunLoop::TimerBase::ScheduledTask::deactivate): Deleted.
* Tools/TestWebKitAPI/Tests/WTF/RedBlackTree.cpp:
(TestWebKitAPI::TEST_F(RedBlackTreeTest, Iterate)):
(TestWebKitAPI::TEST_F(RedBlackTreeTest, IterateBackgroundThread)):
(TestWebKitAPI::TestNode::TestNode): Deleted.
(TestWebKitAPI::TestNode::key): Deleted.
Canonical link: https://commits.webkit.org/303083@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications