mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
ByVal fixes
This commit is contained in:
parent
9158002a42
commit
0dc45cb712
4 changed files with 7 additions and 5 deletions
|
@ -5846,7 +5846,7 @@ BfTypedValue BfExprEvaluator::CreateCall(BfAstNode* targetSrc, BfMethodInstance*
|
||||||
mModule->mBfIRBuilder->Call_AddAttribute(callInst, argIdx + 1, BfIRAttribute_NoCapture);
|
mModule->mBfIRBuilder->Call_AddAttribute(callInst, argIdx + 1, BfIRAttribute_NoCapture);
|
||||||
addDeref = paramType->mSize;
|
addDeref = paramType->mSize;
|
||||||
}
|
}
|
||||||
else if ((methodInstance->WantsStructsAttribByVal()) && (!paramType->IsSizedArray()))
|
else if (methodInstance->WantsStructsAttribByVal(paramType))
|
||||||
{
|
{
|
||||||
mModule->mBfIRBuilder->Call_AddAttribute(callInst, argIdx + 1, BfIRAttribute_ByVal, mModule->mSystem->mPtrSize);
|
mModule->mBfIRBuilder->Call_AddAttribute(callInst, argIdx + 1, BfIRAttribute_ByVal, mModule->mSystem->mPtrSize);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16320,7 +16320,7 @@ void BfModule::SetupIRMethod(BfMethodInstance* methodInstance, BfIRFunction func
|
||||||
PopulateType(resolvedTypeRef, BfPopulateType_Data);
|
PopulateType(resolvedTypeRef, BfPopulateType_Data);
|
||||||
addDeref = resolvedTypeRef->mSize;
|
addDeref = resolvedTypeRef->mSize;
|
||||||
}
|
}
|
||||||
else if ((methodInstance->WantsStructsAttribByVal()) && (!resolvedTypeRef->IsSizedArray()))
|
else if (methodInstance->WantsStructsAttribByVal(resolvedTypeRef))
|
||||||
{
|
{
|
||||||
mBfIRBuilder->PopulateType(resolvedTypeRef, BfIRPopulateType_Full);
|
mBfIRBuilder->PopulateType(resolvedTypeRef, BfIRPopulateType_Full);
|
||||||
BF_ASSERT(resolvedTypeRef->mAlign > 0);
|
BF_ASSERT(resolvedTypeRef->mAlign > 0);
|
||||||
|
|
|
@ -820,13 +820,15 @@ bool BfMethodInstance::GetLoweredReturnType(BfTypeCode* loweredTypeCode, BfTypeC
|
||||||
return mReturnType->GetLoweredType((mMethodDef->mIsStatic || forceStatic) ? BfTypeUsage_Return_Static : BfTypeUsage_Return_NonStatic, loweredTypeCode, loweredTypeCode2);
|
return mReturnType->GetLoweredType((mMethodDef->mIsStatic || forceStatic) ? BfTypeUsage_Return_Static : BfTypeUsage_Return_NonStatic, loweredTypeCode, loweredTypeCode2);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BfMethodInstance::WantsStructsAttribByVal()
|
bool BfMethodInstance::WantsStructsAttribByVal(BfType* paramType)
|
||||||
{
|
{
|
||||||
auto owner = GetOwner();
|
auto owner = GetOwner();
|
||||||
if ((owner->mModule->mCompiler->mOptions.mPlatformType == BfPlatformType_Windows) &&
|
if ((owner->mModule->mCompiler->mOptions.mPlatformType == BfPlatformType_Windows) &&
|
||||||
(owner->mModule->mCompiler->mOptions.mMachineType == BfMachineType_x64))
|
(owner->mModule->mCompiler->mOptions.mMachineType == BfMachineType_x64))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
|
||||||
|
auto typeInst = paramType->ToTypeInstance();
|
||||||
|
return (typeInst != NULL) && (typeInst->mIsCRepr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BfMethodInstance::IsSkipCall(bool bypassVirtual)
|
bool BfMethodInstance::IsSkipCall(bool bypassVirtual)
|
||||||
|
|
|
@ -933,7 +933,7 @@ public:
|
||||||
int GetStructRetIdx(bool forceStatic = false);
|
int GetStructRetIdx(bool forceStatic = false);
|
||||||
bool HasSelf();
|
bool HasSelf();
|
||||||
bool GetLoweredReturnType(BfTypeCode* loweredTypeCode = NULL, BfTypeCode* loweredTypeCode2 = NULL, bool forceStatic = false);
|
bool GetLoweredReturnType(BfTypeCode* loweredTypeCode = NULL, BfTypeCode* loweredTypeCode2 = NULL, bool forceStatic = false);
|
||||||
bool WantsStructsAttribByVal();
|
bool WantsStructsAttribByVal(BfType* paramType);
|
||||||
bool IsAutocompleteMethod() { /*return mIdHash == -1;*/ return mIsAutocompleteMethod; }
|
bool IsAutocompleteMethod() { /*return mIdHash == -1;*/ return mIsAutocompleteMethod; }
|
||||||
bool IsSkipCall(bool bypassVirtual = false);
|
bool IsSkipCall(bool bypassVirtual = false);
|
||||||
bool IsVarArgs();
|
bool IsVarArgs();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue