Title: [279961] trunk
- Revision
- 279961
- Author
- mark....@apple.com
- Date
- 2021-07-15 13:42:53 -0700 (Thu, 15 Jul 2021)
Log Message
JITWorklist::waitUntilAllPlansForVMAreReady() should also be notified when plans are cancelled.
https://bugs.webkit.org/show_bug.cgi?id=228003
rdar://78314543
Reviewed by Yusuke Suzuki.
JSTests:
* stress/waitUntilAllPlansForVMAreReady-should-be-notified-of-cancelled-plans-too.js: Added.
Source/_javascript_Core:
Previously, it only gets notified when plans are done compiling. As a result, if
JITWorklist::waitUntilAllPlansForVMAreReady() found non-ready plans and started
waiting, and those plans were canceled, then JITWorklist::waitUntilAllPlansForVMAreReady()
can hang indefinitely.
This patch renames JITWorklist::::m_planCompiled to m_planCompiledOrCancelled,
and notifies it also when plans are cancelled.
* jit/JITWorklist.cpp:
(JSC::JITWorklist::waitUntilAllPlansForVMAreReady):
(JSC::JITWorklist::removeMatchingPlansForVM):
* jit/JITWorklist.h:
* jit/JITWorklistThread.cpp:
(JSC::JITWorklistThread::work):
Modified Paths
Added Paths
Diff
Modified: trunk/JSTests/ChangeLog (279960 => 279961)
--- trunk/JSTests/ChangeLog 2021-07-15 20:40:06 UTC (rev 279960)
+++ trunk/JSTests/ChangeLog 2021-07-15 20:42:53 UTC (rev 279961)
@@ -1,3 +1,13 @@
+2021-07-15 Mark Lam <mark....@apple.com>
+
+ JITWorklist::waitUntilAllPlansForVMAreReady() should also be notified when plans are cancelled.
+ https://bugs.webkit.org/show_bug.cgi?id=228003
+ rdar://78314543
+
+ Reviewed by Yusuke Suzuki.
+
+ * stress/waitUntilAllPlansForVMAreReady-should-be-notified-of-cancelled-plans-too.js: Added.
+
2021-07-14 Devin Rousso <drou...@apple.com>
Implement Array.prototype.findLast and Array.prototype.findLastIndex
Added: trunk/JSTests/stress/waitUntilAllPlansForVMAreReady-should-be-notified-of-cancelled-plans-too.js (0 => 279961)
--- trunk/JSTests/stress/waitUntilAllPlansForVMAreReady-should-be-notified-of-cancelled-plans-too.js (rev 0)
+++ trunk/JSTests/stress/waitUntilAllPlansForVMAreReady-should-be-notified-of-cancelled-plans-too.js 2021-07-15 20:42:53 UTC (rev 279961)
@@ -0,0 +1,5 @@
+//@ requireOptions("--destroy-vm", "--collectContinuously=true", "--forceMiniVMMode=true")
+
+// This test passes if it does not hang or crash.
+let a = new Uint8Array(10000);
+for (let x of a) {}
Modified: trunk/Source/_javascript_Core/ChangeLog (279960 => 279961)
--- trunk/Source/_javascript_Core/ChangeLog 2021-07-15 20:40:06 UTC (rev 279960)
+++ trunk/Source/_javascript_Core/ChangeLog 2021-07-15 20:42:53 UTC (rev 279961)
@@ -1,3 +1,26 @@
+2021-07-15 Mark Lam <mark....@apple.com>
+
+ JITWorklist::waitUntilAllPlansForVMAreReady() should also be notified when plans are cancelled.
+ https://bugs.webkit.org/show_bug.cgi?id=228003
+ rdar://78314543
+
+ Reviewed by Yusuke Suzuki.
+
+ Previously, it only gets notified when plans are done compiling. As a result, if
+ JITWorklist::waitUntilAllPlansForVMAreReady() found non-ready plans and started
+ waiting, and those plans were canceled, then JITWorklist::waitUntilAllPlansForVMAreReady()
+ can hang indefinitely.
+
+ This patch renames JITWorklist::::m_planCompiled to m_planCompiledOrCancelled,
+ and notifies it also when plans are cancelled.
+
+ * jit/JITWorklist.cpp:
+ (JSC::JITWorklist::waitUntilAllPlansForVMAreReady):
+ (JSC::JITWorklist::removeMatchingPlansForVM):
+ * jit/JITWorklist.h:
+ * jit/JITWorklistThread.cpp:
+ (JSC::JITWorklistThread::work):
+
2021-07-15 Yusuke Suzuki <ysuz...@apple.com>
[JSC] Add samplingProfilerIgnoreExternalSourceID option
Modified: trunk/Source/_javascript_Core/jit/JITWorklist.cpp (279960 => 279961)
--- trunk/Source/_javascript_Core/jit/JITWorklist.cpp 2021-07-15 20:40:06 UTC (rev 279960)
+++ trunk/Source/_javascript_Core/jit/JITWorklist.cpp 2021-07-15 20:42:53 UTC (rev 279961)
@@ -204,7 +204,7 @@
if (allAreCompiled)
break;
- m_planCompiled.wait(*m_lock);
+ m_planCompiledOrCancelled.wait(*m_lock);
}
}
@@ -333,6 +333,7 @@
RELEASE_ASSERT(plan->stage() != JITPlanStage::Canceled);
deadPlanKeys.add(plan->key());
}
+ bool didCancelPlans = !deadPlanKeys.isEmpty();
for (JITCompilationKey key : deadPlanKeys)
m_plans.take(key)->cancel();
for (auto& queue : m_queues) {
@@ -350,6 +351,8 @@
m_readyPlans[i--] = m_readyPlans.last();
m_readyPlans.removeLast();
}
+ if (didCancelPlans)
+ m_planCompiledOrCancelled.notifyAll();
}
} // namespace JSC
Modified: trunk/Source/_javascript_Core/jit/JITWorklist.h (279960 => 279961)
--- trunk/Source/_javascript_Core/jit/JITWorklist.h 2021-07-15 20:40:06 UTC (rev 279960)
+++ trunk/Source/_javascript_Core/jit/JITWorklist.h 2021-07-15 20:42:53 UTC (rev 279961)
@@ -122,7 +122,7 @@
Box<Lock> m_lock;
Ref<AutomaticThreadCondition> m_planEnqueued;
- Condition m_planCompiled;
+ Condition m_planCompiledOrCancelled;
};
} // namespace JSC
Modified: trunk/Source/_javascript_Core/jit/JITWorklistThread.cpp (279960 => 279961)
--- trunk/Source/_javascript_Core/jit/JITWorklistThread.cpp 2021-07-15 20:40:06 UTC (rev 279960)
+++ trunk/Source/_javascript_Core/jit/JITWorklistThread.cpp 2021-07-15 20:42:53 UTC (rev 279961)
@@ -142,7 +142,7 @@
RELEASE_ASSERT(!m_plan->vm()->heap.worldIsStopped());
m_worklist.m_readyPlans.append(WTFMove(m_plan));
- m_worklist.m_planCompiled.notifyAll();
+ m_worklist.m_planCompiledOrCancelled.notifyAll();
}
return WorkResult::Continue;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes