1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 03:28:20 +02:00

Perform PopulateReified pass after ProcessPurgatory

This commit is contained in:
Brian Fiete 2022-06-05 17:46:28 -07:00
parent a82130352a
commit 6f51eca72c
3 changed files with 22 additions and 7 deletions

View file

@ -2574,10 +2574,12 @@ void BfCompiler::SanitizeDependencyMap()
// 1) It gets built on demand
// 2) It gets deleted in UpdateDependencyMap
// 3) It stays undefined and we need to build it here
void BfCompiler::ProcessPurgatory(bool reifiedOnly)
bool BfCompiler::ProcessPurgatory(bool reifiedOnly)
{
BP_ZONE("BfCompiler::ProcessPurgatory");
bool didWork = false;
while (true)
{
mContext->RemoveInvalidWorkItems();
@ -2614,10 +2616,12 @@ void BfCompiler::ProcessPurgatory(bool reifiedOnly)
mGenericInstancePurgatory.Clear();
int prevPurgatorySize = (int)mGenericInstancePurgatory.size();
mContext->ProcessWorkList(reifiedOnly, reifiedOnly);
if (mContext->ProcessWorkList(reifiedOnly, reifiedOnly))
didWork = true;
if (prevPurgatorySize == (int)mGenericInstancePurgatory.size())
break;
}
return didWork;
}
bool BfCompiler::VerifySlotNums()
@ -7259,10 +7263,18 @@ bool BfCompiler::DoCompile(const StringImpl& outputDirectory)
BfLogSysM("DoCompile looping over CompileReified due to mHasReifiedQueuedRebuildTypes\n");
}
ProcessPurgatory(true);
if (mOptions.mCompileOnDemandKind != BfCompileOnDemandKind_AlwaysInclude)
DoWorkLoop();
// Handle purgatory (ie: old generic types)
{
bool didWork = ProcessPurgatory(true);
if (mOptions.mCompileOnDemandKind != BfCompileOnDemandKind_AlwaysInclude)
{
if (DoWorkLoop())
didWork = true;
if (didWork)
PopulateReified();
}
}
// Mark used modules
if ((mOptions.mCompileOnDemandKind != BfCompileOnDemandKind_AlwaysInclude) && (!mCanceling))

View file

@ -481,7 +481,7 @@ public:
void CreateVData(BfVDataModule* bfModule);
void UpdateDependencyMap(bool deleteUnusued, bool& didWork);
void SanitizeDependencyMap();
void ProcessPurgatory(bool reifiedOnly);
bool ProcessPurgatory(bool reifiedOnly);
bool VerifySlotNums();
bool QuickGenerateSlotNums();
bool SlowGenerateSlotNums();

View file

@ -6423,6 +6423,7 @@ BfIRValue BfModule::CreateTypeData(BfType* type, Dictionary<int, int>& usedStrin
if ((methodInstance != NULL) && (!methodInstance->mMethodDef->mIsAbstract))
{
BF_ASSERT(methodInstance->mIsReified);
// This doesn't work because we may have FOREIGN methods from implicit interface methods
//auto moduleMethodInst = GetMethodInstanceAtIdx(methodRef.mTypeInstance, methodRef.mMethodNum);
auto moduleMethodInst = ReferenceExternalMethodInstance(methodInstance, BfGetMethodInstanceFlag_NoInline);
@ -13911,6 +13912,8 @@ BfModuleMethodInstance BfModule::GetMethodInstance(BfTypeInstance* typeInst, BfM
auto _SetReified = [&]()
{
if (!mCompiler->mIsResolveOnly)
BF_ASSERT(mCompiler->mCompileState <= BfCompiler::CompileState_Normal);
methodInstance->mIsReified = true;
};