Fix stack allocation with false recursion with function pointers

This commit is contained in:
drmortalwombat 2023-08-01 22:17:55 +02:00
parent b1a42e5ecf
commit ec15336174
2 changed files with 5 additions and 3 deletions

View File

@ -297,14 +297,16 @@ void GlobalAnalyzer::CheckFastcall(Declaration* procDec, bool head)
for (int i = 0; i < mVariableFunctions.Size(); i++) for (int i = 0; i < mVariableFunctions.Size(); i++)
{ {
Declaration* vf = mVariableFunctions[i]; Declaration* vf = mVariableFunctions[i];
CheckFastcall(vf, false);
if (vf->mBase->IsSame(cf)) if (vf->mBase->IsSame(cf))
{ {
CheckFastcall(vf, false);
int n = vf->mBase->mFastCallBase + vf->mBase->mFastCallSize; int n = vf->mBase->mFastCallBase + vf->mBase->mFastCallSize;
if (n > nbase) if (n > nbase)
nbase = n; nbase = n;
} }
} }
// procDec->mFlags |= DTF_DYNSTACK; // procDec->mFlags |= DTF_DYNSTACK;
} }

View File

@ -3503,7 +3503,7 @@ bool NativeCodeInstruction::ValueForwarding(NativeRegisterDataSet& data, AsmInsT
} }
changed = true; changed = true;
} }
else if (data.mRegs[mAddress].mMode == NRDM_ZERO_PAGE) else if (data.mRegs[mAddress].mMode == NRDM_ZERO_PAGE && (mAddress < BC_REG_FPARAMS || mAddress >= BC_REG_FPARAMS_END))
{ {
data.mRegs[CPU_REG_A] = data.mRegs[mAddress]; data.mRegs[CPU_REG_A] = data.mRegs[mAddress];
mAddress = data.mRegs[CPU_REG_A].mValue; mAddress = data.mRegs[CPU_REG_A].mValue;
@ -41410,7 +41410,7 @@ void NativeCodeProcedure::Optimize(void)
t++; t++;
} while (changed); } while (changed && t < 20);
#endif #endif
BuildDataFlowSets(); BuildDataFlowSets();