diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-01-26 22:03:42 +0300 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-02-01 12:12:18 +0000 |
commit | 358f21e0c2de2067c14c54ce41954954508d3550 (patch) | |
tree | a7e697bc172c0ff1b5a40464c50fe67a2003f033 /basic | |
parent | d279c564a134160c5fc9b5ed6674aec58b8792a3 (diff) |
tdf#153235: Optimize Application::Reschedule calls in SbiRuntime::Step
Setup the "last reschedule time" counter at the first pass,
to avoid useless immediate reschedule.
Update the counter when running "when blocked" reschedules.
This seems to avoid the problem with the bugdoc.
Change-Id: Ib5958a1a2b048f5ec654c69ee9e977e8a26de6f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146215
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146246
Tested-by: Jenkins
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/inc/runtime.hxx | 1 | ||||
-rw-r--r-- | basic/source/runtime/runtime.cxx | 11 |
2 files changed, 7 insertions, 5 deletions
diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx index d0922e6a0e0a..a6e12b50106d 100644 --- a/basic/source/inc/runtime.hxx +++ b/basic/source/inc/runtime.hxx @@ -250,7 +250,6 @@ class SbiRuntime BasicDebugFlags nFlags; // Debugging-Flags ErrCode nError; sal_uInt16 nOps; // opcode counter - sal_uInt32 m_nLastTime; std::vector<SbxVariableRef> aRefSaved; // #74254 save temporary references std::vector<SbiGosub> pGosubStk; // GOSUB stack diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 6a15cb1606e6..23e65805240c 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -599,7 +599,7 @@ SbMethod* SbiInstance::GetCaller( sal_uInt16 nLevel ) SbiRuntime::SbiRuntime( SbModule* pm, SbMethod* pe, sal_uInt32 nStart ) : rBasic( *static_cast<StarBASIC*>(pm->pParent) ), pInst( GetSbData()->pInst ), - pMod( pm ), pMeth( pe ), pImg( pMod->pImage.get() ), mpExtCaller(nullptr), m_nLastTime(0) + pMod( pm ), pMeth( pe ), pImg( pMod->pImage.get() ), mpExtCaller(nullptr) { nFlags = pe ? pe->GetDebugFlags() : BasicDebugFlags::NONE; pIosys = pInst->GetIoSystem(); @@ -792,23 +792,26 @@ bool SbiRuntime::Step() { if( bRun ) { + static sal_uInt32 nLastTime = osl_getGlobalTimer(); + // in any case check casually! if( !( ++nOps & 0xF ) && pInst->IsReschedule() ) { sal_uInt32 nTime = osl_getGlobalTimer(); - if (nTime - m_nLastTime > 5 ) // 20 ms + if (nTime - nLastTime > 5) // 20 ms { + nLastTime = nTime; Application::Reschedule(); - m_nLastTime = nTime; } } // #i48868 blocked by next call level? while( bBlocked ) { - if( pInst->IsReschedule() ) + if( pInst->IsReschedule() ) // And what if not? Busy loop? { Application::Reschedule(); + nLastTime = osl_getGlobalTimer(); } } |