1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 04:22:20 +02:00

Removed mNoSplat for GCMarkMembers, relying on CallingConvention

This commit is contained in:
Brian Fiete 2020-05-06 16:20:17 -07:00
parent b62ac83155
commit bd7a4b392f
5 changed files with 16 additions and 14 deletions

View file

@ -1972,8 +1972,8 @@ void BfDefBuilder::FinishTypeDef(bool wantsToString)
auto methodDef = AddMethod(mCurTypeDef, BfMethodType_Normal, BfProtection_Protected, false, BF_METHODNAME_MARKMEMBERS); auto methodDef = AddMethod(mCurTypeDef, BfMethodType_Normal, BfProtection_Protected, false, BF_METHODNAME_MARKMEMBERS);
methodDef->mIsVirtual = true; methodDef->mIsVirtual = true;
methodDef->mIsOverride = true; methodDef->mIsOverride = true;
methodDef->mNoReflect = true; methodDef->mNoReflect = true;
methodDef->mNoSplat = true; methodDef->mCallingConvention = BfCallingConvention_Cdecl;
mCurTypeDef->mHasOverrideMethods = true; mCurTypeDef->mHasOverrideMethods = true;
} }
} }

View file

@ -4955,7 +4955,7 @@ void BfExprEvaluator::PushThis(BfAstNode* targetSrc, BfTypedValue argVal, BfMeth
if (argVal.mType->IsValuelessType()) if (argVal.mType->IsValuelessType())
return; return;
if ((!methodInstance->AllowsThisSplatting()) && (methodDef->mIsMutating)) if ((!methodInstance->AllowsThisSplatting()) || (methodDef->mIsMutating))
{ {
argVal = mModule->MakeAddressable(argVal); argVal = mModule->MakeAddressable(argVal);
irArgs.push_back(argVal.mValue); irArgs.push_back(argVal.mValue);

View file

@ -1098,7 +1098,7 @@ void BfModule::EnsureIRBuilder(bool dbgVerifyCodeGen)
//mBfIRBuilder->mDbgVerifyCodeGen = true; //mBfIRBuilder->mDbgVerifyCodeGen = true;
if ( if (
(mModuleName == "-") (mModuleName == "-")
//|| (mModuleName == "Vec2") //|| (mModuleName == "Raylib_Color")
//|| (mModuleName == "System_Int32") //|| (mModuleName == "System_Int32")
//|| (mModuleName == "Hey_Dude_Bro_TestClass") //|| (mModuleName == "Hey_Dude_Bro_TestClass")
) )
@ -15143,6 +15143,11 @@ void BfModule::EmitGCMarkValue(BfTypedValue markVal, BfModuleMethodInstance mark
if (markVal.mType != methodOwner) if (markVal.mType != methodOwner)
markVal = Cast(NULL, markVal, methodOwner); markVal = Cast(NULL, markVal, methodOwner);
if (markMemberMethodInstance.mMethodInstance->mIdHash == 0x1500000236LL)
{
NOP;
}
exprEvaluator.PushThis(NULL, markVal, markMemberMethodInstance.mMethodInstance, args); exprEvaluator.PushThis(NULL, markVal, markMemberMethodInstance.mMethodInstance, args);
exprEvaluator.CreateCall(markMemberMethodInstance.mMethodInstance, markMemberMethodInstance.mFunc, false, args); exprEvaluator.CreateCall(markMemberMethodInstance.mMethodInstance, markMemberMethodInstance.mFunc, false, args);
} }
@ -15286,14 +15291,13 @@ void BfModule::ProcessMethod_SetupParams(BfMethodInstance* methodInstance, BfTyp
paramVar->mValue = mBfIRBuilder->GetArgument(argIdx); paramVar->mValue = mBfIRBuilder->GetArgument(argIdx);
else else
paramVar->mValue = mBfIRBuilder->GetFakeVal(); paramVar->mValue = mBfIRBuilder->GetFakeVal();
if ((thisType->IsSplattable()) && (methodInstance->AllowsThisSplatting())) if ((thisType->IsSplattable()) && (methodInstance->AllowsThisSplatting()))
{ {
if (!thisType->IsTypedPrimitive()) if (!thisType->IsTypedPrimitive())
paramVar->mIsSplat = true; paramVar->mIsSplat = true;
} }
else if (!methodDef->mIsMutating) else if ((!methodDef->mIsMutating) && (methodInstance->mCallingConvention == BfCallingConvention_Unspecified))
paramVar->mIsLowered = thisType->GetLoweredType() != BfTypeCode_None; paramVar->mIsLowered = thisType->GetLoweredType() != BfTypeCode_None;
auto thisTypeInst = thisType->ToTypeInstance(); auto thisTypeInst = thisType->ToTypeInstance();

View file

@ -659,7 +659,7 @@ bool BfMethodInstance::AllowsSplatting()
{ {
if (mCallingConvention != BfCallingConvention_Unspecified) if (mCallingConvention != BfCallingConvention_Unspecified)
return false; return false;
return !mMethodDef->mNoSplat; return true;
} }
bool BfMethodInstance::AllowsThisSplatting() bool BfMethodInstance::AllowsThisSplatting()
@ -949,7 +949,7 @@ void BfMethodInstance::GetIRFunctionInfo(BfModule* module, BfIRType& returnType,
{ {
doSplat = true; doSplat = true;
} }
else if (!mMethodDef->mIsMutating) else if ((!mMethodDef->mIsMutating) && (mCallingConvention == BfCallingConvention_Unspecified))
checkLowered = true; checkLowered = true;
} }
else else

View file

@ -710,8 +710,7 @@ public:
bool mHasAppend; bool mHasAppend;
bool mAlwaysInline; bool mAlwaysInline;
bool mNoReturn; bool mNoReturn;
bool mIsMutating; bool mIsMutating;
bool mNoSplat;
bool mNoReflect; bool mNoReflect;
bool mIsSkipCall; bool mIsSkipCall;
bool mIsOperator; bool mIsOperator;
@ -737,8 +736,7 @@ public:
mIsPartial = false; mIsPartial = false;
mCLink = false; mCLink = false;
mNoReturn = false; mNoReturn = false;
mIsMutating = false; mIsMutating = false;
mNoSplat = false;
mNoReflect = false; mNoReflect = false;
mIsSkipCall = false; mIsSkipCall = false;
mIsOperator = false; mIsOperator = false;
@ -763,7 +761,7 @@ public:
virtual ~BfMethodDef(); virtual ~BfMethodDef();
static BfImportKind GetImportKindFromPath(const StringImpl& filePath); static BfImportKind GetImportKindFromPath(const StringImpl& filePath);
bool HasNoThisSplat() { return mIsMutating || mNoSplat; } bool HasNoThisSplat() { return mIsMutating; }
void Reset(); void Reset();
void FreeMembers(); void FreeMembers();
BfMethodDeclaration* GetMethodDeclaration(); BfMethodDeclaration* GetMethodDeclaration();