sc/source/core/tool/interpr4.cxx | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-)
New commits: commit 34126d6fceb054b7ba05ceeae76e32c89fac580f Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Fri Apr 12 12:24:06 2024 +0100 Commit: Eike Rathke <er...@redhat.com> CommitDate: Mon May 6 15:10:12 2024 +0200 Related: tdf#160056 don't call GetParamCount twice GetParamCount: 290ms -> 175ms Change-Id: Ic3a26b1e8035744dcab2da69a8ebd3b29dd2160a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166031 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> (cherry picked from commit 030b655963c182693c7b657dc6aa4d2fe85c17c6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166301 Reviewed-by: Eike Rathke <er...@redhat.com> diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 9a483103e3f9..959b04a70e10 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -4042,8 +4042,9 @@ StackVar ScInterpreter::Interpret() (*aTokenMatrixMapIter).second->GetType() != svJumpMatrix) { // Path already calculated, reuse result. - if (sp >= pCur->GetParamCount()) - nStackBase = sp - pCur->GetParamCount(); + const sal_uInt8 nParamCount = pCur->GetParamCount(); + if (sp >= nParamCount) + nStackBase = sp - nParamCount; else { SAL_WARN("sc.core", "Stack anomaly with calculated path at " @@ -4051,7 +4052,7 @@ StackVar ScInterpreter::Interpret() << " " << aPos.Format( ScRefFlags::VALID | ScRefFlags::FORCE_DOC | ScRefFlags::TAB_3D, &mrDoc) << " eOp: " << static_cast<int>(eOp) - << " params: " << static_cast<int>(pCur->GetParamCount()) + << " params: " << static_cast<int>(nParamCount) << " nStackBase: " << nStackBase << " sp: " << sp); nStackBase = sp; assert(!"underflow"); @@ -4080,18 +4081,22 @@ StackVar ScInterpreter::Interpret() eOp = ocNone; // JumpMatrix created nStackBase = sp; } - else if (sp >= pCur->GetParamCount()) - nStackBase = sp - pCur->GetParamCount(); else { - SAL_WARN("sc.core", "Stack anomaly at " << aPos.Tab() << "," << aPos.Col() << "," << aPos.Row() - << " " << aPos.Format( - ScRefFlags::VALID | ScRefFlags::FORCE_DOC | ScRefFlags::TAB_3D, &mrDoc) - << " eOp: " << static_cast<int>(eOp) - << " params: " << static_cast<int>(pCur->GetParamCount()) - << " nStackBase: " << nStackBase << " sp: " << sp); - nStackBase = sp; - assert(!"underflow"); + const sal_uInt8 nParamCount = pCur->GetParamCount(); + if (sp >= nParamCount) + nStackBase = sp - nParamCount; + else + { + SAL_WARN("sc.core", "Stack anomaly at " << aPos.Tab() << "," << aPos.Col() << "," << aPos.Row() + << " " << aPos.Format( + ScRefFlags::VALID | ScRefFlags::FORCE_DOC | ScRefFlags::TAB_3D, &mrDoc) + << " eOp: " << static_cast<int>(eOp) + << " params: " << static_cast<int>(nParamCount) + << " nStackBase: " << nStackBase << " sp: " << sp); + nStackBase = sp; + assert(!"underflow"); + } } }