vm: get rid of jumpi traces, fix IR value issue with STOREIX

This commit is contained in:
Irmen de Jong 2022-08-13 20:00:13 +02:00
parent 0aa0ec5abd
commit 78d3d9d27d
3 changed files with 5 additions and 6 deletions

View File

@ -259,10 +259,7 @@ internal class AstChecker(private val program: Program,
)
count++
} else {
if(" return" in assembly || "\treturn" in assembly
|| " jump" in assembly || "\tjump" in assembly
|| " jumpi" in assembly || "\tjumpi" in assembly
)
if(" return" in assembly || "\treturn" in assembly || " jump" in assembly || "\tjump" in assembly)
count++
}
}

View File

@ -172,7 +172,7 @@ internal fun IdentifierReference.isSubroutineParameter(program: Program): Boolea
internal fun Subroutine.hasRtsInAsm(compTarget: ICompilationTarget): Boolean {
val instructions =
if(compTarget.name == VMTarget.NAME)
listOf(" return", "\treturn", " jump", "\tjump", " jumpi", "\tjumpi")
listOf(" return", "\treturn", " jump", "\tjump")
else
listOf(" rti", "\trti", " rts", "\trts", " jmp", "\tjmp", " bra", "\tbra")
return statements

View File

@ -44,7 +44,6 @@ But you can decide whatever you want because here we just care about jumping and
Saving/restoring registers is possible with PUSH and POP instructions.
jump location - continue running at instruction number given by location
jumpi reg1 - continue running at instruction number in reg1
call location - save current instruction location+1, continue execution at instruction nr given by location
calli reg1 - save current instruction location+1, continue execution at instruction number in reg1
syscall value - do a systemcall identified by call number
@ -345,8 +344,11 @@ val OpcodesWithAddress = setOf(
Opcode.LOADIX,
Opcode.STOREM,
Opcode.STOREX,
Opcode.STOREIX,
Opcode.STOREZM,
Opcode.STOREZX,
Opcode.JUMP,
Opcode.CALL,
Opcode.INCM,
Opcode.DECM,
Opcode.NEGM,