diff --git a/IDEHelper/Compiler/CeMachine.cpp b/IDEHelper/Compiler/CeMachine.cpp index 2b7fb638..8b8cff1b 100644 --- a/IDEHelper/Compiler/CeMachine.cpp +++ b/IDEHelper/Compiler/CeMachine.cpp @@ -2620,7 +2620,7 @@ CeMachine::CeMachine(BfCompiler* compiler) mCurFunctionId = 0; mRevisionExecuteTime = 0; mCurTargetSrc = NULL; - mCurCEFunction = NULL; + mPreparingFunction = NULL; mCurModule = NULL; mCurMethodInstance = NULL; mCurExpectingType = NULL; @@ -3773,7 +3773,7 @@ BfIRValue CeMachine::CreateConstant(BfModule* module, uint8* ptr, BfType* bfType CE_CHECKSTACK(); bool CeMachine::Execute(CeFunction* startFunction, uint8* startStackPtr, uint8* startFramePtr, BfType*& returnType) -{ +{ mExecuteId++; CeFunction* ceFunction = startFunction; @@ -5245,7 +5245,7 @@ bool CeMachine::Execute(CeFunction* startFunction, uint8* startStackPtr, uint8* void CeMachine::PrepareFunction(CeFunction* ceFunction, CeBuilder* parentBuilder) { AutoTimer autoTimer(mRevisionExecuteTime); - SetAndRestoreValue prevCEFunction(mCurCEFunction, ceFunction); + SetAndRestoreValue prevCEFunction(mPreparingFunction, ceFunction); if (mHeap == NULL) mHeap = new ContiguousHeap(); @@ -5445,8 +5445,11 @@ CeFunction* CeMachine::GetPreparedFunction(BfMethodInstance* methodInstance) void CeMachine::QueueMethod(BfMethodInstance* methodInstance, BfIRValue func) { - auto curOwner = mCurCEFunction->mMethodInstance->GetOwner(); - curOwner->mModule->AddDependency(methodInstance->GetOwner(), curOwner, BfDependencyMap::DependencyFlag_ConstEval); + if (mPreparingFunction != NULL) + { + auto curOwner = mPreparingFunction->mMethodInstance->GetOwner(); + curOwner->mModule->AddDependency(methodInstance->GetOwner(), curOwner, BfDependencyMap::DependencyFlag_ConstEval); + } bool added = false; auto ceFunction = GetFunction(methodInstance, func, added); diff --git a/IDEHelper/Compiler/CeMachine.h b/IDEHelper/Compiler/CeMachine.h index f654e663..d6bc1731 100644 --- a/IDEHelper/Compiler/CeMachine.h +++ b/IDEHelper/Compiler/CeMachine.h @@ -627,7 +627,7 @@ public: HashSet mStaticCtorExecSet; CeAppendAllocInfo* mAppendAllocInfo; - CeFunction* mCurCEFunction; + CeFunction* mPreparingFunction; BfAstNode* mCurTargetSrc; BfMethodInstance* mCurMethodInstance; BfModule* mCurModule;