summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/inc/tokenarray.hxx3
-rw-r--r--sc/source/core/tool/token.cxx41
2 files changed, 32 insertions, 12 deletions
diff --git a/sc/inc/tokenarray.hxx b/sc/inc/tokenarray.hxx
index feac9acf32f6..1e747e8b5dcc 100644
--- a/sc/inc/tokenarray.hxx
+++ b/sc/inc/tokenarray.hxx
@@ -55,6 +55,8 @@ class SAL_WARN_UNUSED SC_DLLPUBLIC ScTokenArray : public formula::FormulaTokenAr
bool mbOpenCLEnabled : 1;
bool mbThreadingEnabled : 1;
+ void CheckForThreading( const formula::FormulaToken& r );
+
public:
ScTokenArray();
/** Assignment with incrementing references of FormulaToken entries
@@ -97,7 +99,6 @@ public:
svl::SharedStringPool& rSPool,
formula::ExternalReferenceHelper* _pRef) override;
virtual void CheckToken( const formula::FormulaToken& r ) override;
- void CheckForThreading( OpCode eOp );
virtual formula::FormulaToken* AddOpCode( OpCode eCode ) override;
/** ScSingleRefToken with ocPush. */
formula::FormulaToken* AddSingleReference( const ScSingleRefData& rRef );
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index a27c1441e143..7bd456c31284 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1308,7 +1308,7 @@ bool ScTokenArray::AddFormulaToken(
return bError;
}
-void ScTokenArray::CheckForThreading( OpCode eOp )
+void ScTokenArray::CheckForThreading( const FormulaToken& r )
{
static const std::set<OpCode> aThreadedCalcBlackList({
ocIndirect,
@@ -1333,29 +1333,48 @@ void ScTokenArray::CheckForThreading( OpCode eOp )
static const bool bThreadingProhibited = std::getenv("SC_NO_THREADED_CALCULATION");
- if (!bThreadingProhibited)
+ if (bThreadingProhibited)
{
- if (aThreadedCalcBlackList.count(eOp))
+ mbThreadingEnabled = false;
+ return;
+ }
+
+ OpCode eOp = r.GetOpCode();
+
+ if (aThreadedCalcBlackList.count(eOp))
+ {
+ SAL_INFO("sc.core.formulagroup", "opcode " << formula::FormulaCompiler().GetOpCodeMap(sheet::FormulaLanguage::ENGLISH)->getSymbol(eOp)
+ << "(" << int(eOp) << ") disables threaded calculation of formula group");
+ mbThreadingEnabled = false;
+ return;
+ }
+
+ if (eOp == ocPush)
+ {
+ switch (r.GetType())
{
- SAL_INFO("sc.core.formulagroup", "opcode " << formula::FormulaCompiler().GetOpCodeMap(sheet::FormulaLanguage::ENGLISH)->getSymbol(eOp)
- << "(" << int(eOp) << ") disables threaded calculation of formula group");
- mbThreadingEnabled = false;
+ case svExternalDoubleRef:
+ case svExternalSingleRef:
+ SAL_INFO("sc.core.formulagroup", "opcode ocPush: variable type " << StackVarEnumToString(r.GetType())
+ << " disables threaded calculcation of formula group");
+ mbThreadingEnabled = false;
+ return;
+ default:
+ break;
}
}
- else
- mbThreadingEnabled = false;
}
void ScTokenArray::CheckToken( const FormulaToken& r )
{
- OpCode eOp = r.GetOpCode();
-
if (mbThreadingEnabled)
- CheckForThreading(eOp);
+ CheckForThreading(r);
if (IsFormulaVectorDisabled())
return; // It's already disabled. No more checking needed.
+ OpCode eOp = r.GetOpCode();
+
if (SC_OPCODE_START_FUNCTION <= eOp && eOp < SC_OPCODE_STOP_FUNCTION)
{
if (ScInterpreter::GetGlobalConfig().mbOpenCLSubsetOnly &&