[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - sc/source

Tor Lillqvist tml at collabora.com
Mon Dec 15 16:01:57 PST 2014


 sc/source/core/data/formulacell.cxx  |    4 +++-
 sc/source/core/tool/formulagroup.cxx |    7 +++++--
 sc/source/core/tool/interpr5.cxx     |   12 ++++++++----
 3 files changed, 16 insertions(+), 7 deletions(-)

New commits:
commit 1c0b8b8f06e1ecf39789f00cff0c6ebc712aa272
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Dec 9 12:45:41 2014 +0200

    fdo#87119: Don't use of the broken "Software" group interpreter
    
    FormulaGroupInterpreterSoftware is known to be broken, says moggi. We should
    not use it as a fallback to OpenCL.
    
    Not sure whether it makes sense, but let's keep it in the code for now.  Make
    using it conditional on setting the environment variable
    SC_ALLOW_BROKEN_SOFTWARE_INTERPRETER (to any value). Only a developer who
    wants to work on it should set that.
    
    sc::FormulaGroupInterpreter::getStatic() can now return NULL, adapt callers
    accordingly.
    
    Change-Id: I20f6e2658f556e2d4a0687f3730dccdbedb88603
    Reviewed-on: https://gerrit.libreoffice.org/13397
    Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>
    Tested-by: Kohei Yoshida <libreoffice at kohei.us>

diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index b4e56b2..e68fe16 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -3779,7 +3779,9 @@ bool ScFormulaCell::InterpretFormulaGroup()
     // The converted code does not have RPN tokens yet.  The interpreter will
     // generate them.
     mxGroup->meCalcState = sc::GroupCalcRunning;
-    if (!sc::FormulaGroupInterpreter::getStatic()->interpret(*pDocument, mxGroup->mpTopCell->aPos, mxGroup, aCode))
+    sc::FormulaGroupInterpreter *pInterpreter = sc::FormulaGroupInterpreter::getStatic();
+    if (pInterpreter == NULL ||
+        !pInterpreter->interpret(*pDocument, mxGroup->mpTopCell->aPos, mxGroup, aCode))
     {
         SAL_INFO("sc.opencl", "interpreting group " << mxGroup << " (state " << (int) mxGroup->meCalcState << ") failed, disabling");
         mxGroup->meCalcState = sc::GroupCalcDisabled;
diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx
index cc4f805..32ee19a 100644
--- a/sc/source/core/tool/formulagroup.cxx
+++ b/sc/source/core/tool/formulagroup.cxx
@@ -528,7 +528,9 @@ FormulaGroupInterpreter *FormulaGroupInterpreter::getStatic()
         if (officecfg::Office::Common::Misc::UseOpenCL::get())
             switchOpenCLDevice(rConfig.maOpenCLDevice, rConfig.mbOpenCLAutoSelect, false);
 #endif
-        if ( !msInstance ) // software fallback
+        static bool bAllowSoftwareInterpreter = (getenv("SC_ALLOW_BROKEN_SOFTWARE_INTERPRETER") != NULL);
+
+        if ( !msInstance && bAllowSoftwareInterpreter ) // software fallback
         {
             SAL_INFO("sc.formulagroup", "Create S/W interpreter");
             msInstance = new sc::FormulaGroupInterpreterSoftware();
@@ -550,7 +552,8 @@ void FormulaGroupInterpreter::fillOpenCLInfo(std::vector<OpenCLPlatformInfo>& rP
 bool FormulaGroupInterpreter::switchOpenCLDevice(const OUString& rDeviceId, bool bAutoSelect, bool bForceEvaluation)
 {
     bool bOpenCLEnabled = officecfg::Office::Common::Misc::UseOpenCL::get();
-    if (!bOpenCLEnabled || rDeviceId == OPENCL_SOFTWARE_DEVICE_CONFIG_NAME)
+    static bool bAllowSoftwareInterpreter = (getenv("SC_ALLOW_BROKEN_SOFTWARE_INTERPRETER") != NULL);
+    if (!bOpenCLEnabled || (bAllowSoftwareInterpreter && rDeviceId == OPENCL_SOFTWARE_DEVICE_CONFIG_NAME))
     {
         if(msInstance)
         {
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index 05936fa..e334846 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -911,11 +911,15 @@ void ScInterpreter::ScMatInv()
 
         if (officecfg::Office::Common::Misc::UseOpenCL::get())
         {
-            ScMatrixRef xResMat = sc::FormulaGroupInterpreter::getStatic()->inverseMatrix(*pMat);
-            if (xResMat)
+            sc::FormulaGroupInterpreter *pInterpreter = sc::FormulaGroupInterpreter::getStatic();
+            if (pInterpreter != NULL)
             {
-                PushMatrix(xResMat);
-                return;
+                ScMatrixRef xResMat = pInterpreter->inverseMatrix(*pMat);
+                if (xResMat)
+                {
+                    PushMatrix(xResMat);
+                    return;
+                }
             }
         }
 


More information about the Libreoffice-commits mailing list