mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Fixed imported method in extension module
This commit is contained in:
parent
7a3bf74a83
commit
bdd22c0154
1 changed files with 14 additions and 3 deletions
|
@ -11955,7 +11955,10 @@ BfModuleMethodInstance BfModule::ReferenceExternalMethodInstance(BfMethodInstanc
|
||||||
BfIRValue func = CreateFunctionFrom(methodInstance, isGenFunction, isInlined);
|
BfIRValue func = CreateFunctionFrom(methodInstance, isGenFunction, isInlined);
|
||||||
|
|
||||||
if (!isGenFunction)
|
if (!isGenFunction)
|
||||||
|
{
|
||||||
|
BF_ASSERT(func || methodInstance->mMethodInstanceGroup->mOwner->IsInterface());
|
||||||
mFuncReferences[methodRef] = func;
|
mFuncReferences[methodRef] = func;
|
||||||
|
}
|
||||||
BfLogSysM("Adding func reference. Module:%p MethodInst:%p NewLLVMFunc:%d OldLLVMFunc:%d\n", this, methodInstance, func.mId, methodInstance->mIRFunction.mId);
|
BfLogSysM("Adding func reference. Module:%p MethodInst:%p NewLLVMFunc:%d OldLLVMFunc:%d\n", this, methodInstance, func.mId, methodInstance->mIRFunction.mId);
|
||||||
|
|
||||||
if ((isInlined) && (!mIsScratchModule) && ((flags & BfGetMethodInstanceFlag_NoInline) == 0))
|
if ((isInlined) && (!mIsScratchModule) && ((flags & BfGetMethodInstanceFlag_NoInline) == 0))
|
||||||
|
@ -12653,7 +12656,9 @@ BfModuleMethodInstance BfModule::GetMethodInstance(BfTypeInstance* typeInst, BfM
|
||||||
{
|
{
|
||||||
BfLogSysM("DllImportGlobalVar creating %p\n", methodInstance);
|
BfLogSysM("DllImportGlobalVar creating %p\n", methodInstance);
|
||||||
methodInstance->mIRFunction = mBfIRBuilder->GetFakeVal();
|
methodInstance->mIRFunction = mBfIRBuilder->GetFakeVal();
|
||||||
mFuncReferences[methodInstance] = CreateDllImportGlobalVar(methodInstance, true);;
|
auto func = CreateDllImportGlobalVar(methodInstance, true);
|
||||||
|
BF_ASSERT(func);
|
||||||
|
mFuncReferences[methodInstance] = func;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17484,6 +17489,7 @@ void BfModule::ProcessMethod(BfMethodInstance* methodInstance, bool isInlineDup)
|
||||||
{
|
{
|
||||||
BfIRValue dllImportGlobalVar = CreateDllImportGlobalVar(methodInstance, true);
|
BfIRValue dllImportGlobalVar = CreateDllImportGlobalVar(methodInstance, true);
|
||||||
methodInstance->mIRFunction = mBfIRBuilder->GetFakeVal();
|
methodInstance->mIRFunction = mBfIRBuilder->GetFakeVal();
|
||||||
|
BF_ASSERT(dllImportGlobalVar);
|
||||||
mFuncReferences[mCurMethodInstance] = dllImportGlobalVar;
|
mFuncReferences[mCurMethodInstance] = dllImportGlobalVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21449,7 +21455,9 @@ void BfModule::DoMethodDeclaration(BfMethodDeclaration* methodDeclaration, bool
|
||||||
// If this is in an extension then we did create the global variable already in the original obj
|
// If this is in an extension then we did create the global variable already in the original obj
|
||||||
bool doDefine = mExtensionCount == 0;
|
bool doDefine = mExtensionCount == 0;
|
||||||
BfIRValue dllImportGlobalVar = CreateDllImportGlobalVar(methodInstance, doDefine);
|
BfIRValue dllImportGlobalVar = CreateDllImportGlobalVar(methodInstance, doDefine);
|
||||||
methodInstance->mIRFunction = mBfIRBuilder->GetFakeVal();
|
func = mBfIRBuilder->GetFakeVal();
|
||||||
|
methodInstance->mIRFunction = func;
|
||||||
|
BF_ASSERT(dllImportGlobalVar);
|
||||||
mFuncReferences[mCurMethodInstance] = dllImportGlobalVar;
|
mFuncReferences[mCurMethodInstance] = dllImportGlobalVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21468,8 +21476,11 @@ void BfModule::DoMethodDeclaration(BfMethodDeclaration* methodDeclaration, bool
|
||||||
// For extension modules we need to keep track of our own methods so we can know which methods
|
// For extension modules we need to keep track of our own methods so we can know which methods
|
||||||
// we have defined ourselves and which are from the parent module or other extensions
|
// we have defined ourselves and which are from the parent module or other extensions
|
||||||
if (!func.IsFake())
|
if (!func.IsFake())
|
||||||
|
{
|
||||||
|
BF_ASSERT(func);
|
||||||
mFuncReferences[methodInstance] = func;
|
mFuncReferences[methodInstance] = func;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (addToWorkList)
|
if (addToWorkList)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue