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

Properly ignore [Inline] on calls to externs and intrinsics

This commit is contained in:
Brian Fiete 2021-06-07 11:11:44 -07:00
parent c3e6282a8b
commit e6fdfa39d0
2 changed files with 9 additions and 0 deletions

View file

@ -12538,6 +12538,9 @@ BfModuleMethodInstance BfModule::ReferenceExternalMethodInstance(BfMethodInstanc
}
bool isInlined = (methodInstance->mAlwaysInline) || ((flags & BfGetMethodInstanceFlag_ForceInline) != 0);
if ((methodInstance->mIsIntrinsic) || (methodInstance->mMethodDef->mIsExtern))
isInlined = false;
BfMethodRef methodRef = methodInstance;
if (isInlined)
methodRef.mMethodRefFlags = (BfMethodRefFlags)(methodRef.mMethodRefFlags | BfMethodRefFlag_AlwaysInclude);
@ -12712,6 +12715,9 @@ BfModuleMethodInstance BfModule::GetMethodInstance(BfTypeInstance* typeInst, BfM
flags = (BfGetMethodInstanceFlags)(flags & ~BfGetMethodInstanceFlag_ForceInline);
}
if (methodDef->mIsExtern)
flags = (BfGetMethodInstanceFlags)(flags & ~BfGetMethodInstanceFlag_ForceInline);
bool processNow = false;
bool keepInCurrentModule = false;
@ -13256,6 +13262,8 @@ BfModuleMethodInstance BfModule::GetMethodInstance(BfTypeInstance* typeInst, BfM
// We need to refer to a function that was defined in a prior module
bool isInlined = (methodInstance->mAlwaysInline) || ((flags & BfGetMethodInstanceFlag_ForceInline) != 0);
if (methodInstance->mIsIntrinsic)
isInlined = false;
methodInstance->mIRFunction = CreateFunctionFrom(methodInstance, false, isInlined);
BF_ASSERT((methodInstance->mDeclModule == this) || (methodInstance->mDeclModule == mContext->mUnreifiedModule) || (methodInstance->mDeclModule == NULL));
methodInstance->mDeclModule = this;