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

Tor Lillqvist tml at collabora.com
Tue Dec 9 03:11: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 6eb155dea00a1e312fdc3339406bf168a93a25e7
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Dec 9 12:45:41 2014 +0200

    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.
    
    This might fix fdo#87119, but I am not able to check, as the document from
    that bug causes an unrelated assertion for me.
    
    Change-Id: I24454f46332014cbcbf696252059b9743f3c84d6

diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 80842fe..7cf0656 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -3778,7 +3778,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