1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +02:00

Compile QueueUnused modify-while-iterating fix

This commit is contained in:
Brian Fiete 2021-05-28 07:36:33 -04:00
parent b1717a0722
commit e606b18a0c

View file

@ -7045,6 +7045,8 @@ bool BfCompiler::DoCompile(const StringImpl& outputDirectory)
mContext->mUnreifiedModule->ResolveTypeDef(typeDef, BfPopulateType_Full); mContext->mUnreifiedModule->ResolveTypeDef(typeDef, BfPopulateType_Full);
} }
Array<BfTypeInstance*> typeWorkList;
for (auto type : mContext->mResolvedTypes) for (auto type : mContext->mResolvedTypes)
{ {
auto module = type->GetModule(); auto module = type->GetModule();
@ -7066,28 +7068,33 @@ bool BfCompiler::DoCompile(const StringImpl& outputDirectory)
continue; continue;
if (!typeInst->IsSpecializedType()) if (!typeInst->IsSpecializedType())
{ {
// Find any remaining methods for unreified processing typeWorkList.Add(typeInst);
for (auto&& methodInstGroup : typeInst->mMethodInstanceGroups) }
}
for (auto typeInst : typeWorkList)
{
// Find any remaining methods for unreified processing
for (auto&& methodInstGroup : typeInst->mMethodInstanceGroups)
{
if ((methodInstGroup.mOnDemandKind == BfMethodOnDemandKind_Decl_AwaitingReference) ||
(methodInstGroup.mOnDemandKind == BfMethodOnDemandKind_NoDecl_AwaitingReference))
{ {
if ((methodInstGroup.mOnDemandKind == BfMethodOnDemandKind_Decl_AwaitingReference) || if ((methodInstGroup.mDefault != NULL) && (methodInstGroup.mDefault->mIsForeignMethodDef))
(methodInstGroup.mOnDemandKind == BfMethodOnDemandKind_NoDecl_AwaitingReference)) {
{ mContext->mUnreifiedModule->GetMethodInstance(typeInst, methodInstGroup.mDefault->mMethodDef, BfTypeVector(),
if ((methodInstGroup.mDefault != NULL) && (methodInstGroup.mDefault->mIsForeignMethodDef)) (BfGetMethodInstanceFlags)(BfGetMethodInstanceFlag_ForeignMethodDef | BfGetMethodInstanceFlag_UnspecializedPass | BfGetMethodInstanceFlag_ExplicitResolveOnlyPass));
{ queuedMoreMethods = true;
mContext->mUnreifiedModule->GetMethodInstance(typeInst, methodInstGroup.mDefault->mMethodDef, BfTypeVector(), }
(BfGetMethodInstanceFlags)(BfGetMethodInstanceFlag_ForeignMethodDef | BfGetMethodInstanceFlag_UnspecializedPass | BfGetMethodInstanceFlag_ExplicitResolveOnlyPass)); else
queuedMoreMethods = true; {
} auto methodDef = typeInst->mTypeDef->mMethods[methodInstGroup.mMethodIdx];
else if (methodDef->mMethodType == BfMethodType_Init)
{ continue;
auto methodDef = typeInst->mTypeDef->mMethods[methodInstGroup.mMethodIdx]; mContext->mUnreifiedModule->GetMethodInstance(typeInst, methodDef, BfTypeVector(),
if (methodDef->mMethodType == BfMethodType_Init) (BfGetMethodInstanceFlags)(BfGetMethodInstanceFlag_UnspecializedPass | BfGetMethodInstanceFlag_ExplicitResolveOnlyPass));
continue; queuedMoreMethods = true;
mContext->mUnreifiedModule->GetMethodInstance(typeInst, methodDef, BfTypeVector(),
(BfGetMethodInstanceFlags)(BfGetMethodInstanceFlag_UnspecializedPass | BfGetMethodInstanceFlag_ExplicitResolveOnlyPass));
queuedMoreMethods = true;
}
} }
} }
} }