[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#792594: libqt5qml5 requires SSE2 on i386



On Sun, 2015-11-01 at 14:31:37 -0300, Lisandro Damián Nicanor Pérez Meyer wrote:
> We are definitely not taken this as a distro delta because the code changes 
> too much between versions and we really lack the manpower to do it, plus that 
> we do our best to avoid distro deltas. So removing the patch tag.

I've found that the changes required for each minor version are rather
minimal. In any case, because I need a patched Qt on my systems to be
able to run many Qt applications at all, I'll have to rebase the patches
and build local packages anyway. I'll try to send the rebased patches
here for whoever else needs them, if I remember.

If someone else wants access to the Qt Declaratives packages I'm
building please say so, and I'll publish them on some repository.

Attached all current patches against 5.4.x, 5.5.x and 5.6.x (git HEAD).

Regards,
Guillem
Description: Do not make lack of SSE2 support on x86-32 fatal
 When an x86-32 CPU does not have SSE2 support (which is the case for
 all AMD CPUs, and older Intel CPUs), fallback to use the interpreter,
 otherwise use the JIT engine.
 .
 Even then, make the lack of SSE2 support on x86-32 fatal when trying
 to instantiate a JIT engine, which does require it.
 .
 Refactor the required CPU support check into a new privately exported
 function to avoid duplicating the logic, and do so in a function
 instead of a class member to avoid changing the class signatures.
Author: Guillem Jover <guillem@hadrons.org>
Origin: vendor
Version: 5.4.x
Bug-Debian: https://bugs.debian.org/792594
Last-Update: 2015-10-09

---
 src/qml/jit/qv4isel_masm.cpp    |    3 +++
 src/qml/jit/qv4isel_masm_p.h    |   10 ++++++++++
 src/qml/jsruntime/qv4engine.cpp |    4 ++--
 src/qml/qml/v8/qv8engine.cpp    |    7 -------
 tools/qmljs/qmljs.cpp           |    7 +++----
 5 files changed, 18 insertions(+), 13 deletions(-)

--- a/src/qml/qml/v8/qv8engine.cpp
+++ b/src/qml/qml/v8/qv8engine.cpp
@@ -58,7 +58,6 @@
 #include <QtCore/qjsonobject.h>
 #include <QtCore/qjsonvalue.h>
 #include <QtCore/qdatetime.h>
-#include <private/qsimd_p.h>
 
 #include <private/qv4value_inl_p.h>
 #include <private/qv4dateobject_p.h>
@@ -121,12 +120,6 @@ QV8Engine::QV8Engine(QJSEngine* qq)
     , m_xmlHttpRequestData(0)
     , m_listModelData(0)
 {
-#ifdef Q_PROCESSOR_X86_32
-    if (!qCpuHasFeature(SSE2)) {
-        qFatal("This program requires an X86 processor that supports SSE2 extension, at least a Pentium 4 or newer");
-    }
-#endif
-
     QML_MEMORY_SCOPE_STRING("QV8Engine::QV8Engine");
     qMetaTypeId<QJSValue>();
     qMetaTypeId<QList<int> >();
--- a/src/qml/jit/qv4isel_masm.cpp
+++ b/src/qml/jit/qv4isel_masm.cpp
@@ -198,6 +198,9 @@ InstructionSelection::InstructionSelecti
     , compilationUnit(new CompilationUnit)
     , qmlEngine(qmlEngine)
 {
+    if (!hasRequiredCpuSupport())
+        qFatal("This program requires an X86 processor that supports SSE2 extension, at least a Pentium 4 or newer");
+
     compilationUnit->codeRefs.resize(module->functions.size());
 }
 
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -183,8 +183,8 @@ ExecutionEngine::ExecutionEngine(EvalISe
     if (!factory) {
 
 #ifdef V4_ENABLE_JIT
-        static const bool forceMoth = !qgetenv("QV4_FORCE_INTERPRETER").isEmpty();
-        if (forceMoth)
+        static const bool useMoth = !qgetenv("QV4_FORCE_INTERPRETER").isEmpty() || !JIT::hasRequiredCpuSupport();
+        if (useMoth)
             factory = new Moth::ISelFactory;
         else
             factory = new JIT::ISelFactory;
--- a/tools/qmljs/qmljs.cpp
+++ b/tools/qmljs/qmljs.cpp
@@ -140,11 +140,10 @@ int main(int argc, char *argv[])
     enum {
         use_masm,
         use_moth
-    } mode;
+    } mode = use_moth;
 #ifdef V4_ENABLE_JIT
-    mode = use_masm;
-#else
-    mode = use_moth;
+    if (QV4::JIT::hasRequiredCpuSupport())
+        mode = use_masm;
 #endif
 
     bool runAsQml = false;
--- a/src/qml/jit/qv4isel_masm_p.h
+++ b/src/qml/jit/qv4isel_masm_p.h
@@ -42,6 +42,7 @@
 
 #include <QtCore/QHash>
 #include <QtCore/QStack>
+#include <private/qsimd_p.h>
 #include <config.h>
 #include <wtf/Vector.h>
 
@@ -54,6 +55,15 @@ QT_BEGIN_NAMESPACE
 namespace QV4 {
 namespace JIT {
 
+inline bool Q_QML_PRIVATE_EXPORT hasRequiredCpuSupport()
+{
+#ifdef Q_PROCESSOR_X86_32
+    return qCpuHasFeature(SSE2);
+#else
+    return true;
+#endif
+}
+
 class Q_QML_EXPORT InstructionSelection:
         protected IR::IRDecoder,
         public EvalInstructionSelection
Description: Do not make lack of SSE2 support on x86-32 fatal
 When an x86-32 CPU does not have SSE2 support (which is the case for
 all AMD CPUs, and older Intel CPUs), fallback to use the interpreter,
 otherwise use the JIT engine.
 .
 Even then, make the lack of SSE2 support on x86-32 fatal when trying
 to instantiate a JIT engine, which does require it.
 .
 Refactor the required CPU support check into a new privately exported
 function to avoid duplicating the logic, and do so in a function
 instead of a class member to avoid changing the class signatures.
Author: Guillem Jover <guillem@hadrons.org>
Origin: vendor
Version: 5.5.x
Bug-Debian: https://bugs.debian.org/792594
Last-Update: 2015-10-09

---
 src/qml/jit/qv4isel_masm.cpp    |    3 +++
 src/qml/jit/qv4isel_masm_p.h    |   10 ++++++++++
 src/qml/jsruntime/qv4engine.cpp |    4 ++--
 src/qml/qml/v8/qv8engine.cpp    |    7 -------
 tools/qmljs/qmljs.cpp           |    7 +++----
 5 files changed, 18 insertions(+), 13 deletions(-)

--- a/src/qml/qml/v8/qv8engine.cpp
+++ b/src/qml/qml/v8/qv8engine.cpp
@@ -59,7 +59,6 @@
 #include <QtCore/qjsonvalue.h>
 #include <QtCore/qdatetime.h>
 #include <QtCore/qdatastream.h>
-#include <private/qsimd_p.h>
 
 #include <private/qv4value_inl_p.h>
 #include <private/qv4dateobject_p.h>
@@ -123,12 +122,6 @@ QV8Engine::QV8Engine(QJSEngine* qq)
     , m_xmlHttpRequestData(0)
     , m_listModelData(0)
 {
-#ifdef Q_PROCESSOR_X86_32
-    if (!qCpuHasFeature(SSE2)) {
-        qFatal("This program requires an X86 processor that supports SSE2 extension, at least a Pentium 4 or newer");
-    }
-#endif
-
     QML_MEMORY_SCOPE_STRING("QV8Engine::QV8Engine");
     qMetaTypeId<QJSValue>();
     qMetaTypeId<QList<int> >();
--- a/src/qml/jit/qv4isel_masm.cpp
+++ b/src/qml/jit/qv4isel_masm.cpp
@@ -199,6 +199,9 @@ InstructionSelection::InstructionSelecti
     , compilationUnit(new CompilationUnit)
     , qmlEngine(qmlEngine)
 {
+    if (!hasRequiredCpuSupport())
+        qFatal("This program requires an X86 processor that supports SSE2 extension, at least a Pentium 4 or newer");
+
     compilationUnit->codeRefs.resize(module->functions.size());
 }
 
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -221,8 +221,8 @@ ExecutionEngine::ExecutionEngine(EvalISe
     if (!factory) {
 
 #ifdef V4_ENABLE_JIT
-        static const bool forceMoth = !qgetenv("QV4_FORCE_INTERPRETER").isEmpty();
-        if (forceMoth)
+        static const bool useMoth = !qgetenv("QV4_FORCE_INTERPRETER").isEmpty() || !JIT::hasRequiredCpuSupport();
+        if (useMoth)
             factory = new Moth::ISelFactory;
         else
             factory = new JIT::ISelFactory;
--- a/tools/qmljs/qmljs.cpp
+++ b/tools/qmljs/qmljs.cpp
@@ -139,11 +139,10 @@ int main(int argc, char *argv[])
     enum {
         use_masm,
         use_moth
-    } mode;
+    } mode = use_moth;
 #ifdef V4_ENABLE_JIT
-    mode = use_masm;
-#else
-    mode = use_moth;
+    if (QV4::JIT::hasRequiredCpuSupport())
+        mode = use_masm;
 #endif
 
     bool runAsQml = false;
--- a/src/qml/jit/qv4isel_masm_p.h
+++ b/src/qml/jit/qv4isel_masm_p.h
@@ -42,6 +42,7 @@
 
 #include <QtCore/QHash>
 #include <QtCore/QStack>
+#include <private/qsimd_p.h>
 #include <config.h>
 #include <wtf/Vector.h>
 
@@ -54,6 +55,15 @@ QT_BEGIN_NAMESPACE
 namespace QV4 {
 namespace JIT {
 
+inline bool Q_QML_PRIVATE_EXPORT hasRequiredCpuSupport()
+{
+#ifdef Q_PROCESSOR_X86_32
+    return qCpuHasFeature(SSE2);
+#else
+    return true;
+#endif
+}
+
 class Q_QML_EXPORT InstructionSelection:
         protected IR::IRDecoder,
         public EvalInstructionSelection
From 8d659f352a159d9348ad51de86706fd842e026de Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@hadrons.org>
Date: Mon, 12 Oct 2015 01:45:37 +0200
Subject: [PATCH] Do not make lack of SSE2 support on x86-32 fatal

When an x86-32 CPU does not have SSE2 support (which is the case for
all AMD CPUs, and older Intel CPUs), fallback to use the interpreter,
otherwise use the JIT engine.

Even then, make the lack of SSE2 support on x86-32 fatal when trying
to instantiate a JIT engine, which does require it.

Refactor the required CPU support check into a new privately exported
function to avoid duplicating the logic, and do so in a function
instead of a class member to avoid changing the class signatures.

Version: 5.6.x
Bug-Debian: https://bugs.debian.org/792594
---
 src/qml/jit/qv4isel_masm.cpp    |  3 +++
 src/qml/jit/qv4isel_masm_p.h    | 10 ++++++++++
 src/qml/jsruntime/qv4engine.cpp |  4 ++--
 src/qml/qml/v8/qv8engine.cpp    |  7 -------
 tools/qmljs/qmljs.cpp           |  7 +++----
 5 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/src/qml/jit/qv4isel_masm.cpp b/src/qml/jit/qv4isel_masm.cpp
index 6de6524..f9b4640 100644
--- a/src/qml/jit/qv4isel_masm.cpp
+++ b/src/qml/jit/qv4isel_masm.cpp
@@ -259,6 +259,9 @@ InstructionSelection::InstructionSelection(QQmlEnginePrivate *qmlEngine, QV4::Ex
     , compilationUnit(new CompilationUnit)
     , qmlEngine(qmlEngine)
 {
+    if (!hasRequiredCpuSupport())
+        qFatal("This program requires an X86 processor that supports SSE2 extension, at least a Pentium 4 or newer");
+
     compilationUnit->codeRefs.resize(module->functions.size());
 }
 
diff --git a/src/qml/jit/qv4isel_masm_p.h b/src/qml/jit/qv4isel_masm_p.h
index 6e9b02b..0cde542 100644
--- a/src/qml/jit/qv4isel_masm_p.h
+++ b/src/qml/jit/qv4isel_masm_p.h
@@ -53,6 +53,7 @@
 
 #include <QtCore/QHash>
 #include <QtCore/QStack>
+#include <private/qsimd_p.h>
 #include <config.h>
 #include <wtf/Vector.h>
 
@@ -65,6 +66,15 @@ QT_BEGIN_NAMESPACE
 namespace QV4 {
 namespace JIT {
 
+inline bool Q_QML_PRIVATE_EXPORT hasRequiredCpuSupport()
+{
+#ifdef Q_PROCESSOR_X86_32
+    return qCpuHasFeature(SSE2);
+#else
+    return true;
+#endif
+}
+
 class Q_QML_EXPORT InstructionSelection:
         protected IR::IRDecoder,
         public EvalInstructionSelection
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index e31d9b1..a7e1656 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -218,8 +218,8 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory)
     if (!factory) {
 
 #ifdef V4_ENABLE_JIT
-        static const bool forceMoth = !qEnvironmentVariableIsEmpty("QV4_FORCE_INTERPRETER");
-        if (forceMoth)
+        static const bool useMoth = !qEnvironmentVariableIsEmpty("QV4_FORCE_INTERPRETER") || !JIT::hasRequiredCpuSupport();
+        if (useMoth)
             factory = new Moth::ISelFactory;
         else
             factory = new JIT::ISelFactory;
diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp
index dae932e..c6d3a81 100644
--- a/src/qml/qml/v8/qv8engine.cpp
+++ b/src/qml/qml/v8/qv8engine.cpp
@@ -59,7 +59,6 @@
 #include <QtCore/qjsonvalue.h>
 #include <QtCore/qdatetime.h>
 #include <QtCore/qdatastream.h>
-#include <private/qsimd_p.h>
 
 #include <private/qv4value_p.h>
 #include <private/qv4dateobject_p.h>
@@ -123,12 +122,6 @@ QV8Engine::QV8Engine(QJSEngine* qq)
     , m_xmlHttpRequestData(0)
     , m_listModelData(0)
 {
-#ifdef Q_PROCESSOR_X86_32
-    if (!qCpuHasFeature(SSE2)) {
-        qFatal("This program requires an X86 processor that supports SSE2 extension, at least a Pentium 4 or newer");
-    }
-#endif
-
     QML_MEMORY_SCOPE_STRING("QV8Engine::QV8Engine");
     qMetaTypeId<QJSValue>();
     qMetaTypeId<QList<int> >();
diff --git a/tools/qmljs/qmljs.cpp b/tools/qmljs/qmljs.cpp
index 27aeed4..e1929df 100644
--- a/tools/qmljs/qmljs.cpp
+++ b/tools/qmljs/qmljs.cpp
@@ -140,11 +140,10 @@ int main(int argc, char *argv[])
     enum {
         use_masm,
         use_moth
-    } mode;
+    } mode = use_moth;
 #ifdef V4_ENABLE_JIT
-    mode = use_masm;
-#else
-    mode = use_moth;
+    if (QV4::JIT::hasRequiredCpuSupport())
+        mode = use_masm;
 #endif
 
     bool runAsQml = false;
-- 
2.6.2.409.gb049f0a


Reply to: