sc/inc/tokenarray.hxx | 3 ++- sc/source/core/tool/token.cxx | 35 +++++++++++++++++++++++++++-------- 2 files changed, 29 insertions(+), 9 deletions(-)
New commits: commit 9ac5100cd3c9d7767067a3421c736b99b76670ed Author: Luboš Luňák <l.lu...@collabora.com> Date: Fri Jun 22 11:01:24 2018 +0200 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/56377 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sc/inc/tokenarray.hxx b/sc/inc/tokenarray.hxx index f5f9a3d3c65a..ba91db779ac0 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 61881581648b..4848afef0b01 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -1307,7 +1307,7 @@ bool ScTokenArray::AddFormulaToken( return bError; } -void ScTokenArray::CheckForThreading( OpCode eOp ) +void ScTokenArray::CheckForThreading( const FormulaToken& r ) { static const std::set<OpCode> aThreadedCalcBlackList({ ocIndirect, @@ -1330,16 +1330,35 @@ 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) << " 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) << " 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 ) @@ -1347,7 +1366,7 @@ 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. _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits