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

Fixed base-call append alloc

This commit is contained in:
Brian Fiete 2020-12-30 06:26:59 -08:00
parent 9eb3d8c3a5
commit 585e2575e8

View file

@ -420,7 +420,7 @@ public:
{ {
mFailed = false; mFailed = false;
mIsFirstConstPass = false; mIsFirstConstPass = false;
mCurAppendAlign = 0; mCurAppendAlign = 1;
} }
void EmitAppendAlign(int align, int sizeMultiple = 0) void EmitAppendAlign(int align, int sizeMultiple = 0)
@ -702,7 +702,7 @@ public:
auto calcAppendMethodModule = mModule->GetMethodInstanceAtIdx(bindResult.mMethodInstance->GetOwner(), bindResult.mMethodInstance->mMethodDef->mIdx + 1, BF_METHODNAME_CALCAPPEND); auto calcAppendMethodModule = mModule->GetMethodInstanceAtIdx(bindResult.mMethodInstance->GetOwner(), bindResult.mMethodInstance->mMethodDef->mIdx + 1, BF_METHODNAME_CALCAPPEND);
auto subDependSize = mModule->TryConstCalcAppend(bindResult.mMethodInstance, calcAppendArgs); auto subDependSize = mModule->TryConstCalcAppend(calcAppendMethodModule.mMethodInstance, calcAppendArgs);
if (calcAppendMethodModule.mMethodInstance->mAppendAllocAlign > 0) if (calcAppendMethodModule.mMethodInstance->mAppendAllocAlign > 0)
{ {
EmitAppendAlign(calcAppendMethodModule.mMethodInstance->mAppendAllocAlign); EmitAppendAlign(calcAppendMethodModule.mMethodInstance->mAppendAllocAlign);
@ -14760,6 +14760,8 @@ BfTypedValue BfModule::TryConstCalcAppend(BfMethodInstance* methodInst, SizedArr
{ {
BP_ZONE("BfModule::TryConstCalcAppend"); BP_ZONE("BfModule::TryConstCalcAppend");
BF_ASSERT(methodInst->mMethodDef->mMethodType == BfMethodType_CtorCalcAppend);
if ((mCompiler->mIsResolveOnly) && (!mIsConstModule)) if ((mCompiler->mIsResolveOnly) && (!mIsConstModule))
return BfTypedValue(); return BfTypedValue();
@ -14895,7 +14897,11 @@ BfTypedValue BfModule::TryConstCalcAppend(BfMethodInstance* methodInst, SizedArr
if (!appendAllocVisitor.mFailed) if (!appendAllocVisitor.mFailed)
constValue = appendAllocVisitor.mConstAccum; constValue = appendAllocVisitor.mConstAccum;
if (isFirstRun) if (isFirstRun)
{
mCurMethodInstance->mEndingAppendAllocAlign = appendAllocVisitor.mCurAppendAlign; mCurMethodInstance->mEndingAppendAllocAlign = appendAllocVisitor.mCurAppendAlign;
if (mCurMethodInstance->mAppendAllocAlign <= 0)
mCurMethodInstance->mAppendAllocAlign = 1;
}
if (isFirstRun) if (isFirstRun)
{ {