From 114fb829905cce1e1f63ff1fee6fdbe11bb72715 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Thu, 2 Nov 2023 20:41:36 +0000 Subject: Removed instruction OP_JUMP_REGISTER Not necessary when you can just push the relevant word onto the stack then just do OP_JUMP_STACK. --- vm/runtime.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'vm') 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}; -- cgit v1.2.3-13-gbd6f