diff options
-rw-r--r-- | src/3rdparty/masm/masm-defs.pri | 4 | ||||
-rw-r--r-- | src/qml/configure.json | 69 | ||||
-rw-r--r-- | src/qml/jit/qv4assemblercommon.cpp | 4 | ||||
-rw-r--r-- | src/qml/jit/qv4assemblercommon_p.h | 4 | ||||
-rw-r--r-- | src/qml/jit/qv4baselineassembler.cpp | 4 | ||||
-rw-r--r-- | src/qml/jit/qv4baselineassembler_p.h | 2 | ||||
-rw-r--r-- | src/qml/jit/qv4baselinejit.cpp | 4 | ||||
-rw-r--r-- | src/qml/jit/qv4baselinejit_p.h | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4engine_p.h | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4global_p.h | 46 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4vme_moth.cpp | 6 | ||||
-rw-r--r-- | src/qml/qml.pro | 4 | ||||
-rw-r--r-- | src/qml/qtqmlglobal.h | 1 | ||||
-rw-r--r-- | tests/auto/qml/qv4assembler/tst_qv4assembler.cpp | 12 |
15 files changed, 88 insertions, 82 deletions
diff --git a/src/3rdparty/masm/masm-defs.pri b/src/3rdparty/masm/masm-defs.pri index 08c46a7ac2..90a795c6ce 100644 --- a/src/3rdparty/masm/masm-defs.pri +++ b/src/3rdparty/masm/masm-defs.pri @@ -33,10 +33,6 @@ disassembler { DEFINES += WTF_USE_UDIS86=0 } -force-compile-jit { - DEFINES += V4_FORCE_COMPILE_JIT -} - INCLUDEPATH += $$PWD/disassembler INCLUDEPATH += $$PWD/disassembler/udis86 INCLUDEPATH += $$_OUT_PWD diff --git a/src/qml/configure.json b/src/qml/configure.json index c35f5be06b..ef6a9f5e7e 100644 --- a/src/qml/configure.json +++ b/src/qml/configure.json @@ -24,6 +24,52 @@ ], "qmake": "CONFIG += c++11" } + }, + "pointer_32bit": { + "label": "32bit pointers", + "type": "compile", + "test": { + "main": "static_assert(sizeof(void *) == 4, \"fail\");" + } + }, + "pointer_64bit": { + "label": "64bit pointers", + "type": "compile", + "test": { + "main": "static_assert(sizeof(void *) == 8, \"fail\");" + } + }, + "arm_thumb": { + "label": "THUMB mode on ARM", + "type": "compile", + "test": { + "main": [ + "#if defined(thumb2) || defined(__thumb2__)", + "# define THUMB_OK", + "#elif (defined(__thumb) || defined(__thumb__)) && __TARGET_ARCH_THUMB-0 == 4", + "# define THUMB_OK", + "#elif defined(__ARM_ARCH_ISA_THUMB) && __ARM_ARCH_ISA_THUMB == 2", + "// clang 3.5 and later will set this if the core supports the Thumb-2 ISA.", + "# define THUMB_OK", + "#else", + "# error \"fail\"", + "#endif" + ] + } + }, + "arm_fp": { + "label": "Sufficiently recent FPU on ARM", + "type": "compile", + "test": { + "main": [ + "// if !defined(__ARM_FP) we might be on MSVC or we might have a device", + "// without an FPU.", + "// TODO: The latter case is not supported, but the test still succeeds.", + "#if defined(__ARM_FP) && (__ARM_FP <= 0x04)", + "# error \"fail\"", + "#endif" + ] + } } }, @@ -40,10 +86,32 @@ "condition": "features.network", "output": [ "publicFeature" ] }, + "qml-jit": { + "label": "QML just-in-time compiler", + "purpose": "Provides a JIT for QML and JavaScript", + "section": "QML", + "condition": [ + " (arch.i386 && tests.pointer_32bit) + || (arch.x86_64 && tests.pointer_64bit) + || (arch.arm && tests.pointer_32bit && tests.arm_fp && tests.arm_thumb + && (config.linux || config.ios || config.tvos || config.qnx)) + || (arch.arm64 && tests.pointer_64bit && tests.arm_fp + && (config.linux || config.ios || config.tvos || config.qnx || config.integrity))" + ], + "output": [ "privateFeature" ], + "autoDetect": "!config.ios && !config.tvos", + "comment": "On arm and arm64 we need a specialization of cacheFlush() for each OS to be + enabeled. Therefore the config white list. + Also Mind that e.g. x86_32 has arch.x86_64 but 32bit pointers. Therefore + the checks for architecture and pointer size. + Finally, ios and tvos can technically use the JIT but Apple does not allow + it. Therefore, it's disabled by default." + }, "qml-tracing": { "label": "QML tracing JIT support", "purpose": "Provides a JIT that uses trace information generated by the interpreter.", "section": "QML", + "condition": "features.qml-jit", "output": [ "privateFeature" ], "autoDetect": false }, @@ -140,6 +208,7 @@ "entries": [ "qml-network", "qml-debug", + "qml-jit", "qml-tracing", "qml-sequence-object", "qml-list-model", diff --git a/src/qml/jit/qv4assemblercommon.cpp b/src/qml/jit/qv4assemblercommon.cpp index dd810d9d70..800ee22cd7 100644 --- a/src/qml/jit/qv4assemblercommon.cpp +++ b/src/qml/jit/qv4assemblercommon.cpp @@ -53,8 +53,6 @@ #undef ENABLE_ALL_ASSEMBLERS_FOR_REFACTORING_PURPOSES -#ifdef V4_ENABLE_JIT - QT_BEGIN_NAMESPACE namespace QV4 { namespace JIT { @@ -366,5 +364,3 @@ void PlatformAssemblerCommon::storeInt32AsValue(int srcInt, Address destAddr) } // QV4 namepsace QT_END_NAMESPACE - -#endif // V4_ENABLE_JIT diff --git a/src/qml/jit/qv4assemblercommon_p.h b/src/qml/jit/qv4assemblercommon_p.h index d3d7eedae2..e5c2aff1a7 100644 --- a/src/qml/jit/qv4assemblercommon_p.h +++ b/src/qml/jit/qv4assemblercommon_p.h @@ -58,7 +58,7 @@ #include <wtf/Vector.h> #include <assembler/MacroAssembler.h> -#ifdef V4_ENABLE_JIT +QT_REQUIRE_CONFIG(qml_jit); QT_BEGIN_NAMESPACE @@ -735,6 +735,4 @@ private: QT_END_NAMESPACE -#endif // V4_ENABLE_JIT - #endif // QV4PLATFORMASSEMBLER_P_H diff --git a/src/qml/jit/qv4baselineassembler.cpp b/src/qml/jit/qv4baselineassembler.cpp index 238c11f478..5e34087ff5 100644 --- a/src/qml/jit/qv4baselineassembler.cpp +++ b/src/qml/jit/qv4baselineassembler.cpp @@ -55,8 +55,6 @@ #undef ENABLE_ALL_ASSEMBLERS_FOR_REFACTORING_PURPOSES -#ifdef V4_ENABLE_JIT - QT_BEGIN_NAMESPACE namespace QV4 { namespace JIT { @@ -1620,5 +1618,3 @@ void BaselineAssembler::ret() } // QV4 namepsace QT_END_NAMESPACE - -#endif // V4_ENABLE_JIT diff --git a/src/qml/jit/qv4baselineassembler_p.h b/src/qml/jit/qv4baselineassembler_p.h index 3bbaefd000..5e5d9d0672 100644 --- a/src/qml/jit/qv4baselineassembler_p.h +++ b/src/qml/jit/qv4baselineassembler_p.h @@ -55,6 +55,8 @@ #include <private/qv4function_p.h> #include <QHash> +QT_REQUIRE_CONFIG(qml_jit); + QT_BEGIN_NAMESPACE namespace QV4 { diff --git a/src/qml/jit/qv4baselinejit.cpp b/src/qml/jit/qv4baselinejit.cpp index 80155d7b20..60880419a6 100644 --- a/src/qml/jit/qv4baselinejit.cpp +++ b/src/qml/jit/qv4baselinejit.cpp @@ -42,8 +42,6 @@ #include <private/qv4lookup_p.h> #include <private/qv4generatorobject_p.h> -#ifdef V4_ENABLE_JIT - QT_USE_NAMESPACE using namespace QV4; using namespace QV4::JIT; @@ -913,5 +911,3 @@ void BaselineJIT::endInstruction(Instr::Type instr) { Q_UNUSED(instr); } - -#endif // V4_ENABLE_JIT diff --git a/src/qml/jit/qv4baselinejit_p.h b/src/qml/jit/qv4baselinejit_p.h index 37ab37eac2..941e0cd408 100644 --- a/src/qml/jit/qv4baselinejit_p.h +++ b/src/qml/jit/qv4baselinejit_p.h @@ -56,7 +56,7 @@ #include <private/qv4instr_moth_p.h> #include <private/qv4bytecodehandler_p.h> -//QT_REQUIRE_CONFIG(qml_jit); +QT_REQUIRE_CONFIG(qml_jit); QT_BEGIN_NAMESPACE @@ -65,7 +65,6 @@ namespace JIT { class BaselineAssembler; -#ifdef V4_ENABLE_JIT class BaselineJIT final: public Moth::ByteCodeHandler { public: @@ -214,7 +213,6 @@ private: QScopedPointer<BaselineAssembler> as; QSet<int> labels; }; -#endif // V4_ENABLE_JIT } // namespace JIT } // namespace QV4 diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 18927c637c..b9130aa7f8 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -165,7 +165,7 @@ ExecutionEngine::ExecutionEngine(QJSEngine *jsEngine) , m_engineId(engineSerial.fetchAndAddOrdered(1)) , regExpCache(nullptr) , m_multiplyWrappedQObjects(nullptr) -#if defined(V4_ENABLE_JIT) && !defined(V4_BOOTSTRAP) +#if QT_CONFIG(qml_jit) , m_canAllocateExecutableMemory(OSAllocator::canAllocateExecutableMemory()) #endif { diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h index 6df4545014..d0c58eee8f 100644 --- a/src/qml/jsruntime/qv4engine_p.h +++ b/src/qml/jsruntime/qv4engine_p.h @@ -464,7 +464,7 @@ public: // but any time a QObject is wrapped a second time in another engine, we have to do // bookkeeping. MultiplyWrappedQObjectMap *m_multiplyWrappedQObjects; -#if defined(V4_ENABLE_JIT) && !defined(V4_BOOTSTRAP) +#if QT_CONFIG(qml_jit) const bool m_canAllocateExecutableMemory; #endif @@ -595,7 +595,7 @@ public: bool canJIT(Function *f = nullptr) { -#if defined(V4_ENABLE_JIT) && !defined(V4_BOOTSTRAP) +#if QT_CONFIG(qml_jit) if (!m_canAllocateExecutableMemory) return false; if (f) diff --git a/src/qml/jsruntime/qv4global_p.h b/src/qml/jsruntime/qv4global_p.h index d47393b3bb..8a0ef5aa30 100644 --- a/src/qml/jsruntime/qv4global_p.h +++ b/src/qml/jsruntime/qv4global_p.h @@ -82,53 +82,9 @@ inline bool isfinite(double d) { return _finite(d); } inline double trunc(double d) { return d > 0 ? floor(d) : ceil(d); } #endif -// Decide whether to enable or disable the JIT - -// White list architectures -// -// NOTE: This should match the logic in qv4targetplatform_p.h! - -#if defined(Q_PROCESSOR_X86_32) && (QT_POINTER_SIZE == 4) \ - && (defined(Q_OS_WIN) || defined(Q_OS_LINUX) || defined(Q_OS_QNX) || defined(Q_OS_FREEBSD)) -# define V4_ENABLE_JIT -#elif defined(Q_PROCESSOR_X86_64) && (QT_POINTER_SIZE == 8) \ - && (defined(Q_OS_WIN) || defined(Q_OS_LINUX) || defined(Q_OS_QNX) || defined(Q_OS_MAC) || defined(Q_OS_FREEBSD)) -# define V4_ENABLE_JIT -#elif defined(Q_PROCESSOR_ARM_32) && (QT_POINTER_SIZE == 4) \ - && (defined(Q_OS_LINUX) || defined(Q_OS_QNX) || defined(Q_OS_FREEBSD) || defined(Q_OS_INTEGRITY)) -# if defined(thumb2) || defined(__thumb2__) || ((defined(__thumb) || defined(__thumb__)) && __TARGET_ARCH_THUMB-0 == 4) -# define V4_ENABLE_JIT -# elif defined(__ARM_ARCH_ISA_THUMB) && __ARM_ARCH_ISA_THUMB == 2 // clang 3.5 and later will set this if the core supports the Thumb-2 ISA. -# define V4_ENABLE_JIT -# endif -#elif defined(Q_PROCESSOR_ARM_64) && (QT_POINTER_SIZE == 8) -# if defined(Q_OS_LINUX) || defined(Q_OS_QNX) || defined(Q_OS_INTEGRITY) -# define V4_ENABLE_JIT -# endif -//#elif defined(Q_PROCESSOR_MIPS_32) && defined(Q_OS_LINUX) -//# define V4_ENABLE_JIT -#endif - -// check FPU with double precision on ARM platform -#if (defined(Q_PROCESSOR_ARM_64) || defined(Q_PROCESSOR_ARM_32)) && defined(V4_ENABLE_JIT) && defined(__ARM_FP) && (__ARM_FP <= 0x04) -# undef V4_ENABLE_JIT -#endif - -// Black list some platforms -#if defined(V4_ENABLE_JIT) -#if defined(Q_OS_IOS) || defined(Q_OS_TVOS) -# undef V4_ENABLE_JIT -#endif -#endif - -// For debug purposes: add CONFIG+=force-compile-jit to qmake's command-line to always compile the JIT. -#if defined(V4_FORCE_COMPILE_JIT) && !defined(V4_ENABLE_JIT) -# define V4_ENABLE_JIT -#endif - // Do certain things depending on whether the JIT is enabled or disabled -#ifdef V4_ENABLE_JIT +#if QT_CONFIG(qml_jit) #define ENABLE_YARR_JIT 1 #define ENABLE_JIT 1 #define ENABLE_ASSEMBLER 1 diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp index 98e4f4f7b9..71e35bdc07 100644 --- a/src/qml/jsruntime/qv4vme_moth.cpp +++ b/src/qml/jsruntime/qv4vme_moth.cpp @@ -61,7 +61,9 @@ #include "qv4alloca_p.h" +#if QT_CONFIG(qml_jit) #include <private/qv4baselinejit_p.h> +#endif #undef COUNT_INSTRUCTIONS @@ -499,7 +501,7 @@ ReturnedValue VME::exec(CppStackFrame *frame, ExecutionEngine *engine) Profiling::FunctionCallProfiler profiler(engine, function); // start execution profiling QV4::Debugging::Debugger *debugger = engine->debugger(); -#ifdef V4_ENABLE_JIT +#if QT_CONFIG(qml_jit) if (debugger == nullptr) { if (function->jittedCode == nullptr) { if (engine->canJIT(function)) { @@ -514,7 +516,7 @@ ReturnedValue VME::exec(CppStackFrame *frame, ExecutionEngine *engine) } } } -#endif // V4_ENABLE_JIT +#endif // QT_CONFIG(qml_jit) // interpreter if (debugger) diff --git a/src/qml/qml.pro b/src/qml/qml.pro index d96a1c285a..ca3282556e 100644 --- a/src/qml/qml.pro +++ b/src/qml/qml.pro @@ -70,7 +70,9 @@ include(parser/parser.pri) include(compiler/compiler.pri) include(jsapi/jsapi.pri) include(jsruntime/jsruntime.pri) -include(jit/jit.pri) +qtConfig(qml-jit) { + include(jit/jit.pri) +} include(qml/qml.pri) include(debugger/debugger.pri) include(qmldirparser/qmldirparser.pri) diff --git a/src/qml/qtqmlglobal.h b/src/qml/qtqmlglobal.h index 090b830b3c..348cfd86b8 100644 --- a/src/qml/qtqmlglobal.h +++ b/src/qml/qtqmlglobal.h @@ -53,6 +53,7 @@ #else # define QT_FEATURE_qml_debug -1 # define QT_FEATURE_qml_sequence_object 1 +# define QT_FEATURE_qml_jit -1 # define QT_FEATURE_qml_tracing -1 #endif diff --git a/tests/auto/qml/qv4assembler/tst_qv4assembler.cpp b/tests/auto/qml/qv4assembler/tst_qv4assembler.cpp index fd50ff5020..392ce16880 100644 --- a/tests/auto/qml/qv4assembler/tst_qv4assembler.cpp +++ b/tests/auto/qml/qv4assembler/tst_qv4assembler.cpp @@ -140,23 +140,17 @@ void tst_QV4Assembler::functionTable() #endif } -#ifdef V4_ENABLE_JIT -#define JIT_ENABLED 1 -#else -#define JIT_ENABLED 0 -#endif - void tst_QV4Assembler::jitEnabled() { #if defined(Q_OS_IOS) || defined(Q_OS_TVOS) /* JIT should be disabled on iOS and tvOS. */ - QCOMPARE(JIT_ENABLED, 0); + QVERIFY(!QT_CONFIG(qml_jit)); #elif defined(Q_OS_WIN) && defined(Q_PROCESSOR_ARM) /* JIT should be disabled Windows on ARM/ARM64 for now. */ - QCOMPARE(JIT_ENABLED, 0); + QVERIFY(!QT_CONFIG(qml_jit)); #else /* JIT should be enabled on all other architectures/OSes tested in CI. */ - QCOMPARE(JIT_ENABLED, 1); + QVERIFY(QT_CONFIG(qml_jit)); #endif } |