Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qv4enginebase_p.h
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3#ifndef QV4ENGINEBASE_P_H
4#define QV4ENGINEBASE_P_H
5
6//
7// W A R N I N G
8// -------------
9//
10// This file is not part of the Qt API. It exists purely as an
11// implementation detail. This header file may change from version to
12// version without notice, or even be removed.
13//
14// We mean it.
15//
16
17#include <private/qv4global_p.h>
18#include <private/qv4runtimeapi_p.h>
19
21
22namespace QV4 {
23
24struct CppStackFrame;
25
26// Base class for the execution engine
27struct Q_QML_EXPORT EngineBase {
28
29 CppStackFrame *currentStackFrame = nullptr;
30
31 Value *jsStackTop = nullptr;
32
33 // The JIT expects hasException and isInterrupted to be in the same 32bit word in memory.
34 quint8 hasException = false;
35 // isInterrupted is expected to be set from a different thread
36#if defined(Q_ATOMIC_INT8_IS_SUPPORTED)
37 QAtomicInteger<quint8> isInterrupted = false;
38 quint16 unused = 0;
39#elif defined(Q_ATOMIC_INT16_IS_SUPPORTED)
40 quint8 unused = 0;
41 QAtomicInteger<quint16> isInterrupted = false;
42#else
43# error V4 needs either 8bit or 16bit atomics.
44#endif
45
46 quint8 isExecutingInRegExpJIT = false;
47 quint8 isInitialized = false;
48 quint8 inShutdown = false;
49 quint8 isGCOngoing = false; // incremental gc is ongoing (but mutator might be running)
50 MemoryManager *memoryManager = nullptr;
51
52 union {
53 const void *cppStackBase = nullptr;
54 struct {
56#if QT_POINTER_SIZE == 8
57 quint32 padding2;
58#endif
59 };
60 };
61 const void *cppStackLimit = nullptr;
62
63 Object *globalObject = nullptr;
64 Value *jsStackLimit = nullptr;
65 Value *jsStackBase = nullptr;
66
67 IdentifierTable *identifierTable = nullptr;
68
69 // Exception handling
70 Value *exceptionValue = nullptr;
71
108 Heap::InternalClass *classes[NClasses];
109 Heap::InternalClass *internalClasses(InternalClassType icType) { return classes[icType]; }
110};
111
112Q_STATIC_ASSERT(std::is_standard_layout<EngineBase>::value);
113Q_STATIC_ASSERT(offsetof(EngineBase, currentStackFrame) == 0);
114Q_STATIC_ASSERT(offsetof(EngineBase, jsStackTop) == offsetof(EngineBase, currentStackFrame) + QT_POINTER_SIZE);
115Q_STATIC_ASSERT(offsetof(EngineBase, hasException) == offsetof(EngineBase, jsStackTop) + QT_POINTER_SIZE);
116Q_STATIC_ASSERT(offsetof(EngineBase, memoryManager) == offsetof(EngineBase, hasException) + 8);
117Q_STATIC_ASSERT(offsetof(EngineBase, isInterrupted) + sizeof(EngineBase::isInterrupted) <= offsetof(EngineBase, hasException) + 4);
119
120}
121
123
124#endif
Combined button and popup list for selecting options.
#define Q_STATIC_ASSERT(Condition)
Definition qassert.h:108
#define QT_POINTER_SIZE
unsigned int quint32
Definition qtypes.h:50
unsigned short quint16
Definition qtypes.h:48
int qint32
Definition qtypes.h:49
unsigned char quint8
Definition qtypes.h:46
engine globalObject().setProperty("myObject"
Heap::InternalClass * internalClasses(InternalClassType icType)