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

Fixed mDeclModule changes from this morning

This commit is contained in:
Brian Fiete 2019-09-07 15:18:56 -07:00
parent 3616305378
commit 43b78a6c25
3 changed files with 21 additions and 15 deletions

View file

@ -1063,6 +1063,22 @@ void BfModule::Cleanup()
CleanupFileInstances(); CleanupFileInstances();
} }
void BfModule::PrepareForIRWriting(BfTypeInstance* typeInst)
{
if (HasCompiledOutput())
{
// It's possible that the target's code hasn't changed but we're requesting a new generic method specialization
if ((!mIsModuleMutable) && (!typeInst->IsUnspecializedType()) && (!typeInst->mResolvingVarField))
{
StartExtension();
}
}
else
{
EnsureIRBuilder();
}
}
void BfModule::EnsureIRBuilder(bool dbgVerifyCodeGen) void BfModule::EnsureIRBuilder(bool dbgVerifyCodeGen)
{ {
BF_ASSERT(!mIsDeleting); BF_ASSERT(!mIsDeleting);
@ -10569,18 +10585,6 @@ BfModuleMethodInstance BfModule::ReferenceExternalMethodInstance(BfMethodInstanc
BfModule* BfModule::GetOrCreateMethodModule(BfMethodInstance* methodInstance) BfModule* BfModule::GetOrCreateMethodModule(BfMethodInstance* methodInstance)
{ {
BfTypeInstance* typeInst = methodInstance->mMethodInstanceGroup->mOwner; BfTypeInstance* typeInst = methodInstance->mMethodInstanceGroup->mOwner;
if (HasCompiledOutput())
{
// It's possible that the target's code hasn't changed but we're requesting a new generic method specialization
if ((!mIsModuleMutable) && (!typeInst->IsUnspecializedType()) && (!typeInst->mResolvingVarField))
{
StartExtension();
}
}
else
{
EnsureIRBuilder();
}
BfModule* declareModule = this; BfModule* declareModule = this;
// Get to the optionless branch head -- but this could still be a specialized method module, not the true root // Get to the optionless branch head -- but this could still be a specialized method module, not the true root
@ -10678,6 +10682,7 @@ BfModule* BfModule::GetOrCreateMethodModule(BfMethodInstance* methodInstance)
} }
} }
declareModule->PrepareForIRWriting(typeInst);
return declareModule; return declareModule;
} }

View file

@ -1735,6 +1735,7 @@ public:
void UnreifyModule(); void UnreifyModule();
void Cleanup(); void Cleanup();
void StartNewRevision(RebuildKind rebuildKind = RebuildKind_All, bool force = false); void StartNewRevision(RebuildKind rebuildKind = RebuildKind_All, bool force = false);
void PrepareForIRWriting(BfTypeInstance* typeInst);
void EnsureIRBuilder(bool dbgVerifyCodeGen = false); void EnsureIRBuilder(bool dbgVerifyCodeGen = false);
void DbgFinish(); void DbgFinish();
BfIRValue CreateForceLinkMarker(BfModule* module, String* outName); BfIRValue CreateForceLinkMarker(BfModule* module, String* outName);

View file

@ -4097,10 +4097,10 @@ void BfModule::AddMethodToWorkList(BfMethodInstance* methodInstance)
return; return;
} }
if ((!mCompiler->mIsResolveOnly) && (!methodInstance->mIRFunction) && (methodInstance->mIsReified) && (!methodInstance->mIsUnspecialized)) if ((!methodInstance->mIRFunction) && (methodInstance->mIsReified) && (!methodInstance->mIsUnspecialized))
{ {
if (!mIsModuleMutable) if (!mIsModuleMutable)
StartExtension(); PrepareForIRWriting(methodInstance->GetOwner());
BfIRValue func = CreateFunctionFrom(methodInstance, false, methodInstance->mAlwaysInline); BfIRValue func = CreateFunctionFrom(methodInstance, false, methodInstance->mAlwaysInline);
methodInstance->mIRFunction = func; methodInstance->mIRFunction = func;