From 970828df9c134859d3ceb352e53374c94d1eeb07 Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Fri, 9 Feb 2024 21:42:59 +0100 Subject: Prepare for white allocations during gc(6/9): Engine setup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We temporarily forbid the GC from running before global object is setup, as our root set marking would otherwise run into issues in incremental mode (we don't revisit roots, and roots don't generally employ write barriers, so we might miss internal classes referenced by the global object). The GC would normally never run while the engine's constructor has not completed, however this does not hold true when QV4_MM_AGGRESSIVE_GC is enabled. Task-number: QTBUG-121910 Change-Id: I08360005f66bb6e6a36da2e16704093398f0d154 Reviewed-by: Sami Shalayel Reviewed-by: Olivier De Cannière Reviewed-by: Ulf Hermann --- src/qml/jsruntime/qv4engine.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 09c763e956..1e72e0e29b 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -370,6 +370,9 @@ ExecutionEngine::ExecutionEngine(QJSEngine *jsEngine) const size_t guardPages = 2 * WTF::pageSize(); memoryManager = new QV4::MemoryManager(this); + // we don't want to run the gc while the initial setup is not done; not even in aggressive mode + memoryManager->gcBlocked = true; + auto cleanup = qScopeGuard([this] { memoryManager->gcBlocked = false; } ); // reserve space for the JS stack // we allow it to grow to a bit more than m_maxJSStackSize, as we can overshoot due to ScopedValues // allocated outside of JIT'ed methods. -- cgit v1.2.3