1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-14 14:24:10 +02:00

Fixed ce dependency issue

This commit is contained in:
Brian Fiete 2021-01-01 15:33:17 -08:00
parent 06a1ea841f
commit 3b1a5fd4d6
2 changed files with 9 additions and 6 deletions

View file

@ -2620,7 +2620,7 @@ CeMachine::CeMachine(BfCompiler* compiler)
mCurFunctionId = 0; mCurFunctionId = 0;
mRevisionExecuteTime = 0; mRevisionExecuteTime = 0;
mCurTargetSrc = NULL; mCurTargetSrc = NULL;
mCurCEFunction = NULL; mPreparingFunction = NULL;
mCurModule = NULL; mCurModule = NULL;
mCurMethodInstance = NULL; mCurMethodInstance = NULL;
mCurExpectingType = NULL; mCurExpectingType = NULL;
@ -3773,7 +3773,7 @@ BfIRValue CeMachine::CreateConstant(BfModule* module, uint8* ptr, BfType* bfType
CE_CHECKSTACK(); CE_CHECKSTACK();
bool CeMachine::Execute(CeFunction* startFunction, uint8* startStackPtr, uint8* startFramePtr, BfType*& returnType) bool CeMachine::Execute(CeFunction* startFunction, uint8* startStackPtr, uint8* startFramePtr, BfType*& returnType)
{ {
mExecuteId++; mExecuteId++;
CeFunction* ceFunction = startFunction; CeFunction* ceFunction = startFunction;
@ -5245,7 +5245,7 @@ bool CeMachine::Execute(CeFunction* startFunction, uint8* startStackPtr, uint8*
void CeMachine::PrepareFunction(CeFunction* ceFunction, CeBuilder* parentBuilder) void CeMachine::PrepareFunction(CeFunction* ceFunction, CeBuilder* parentBuilder)
{ {
AutoTimer autoTimer(mRevisionExecuteTime); AutoTimer autoTimer(mRevisionExecuteTime);
SetAndRestoreValue<CeFunction*> prevCEFunction(mCurCEFunction, ceFunction); SetAndRestoreValue<CeFunction*> prevCEFunction(mPreparingFunction, ceFunction);
if (mHeap == NULL) if (mHeap == NULL)
mHeap = new ContiguousHeap(); mHeap = new ContiguousHeap();
@ -5445,8 +5445,11 @@ CeFunction* CeMachine::GetPreparedFunction(BfMethodInstance* methodInstance)
void CeMachine::QueueMethod(BfMethodInstance* methodInstance, BfIRValue func) void CeMachine::QueueMethod(BfMethodInstance* methodInstance, BfIRValue func)
{ {
auto curOwner = mCurCEFunction->mMethodInstance->GetOwner(); if (mPreparingFunction != NULL)
curOwner->mModule->AddDependency(methodInstance->GetOwner(), curOwner, BfDependencyMap::DependencyFlag_ConstEval); {
auto curOwner = mPreparingFunction->mMethodInstance->GetOwner();
curOwner->mModule->AddDependency(methodInstance->GetOwner(), curOwner, BfDependencyMap::DependencyFlag_ConstEval);
}
bool added = false; bool added = false;
auto ceFunction = GetFunction(methodInstance, func, added); auto ceFunction = GetFunction(methodInstance, func, added);

View file

@ -627,7 +627,7 @@ public:
HashSet<int> mStaticCtorExecSet; HashSet<int> mStaticCtorExecSet;
CeAppendAllocInfo* mAppendAllocInfo; CeAppendAllocInfo* mAppendAllocInfo;
CeFunction* mCurCEFunction; CeFunction* mPreparingFunction;
BfAstNode* mCurTargetSrc; BfAstNode* mCurTargetSrc;
BfMethodInstance* mCurMethodInstance; BfMethodInstance* mCurMethodInstance;
BfModule* mCurModule; BfModule* mCurModule;