aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/memory/qv4mmdefs_p.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2017-03-13 14:26:07 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2017-03-17 08:34:57 +0000
commit7efa1e60d24fee9b1745c30965949af78f3fb0f3 (patch)
tree3fda45c6592a86b8240805305274b70ca636a537 /src/qml/memory/qv4mmdefs_p.h
parent4b445c487d00cc85b01ff92b554e3c1cce2de32d (diff)
Fix running of 32-bit JIT code generated on 64-bit hosts
The offsets of members encoded in JIT generated code differ between 32-bit and 64-bit architectures. This patch moves some of the ExecutionEngine members into a separate standard-layout EngineBase class (in line with the same class in commit 2a554434a571dcefd26cf10ef8c5ae8b3b7d66db and subject to merging). By ensuring that the members are stored at pointer intervals, we can translate from host pointer size to target when generating the code. Task-number: QTBUG-58666 Change-Id: I1c38a7da059826848b80fd9972ed073214501386 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/memory/qv4mmdefs_p.h')
-rw-r--r--src/qml/memory/qv4mmdefs_p.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/qml/memory/qv4mmdefs_p.h b/src/qml/memory/qv4mmdefs_p.h
index 588ae21ee0..edae7293ce 100644
--- a/src/qml/memory/qv4mmdefs_p.h
+++ b/src/qml/memory/qv4mmdefs_p.h
@@ -255,6 +255,26 @@ Q_STATIC_ASSERT(sizeof(HeapItem) == Chunk::SlotSize);
Q_STATIC_ASSERT(QT_POINTER_SIZE*8 == Chunk::Bits);
Q_STATIC_ASSERT((1 << Chunk::BitShift) == Chunk::Bits);
+// Base class for the execution engine
+
+#if defined(Q_CC_MSVC) || defined(Q_CC_GNU)
+#pragma pack(push, 1)
+#endif
+struct EngineBase {
+ Heap::ExecutionContext *current = 0;
+
+ Value *jsStackTop = 0;
+ quint32 hasException = false;
+};
+#if defined(Q_CC_MSVC) || defined(Q_CC_GNU)
+#pragma pack(pop)
+#endif
+
+Q_STATIC_ASSERT(std::is_standard_layout<EngineBase>::value);
+Q_STATIC_ASSERT(offsetof(EngineBase, current) == 0);
+Q_STATIC_ASSERT(offsetof(EngineBase, jsStackTop) == offsetof(EngineBase, current) + QT_POINTER_SIZE);
+Q_STATIC_ASSERT(offsetof(EngineBase, hasException) == offsetof(EngineBase, jsStackTop) + QT_POINTER_SIZE);
+
}
QT_END_NAMESPACE