From dc57db202d37a6a1ffa5eee5fed08532f31fa94f Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Sat, 20 Nov 2021 10:39:01 -0800 Subject: [PATCH] PrepareFunction fix during reentry (error condition) --- IDEHelper/Compiler/CeMachine.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/IDEHelper/Compiler/CeMachine.cpp b/IDEHelper/Compiler/CeMachine.cpp index 30cf5fa5..a17417a8 100644 --- a/IDEHelper/Compiler/CeMachine.cpp +++ b/IDEHelper/Compiler/CeMachine.cpp @@ -5466,6 +5466,7 @@ bool CeContext::Execute(CeFunction* startFunction, uint8* startStackPtr, uint8* { auto curFrame = _GetCurFrame(); SetAndRestoreValue prevFrame(mCurFrame, &curFrame); + BF_ASSERT(!callEntry.mFunction->mInitialized); mCeMachine->PrepareFunction(callEntry.mFunction, NULL); } @@ -6915,8 +6916,14 @@ void CeMachine::PrepareFunction(CeFunction* ceFunction, CeBuilder* parentBuilder AutoTimer autoTimer(mRevisionExecuteTime); SetAndRestoreValue prevCEFunction(mPreparingFunction, ceFunction); + BF_ASSERT(!ceFunction->mInitialized); + if (ceFunction->mFunctionKind == CeFunctionKind_NotSet) - CheckFunctionKind(ceFunction); + { + CheckFunctionKind(ceFunction); + if (ceFunction->mInitialized) + return; + } BF_ASSERT(!ceFunction->mInitialized); ceFunction->mInitialized = true;