[Libreoffice-commits] core.git: 2 commits - sc/source

Luboš Luňák l.lunak at collabora.com
Wed Jun 6 10:34:57 UTC 2018


 sc/source/core/tool/token.cxx |   51 +++++++++++++++++++++---------------------
 1 file changed, 26 insertions(+), 25 deletions(-)

New commits:
commit a5bae14bc3ae4fd1d0bd3bf72c5a6151d1ccf762
Author: Luboš Luňák <l.lunak at collabora.com>
Date:   Wed Jun 6 09:37:23 2018 +0200

    fix broken control flow in ScTokenArray::CheckToken()
    
    Before commit b366adcf5aca this function didn't do anything for unhandled
    opcodes, but the commit made the else branch disable vectorization
    for "the rest" of opcodes. That meant that basic opcodes such as ocAdd,
    which didn't get thrown out by the SC_OPCODE_START_BIN_OP block (since they
    are in the allowed subset), ended up in the else block and vectorization
    got disabled.
    
    Change-Id: I9eb408b601f48b8d7b5022ec85225d92729cd778
    Reviewed-on: https://gerrit.libreoffice.org/55362
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 8f2330f0cb2e..000e537b65b8 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1612,26 +1612,27 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
                 ;
         }
     }
-    else if (SC_OPCODE_START_BIN_OP <= eOp && eOp < SC_OPCODE_STOP_UN_OP &&
-        ScInterpreter::GetGlobalConfig().mbOpenCLSubsetOnly &&
-        ScInterpreter::GetGlobalConfig().mpOpenCLSubsetOpCodes->find(eOp) == ScInterpreter::GetGlobalConfig().mpOpenCLSubsetOpCodes->end())
+    else if (SC_OPCODE_START_BIN_OP <= eOp && eOp < SC_OPCODE_STOP_UN_OP)
     {
-        SAL_INFO("sc.opencl", "opcode " << formula::FormulaCompiler().GetOpCodeMap(sheet::FormulaLanguage::ENGLISH)->getSymbol(eOp) << " disables vectorisation for formula group");
-        meVectorState = FormulaVectorDisabledNotInSubSet;
-        mbOpenCLEnabled = false;
-        CheckForThreading(eOp);
-    }
-    // only when openCL interpreter is not enabled - the assumption is that
-    // the S/W interpreter blacklist is more strict
-    else if (SC_OPCODE_START_BIN_OP <= eOp && eOp < SC_OPCODE_STOP_UN_OP &&
-        ScCalcConfig::isSwInterpreterEnabled() &&
-        (dynamic_cast<sc::FormulaGroupInterpreterSoftware*>(sc::FormulaGroupInterpreter::getStatic()) != nullptr) &&
-        ScInterpreter::GetGlobalConfig().mpSwInterpreterSubsetOpCodes->find(eOp) == ScInterpreter::GetGlobalConfig().mpSwInterpreterSubsetOpCodes->end())
-    {
-        SAL_INFO("sc.core.formulagroup", "opcode " << formula::FormulaCompiler().GetOpCodeMap(sheet::FormulaLanguage::ENGLISH)->getSymbol(eOp) << " disables S/W interpreter for formula group");
-        meVectorState = FormulaVectorDisabledNotInSoftwareSubset;
-        mbOpenCLEnabled = false;
-        CheckForThreading(eOp);
+        if (ScInterpreter::GetGlobalConfig().mbOpenCLSubsetOnly &&
+            ScInterpreter::GetGlobalConfig().mpOpenCLSubsetOpCodes->find(eOp) == ScInterpreter::GetGlobalConfig().mpOpenCLSubsetOpCodes->end())
+        {
+            SAL_INFO("sc.opencl", "opcode " << formula::FormulaCompiler().GetOpCodeMap(sheet::FormulaLanguage::ENGLISH)->getSymbol(eOp) << " disables vectorisation for formula group");
+            meVectorState = FormulaVectorDisabledNotInSubSet;
+            mbOpenCLEnabled = false;
+            CheckForThreading(eOp);
+        }
+        // only when openCL interpreter is not enabled - the assumption is that
+        // the S/W interpreter blacklist is more strict
+        else if (ScCalcConfig::isSwInterpreterEnabled() &&
+                 (dynamic_cast<sc::FormulaGroupInterpreterSoftware*>(sc::FormulaGroupInterpreter::getStatic()) != nullptr) &&
+                 ScInterpreter::GetGlobalConfig().mpSwInterpreterSubsetOpCodes->find(eOp) == ScInterpreter::GetGlobalConfig().mpSwInterpreterSubsetOpCodes->end())
+        {
+            SAL_INFO("sc.core.formulagroup", "opcode " << formula::FormulaCompiler().GetOpCodeMap(sheet::FormulaLanguage::ENGLISH)->getSymbol(eOp) << " disables S/W interpreter for formula group");
+            meVectorState = FormulaVectorDisabledNotInSoftwareSubset;
+            mbOpenCLEnabled = false;
+            CheckForThreading(eOp);
+        }
     }
     else
     {
commit 377cb34ac023096af7f1708c3d4ea5293d4cc7ab
Author: Luboš Luňák <l.lunak at collabora.com>
Date:   Wed Jun 6 09:32:09 2018 +0200

    fix misplaced case labels
    
    Jump opcodes such as ocIf are quite clearly not in the function range,
    as can be seen in include/formula/opcode.hxx . This used to be harmless,
    since originally ScTokenArray::CheckToken() didn't do anything in the default
    case, but commit b366adcf5aca changed it to disable vectorization for
    unhandled opcodes.
    
    Change-Id: Ia182f446f1da819e18309075aa00251674640c74
    Reviewed-on: https://gerrit.libreoffice.org/55361
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 9b921db2b3e4..8f2330f0cb2e 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1388,12 +1388,6 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
         // We support vectorization for the following opcodes.
         switch (eOp)
         {
-            case ocIf:
-            case ocIfError:
-            case ocIfNA:
-            case ocChoose:
-                // Jump commands are now supported.
-            break;
             case ocAverage:
             case ocMin:
             case ocMinA:
@@ -1697,6 +1691,12 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
             case ocErrNum:
             case ocErrNA:
             break;
+            case ocIf:
+            case ocIfError:
+            case ocIfNA:
+            case ocChoose:
+                // Jump commands are now supported.
+            break;
         }
     }
 }


More information about the Libreoffice-commits mailing list