Fix various bugs related to byte size operands
This commit is contained in:
parent
9ec846c506
commit
2cd9a55880
|
@ -1436,7 +1436,7 @@ void ByteCodeBasicBlock::LoadDirectValue(InterCodeProcedure* proc, const InterIn
|
|||
lins.mRegister = BC_REG_ADDR;
|
||||
lins.mValue = index;
|
||||
mIns.Push(lins);
|
||||
ByteCodeInstruction bins((ins->mTType == IT_BOOL || ins->mTType == IT_INT8) ? BC_LOAD_LOCAL_8 : BC_LOAD_ADDR_U8);
|
||||
ByteCodeInstruction bins((ins->mTType == IT_BOOL || ins->mTType == IT_INT8) ? BC_LOAD_ADDR_8 : BC_LOAD_ADDR_U8);
|
||||
bins.mRegister = BC_REG_TMP + proc->mTempOffset[ins->mTTemp];
|
||||
bins.mValue = 0;
|
||||
mIns.Push(bins);
|
||||
|
|
|
@ -505,7 +505,8 @@ void ValueSet::UpdateValue(InterInstruction * ins, const GrowingInstructionPtrAr
|
|||
mInstructions[i]->mTType != ins->mTType ||
|
||||
mInstructions[i]->mIntValue != ins->mIntValue ||
|
||||
mInstructions[i]->mMemory != ins->mMemory ||
|
||||
mInstructions[i]->mVarIndex != ins->mVarIndex))
|
||||
mInstructions[i]->mVarIndex != ins->mVarIndex ||
|
||||
mInstructions[i]->mLinkerObject != ins->mLinkerObject))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
|
|
|
@ -1960,6 +1960,7 @@ InterCodeGenerator::ExValue InterCodeGenerator::TranslateExpression(Declaration*
|
|||
{
|
||||
vl = TranslateExpression(procType, proc, block, exp->mLeft, breakBlock, continueBlock);
|
||||
vl = Dereference(proc, block, vl);
|
||||
vl = CoerceType(proc, block, vl, TheSignedIntTypeDeclaration);
|
||||
|
||||
InterCodeBasicBlock * dblock = nullptr;
|
||||
InterCodeBasicBlock* sblock = block;
|
||||
|
@ -1983,6 +1984,7 @@ InterCodeGenerator::ExValue InterCodeGenerator::TranslateExpression(Declaration*
|
|||
|
||||
vr = TranslateExpression(procType, proc, sblock, cexp->mLeft, breakBlock, continueBlock);
|
||||
vr = Dereference(proc, sblock, vr);
|
||||
vr = CoerceType(proc, sblock, vr, TheSignedIntTypeDeclaration);
|
||||
|
||||
InterInstruction * cins = new InterInstruction();
|
||||
cins->mCode = IC_RELATIONAL_OPERATOR;
|
||||
|
|
|
@ -2501,7 +2501,7 @@ int NativeCodeBasicBlock::ShortMultiply(InterCodeProcedure* proc, NativeCodeProc
|
|||
ShiftRegisterLeft(proc, BC_REG_ACCU, lshift);
|
||||
return BC_REG_ACCU;
|
||||
default:
|
||||
mIns.Push(NativeCodeInstruction(ASMIT_LDA, ASMIM_IMMEDIATE, ins->mSIntConst[1] & 0xff));
|
||||
mIns.Push(NativeCodeInstruction(ASMIT_LDA, ASMIM_IMMEDIATE, mul));
|
||||
mIns.Push(NativeCodeInstruction(ASMIT_STA, ASMIM_ZERO_PAGE, BC_REG_WORK + 0));
|
||||
|
||||
NativeCodeGenerator::Runtime& rt(nproc->mGenerator->ResolveRuntime(Ident::Unique("mul16by8")));
|
||||
|
@ -3766,10 +3766,13 @@ void NativeCodeBasicBlock::CallFunction(InterCodeProcedure* proc, NativeCodeProc
|
|||
{
|
||||
mIns.Push(NativeCodeInstruction(ASMIT_LDA, ASMIM_ZERO_PAGE, BC_REG_ACCU + 0));
|
||||
mIns.Push(NativeCodeInstruction(ASMIT_STA, ASMIM_ZERO_PAGE, BC_REG_TMP + proc->mTempOffset[ins->mTTemp] + 0));
|
||||
if (InterTypeSize[ins->mTType] > 1)
|
||||
{
|
||||
mIns.Push(NativeCodeInstruction(ASMIT_LDA, ASMIM_ZERO_PAGE, BC_REG_ACCU + 1));
|
||||
mIns.Push(NativeCodeInstruction(ASMIT_STA, ASMIM_ZERO_PAGE, BC_REG_TMP + proc->mTempOffset[ins->mTTemp] + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NativeCodeBasicBlock::CallAssembler(InterCodeProcedure* proc, const InterInstruction * ins)
|
||||
|
@ -3793,10 +3796,13 @@ void NativeCodeBasicBlock::CallAssembler(InterCodeProcedure* proc, const InterIn
|
|||
{
|
||||
mIns.Push(NativeCodeInstruction(ASMIT_LDA, ASMIM_ZERO_PAGE, BC_REG_ACCU + 0));
|
||||
mIns.Push(NativeCodeInstruction(ASMIT_STA, ASMIM_ZERO_PAGE, BC_REG_TMP + proc->mTempOffset[ins->mTTemp] + 0));
|
||||
if (InterTypeSize[ins->mTType] > 1)
|
||||
{
|
||||
mIns.Push(NativeCodeInstruction(ASMIT_LDA, ASMIM_ZERO_PAGE, BC_REG_ACCU + 1));
|
||||
mIns.Push(NativeCodeInstruction(ASMIT_STA, ASMIM_ZERO_PAGE, BC_REG_TMP + proc->mTempOffset[ins->mTTemp] + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NativeCodeBasicBlock::BuildLocalRegSets(void)
|
||||
|
@ -4620,6 +4626,18 @@ void NativeCodeProcedure::Compile(InterCodeProcedure* proc)
|
|||
entryBlock->mIns.Push(NativeCodeInstruction(ASMIT_LDA, ASMIM_ZERO_PAGE, BC_REG_LOCALS + 1));
|
||||
entryBlock->mIns.Push(NativeCodeInstruction(ASMIT_STA, ASMIM_INDIRECT_Y, BC_REG_STACK));
|
||||
|
||||
if (tempSave)
|
||||
{
|
||||
entryBlock->mIns.Push(NativeCodeInstruction(ASMIT_DEY, ASMIM_IMPLIED));
|
||||
entryBlock->mIns.Push(NativeCodeInstruction(ASMIT_LDA, ASMIM_ABSOLUTE_Y, BC_REG_TMP_SAVED - 1));
|
||||
if (tempSave > 1)
|
||||
{
|
||||
entryBlock->mIns.Push(NativeCodeInstruction(ASMIT_DEY, ASMIM_IMPLIED));
|
||||
entryBlock->mIns.Push(NativeCodeInstruction(ASMIT_STA, ASMIM_INDIRECT_Y, BC_REG_STACK));
|
||||
entryBlock->mIns.Push(NativeCodeInstruction(ASMIT_BNE, ASMIM_RELATIVE, -8));
|
||||
}
|
||||
}
|
||||
|
||||
entryBlock->mIns.Push(NativeCodeInstruction(ASMIT_CLC, ASMIM_IMPLIED));
|
||||
entryBlock->mIns.Push(NativeCodeInstruction(ASMIT_LDA, ASMIM_ZERO_PAGE, BC_REG_STACK));
|
||||
entryBlock->mIns.Push(NativeCodeInstruction(ASMIT_ADC, ASMIM_IMMEDIATE, tempSave + 2));
|
||||
|
@ -4627,15 +4645,6 @@ void NativeCodeProcedure::Compile(InterCodeProcedure* proc)
|
|||
entryBlock->mIns.Push(NativeCodeInstruction(ASMIT_LDA, ASMIM_ZERO_PAGE, BC_REG_STACK + 1));
|
||||
entryBlock->mIns.Push(NativeCodeInstruction(ASMIT_ADC, ASMIM_IMMEDIATE, 0));
|
||||
entryBlock->mIns.Push(NativeCodeInstruction(ASMIT_STA, ASMIM_ZERO_PAGE, BC_REG_LOCALS + 1));
|
||||
|
||||
if (tempSave)
|
||||
{
|
||||
entryBlock->mIns.Push(NativeCodeInstruction(ASMIT_DEY, ASMIM_IMPLIED));
|
||||
entryBlock->mIns.Push(NativeCodeInstruction(ASMIT_LDA, ASMIM_ABSOLUTE_Y, BC_REG_TMP_SAVED - 1));
|
||||
entryBlock->mIns.Push(NativeCodeInstruction(ASMIT_DEY, ASMIM_IMPLIED));
|
||||
entryBlock->mIns.Push(NativeCodeInstruction(ASMIT_STA, ASMIM_INDIRECT_Y, BC_REG_STACK));
|
||||
entryBlock->mIns.Push(NativeCodeInstruction(ASMIT_BNE, ASMIM_RELATIVE, - 8));
|
||||
}
|
||||
}
|
||||
|
||||
if (!proc->mLeafProcedure)
|
||||
|
@ -4681,10 +4690,13 @@ void NativeCodeProcedure::Compile(InterCodeProcedure* proc)
|
|||
exitBlock->mIns.Push(NativeCodeInstruction(ASMIT_DEY, ASMIM_IMPLIED));
|
||||
exitBlock->mIns.Push(NativeCodeInstruction(ASMIT_DEY, ASMIM_IMPLIED));
|
||||
|
||||
if (tempSave > 1)
|
||||
{
|
||||
exitBlock->mIns.Push(NativeCodeInstruction(ASMIT_LDA, ASMIM_INDIRECT_Y, BC_REG_STACK));
|
||||
exitBlock->mIns.Push(NativeCodeInstruction(ASMIT_STA, ASMIM_ABSOLUTE_Y, BC_REG_TMP_SAVED));
|
||||
exitBlock->mIns.Push(NativeCodeInstruction(ASMIT_DEY, ASMIM_IMPLIED));
|
||||
exitBlock->mIns.Push(NativeCodeInstruction(ASMIT_BNE, ASMIM_RELATIVE, -8));
|
||||
}
|
||||
exitBlock->mIns.Push(NativeCodeInstruction(ASMIT_LDA, ASMIM_INDIRECT_Y, BC_REG_STACK));
|
||||
exitBlock->mIns.Push(NativeCodeInstruction(ASMIT_STA, ASMIM_ABSOLUTE_Y, BC_REG_TMP_SAVED));
|
||||
}
|
||||
|
|
|
@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,32,0
|
||||
PRODUCTVERSION 1,0,32,0
|
||||
FILEVERSION 1,0,33,0
|
||||
PRODUCTVERSION 1,0,33,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -43,12 +43,12 @@ BEGIN
|
|||
BEGIN
|
||||
VALUE "CompanyName", "oscar64"
|
||||
VALUE "FileDescription", "oscar64 compiler"
|
||||
VALUE "FileVersion", "1.0.32.0"
|
||||
VALUE "FileVersion", "1.0.33.0"
|
||||
VALUE "InternalName", "oscar64.exe"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2021"
|
||||
VALUE "OriginalFilename", "oscar64.exe"
|
||||
VALUE "ProductName", "oscar64"
|
||||
VALUE "ProductVersion", "1.0.32.0"
|
||||
VALUE "ProductVersion", "1.0.33.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
|
@ -564,15 +564,15 @@
|
|||
{
|
||||
"Name" = "8:Microsoft Visual Studio"
|
||||
"ProductName" = "8:oscar64"
|
||||
"ProductCode" = "8:{69C89FCE-CBE7-4824-B039-777CDE9B33FF}"
|
||||
"PackageCode" = "8:{025298B2-CAEE-4BDE-AA51-591D0418C086}"
|
||||
"ProductCode" = "8:{2D9BBEE3-38BA-4F07-8856-BAD10EA4EA7F}"
|
||||
"PackageCode" = "8:{EF59FA40-CFC8-4435-B56B-7702FE69C366}"
|
||||
"UpgradeCode" = "8:{9AB61EFF-ACAC-4079-9950-8D96615CD4EF}"
|
||||
"AspNetVersion" = "8:2.0.50727.0"
|
||||
"RestartWWWService" = "11:FALSE"
|
||||
"RemovePreviousVersions" = "11:TRUE"
|
||||
"DetectNewerInstalledVersion" = "11:TRUE"
|
||||
"InstallAllUsers" = "11:FALSE"
|
||||
"ProductVersion" = "8:1.0.32"
|
||||
"ProductVersion" = "8:1.0.33"
|
||||
"Manufacturer" = "8:oscar64"
|
||||
"ARPHELPTELEPHONE" = "8:"
|
||||
"ARPHELPLINK" = "8:"
|
||||
|
|
Loading…
Reference in New Issue