From 43b78a6c25cf84c373741f7f8d4a57fe2f9d5832 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Sat, 7 Sep 2019 15:18:56 -0700 Subject: [PATCH] Fixed mDeclModule changes from this morning --- IDEHelper/Compiler/BfModule.cpp | 31 ++++++++++++++---------- IDEHelper/Compiler/BfModule.h | 1 + IDEHelper/Compiler/BfModuleTypeUtils.cpp | 4 +-- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/IDEHelper/Compiler/BfModule.cpp b/IDEHelper/Compiler/BfModule.cpp index ae410afe..9021df49 100644 --- a/IDEHelper/Compiler/BfModule.cpp +++ b/IDEHelper/Compiler/BfModule.cpp @@ -1063,6 +1063,22 @@ void BfModule::Cleanup() 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) { BF_ASSERT(!mIsDeleting); @@ -10569,19 +10585,7 @@ BfModuleMethodInstance BfModule::ReferenceExternalMethodInstance(BfMethodInstanc BfModule* BfModule::GetOrCreateMethodModule(BfMethodInstance* methodInstance) { 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; // Get to the optionless branch head -- but this could still be a specialized method module, not the true root while ((declareModule->mParentModule != NULL) && (!declareModule->mIsSpecializedMethodModuleRoot)) @@ -10678,6 +10682,7 @@ BfModule* BfModule::GetOrCreateMethodModule(BfMethodInstance* methodInstance) } } + declareModule->PrepareForIRWriting(typeInst); return declareModule; } diff --git a/IDEHelper/Compiler/BfModule.h b/IDEHelper/Compiler/BfModule.h index 74626b52..1dda21fe 100644 --- a/IDEHelper/Compiler/BfModule.h +++ b/IDEHelper/Compiler/BfModule.h @@ -1735,6 +1735,7 @@ public: void UnreifyModule(); void Cleanup(); void StartNewRevision(RebuildKind rebuildKind = RebuildKind_All, bool force = false); + void PrepareForIRWriting(BfTypeInstance* typeInst); void EnsureIRBuilder(bool dbgVerifyCodeGen = false); void DbgFinish(); BfIRValue CreateForceLinkMarker(BfModule* module, String* outName); diff --git a/IDEHelper/Compiler/BfModuleTypeUtils.cpp b/IDEHelper/Compiler/BfModuleTypeUtils.cpp index 7f6f4a99..80d10c61 100644 --- a/IDEHelper/Compiler/BfModuleTypeUtils.cpp +++ b/IDEHelper/Compiler/BfModuleTypeUtils.cpp @@ -4097,10 +4097,10 @@ void BfModule::AddMethodToWorkList(BfMethodInstance* methodInstance) return; } - if ((!mCompiler->mIsResolveOnly) && (!methodInstance->mIRFunction) && (methodInstance->mIsReified) && (!methodInstance->mIsUnspecialized)) + if ((!methodInstance->mIRFunction) && (methodInstance->mIsReified) && (!methodInstance->mIsUnspecialized)) { if (!mIsModuleMutable) - StartExtension(); + PrepareForIRWriting(methodInstance->GetOwner()); BfIRValue func = CreateFunctionFrom(methodInstance, false, methodInstance->mAlwaysInline); methodInstance->mIRFunction = func;