aboutsummaryrefslogtreecommitdiff
path: root/vm
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-11-02 20:41:36 +0000
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-11-02 20:41:36 +0000
commit114fb829905cce1e1f63ff1fee6fdbe11bb72715 (patch)
tree7c25829f1ba547effc7720a22b42d0085e303398 /vm
parent99b0ebdfa6e05b202e4ce900f95aef12f2214f69 (diff)
downloadovm-114fb829905cce1e1f63ff1fee6fdbe11bb72715.tar.gz
ovm-114fb829905cce1e1f63ff1fee6fdbe11bb72715.tar.bz2
ovm-114fb829905cce1e1f63ff1fee6fdbe11bb72715.zip
Removed instruction OP_JUMP_REGISTER
Not necessary when you can just push the relevant word onto the stack then just do OP_JUMP_STACK.
Diffstat (limited to 'vm')
-rw-r--r--vm/runtime.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/vm/runtime.c b/vm/runtime.c
index 5d5333b..c927662 100644
--- a/vm/runtime.c
+++ b/vm/runtime.c
@@ -60,7 +60,7 @@ const char *err_as_cstr(err_t err)
err_t vm_execute(vm_t *vm)
{
- static_assert(NUMBER_OF_OPCODES == 96, "vm_execute: Out of date");
+ static_assert(NUMBER_OF_OPCODES == 95, "vm_execute: Out of date");
struct Program *prog = &vm->program;
if (prog->ptr >= prog->max)
return ERR_END_OF_PROGRAM;
@@ -133,13 +133,6 @@ err_t vm_execute(vm_t *vm)
return err;
return vm_jump(vm, ret.as_word);
}
- else if (instruction.opcode == OP_JUMP_REGISTER)
- {
- if (instruction.operand.as_word >= vm->registers.available)
- return ERR_INVALID_REGISTER_WORD;
- word addr = vm->registers.data[instruction.operand.as_word];
- return vm_jump(vm, addr);
- }
else if (OPCODE_IS_TYPE(instruction.opcode, OP_JUMP_IF))
{
data_t datum = {0};