diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-04-01 14:03:55 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-04-03 19:07:28 +0200 |
commit | fcbb78808eea5672f12deb3f15c1fcbf9f0fbdaf (patch) | |
tree | 78502b183038662037fb2f937f837a9e1c4aa62b /src | |
parent | 76a7c93f9b860e2f6fde2198edde19a5d704a97f (diff) |
CMake: Disable JIT for arm64 when doing macOS universal builds
Our current approach to building universal macOS Qt is to pass 2 -arch
flags to clang, which underneath spawn 2 clang invocations with each
separate arch and lipo-s the result together.
This approah also meanss that we do only one set of config tests for
the main (first) architecture.
Currently Qml doesn't support JITing for macOS on Apple Silicon
(arm64), but if the first architecture is x86_64, the qml_jit feature
will be set to 'true', and cause compilation errors when trying to
build the arm slice of the jit source files.
To circumvent that, and allow skipping compilation of JIT specific
code, we have to apply the same trick we do in qtbase,
which is to set a compile definition that takes the current
architecture into account, and surround all relevant code with an #if
block taking to account both the feature and current architecture.
Use a custom hacky qt_extra_definition call to redefine the value of
QT_FEATURE_qml_jit based on the original feature value and the current
architecture.
Additionally, surround the jit source files with #if
QT_CONFIG(qml_jit).
Amends 561a2cec9b95b22783a00b48078b532010357066
Task-number: QTBUG-85447
Change-Id: I28b286d218333076223177c456175f180888a667
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/configure.cmake | 24 | ||||
-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 | 4 | ||||
-rw-r--r-- | src/qml/jit/qv4baselinejit.cpp | 5 | ||||
-rw-r--r-- | src/qml/jit/qv4baselinejit_p.h | 4 |
7 files changed, 46 insertions, 3 deletions
diff --git a/src/qml/configure.cmake b/src/qml/configure.cmake index abab0ee731..6f6cef2e58 100644 --- a/src/qml/configure.cmake +++ b/src/qml/configure.cmake @@ -134,6 +134,30 @@ qt_feature("qml-jit" PRIVATE AUTODETECT NOT IOS AND NOT TVOS CONDITION ( ( ( TEST_architecture_arch STREQUAL i386 ) AND TEST_pointer_32bit AND QT_FEATURE_sse2 ) OR ( ( TEST_architecture_arch STREQUAL x86_64 ) AND TEST_pointer_64bit AND QT_FEATURE_sse2 ) OR ( ( TEST_architecture_arch STREQUAL arm ) AND TEST_pointer_32bit AND TEST_arm_fp AND TEST_arm_thumb AND ( LINUX OR IOS OR TVOS OR QNX ) ) OR ( ( TEST_architecture_arch STREQUAL arm64 ) AND TEST_pointer_64bit AND TEST_arm_fp AND ( LINUX OR IOS OR TVOS OR QNX OR INTEGRITY ) ) ) ) +# special case begin +# When doing macOS universal builds, JIT needs to be disabled for the ARM slice. +# Because both arm and x86_64 slices are built in one clang frontend invocation +# we need this hack to ensure each backend invocation sees the correct value +# of the feature definition. +qt_extra_definition("QT_QML_JIT_SUPPORTED_IMPL" "0 +// Unset dummy value +#undef QT_QML_JIT_SUPPORTED_IMPL +// Compute per-arch value and save in extra define +#if QT_CONFIG(qml_jit) && !(defined(Q_OS_MACOS) && defined(Q_PROCESSOR_ARM)) +#define QT_QML_JIT_SUPPORTED_IMPL 1 +#else +#define QT_QML_JIT_SUPPORTED_IMPL 0 +#endif +// Unset original feature value +#undef QT_FEATURE_qml_jit +// Set new value based on previous computation +#if QT_QML_JIT_SUPPORTED_IMPL +#define QT_FEATURE_qml_jit 1 +#else +#define QT_FEATURE_qml_jit -1 +#endif +" PRIVATE) +# special case end qt_feature("qml-debug" PUBLIC SECTION "QML" LABEL "QML debugging and profiling support" diff --git a/src/qml/jit/qv4assemblercommon.cpp b/src/qml/jit/qv4assemblercommon.cpp index a55c7d3851..6952c0b053 100644 --- a/src/qml/jit/qv4assemblercommon.cpp +++ b/src/qml/jit/qv4assemblercommon.cpp @@ -51,6 +51,8 @@ #include <assembler/LinkBuffer.h> #include <WTFStubs.h> +#if QT_CONFIG(qml_jit) + #undef ENABLE_ALL_ASSEMBLERS_FOR_REFACTORING_PURPOSES QT_BEGIN_NAMESPACE @@ -371,3 +373,5 @@ void PlatformAssemblerCommon::storeInt32AsValue(int srcInt, Address destAddr) } // QV4 namepsace QT_END_NAMESPACE + +#endif // QT_CONFIG(qml_jit) diff --git a/src/qml/jit/qv4assemblercommon_p.h b/src/qml/jit/qv4assemblercommon_p.h index 8f0b9fb83d..63a88f287f 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> -QT_REQUIRE_CONFIG(qml_jit); +#if QT_CONFIG(qml_jit) QT_BEGIN_NAMESPACE @@ -741,4 +741,6 @@ private: QT_END_NAMESPACE +#endif // QT_CONFIG(qml_jit) + #endif // QV4PLATFORMASSEMBLER_P_H diff --git a/src/qml/jit/qv4baselineassembler.cpp b/src/qml/jit/qv4baselineassembler.cpp index ff80445be5..f0f20d4669 100644 --- a/src/qml/jit/qv4baselineassembler.cpp +++ b/src/qml/jit/qv4baselineassembler.cpp @@ -55,6 +55,8 @@ #undef ENABLE_ALL_ASSEMBLERS_FOR_REFACTORING_PURPOSES +#if QT_CONFIG(qml_jit) + QT_BEGIN_NAMESPACE namespace QV4 { namespace JIT { @@ -1619,3 +1621,5 @@ void BaselineAssembler::ret() } // QV4 namepsace QT_END_NAMESPACE + +#endif // QT_CONFIG(qml_jit) diff --git a/src/qml/jit/qv4baselineassembler_p.h b/src/qml/jit/qv4baselineassembler_p.h index c2c735282b..c6fdab51c5 100644 --- a/src/qml/jit/qv4baselineassembler_p.h +++ b/src/qml/jit/qv4baselineassembler_p.h @@ -55,7 +55,7 @@ #include <private/qv4function_p.h> #include <QHash> -QT_REQUIRE_CONFIG(qml_jit); +#if QT_CONFIG(qml_jit) QT_BEGIN_NAMESPACE @@ -182,4 +182,6 @@ private: QT_END_NAMESPACE +#endif // QT_CONFIG(qml_jit) + #endif // QV4BASELINEASSEMBLER_P_H diff --git a/src/qml/jit/qv4baselinejit.cpp b/src/qml/jit/qv4baselinejit.cpp index 5e6d843fbc..22cbfd1536 100644 --- a/src/qml/jit/qv4baselinejit.cpp +++ b/src/qml/jit/qv4baselinejit.cpp @@ -42,6 +42,8 @@ #include <private/qv4lookup_p.h> #include <private/qv4generatorobject_p.h> +#if QT_CONFIG(qml_jit) + QT_USE_NAMESPACE using namespace QV4; using namespace QV4::JIT; @@ -931,3 +933,6 @@ void BaselineJIT::endInstruction(Instr::Type instr) { Q_UNUSED(instr); } + +#endif // QT_CONFIG(qml_jit) + diff --git a/src/qml/jit/qv4baselinejit_p.h b/src/qml/jit/qv4baselinejit_p.h index 284faf0ff0..2b0913169e 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); +#if QT_CONFIG(qml_jit) QT_BEGIN_NAMESPACE @@ -220,4 +220,6 @@ private: QT_END_NAMESPACE +#endif // QT_CONFIG(qml_jit) + #endif // QV4JIT_P_H |