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_STACK_OVERFLOW,
ERRR_INVALID_NUMBER, ERRR_INVALID_NUMBER,
EERR_OVERLAPPING_DATA_SECTIONS, EERR_OVERLAPPING_DATA_SECTIONS,
EERR_ASSEMBLER_LIMIT,
EERR_INVALID_PREPROCESSOR, EERR_INVALID_PREPROCESSOR,

View File

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

View File

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