aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4engine.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2024-09-25 14:45:39 +0200
committerUlf Hermann <ulf.hermann@qt.io>2024-09-27 18:42:08 +0200
commit9a9a2184cefb777457984c965416c7ebf4c22e1a (patch)
tree07d3c74ba0c6c222d1ab0f19bbb88de1af981f6f /src/qml/jsruntime/qv4engine.cpp
parent4d1dd6387b2a06114a32b879bc250abfc89b42c6 (diff)
QtQml: Disable AOT compiled code when QML-previewing
We cannot replace AOT-compiled compilation units while an object is still holding on to them and we cannot delete all objects holding on to a CU because they might not belong to the preview to begin with. Pick-to: 6.8 6.5 Fixes: QTBUG-129329 Change-Id: Icbcb7822be770a440f3216955c0ae51151390e17 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4engine.cpp')
-rw-r--r--src/qml/jsruntime/qv4engine.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index b392ba4807..e80c15f785 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -106,7 +106,8 @@ using namespace QV4;
// odd while the statics are being initialized, and stays even afterwards.
// Any further engines created while the statics are being initialized busy-wait until engineSerial
// is even.
-static QBasicAtomicInt engineSerial = Q_BASIC_ATOMIC_INITIALIZER(1);
+Q_CONSTINIT static QBasicAtomicInt engineSerial = Q_BASIC_ATOMIC_INITIALIZER(1);
+Q_CONSTINIT static QBasicAtomicInt hasPreview = Q_BASIC_ATOMIC_INITIALIZER(0);
int ExecutionEngine::s_maxCallDepth = -1;
int ExecutionEngine::s_jitCallCountThreshold = 3;
int ExecutionEngine::s_maxJSStackSize = 4 * 1024 * 1024;
@@ -896,6 +897,12 @@ void ExecutionEngine::setProfiler(Profiling::Profiler *profiler)
Q_ASSERT(!m_profiler);
m_profiler.reset(profiler);
}
+
+void ExecutionEngine::setPreviewing(bool enabled)
+{
+ hasPreview.storeRelease(enabled);
+}
+
#endif // QT_CONFIG(qml_debug)
void ExecutionEngine::initRootContext()
@@ -2204,7 +2211,9 @@ ExecutionEngine::DiskCacheOptions ExecutionEngine::diskCacheOptions() const
return DiskCache::Disabled;
static const DiskCacheOptions options = qmlGetConfigOption<
DiskCacheOptions, transFormDiskCache>("QML_DISK_CACHE");
- return options;
+ return hasPreview.loadAcquire()
+ ? (options & ~DiskCacheOptions(DiskCache::Aot)) // Disable AOT if preview enabled
+ : options;
}
void ExecutionEngine::callInContext(QV4::Function *function, QObject *self,