[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - 2 commits - sc/source

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


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

New commits:
commit 591933bf668b014055813edc75d5d4764c428e11
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>
    (cherry picked from commit a5bae14bc3ae4fd1d0bd3bf72c5a6151d1ccf762)
    Reviewed-on: https://gerrit.libreoffice.org/55367
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
    Tested-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 345af5772d2f..fa7bcdaf6e31 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1611,26 +1611,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 5859d4ac37eaf32045a67ddd76419c14fe6fadfb
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>
    (cherry picked from commit 377cb34ac023096af7f1708c3d4ea5293d4cc7ab)
    Reviewed-on: https://gerrit.libreoffice.org/55368
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
    Tested-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 575ebd64cad4..345af5772d2f 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1387,12 +1387,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:
@@ -1696,6 +1690,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