aboutsummaryrefslogtreecommitdiff
path: root/src/inst.h
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-10-22 20:57:29 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-10-22 20:57:29 +0100
commit7f1994c7aa1e3f18bc8baf7cb37f9fe093c884eb (patch)
tree055cb12056a3be08dcadad1f8fff59a2292c701c /src/inst.h
parentd8e45fce0435dc0961db2f1b8f0f4a5805347118 (diff)
downloadovm-7f1994c7aa1e3f18bc8baf7cb37f9fe093c884eb.tar.gz
ovm-7f1994c7aa1e3f18bc8baf7cb37f9fe093c884eb.tar.bz2
ovm-7f1994c7aa1e3f18bc8baf7cb37f9fe093c884eb.zip
Added and implemented OP_JUMP_(STACK|REGISTER)
Uses the stack and register, respectively, to jump to an absolute address. The stack based jump pops a word off the stack to perform a jump, while the register based one uses the operand to figure out which register to use.
Diffstat (limited to 'src/inst.h')
-rw-r--r--src/inst.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/inst.h b/src/inst.h
index a9709fd..487a41b 100644
--- a/src/inst.h
+++ b/src/inst.h
@@ -68,6 +68,8 @@ typedef enum
// Mathematical operations
// Program control flow
OP_JUMP_ABS,
+ OP_JUMP_STACK,
+ OP_JUMP_REGISTER,
// Should not be an opcode
NUMBER_OF_OPCODES,
@@ -129,5 +131,7 @@ inst_t *insts_read_bytecode_file(FILE *, size_t *);
#define INST_JUMP_ABS(OP) \
((inst_t){.opcode = OP_JUMP_ABS, .operand = DWORD(OP)})
+#define INST_JUMP_STACK ((inst_t){.opcode = OP_JUMP_STACK})
+#define INST_JUMP_REGISTER ((inst_t){.opcode = OP_JUMP_REGISTER})
#endif