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

DLL import hotswap fixes

This commit is contained in:
Brian Fiete 2020-04-16 00:32:00 -07:00
parent 75e0cb9907
commit 11a46fa422
2 changed files with 22 additions and 2 deletions

View file

@ -11136,7 +11136,7 @@ BfModule* BfModule::GetOrCreateMethodModule(BfMethodInstance* methodInstance)
}
BfModuleMethodInstance BfModule::GetMethodInstance(BfTypeInstance* typeInst, BfMethodDef* methodDef, const BfTypeVector& methodGenericArguments, BfGetMethodInstanceFlags flags, BfTypeInstance* foreignType)
{
{
if (((flags & BfGetMethodInstanceFlag_ForceInline) != 0) && (mCompiler->mIsResolveOnly))
{
// Don't bother inlining for resolve-only
@ -18904,7 +18904,10 @@ void BfModule::CheckHotMethod(BfMethodInstance* methodInstance, const StringImpl
#ifdef BF_DBG_HOTMETHOD_NAME
hotMethod->mMangledName = mangledName;
#endif
methodInstance->mHotMethod = hotMethod;
if ((methodInstance->mMethodInstanceGroup->IsImplemented()) && (!mCompiler->IsHotCompile()))
hotMethod->mFlags = (BfHotDepDataFlags)(hotMethod->mFlags | BfHotDepDataFlag_IsOriginalBuild);
methodInstance->mHotMethod = hotMethod;
}
}
@ -19788,6 +19791,14 @@ void BfModule::DoMethodDeclaration(BfMethodDeclaration* methodDeclaration, bool
return; // Bail out early for autocomplete pass
}
if ((methodInstance->GetImportCallKind() != BfImportCallKind_None) && (!mBfIRBuilder->mIgnoreWrites) && (!methodInstance->mIRFunction))
{
BfLogSysM("DllImportGlobalVar DoMethodDeclaration processing %p\n", methodInstance);
BfIRValue dllImportGlobalVar = CreateDllImportGlobalVar(methodInstance, true);
methodInstance->mIRFunction = mBfIRBuilder->GetFakeVal();
mFuncReferences[mCurMethodInstance] = dllImportGlobalVar;
}
//TODO: We used to have this (this != mContext->mExternalFuncModule) check, but it caused us to keep around
// an invalid mFuncRefernce (which came from GetMethodInstanceAtIdx) which later got remapped by the
// autocompleter. Why did we have this check anyway?