[O] Optimize a lot of things

This commit is contained in:
Hykilpikonna
2022-11-12 17:06:02 -05:00
parent 18750d7595
commit 2c8c4f51a5
22 changed files with 400 additions and 588 deletions
+8 -8
View File
@@ -319,18 +319,18 @@ public class Simulator extends Observable
ProgramStatement statement = null;
try
{
statement = Globals.memory.getStatement(RegisterFile.getProgramCounter());
statement = Globals.memory.getStatement(RegisterFile.getPc());
}
catch (AddressErrorException e)
{
ErrorList el = new ErrorList();
el.add(new ErrorMessage((MIPSprogram) null, 0, 0, "invalid program counter value: " + Binary.intToHexString(RegisterFile.getProgramCounter())));
el.add(new ErrorMessage((MIPSprogram) null, 0, 0, "invalid program counter value: " + Binary.intToHexString(RegisterFile.getPc())));
this.pe = new ProcessingException(el, e);
// Next statement is a hack. Previous statement sets EPC register to ProgramCounter-4
// because it assumes the bad address comes from an operand so the ProgramCounter has already been
// incremented. In this case, bad address is the instruction fetch itself so Program Counter has
// not yet been incremented. We'll set the EPC directly here. DPS 8-July-2013
Coprocessor0.updateRegister(Coprocessor0.EPC, RegisterFile.getProgramCounter());
Coprocessor0.updateRegister(Coprocessor0.EPC, RegisterFile.getPc());
this.constructReturnReason = EXCEPTION;
this.done = true;
SystemIO.resetFiles(); // close any files opened in MIPS program
@@ -373,7 +373,7 @@ public class Simulator extends Observable
while (statement != null)
{
pc = RegisterFile.getProgramCounter(); // added: 7/26/06 (explanation above)
pc = RegisterFile.getPc(); // added: 7/26/06 (explanation above)
RegisterFile.incrementPC();
// Perform the MIPS instruction in synchronized block. If external threads agree
// to access MIPS memory and registers only through synchronized blocks on same
@@ -469,7 +469,7 @@ public class Simulator extends Observable
}
// Return if we've reached a breakpoint.
if ((breakPoints != null) &&
(Arrays.binarySearch(breakPoints, RegisterFile.getProgramCounter()) >= 0))
(Arrays.binarySearch(breakPoints, RegisterFile.getPc()) >= 0))
{
this.constructReturnReason = BREAKPOINT;
this.done = false;
@@ -518,18 +518,18 @@ public class Simulator extends Observable
try
{
statement = Globals.memory.getStatement(RegisterFile.getProgramCounter());
statement = Globals.memory.getStatement(RegisterFile.getPc());
}
catch (AddressErrorException e)
{
ErrorList el = new ErrorList();
el.add(new ErrorMessage((MIPSprogram) null, 0, 0, "invalid program counter value: " + Binary.intToHexString(RegisterFile.getProgramCounter())));
el.add(new ErrorMessage((MIPSprogram) null, 0, 0, "invalid program counter value: " + Binary.intToHexString(RegisterFile.getPc())));
this.pe = new ProcessingException(el, e);
// Next statement is a hack. Previous statement sets EPC register to ProgramCounter-4
// because it assumes the bad address comes from an operand so the ProgramCounter has already been
// incremented. In this case, bad address is the instruction fetch itself so Program Counter has
// not yet been incremented. We'll set the EPC directly here. DPS 8-July-2013
Coprocessor0.updateRegister(Coprocessor0.EPC, RegisterFile.getProgramCounter());
Coprocessor0.updateRegister(Coprocessor0.EPC, RegisterFile.getPc());
this.constructReturnReason = EXCEPTION;
this.done = true;
SystemIO.resetFiles(); // close any files opened in MIPS program