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++ count++
} else { } else {
if(" return" in assembly || "\treturn" in assembly if(" return" in assembly || "\treturn" in assembly || " jump" in assembly || "\tjump" in assembly)
|| " jump" in assembly || "\tjump" in assembly
|| " jumpi" in assembly || "\tjumpi" in assembly
)
count++ count++
} }
} }

View File

@ -172,7 +172,7 @@ internal fun IdentifierReference.isSubroutineParameter(program: Program): Boolea
internal fun Subroutine.hasRtsInAsm(compTarget: ICompilationTarget): Boolean { internal fun Subroutine.hasRtsInAsm(compTarget: ICompilationTarget): Boolean {
val instructions = val instructions =
if(compTarget.name == VMTarget.NAME) if(compTarget.name == VMTarget.NAME)
listOf(" return", "\treturn", " jump", "\tjump", " jumpi", "\tjumpi") listOf(" return", "\treturn", " jump", "\tjump")
else else
listOf(" rti", "\trti", " rts", "\trts", " jmp", "\tjmp", " bra", "\tbra") listOf(" rti", "\trti", " rts", "\trts", " jmp", "\tjmp", " bra", "\tbra")
return statements 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. Saving/restoring registers is possible with PUSH and POP instructions.
jump location - continue running at instruction number given by location 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 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 calli reg1 - save current instruction location+1, continue execution at instruction number in reg1
syscall value - do a systemcall identified by call number syscall value - do a systemcall identified by call number
@ -345,8 +344,11 @@ val OpcodesWithAddress = setOf(
Opcode.LOADIX, Opcode.LOADIX,
Opcode.STOREM, Opcode.STOREM,
Opcode.STOREX, Opcode.STOREX,
Opcode.STOREIX,
Opcode.STOREZM, Opcode.STOREZM,
Opcode.STOREZX, Opcode.STOREZX,
Opcode.JUMP,
Opcode.CALL,
Opcode.INCM, Opcode.INCM,
Opcode.DECM, Opcode.DECM,
Opcode.NEGM, Opcode.NEGM,