Add error when exceeding assembler limits

This commit is contained in:
drmortalwombat 2024-05-20 09:03:41 +02:00
parent a2a22476ed
commit 4fb35a7af2
3 changed files with 10 additions and 4 deletions

View File

@ -105,6 +105,7 @@ enum ErrorID
ERRR_STACK_OVERFLOW,
ERRR_INVALID_NUMBER,
EERR_OVERLAPPING_DATA_SECTIONS,
EERR_ASSEMBLER_LIMIT,
EERR_INVALID_PREPROCESSOR,

View File

@ -301,7 +301,7 @@ class InterInstruction
public:
Location mLocation;
InterCode mCode;
InterOperand mSrc[8];
InterOperand mSrc[12];
InterOperand mDst;
InterOperand mConst;
InterOperator mOperator;

View File

@ -4055,9 +4055,14 @@ InterCodeGenerator::ExValue InterCodeGenerator::TranslateExpression(Declaration*
lins->mSrc[0].mOperandSize = vdec->mSize;
block->Append(lins);
jins->mSrc[jins->mNumOperands].mType = InterTypeOf(vdec->mBase);
jins->mSrc[jins->mNumOperands].mTemp = lins->mDst.mTemp;
jins->mNumOperands++;
if (jins->mNumOperands >= 12)
mErrors->Error(exp->mLocation, EERR_ASSEMBLER_LIMIT, "Maximum number of variables in assembler block exceeded", vdec->mIdent);
else
{
jins->mSrc[jins->mNumOperands].mType = InterTypeOf(vdec->mBase);
jins->mSrc[jins->mNumOperands].mTemp = lins->mDst.mTemp;
jins->mNumOperands++;
}
}
block->Append(jins);