diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2024-02-09 21:42:59 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2024-03-05 14:06:29 +0100 |
commit | 970828df9c134859d3ceb352e53374c94d1eeb07 (patch) | |
tree | 50247fa914dde92cb2d9f390ad83fd6cecf4be7d /src/qml | |
parent | 2adc2443bbb4d41ee75f9c97be6c3c441dfbecdd (diff) |
Prepare for white allocations during gc(6/9): Engine setup
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 <sami.shalayel@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
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. |