mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 12:02:21 +02:00
Fixed reifying dll import methods during hot compile
This commit is contained in:
parent
85fcca9c76
commit
05f17ce3ae
1 changed files with 26 additions and 15 deletions
|
@ -14692,6 +14692,23 @@ BfModuleMethodInstance BfModule::GetMethodInstance(BfTypeInstance* typeInst, BfM
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto _CheckDllImport = [&]()
|
||||||
|
{
|
||||||
|
auto declModule = methodInstance->mDeclModule;
|
||||||
|
if ((!methodInstance->mIRFunction) && (declModule->mIsModuleMutable) && (!declModule->mBfIRBuilder->mIgnoreWrites))
|
||||||
|
{
|
||||||
|
auto importKind = methodInstance->GetImportCallKind();
|
||||||
|
if (importKind != BfImportCallKind_None)
|
||||||
|
{
|
||||||
|
BfLogSysM("DllImportGlobalVar creating %p in module %p from module %p\n", methodInstance, declModule, this);
|
||||||
|
methodInstance->mIRFunction = mBfIRBuilder->GetFakeVal();
|
||||||
|
auto func = declModule->CreateDllImportGlobalVar(methodInstance, true);
|
||||||
|
BF_ASSERT(func);
|
||||||
|
declModule->mFuncReferences[methodInstance] = func;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if ((methodInstance != NULL) && (!doingRedeclare))
|
if ((methodInstance != NULL) && (!doingRedeclare))
|
||||||
{
|
{
|
||||||
SetMethodDependency(methodInstance);
|
SetMethodDependency(methodInstance);
|
||||||
|
@ -14794,18 +14811,7 @@ BfModuleMethodInstance BfModule::GetMethodInstance(BfTypeInstance* typeInst, BfM
|
||||||
if (methodInstance->mDeclModule != this)
|
if (methodInstance->mDeclModule != this)
|
||||||
return ReferenceExternalMethodInstance(methodInstance, flags);
|
return ReferenceExternalMethodInstance(methodInstance, flags);
|
||||||
|
|
||||||
if ((!methodInstance->mIRFunction) && (mIsModuleMutable) && (!mBfIRBuilder->mIgnoreWrites))
|
_CheckDllImport();
|
||||||
{
|
|
||||||
auto importKind = methodInstance->GetImportCallKind();
|
|
||||||
if (importKind != BfImportCallKind_None)
|
|
||||||
{
|
|
||||||
BfLogSysM("DllImportGlobalVar creating %p\n", methodInstance);
|
|
||||||
methodInstance->mIRFunction = mBfIRBuilder->GetFakeVal();
|
|
||||||
auto func = CreateDllImportGlobalVar(methodInstance, true);
|
|
||||||
BF_ASSERT(func);
|
|
||||||
mFuncReferences[methodInstance] = func;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return BfModuleMethodInstance(methodInstance);
|
return BfModuleMethodInstance(methodInstance);
|
||||||
}
|
}
|
||||||
|
@ -15040,6 +15046,11 @@ BfModuleMethodInstance BfModule::GetMethodInstance(BfTypeInstance* typeInst, BfM
|
||||||
if (methodInstance->mDeclModule != this)
|
if (methodInstance->mDeclModule != this)
|
||||||
return ReferenceExternalMethodInstance(methodInstance, flags);
|
return ReferenceExternalMethodInstance(methodInstance, flags);
|
||||||
|
|
||||||
|
if (doingRedeclare)
|
||||||
|
{
|
||||||
|
_CheckDllImport();
|
||||||
|
}
|
||||||
|
|
||||||
return BfModuleMethodInstance(methodInstance);
|
return BfModuleMethodInstance(methodInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue