Control: tag -1 patch On Thu, 2015-07-16 at 18:37:48 -0300, Lisandro Damián Nicanor Pérez Meyer wrote: > But QML *requires* SSE2, so.. this won't be fixed :(
I just upgraded two main workstations of mine with AMD Athlon MP and XP CPUs, and they crashed with an abort, with drkonqi showing up with backtraces but no actual visible error message. After a «startx startkde» I discovered that the QML code knows it cannot run, prints an error and aborts, and found this bug report and the discussions upstream. Almost everything that is needed is already there, it just needs some code shuffling. Attached is a tested and working patch that keeps the JIT requiring SSE2, uses that if the cpu supports it, and fallsback to the interpreter otherwise. Thanks, Guillem
Description: Do not make lack of SSE2 fatal Author: Guillem Jover <guil...@hadrons.org> Origin: vendor Bug-Debian: https://bugs.debian.org/792594 Last-Update: 2015-10-09 --- src/qml/jit/qv4isel_masm.cpp | 7 +++++++ src/qml/jsruntime/qv4engine.cpp | 10 ++++++++-- src/qml/qml/v8/qv8engine.cpp | 6 ------ tools/qmljs/qmljs.cpp | 10 +++++++--- 4 files changed, 22 insertions(+), 11 deletions(-) --- a/src/qml/qml/v8/qv8engine.cpp +++ b/src/qml/qml/v8/qv8engine.cpp @@ -121,12 +121,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 @@ -45,6 +45,7 @@ #include "qv4binop_p.h" #include <QtCore/QBuffer> +#include <private/qsimd_p.h> #include <assembler/LinkBuffer.h> #include <WTFStubs.h> @@ -198,6 +199,12 @@ InstructionSelection::InstructionSelecti , compilationUnit(new CompilationUnit) , qmlEngine(qmlEngine) { +#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 + compilationUnit->codeRefs.resize(module->functions.size()); } --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -64,6 +64,7 @@ #include <QtCore/QTextStream> #include <QDateTime> +#include <private/qsimd_p.h> #ifdef V4_ENABLE_JIT #include "qv4isel_masm_p.h" @@ -155,6 +156,11 @@ quintptr getStackLimit() return stackLimit + MinimumStackSize*1024; } +#ifdef Q_PROCESSOR_X86_32 +# define QV4_HAS_HW_SUPPORT qCpuHasFeature(SSE2) +#else +# define QV4_HAS_HW_SUPPORT 1 +#endif ExecutionEngine::ExecutionEngine(EvalISelFactory *factory) : current(0) @@ -183,8 +189,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() || !QV4_HAS_HW_SUPPORT; + if (useMoth) factory = new Moth::ISelFactory; else factory = new JIT::ISelFactory; --- a/tools/qmljs/qmljs.cpp +++ b/tools/qmljs/qmljs.cpp @@ -51,6 +51,7 @@ #include <QtCore/QCoreApplication> #include <QtCore/QFile> +#include <private/qsimd_p.h> #include <private/qqmljsengine_p.h> #include <private/qqmljslexer_p.h> #include <private/qqmljsparser_p.h> @@ -140,11 +141,14 @@ int main(int argc, char *argv[]) enum { use_masm, use_moth - } mode; + } mode = use_moth; #ifdef V4_ENABLE_JIT +# ifdef Q_PROCESSOR_X86_32 + if (qCpuHasFeature(SSE2)) + mode = use_masm; +# else mode = use_masm; -#else - mode = use_moth; +# endif #endif bool runAsQml = false;