summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2014-12-09 12:45:41 +0200
committerKohei Yoshida <libreoffice@kohei.us>2014-12-16 00:01:26 +0000
commit1c0b8b8f06e1ecf39789f00cff0c6ebc712aa272 (patch)
treecaff86504670aace21cadd73becdfe324465c08e
parente9aa788f6c2016953f3e9ff4483f8d4215c9edea (diff)
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@kohei.us> Tested-by: Kohei Yoshida <libreoffice@kohei.us>
-rw-r--r--sc/source/core/data/formulacell.cxx4
-rw-r--r--sc/source/core/tool/formulagroup.cxx7
-rw-r--r--sc/source/core/tool/interpr5.cxx12
3 files changed, 16 insertions, 7 deletions
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index b4e56b2807a1..e68fe1673367 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 cc4f80512376..32ee19aa770d 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 05936fa29696..e33484658837 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;
+ }
}
}