diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2018-06-22 11:01:24 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2018-06-22 17:00:02 +0200 |
commit | a4f7c91c933c24e812acac9d6566c57fcbe412e0 (patch) | |
tree | 872e2af092ef24eab389154983e429f689230703 /sc/source/core/tool/token.cxx | |
parent | f0ff9739381b91941b8a17ac9210389ec4c8d233 (diff) |
disable calc's threading for external references
Since the code uses ScExternalRefManager, which caches values, so
better just disable it. Can be seen e.g. with fdo#78490-1 (and
mnOpenCLMinimumFormulaGroupSize disabled). The doc actually asserts
in GetFormatTable() called from ScExternalRefManager, but there
seems to be no point in fixing just the assert if the whole class
is possibly problematic.
Change-Id: I4ace488414fd15b4ad0b88da51205b02c561c7a6
Reviewed-on: https://gerrit.libreoffice.org/56289
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'sc/source/core/tool/token.cxx')
-rw-r--r-- | sc/source/core/tool/token.cxx | 41 |
1 files changed, 30 insertions, 11 deletions
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 && |