mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 19:48:20 +02:00
Fixed split deferred call processor
This commit is contained in:
parent
e09b701e9f
commit
acb644830c
6 changed files with 97 additions and 8 deletions
|
@ -801,7 +801,28 @@ void BfModule::EmitDeferredCall(BfModuleMethodInstance moduleMethodInstance, Siz
|
|||
}
|
||||
}
|
||||
|
||||
void BfModule::EmitDeferredCall(BfDeferredCallEntry& deferredCallEntry, bool moveBlocks)
|
||||
void BfModule::EmitDeferredCallProcessorInstances(BfScopeData* scopeData)
|
||||
{
|
||||
BF_ASSERT(scopeData->mDone);
|
||||
|
||||
for (auto& deferredProcessor : scopeData->mDeferredCallProcessorInstances)
|
||||
{
|
||||
SetAndRestoreValue<bool> prevHadReturn(mCurMethodState->mHadReturn, false);
|
||||
SetAndRestoreValue<bool> prevInPostReturn(mCurMethodState->mInPostReturn, false);
|
||||
SetAndRestoreValue<bool> prevLeftBlockUncond(mCurMethodState->mLeftBlockUncond, false);
|
||||
|
||||
auto prevBlock = mBfIRBuilder->GetInsertBlock();
|
||||
|
||||
mBfIRBuilder->AddBlock(deferredProcessor.mProcessorBlock);
|
||||
mBfIRBuilder->SetInsertPoint(deferredProcessor.mProcessorBlock);
|
||||
EmitDeferredCallProcessor(scopeData, deferredProcessor.mDeferredCallEntry->mDynList, deferredProcessor.mDeferredCallEntry->mDynCallTail);
|
||||
mBfIRBuilder->CreateBr(deferredProcessor.mContinueBlock);
|
||||
|
||||
mBfIRBuilder->SetInsertPoint(prevBlock);
|
||||
}
|
||||
}
|
||||
|
||||
void BfModule::EmitDeferredCall(BfScopeData* scopeData, BfDeferredCallEntry& deferredCallEntry, bool moveBlocks)
|
||||
{
|
||||
if ((mCompiler->mIsResolveOnly) && (!mIsComptimeModule) && (deferredCallEntry.mHandlerCount > 0))
|
||||
{
|
||||
|
@ -813,7 +834,23 @@ void BfModule::EmitDeferredCall(BfDeferredCallEntry& deferredCallEntry, bool mov
|
|||
|
||||
if (deferredCallEntry.IsDynList())
|
||||
{
|
||||
EmitDeferredCallProcessor(deferredCallEntry.mDynList, deferredCallEntry.mDynCallTail);
|
||||
if (scopeData->mDone)
|
||||
{
|
||||
EmitDeferredCallProcessor(scopeData, deferredCallEntry.mDynList, deferredCallEntry.mDynCallTail);
|
||||
}
|
||||
else
|
||||
{
|
||||
BfDeferredCallProcessorInstance deferredProcessor;
|
||||
deferredProcessor.mProcessorBlock = mBfIRBuilder->CreateBlock("dyn.processor");
|
||||
deferredProcessor.mContinueBlock = mBfIRBuilder->CreateBlock("dyn.continue");
|
||||
deferredProcessor.mDeferredCallEntry = &deferredCallEntry;
|
||||
scopeData->mDeferredCallProcessorInstances.Add(deferredProcessor);
|
||||
mBfIRBuilder->CreateBr(deferredProcessor.mProcessorBlock);
|
||||
|
||||
mBfIRBuilder->AddBlock(deferredProcessor.mContinueBlock);
|
||||
mBfIRBuilder->SetInsertPoint(deferredProcessor.mContinueBlock);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -877,7 +914,7 @@ void BfModule::EmitDeferredCall(BfDeferredCallEntry& deferredCallEntry, bool mov
|
|||
EmitDeferredCall(deferredCallEntry.mModuleMethodInstance, args, flags);
|
||||
}
|
||||
|
||||
void BfModule::EmitDeferredCallProcessor(SLIList<BfDeferredCallEntry*>& callEntries, BfIRValue callTail)
|
||||
void BfModule::EmitDeferredCallProcessor(BfScopeData* scopeData, SLIList<BfDeferredCallEntry*>& callEntries, BfIRValue callTail)
|
||||
{
|
||||
int64 collisionId = 0;
|
||||
|
||||
|
@ -1036,7 +1073,7 @@ void BfModule::EmitDeferredCallProcessor(SLIList<BfDeferredCallEntry*>& callEntr
|
|||
}
|
||||
|
||||
auto prevHead = callEntries.mHead;
|
||||
EmitDeferredCall(*deferredCallEntry, moveBlocks);
|
||||
EmitDeferredCall(scopeData, *deferredCallEntry, moveBlocks);
|
||||
ValueScopeEnd(valueScopeStart);
|
||||
mBfIRBuilder->CreateBr(condBB);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue