From 585e2575e809d4de8693b080b9f3c5b389a3d7ed Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Wed, 30 Dec 2020 06:26:59 -0800 Subject: [PATCH] Fixed base-call append alloc --- IDEHelper/Compiler/BfModule.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/IDEHelper/Compiler/BfModule.cpp b/IDEHelper/Compiler/BfModule.cpp index 13c9f36f..e56bd99f 100644 --- a/IDEHelper/Compiler/BfModule.cpp +++ b/IDEHelper/Compiler/BfModule.cpp @@ -420,7 +420,7 @@ public: { mFailed = false; mIsFirstConstPass = false; - mCurAppendAlign = 0; + mCurAppendAlign = 1; } 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 subDependSize = mModule->TryConstCalcAppend(bindResult.mMethodInstance, calcAppendArgs); + auto subDependSize = mModule->TryConstCalcAppend(calcAppendMethodModule.mMethodInstance, calcAppendArgs); if (calcAppendMethodModule.mMethodInstance->mAppendAllocAlign > 0) { EmitAppendAlign(calcAppendMethodModule.mMethodInstance->mAppendAllocAlign); @@ -14760,6 +14760,8 @@ BfTypedValue BfModule::TryConstCalcAppend(BfMethodInstance* methodInst, SizedArr { BP_ZONE("BfModule::TryConstCalcAppend"); + BF_ASSERT(methodInst->mMethodDef->mMethodType == BfMethodType_CtorCalcAppend); + if ((mCompiler->mIsResolveOnly) && (!mIsConstModule)) return BfTypedValue(); @@ -14895,7 +14897,11 @@ BfTypedValue BfModule::TryConstCalcAppend(BfMethodInstance* methodInst, SizedArr if (!appendAllocVisitor.mFailed) constValue = appendAllocVisitor.mConstAccum; if (isFirstRun) + { mCurMethodInstance->mEndingAppendAllocAlign = appendAllocVisitor.mCurAppendAlign; + if (mCurMethodInstance->mAppendAllocAlign <= 0) + mCurMethodInstance->mAppendAllocAlign = 1; + } if (isFirstRun) {