summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--comphelper/source/misc/backupfilehelper.cxx2
-rw-r--r--cui/source/dialogs/about.cxx3
-rw-r--r--cui/source/options/optopencl.cxx14
-rw-r--r--cui/source/options/optopencl.hxx1
-rw-r--r--cui/uiconfig/ui/optopenclpage.ui16
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Common.xcs7
-rw-r--r--sc/inc/calcconfig.hxx2
-rw-r--r--sc/inc/formulagroup.hxx10
-rw-r--r--sc/qa/perf/scperfobj.cxx32
-rw-r--r--sc/qa/unit/copy_paste_test.cxx1
-rw-r--r--sc/qa/unit/ucalc_formula.cxx48
-rw-r--r--sc/source/core/data/formulacell.cxx15
-rw-r--r--sc/source/core/tool/calcconfig.cxx21
-rw-r--r--sc/source/core/tool/formulagroup.cxx311
-rw-r--r--sc/source/core/tool/formulalogger.cxx2
-rw-r--r--sc/source/core/tool/token.cxx27
16 files changed, 25 insertions, 487 deletions
diff --git a/comphelper/source/misc/backupfilehelper.cxx b/comphelper/source/misc/backupfilehelper.cxx
index 8bb0804739d5..d47c9904c696 100644
--- a/comphelper/source/misc/backupfilehelper.cxx
+++ b/comphelper/source/misc/backupfilehelper.cxx
@@ -2112,8 +2112,6 @@ namespace comphelper
"ForceOpenGL", "false"));
xRootElement->appendChild(lcl_getConfigElement(xDocument, "/org.openoffice.Office.Common/Misc",
"UseOpenCL", "false"));
- xRootElement->appendChild(lcl_getConfigElement(xDocument, "/org.openoffice.Office.Common/Misc",
- "UseSwInterpreter", "false"));
// write back
uno::Reference< xml::sax::XSAXSerializable > xSerializer(xDocument, uno::UNO_QUERY);
diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx
index 152b49ec9d1f..76ad0ef1fdbe 100644
--- a/cui/source/dialogs/about.cxx
+++ b/cui/source/dialogs/about.cxx
@@ -341,12 +341,9 @@ OUString AboutDialog::GetVersionString()
OUString aCalcMode = "Calc: "; // Calc calculation mode
#if HAVE_FEATURE_OPENCL
- bool bSWInterp = officecfg::Office::Common::Misc::UseSwInterpreter::get();
bool bOpenCL = openclwrapper::GPUEnv::isOpenCLEnabled();
if (bOpenCL)
aCalcMode += "CL";
- else if (bSWInterp)
- aCalcMode += "group";
#else
const bool bOpenCL = false;
#endif
diff --git a/cui/source/options/optopencl.cxx b/cui/source/options/optopencl.cxx
index 4448ed99405c..e6cf91a376ff 100644
--- a/cui/source/options/optopencl.cxx
+++ b/cui/source/options/optopencl.cxx
@@ -47,14 +47,10 @@ SvxOpenCLTabPage::SvxOpenCLTabPage(vcl::Window* pParent, const SfxItemSet& rSet)
SfxTabPage(pParent, "OptOpenCLPage", "cui/ui/optopenclpage.ui", &rSet),
maConfig(OpenCLConfig::get())
{
- get(mpUseSwInterpreter, "useswinterpreter");
get(mpUseOpenCL, "useopencl");
get(mpOclUsed,"openclused");
get(mpOclNotUsed,"openclnotused");
- mpUseSwInterpreter->Check(officecfg::Office::Common::Misc::UseSwInterpreter::get());
- mpUseSwInterpreter->Enable(!officecfg::Office::Common::Misc::UseSwInterpreter::isReadOnly());
-
mpUseOpenCL->Check(maConfig.mbUseOpenCL);
mpUseOpenCL->Enable(!officecfg::Office::Common::Misc::UseOpenCL::isReadOnly());
@@ -70,7 +66,6 @@ SvxOpenCLTabPage::~SvxOpenCLTabPage()
void SvxOpenCLTabPage::dispose()
{
- mpUseSwInterpreter.clear();
mpUseOpenCL.clear();
mpOclUsed.clear();
mpOclNotUsed.clear();
@@ -88,12 +83,6 @@ bool SvxOpenCLTabPage::FillItemSet( SfxItemSet* )
bool bModified = false;
std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
- if (mpUseSwInterpreter->IsValueChangedFromSaved())
- {
- officecfg::Office::Common::Misc::UseSwInterpreter::set(mpUseSwInterpreter->IsChecked(), batch);
- bModified = true;
- }
-
if (mpUseOpenCL->IsValueChangedFromSaved())
maConfig.mbUseOpenCL = mpUseOpenCL->IsChecked();
@@ -127,9 +116,6 @@ void SvxOpenCLTabPage::Reset( const SfxItemSet* )
{
maConfig = OpenCLConfig::get();
- mpUseSwInterpreter->Check(officecfg::Office::Common::Misc::UseSwInterpreter::get());
- mpUseSwInterpreter->SaveValue();
-
mpUseOpenCL->Check(maConfig.mbUseOpenCL);
mpUseOpenCL->SaveValue();
}
diff --git a/cui/source/options/optopencl.hxx b/cui/source/options/optopencl.hxx
index cb7878f80646..f7d62eb831c7 100644
--- a/cui/source/options/optopencl.hxx
+++ b/cui/source/options/optopencl.hxx
@@ -31,7 +31,6 @@ class SvxOpenCLTabPage : public SfxTabPage
private:
OpenCLConfig maConfig;
- VclPtr<CheckBox> mpUseSwInterpreter;
VclPtr<CheckBox> mpUseOpenCL;
VclPtr<FixedText> mpOclUsed;
diff --git a/cui/uiconfig/ui/optopenclpage.ui b/cui/uiconfig/ui/optopenclpage.ui
index 4c956b6f9887..b0dad0b14d15 100644
--- a/cui/uiconfig/ui/optopenclpage.ui
+++ b/cui/uiconfig/ui/optopenclpage.ui
@@ -26,22 +26,6 @@
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
- <object class="GtkCheckButton" id="useswinterpreter">
- <property name="label" translatable="yes" context="optopenclpage|useswinterpreter">Allow use of Software Interpreter (even when OpenCL is not available)</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
<object class="GtkCheckButton" id="useopencl">
<property name="label" translatable="yes" context="optopenclpage|useopencl">Allow use of OpenCL</property>
<property name="visible">True</property>
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index d31d8697a646..948fddc7cc31 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -5417,13 +5417,6 @@
</info>
<value>none</value>
</prop>
- <prop oor:name="UseSwInterpreter" oor:type="xs:boolean" oor:nillable="false">
- <info>
- <desc>Determines whether Software Interpreter can be used to speed
- up some operations on Calc formulas.</desc>
- </info>
- <value>true</value>
- </prop>
<prop oor:name="MacroRecorderMode" oor:type="xs:boolean" oor:nillable="false">
<info>
<desc>Determines if the limited, and awkward code producing
diff --git a/sc/inc/calcconfig.hxx b/sc/inc/calcconfig.hxx
index 3ef920857fd0..2f840f9abdcb 100644
--- a/sc/inc/calcconfig.hxx
+++ b/sc/inc/calcconfig.hxx
@@ -47,7 +47,6 @@ struct SC_DLLPUBLIC ScCalcConfig
static bool isOpenCLEnabled();
static bool isThreadingEnabled();
- static bool isSwInterpreterEnabled();
bool mbOpenCLSubsetOnly:1;
bool mbOpenCLAutoSelect:1;
@@ -57,7 +56,6 @@ struct SC_DLLPUBLIC ScCalcConfig
typedef std::shared_ptr<std::set<OpCode>> OpCodeSet;
OpCodeSet mpOpenCLSubsetOpCodes;
- OpCodeSet mpSwInterpreterSubsetOpCodes;
ScCalcConfig();
diff --git a/sc/inc/formulagroup.hxx b/sc/inc/formulagroup.hxx
index db37426df05f..593beb8c4bca 100644
--- a/sc/inc/formulagroup.hxx
+++ b/sc/inc/formulagroup.hxx
@@ -146,16 +146,6 @@ public:
virtual bool interpret(ScDocument& rDoc, const ScAddress& rTopPos, ScFormulaCellGroupRef& xGroup, ScTokenArray& rCode) = 0;
};
-/// Inherit from this for alternate formula group calculation approaches.
-class SC_DLLPUBLIC FormulaGroupInterpreterSoftware : public FormulaGroupInterpreter
-{
-public:
- FormulaGroupInterpreterSoftware();
-
- virtual ScMatrixRef inverseMatrix(const ScMatrix& rMat) override;
- virtual bool interpret(ScDocument& rDoc, const ScAddress& rTopPos, ScFormulaCellGroupRef& xGroup, ScTokenArray& rCode) override;
-};
-
}
#endif
diff --git a/sc/qa/perf/scperfobj.cxx b/sc/qa/perf/scperfobj.cxx
index 433985360323..628fc1233669 100644
--- a/sc/qa/perf/scperfobj.cxx
+++ b/sc/qa/perf/scperfobj.cxx
@@ -65,7 +65,6 @@ public:
CPPUNIT_TEST_SUITE(ScPerfObj);
CPPUNIT_TEST(testSheetFindAll);
CPPUNIT_TEST(testFixedSum);
- CPPUNIT_TEST(testFormulaGroupSWInterpreter);
CPPUNIT_TEST(testSheetNamedRanges);
CPPUNIT_TEST(testSheets);
CPPUNIT_TEST(testSum);
@@ -103,7 +102,6 @@ private:
void testSubTotalWithoutFormulas();
void testLoadingFileWithSingleBigSheet();
void testFixedSum();
- void testFormulaGroupSWInterpreter();
void testMatConcatSmall();
void testMatConcatLarge();
};
@@ -697,36 +695,6 @@ void ScPerfObj::testFixedSum()
}
}
-void ScPerfObj::testFormulaGroupSWInterpreter()
-{
- // 1. Create spreadsheet
- SpreadsheetDoc aSpreadsheet;
-
- // 2. Disable OpenCL
- ScModelObj* pModel = aSpreadsheet.GetModel();
- pModel->enableOpenCL(false);
- CPPUNIT_ASSERT(!ScCalcConfig::isOpenCLEnabled());
- pModel->enableAutomaticCalculation(false);
-
- // 3. Setup data and formulas
- ScDocument& rDoc = aSpreadsheet.GetDocument();
-
- for (unsigned int r = 0; r <= 10000; ++r)
- rDoc.SetValue( ScAddress(0,r,0), r+1 );
-
- rDoc.SetString(ScAddress(1,0,0), "=A1");
- rDoc.SetString(ScAddress(2,0,0), "=PRODUCT(A1,SUM(B1:B$10000))");
-
- aSpreadsheet.copyRange("B1:C1", "B2:C10000");
-
- // 4. Calculate
- callgrindStart();
- pModel->calculateAll();
- callgrindDump("sc:formula_group_sw_interpreter");
-
- // 5. Automatically close the document (Ctrl-W) on spreadsheet destruction
-}
-
void ScPerfObj::testMatConcatSmall()
{
uno::Reference< sheet::XSpreadsheetDocument > xDoc(init("empty.ods"), UNO_QUERY_THROW);
diff --git a/sc/qa/unit/copy_paste_test.cxx b/sc/qa/unit/copy_paste_test.cxx
index f222f8fd3e34..e2a8b51a030a 100644
--- a/sc/qa/unit/copy_paste_test.cxx
+++ b/sc/qa/unit/copy_paste_test.cxx
@@ -209,7 +209,6 @@ void ScCopyPasteTest::testTdf84411()
pModel->enableOpenCL(false);
CPPUNIT_ASSERT(!ScCalcConfig::isOpenCLEnabled());
pModel->enableAutomaticCalculation(true);
- CPPUNIT_ASSERT( ScCalcConfig::isSwInterpreterEnabled() );
// 4. Copy and Paste
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index 3b69bce3049f..5be2404d484f 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -865,48 +865,30 @@ void Test::testFormulaHashAndTag()
struct {
const char* pFormula;
ScFormulaVectorState eState;
- ScFormulaVectorState eSwInterpreterState; // these can change when more is whitelisted
} aVectorTests[] = {
- { "=SUM(1;2;3;4;5)", FormulaVectorEnabled, FormulaVectorEnabled },
- { "=NOW()", FormulaVectorDisabled, FormulaVectorDisabled },
- { "=AVERAGE(X1:Y200)", FormulaVectorCheckReference, FormulaVectorDisabled },
- { "=MAX(X1:Y200;10;20)", FormulaVectorCheckReference, FormulaVectorDisabled },
- { "=MIN(10;11;22)", FormulaVectorEnabled, FormulaVectorDisabled },
- { "=H4", FormulaVectorCheckReference, FormulaVectorCheckReference },
+ { "=SUM(1;2;3;4;5)", FormulaVectorEnabled },
+ { "=NOW()", FormulaVectorDisabled },
+ { "=AVERAGE(X1:Y200)", FormulaVectorCheckReference },
+ { "=MAX(X1:Y200;10;20)", FormulaVectorCheckReference },
+ { "=MIN(10;11;22)", FormulaVectorEnabled },
+ { "=H4", FormulaVectorCheckReference },
};
- bool bSwInterpreter = officecfg::Office::Common::Misc::UseSwInterpreter::get();
- bool bOpenCL = officecfg::Office::Common::Misc::UseOpenCL::get();
-
- for (bool bForceSwInterpreter : { false, true })
+ for (size_t i = 0; i < SAL_N_ELEMENTS(aVectorTests); ++i)
{
- std::shared_ptr< comphelper::ConfigurationChanges > xBatch(comphelper::ConfigurationChanges::create());
- officecfg::Office::Common::Misc::UseSwInterpreter::set(bForceSwInterpreter, xBatch);
- if (bForceSwInterpreter)
- officecfg::Office::Common::Misc::UseOpenCL::set(false, xBatch);
- xBatch->commit();
+ m_pDoc->SetString(aPos1, OUString::createFromAscii(aVectorTests[i].pFormula));
+ ScFormulaVectorState eState = m_pDoc->GetFormulaVectorState(aPos1);
+ ScFormulaVectorState eReferenceState = aVectorTests[i].eState;
- for (size_t i = 0; i < SAL_N_ELEMENTS(aVectorTests); ++i)
+ if (eState != eReferenceState)
{
- m_pDoc->SetString(aPos1, OUString::createFromAscii(aVectorTests[i].pFormula));
- ScFormulaVectorState eState = m_pDoc->GetFormulaVectorState(aPos1);
- ScFormulaVectorState eReferenceState = bForceSwInterpreter? aVectorTests[i].eSwInterpreterState: aVectorTests[i].eState;
-
- if (eState != eReferenceState)
- {
- std::ostringstream os;
- os << "Unexpected vectorization state: expr: '" << aVectorTests[i].pFormula << "', using software interpreter: " << bForceSwInterpreter;
- CPPUNIT_ASSERT_MESSAGE(os.str(), false);
- }
- aPos1.IncRow();
+ std::ostringstream os;
+ os << "Unexpected vectorization state: expr: '" << aVectorTests[i].pFormula << "'";
+ CPPUNIT_ASSERT_MESSAGE(os.str(), false);
}
+ aPos1.IncRow();
}
- std::shared_ptr< comphelper::ConfigurationChanges > xBatch(comphelper::ConfigurationChanges::create());
- officecfg::Office::Common::Misc::UseSwInterpreter::set(bSwInterpreter, xBatch);
- officecfg::Office::Common::Misc::UseOpenCL::set(bOpenCL, xBatch);
- xBatch->commit();
-
m_pDoc->DeleteTab(0);
}
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 2bb71a46b868..53e82c367d47 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -4526,17 +4526,14 @@ bool ScFormulaCell::InterpretFormulaGroup()
bool bDependencyComputed = false;
bool bDependencyCheckFailed = false;
- // Preference order:
- // First try OpenCL, but only if actual OpenCL is available (i.e. no SwInterpreter).
- // Then try threading and as the last one try SwInterpreter.
- if( ScCalcConfig::isOpenCLEnabled())
- if( InterpretFormulaGroupOpenCL(aScope, bDependencyComputed, bDependencyCheckFailed))
- return true;
+ // Preference order: First try OpenCL, then threading.
+ if( InterpretFormulaGroupOpenCL(aScope, bDependencyComputed, bDependencyCheckFailed))
+ return true;
if( InterpretFormulaGroupThreading(aScope, bDependencyComputed, bDependencyCheckFailed))
return true;
- return InterpretFormulaGroupOpenCL(aScope, bDependencyComputed, bDependencyCheckFailed);
+ return false;
}
bool ScFormulaCell::CheckComputeDependencies(sc::FormulaLogger::GroupScope& rScope)
@@ -4726,9 +4723,9 @@ bool ScFormulaCell::InterpretFormulaGroupOpenCL(sc::FormulaLogger::GroupScope& a
if (!bCanVectorize)
return false;
- if (!ScCalcConfig::isOpenCLEnabled() && !ScCalcConfig::isSwInterpreterEnabled())
+ if (!ScCalcConfig::isOpenCLEnabled())
{
- aScope.addMessage("opencl not enabled and sw interpreter not enabled");
+ aScope.addMessage("opencl not enabled");
return false;
}
diff --git a/sc/source/core/tool/calcconfig.cxx b/sc/source/core/tool/calcconfig.cxx
index 5e63d4debf62..4a1f5d3d3c27 100644
--- a/sc/source/core/tool/calcconfig.cxx
+++ b/sc/source/core/tool/calcconfig.cxx
@@ -59,14 +59,6 @@ bool ScCalcConfig::isThreadingEnabled()
return gThreadingEnabled.get();
}
-bool ScCalcConfig::isSwInterpreterEnabled()
-{
- if (utl::ConfigManager::IsFuzzing())
- return false;
- static comphelper::ConfigurationListenerProperty<bool> gSwInterpreterEnabled(getMiscListener(), "UseSwInterpreter");
- return gSwInterpreterEnabled.get();
-}
-
ScCalcConfig::ScCalcConfig() :
meStringRefAddressSyntax(formula::FormulaGrammar::CONV_UNSPECIFIED),
meStringConversion(StringConversion::LOCALE), // old LibreOffice behavior
@@ -115,15 +107,6 @@ void ScCalcConfig::setOpenCLConfigToDefault()
ocSlope,
ocSumIfs}));
- // opcodes that are known to work well with the software interpreter
- static OpCodeSet pDefaultSwInterpreterSubsetOpCodes(new std::set<OpCode>({
- ocAdd,
- ocSub,
- ocMul,
- ocDiv,
- ocSum,
- ocProduct}));
-
// Note that these defaults better be kept in sync with those in
// officecfg/registry/schema/org/openoffice/Office/Calc.xcs.
// Crazy.
@@ -131,7 +114,6 @@ void ScCalcConfig::setOpenCLConfigToDefault()
mbOpenCLAutoSelect = true;
mnOpenCLMinimumFormulaGroupSize = 100;
mpOpenCLSubsetOpCodes = pDefaultOpenCLSubsetOpCodes;
- mpSwInterpreterSubsetOpCodes = pDefaultSwInterpreterSubsetOpCodes;
}
void ScCalcConfig::reset()
@@ -165,8 +147,7 @@ bool ScCalcConfig::operator== (const ScCalcConfig& r) const
mbOpenCLAutoSelect == r.mbOpenCLAutoSelect &&
maOpenCLDevice == r.maOpenCLDevice &&
mnOpenCLMinimumFormulaGroupSize == r.mnOpenCLMinimumFormulaGroupSize &&
- *mpOpenCLSubsetOpCodes == *r.mpOpenCLSubsetOpCodes &&
- *mpSwInterpreterSubsetOpCodes == *r.mpSwInterpreterSubsetOpCodes;
+ *mpOpenCLSubsetOpCodes == *r.mpOpenCLSubsetOpCodes;
}
bool ScCalcConfig::operator!= (const ScCalcConfig& r) const
diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx
index c007263f68f1..533c0c002d87 100644
--- a/sc/source/core/tool/formulagroup.cxx
+++ b/sc/source/core/tool/formulagroup.cxx
@@ -147,292 +147,6 @@ CompiledFormula::CompiledFormula() {}
CompiledFormula::~CompiledFormula() {}
-FormulaGroupInterpreterSoftware::FormulaGroupInterpreterSoftware() : FormulaGroupInterpreter()
-{
-}
-
-ScMatrixRef FormulaGroupInterpreterSoftware::inverseMatrix(const ScMatrix& /*rMat*/)
-{
- return ScMatrixRef();
-}
-
-class SoftwareInterpreterFunc
-{
-public:
- SoftwareInterpreterFunc(ScTokenArray& rCode,
- ScAddress aBatchTopPos,
- const ScAddress& rTopPos,
- ScDocument& rDoc,
- SvNumberFormatter* pFormatter,
- std::vector<formula::FormulaConstTokenRef>& rRes,
- SCROW nIndex,
- SCROW nLastIndex) :
- mrCode(rCode),
- maBatchTopPos(aBatchTopPos),
- mrTopPos(rTopPos),
- mrDoc(rDoc),
- mpFormatter(pFormatter),
- mrResults(rRes),
- mnIdx(nIndex),
- mnLastIdx(nLastIndex)
- {
- }
-
- void operator() ()
- {
- double fNan;
- rtl::math::setNan(&fNan);
- ScTokenArray aCode2;
-
- ScInterpreterContext aContext(mrDoc, mpFormatter);
- sal_uInt16 nNumNonOpenClose = mrCode.GetLen();
-
- for (SCROW i = mnIdx; i <= mnLastIdx; ++i, maBatchTopPos.IncRow())
- {
- formula::FormulaTokenArrayPlainIterator aIter(mrCode);
- size_t nTokIdx = 0;
- for (const formula::FormulaToken* p = aIter.First(); p; p = aIter.Next(), ++nTokIdx)
- {
- formula::FormulaToken* pTargetTok = aCode2.TokenAt(nTokIdx);
- switch (p->GetType())
- {
- case formula::svSingleVectorRef:
- {
- const formula::SingleVectorRefToken* p2 = static_cast<const formula::SingleVectorRefToken*>(p);
- const formula::VectorRefArray& rArray = p2->GetArray();
-
- rtl_uString* pStr = nullptr;
- double fVal = fNan;
- if (static_cast<size_t>(i) < p2->GetArrayLength())
- {
- if (rArray.mpStringArray)
- // See if the cell is of string type.
- pStr = rArray.mpStringArray[i];
-
- if (!pStr && rArray.mpNumericArray)
- fVal = rArray.mpNumericArray[i];
- }
-
- if (pStr)
- {
- // This is a string cell.
- svl::SharedStringPool& rPool = mrDoc.GetSharedStringPool();
- if ( !pTargetTok )
- aCode2.AddString(rPool.intern(OUString(pStr)));
- else
- {
- if ( ( pTargetTok->GetType() == formula::svString ) && ( nNumNonOpenClose > 1 ) )
- pTargetTok->SetString(rPool.intern(OUString(pStr)));
- else
- {
- formula::FormulaStringToken* pStrTok = new formula::FormulaStringToken(rPool.intern(OUString(pStr)));
- aCode2.ReplaceToken(nTokIdx, pStrTok, formula::FormulaTokenArray::CODE_ONLY);
- }
- }
- }
- else if (rtl::math::isNan(fVal))
- {
- // Value of NaN represents an empty cell.
- if ( !pTargetTok )
- aCode2.AddToken(ScEmptyCellToken(false, false));
- else if ( ( pTargetTok->GetType() != formula::svEmptyCell ) || ( nNumNonOpenClose == 1 ) )
- {
- ScEmptyCellToken* pEmptyTok = new ScEmptyCellToken(false, false);
- aCode2.ReplaceToken(nTokIdx, pEmptyTok, formula::FormulaTokenArray::CODE_ONLY);
- }
- }
- else
- {
- // Numeric cell.
- if ( !pTargetTok )
- aCode2.AddDouble(fVal);
- else
- {
- if ( ( pTargetTok->GetType() == formula::svDouble ) && ( nNumNonOpenClose > 1 ) )
- pTargetTok->GetDoubleAsReference() = fVal;
- else
- {
- formula::FormulaDoubleToken* pDoubleTok = new formula::FormulaDoubleToken( fVal );
- aCode2.ReplaceToken(nTokIdx, pDoubleTok, formula::FormulaTokenArray::CODE_ONLY);
- }
- }
- }
- }
- break;
- case formula::svDoubleVectorRef:
- {
- const formula::DoubleVectorRefToken* p2 = static_cast<const formula::DoubleVectorRefToken*>(p);
- size_t nRowStart = p2->IsStartFixed() ? 0 : i;
- size_t nRowEnd = p2->GetRefRowSize() - 1;
- if (!p2->IsEndFixed())
- nRowEnd += i;
-
- assert(nRowStart <= nRowEnd);
- ScMatrixRef pMat(new ScVectorRefMatrix(p2, nRowStart, nRowEnd - nRowStart + 1));
-
- if (p2->IsStartFixed() && p2->IsEndFixed())
- {
- // Cached the converted token for absolute range reference.
- ScComplexRefData aRef;
- ScRange aRefRange = mrTopPos;
- aRefRange.aEnd.SetRow(mrTopPos.Row() + nRowEnd);
- aRef.InitRange(aRefRange);
- formula::FormulaTokenRef xTok(new ScMatrixRangeToken(pMat, aRef));
- if ( !pTargetTok )
- aCode2.AddToken(*xTok);
- else
- aCode2.ReplaceToken(nTokIdx, xTok.get(), formula::FormulaTokenArray::CODE_ONLY);
- }
- else
- {
- if ( !pTargetTok )
- {
- ScMatrixToken aTok(pMat);
- aCode2.AddToken(aTok);
- }
- else
- {
- ScMatrixToken* pMatTok = new ScMatrixToken(pMat);
- aCode2.ReplaceToken(nTokIdx, pMatTok, formula::FormulaTokenArray::CODE_ONLY);
- }
- }
- }
- break;
- default:
- if ( !pTargetTok )
- {
- if ( p->GetType() == formula::svSep )
- {
- OpCode eOp = p->GetOpCode();
- if ( eOp == ocOpen || eOp == ocClose )
- --nNumNonOpenClose;
- }
-
- aCode2.AddToken(*p);
- }
- } // end of switch statement
- } // end of formula token for loop
-
- ScFormulaCell* pDest = mrDoc.GetFormulaCell(maBatchTopPos);
- if (!pDest)
- return;
-
- ScCompiler aComp(&mrDoc, maBatchTopPos, aCode2);
- aComp.CompileTokenArray();
- ScInterpreter aInterpreter(pDest, &mrDoc, aContext, maBatchTopPos, aCode2);
- aInterpreter.Interpret();
- mrResults[i] = aInterpreter.GetResultToken();
- } // Row iteration for loop end
- } // operator () end
-
-private:
- ScTokenArray& mrCode;
- ScAddress maBatchTopPos;
- const ScAddress& mrTopPos;
- ScDocument& mrDoc;
- SvNumberFormatter* mpFormatter;
- std::vector<formula::FormulaConstTokenRef>& mrResults;
- SCROW mnIdx;
- SCROW mnLastIdx;
-};
-
-bool FormulaGroupInterpreterSoftware::interpret(ScDocument& rDoc, const ScAddress& rTopPos,
- ScFormulaCellGroupRef& xGroup,
- ScTokenArray& rCode)
-{
- // Decompose the group into individual cells and calculate them individually.
-
- // The caller must ensure that the top position is the start position of
- // the group.
-
- const static bool bHyperThreadingActive = tools::cpuid::hasHyperThreading();
- ScAddress aTmpPos = rTopPos;
- std::vector<formula::FormulaConstTokenRef> aResults(xGroup->mnLength);
-
- class Executor : public comphelper::ThreadTask
- {
- public:
- Executor(const std::shared_ptr<comphelper::ThreadTaskTag>& rTag,
- ScTokenArray& rCode2,
- ScAddress aBatchTopPos,
- const ScAddress& rTopPos2,
- ScDocument& rDoc2,
- SvNumberFormatter* pFormatter2,
- std::vector<formula::FormulaConstTokenRef>& rRes,
- SCROW nIndex,
- SCROW nLastIndex) :
- comphelper::ThreadTask(rTag),
- maSWIFunc(rCode2, aBatchTopPos, rTopPos2, rDoc2, pFormatter2, rRes, nIndex, nLastIndex)
- {
- }
- virtual void doWork() override
- {
- maSWIFunc();
- }
-
- private:
- SoftwareInterpreterFunc maSWIFunc;
- };
-
- static const bool bThreadingProhibited = std::getenv("SC_NO_THREADED_CALCULATION");
-
- bool bUseThreading = !bThreadingProhibited && ScCalcConfig::isThreadingEnabled() && rCode.IsEnabledForThreading();
-
- SvNumberFormatter* pFormatter = rDoc.GetNonThreadedContext().GetFormatTable();
-
- if (bUseThreading)
- {
- comphelper::ThreadPool& rThreadPool(comphelper::ThreadPool::getSharedOptimalPool());
- sal_Int32 nThreadCount = rThreadPool.getWorkerCount();
-
- if ( bHyperThreadingActive && nThreadCount >= 2 )
- nThreadCount /= 2;
-
- SCROW nLen = xGroup->mnLength;
- SCROW nBatchSize = nLen / nThreadCount;
- if (nLen < nThreadCount)
- {
- nBatchSize = 1;
- nThreadCount = nLen;
- }
- SCROW nRemaining = nLen - nBatchSize * nThreadCount;
-
- SAL_INFO("sc.threaded", "Running " << nThreadCount << " threads");
-
- SCROW nLeft = nLen;
- SCROW nStart = 0;
- std::shared_ptr<comphelper::ThreadTaskTag> aTag = comphelper::ThreadPool::createThreadTaskTag();
- while (nLeft > 0)
- {
- SCROW nCount = std::min(nLeft, nBatchSize) + (nRemaining ? 1 : 0);
- if ( nRemaining )
- --nRemaining;
- SCROW nLast = nStart + nCount - 1;
- rThreadPool.pushTask(o3tl::make_unique<Executor>(aTag, rCode, aTmpPos, rTopPos, rDoc, pFormatter, aResults, nStart, nLast));
- aTmpPos.IncRow(nCount);
- nLeft -= nCount;
- nStart = nLast + 1;
- }
- SAL_INFO("sc.threaded", "Joining threads");
- rThreadPool.waitUntilDone(aTag);
- SAL_INFO("sc.threaded", "Done");
- }
- else
- {
- SoftwareInterpreterFunc aSWIFunc(rCode, aTmpPos, rTopPos, rDoc, pFormatter, aResults, 0, xGroup->mnLength - 1);
- aSWIFunc();
- }
-
- for (SCROW i = 0; i < xGroup->mnLength; ++i)
- if (!aResults[i].get())
- return false;
-
- if (!aResults.empty())
- rDoc.SetFormulaResults(rTopPos, &aResults[0], aResults.size());
-
- return true;
-}
-
FormulaGroupInterpreter *FormulaGroupInterpreter::msInstance = nullptr;
void FormulaGroupInterpreter::MergeCalcConfig(const ScDocument& rDoc)
@@ -453,12 +167,6 @@ FormulaGroupInterpreter *FormulaGroupInterpreter::getStatic()
switchOpenCLDevice(rConfig.maOpenCLDevice, rConfig.mbOpenCLAutoSelect);
}
#endif
-
- if (!msInstance && ScCalcConfig::isSwInterpreterEnabled()) // software interpreter
- {
- SAL_INFO("sc.core.formulagroup", "Create S/W interpreter");
- msInstance = new sc::FormulaGroupInterpreterSoftware();
- }
}
return msInstance;
@@ -478,23 +186,8 @@ bool FormulaGroupInterpreter::switchOpenCLDevice(const OUString& rDeviceId, bool
bool bOpenCLEnabled = ScCalcConfig::isOpenCLEnabled();
if (!bOpenCLEnabled || (rDeviceId == OPENCL_SOFTWARE_DEVICE_CONFIG_NAME))
{
- bool bSwInterpreterEnabled = ScCalcConfig::isSwInterpreterEnabled();
- if (msInstance)
- {
- // if we already have a software interpreter don't delete it
- if (bSwInterpreterEnabled && dynamic_cast<sc::FormulaGroupInterpreterSoftware*>(msInstance))
- return true;
-
- delete msInstance;
- msInstance = nullptr;
- }
-
- if (bSwInterpreterEnabled)
- {
- msInstance = new sc::FormulaGroupInterpreterSoftware();
- return true;
- }
-
+ delete msInstance;
+ msInstance = nullptr;
return false;
}
diff --git a/sc/source/core/tool/formulalogger.cxx b/sc/source/core/tool/formulalogger.cxx
index f202ac35414f..ca049a04a0c1 100644
--- a/sc/source/core/tool/formulalogger.cxx
+++ b/sc/source/core/tool/formulalogger.cxx
@@ -269,8 +269,6 @@ FormulaLogger::FormulaLogger()
writeAscii("---\n");
writeAscii("OpenCL: ");
writeAscii(ScCalcConfig::isOpenCLEnabled() ? "enabled\n" : "disabled\n");
- writeAscii("Software Interpreter: ");
- writeAscii(ScCalcConfig::isSwInterpreterEnabled() ? "enabled\n" : "disabled\n");
writeAscii("---\n");
sync();
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 857e104f6895..5a8325959693 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1376,19 +1376,6 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
return;
}
- // test for OpenCL interpreter first - the assumption is that S/W
- // interpreter blacklist is more strict than the OpenCL one
- 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)
- << "(" << int(eOp) << ") disables S/W interpreter for formula group");
- meVectorState = FormulaVectorDisabledNotInSoftwareSubset;
- mbOpenCLEnabled = false;
- return;
- }
-
// We support vectorization for the following opcodes.
switch (eOp)
{
@@ -1627,18 +1614,6 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
mbOpenCLEnabled = false;
return;
}
- // 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)
- << "(" << int(eOp) << ") disables S/W interpreter for formula group");
- meVectorState = FormulaVectorDisabledNotInSoftwareSubset;
- mbOpenCLEnabled = false;
- return;
- }
}
else
{
@@ -1825,7 +1800,7 @@ void ScTokenArray::GenHash()
void ScTokenArray::ResetVectorState()
{
- mbOpenCLEnabled = ScCalcConfig::isOpenCLEnabled() || ScCalcConfig::isSwInterpreterEnabled();
+ mbOpenCLEnabled = ScCalcConfig::isOpenCLEnabled();
meVectorState = mbOpenCLEnabled ? FormulaVectorEnabled : FormulaVectorDisabled;
mbThreadingEnabled = ScCalcConfig::isThreadingEnabled();
}