mirror of
https://github.com/irmen/prog8.git
synced 2026-04-21 17:16:33 +00:00
ir: JUMPI instruction added to support indirect jumps
This commit is contained in:
@@ -147,6 +147,10 @@ class VirtualMachine(irProgram: IRProgram) {
|
||||
null -> {
|
||||
if(i.address!=null)
|
||||
throw IllegalArgumentException("vm program can't jump to system memory address (${i.opcode} ${i.address!!.toHex()})")
|
||||
else if(i.labelSymbol!=null)
|
||||
throw IllegalArgumentException("vm program can't jump to system memory address (${i.opcode} ${i.labelSymbol})")
|
||||
else if(i.reg1!=null)
|
||||
throw IllegalArgumentException("vm program can't jump to system memory address (${i})")
|
||||
else
|
||||
throw IllegalArgumentException("no branchtarget in $i")
|
||||
}
|
||||
@@ -174,8 +178,7 @@ class VirtualMachine(irProgram: IRProgram) {
|
||||
Opcode.STOREZM -> InsSTOREZM(ins)
|
||||
Opcode.STOREZX -> InsSTOREZX(ins)
|
||||
Opcode.STOREZI -> InsSTOREZI(ins)
|
||||
Opcode.JUMP -> InsJUMP(ins)
|
||||
Opcode.JUMPA -> throw IllegalArgumentException("vm program can't jump to system memory address (JUMPA)")
|
||||
Opcode.JUMP, Opcode.JUMPI -> InsJUMP(ins)
|
||||
Opcode.CALL -> InsCALL(ins)
|
||||
Opcode.SYSCALL -> InsSYSCALL(ins)
|
||||
Opcode.RETURN -> InsRETURN()
|
||||
|
||||
@@ -191,8 +191,6 @@ class VmProgramLoader {
|
||||
}
|
||||
}
|
||||
|
||||
private val functionCallOpcodes = setOf(Opcode.CALL, Opcode.SYSCALL, Opcode.JUMP, Opcode.JUMPA)
|
||||
|
||||
private fun varsToMemory(
|
||||
program: IRProgram,
|
||||
allocations: VmVariableAllocator,
|
||||
|
||||
Reference in New Issue
Block a user