mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 20:12:21 +02:00
DLL import hotswap fixes
This commit is contained in:
parent
75e0cb9907
commit
11a46fa422
2 changed files with 22 additions and 2 deletions
|
@ -4215,6 +4215,15 @@ BfTypedValue BfExprEvaluator::CreateCall(BfMethodInstance* methodInstance, BfIRV
|
||||||
mModule->mFuncReferences.TryGetValue(methodInstance, &funcCallInst);
|
mModule->mFuncReferences.TryGetValue(methodInstance, &funcCallInst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((importCallKind == BfImportCallKind_GlobalVar) &&
|
||||||
|
(methodInstance->mHotMethod == NULL) &&
|
||||||
|
(mModule->mCompiler->IsHotCompile()))
|
||||||
|
{
|
||||||
|
// This may actually be a BfImportCallKind_GlobalVar_Hot, so check it...
|
||||||
|
mModule->CheckHotMethod(methodInstance, "");
|
||||||
|
importCallKind = methodInstance->GetImportCallKind();
|
||||||
|
}
|
||||||
|
|
||||||
if (importCallKind == BfImportCallKind_GlobalVar_Hot)
|
if (importCallKind == BfImportCallKind_GlobalVar_Hot)
|
||||||
{
|
{
|
||||||
//TODO: Check against NULL for calling BfLoadSharedLibraries
|
//TODO: Check against NULL for calling BfLoadSharedLibraries
|
||||||
|
|
|
@ -11136,7 +11136,7 @@ BfModule* BfModule::GetOrCreateMethodModule(BfMethodInstance* methodInstance)
|
||||||
}
|
}
|
||||||
|
|
||||||
BfModuleMethodInstance BfModule::GetMethodInstance(BfTypeInstance* typeInst, BfMethodDef* methodDef, const BfTypeVector& methodGenericArguments, BfGetMethodInstanceFlags flags, BfTypeInstance* foreignType)
|
BfModuleMethodInstance BfModule::GetMethodInstance(BfTypeInstance* typeInst, BfMethodDef* methodDef, const BfTypeVector& methodGenericArguments, BfGetMethodInstanceFlags flags, BfTypeInstance* foreignType)
|
||||||
{
|
{
|
||||||
if (((flags & BfGetMethodInstanceFlag_ForceInline) != 0) && (mCompiler->mIsResolveOnly))
|
if (((flags & BfGetMethodInstanceFlag_ForceInline) != 0) && (mCompiler->mIsResolveOnly))
|
||||||
{
|
{
|
||||||
// Don't bother inlining for resolve-only
|
// Don't bother inlining for resolve-only
|
||||||
|
@ -18904,7 +18904,10 @@ void BfModule::CheckHotMethod(BfMethodInstance* methodInstance, const StringImpl
|
||||||
#ifdef BF_DBG_HOTMETHOD_NAME
|
#ifdef BF_DBG_HOTMETHOD_NAME
|
||||||
hotMethod->mMangledName = mangledName;
|
hotMethod->mMangledName = mangledName;
|
||||||
#endif
|
#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
|
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
|
//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
|
// an invalid mFuncRefernce (which came from GetMethodInstanceAtIdx) which later got remapped by the
|
||||||
// autocompleter. Why did we have this check anyway?
|
// autocompleter. Why did we have this check anyway?
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue