aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-10-31 21:28:19 +0000
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-10-31 21:28:19 +0000
commit5202dfbb2646cfbfb585f1a00a079438010373e5 (patch)
tree5c4be17d331cc90b12b148556390f1f1010c144d
parentf7f566b106a29b91f2a1651aad2d91b49bdd8e45 (diff)
downloadovm-5202dfbb2646cfbfb585f1a00a079438010373e5.tar.gz
ovm-5202dfbb2646cfbfb585f1a00a079438010373e5.tar.bz2
ovm-5202dfbb2646cfbfb585f1a00a079438010373e5.zip
Remove duplicated code
-rw-r--r--vm/runtime.c4
-rw-r--r--vm/runtime.h4
2 files changed, 0 insertions, 8 deletions
diff --git a/vm/runtime.c b/vm/runtime.c
index 6f9495a..a7d356d 100644
--- a/vm/runtime.c
+++ b/vm/runtime.c
@@ -443,8 +443,6 @@ err_t vm_push_hword_register(vm_t *vm, byte reg)
{
if (reg >= VM_REGISTERS * 2)
return ERR_INVALID_REGISTER_HWORD;
- else if (vm->stack.ptr >= vm->stack.max)
- return ERR_STACK_OVERFLOW;
// Interpret each word based register as 2 hword registers
hword hw = WORD_NTH_HWORD(vm->registers.reg[reg / 2], reg % 2);
return vm_push_hword(vm, DHWORD(hw));
@@ -454,8 +452,6 @@ err_t vm_push_word_register(vm_t *vm, byte reg)
{
if (reg >= VM_REGISTERS)
return ERR_INVALID_REGISTER_WORD;
- else if (vm->stack.ptr >= vm->stack.max)
- return ERR_STACK_OVERFLOW;
return vm_push_word(vm, DWORD(vm->registers.reg[reg]));
}
diff --git a/vm/runtime.h b/vm/runtime.h
index 1a03700..2986bda 100644
--- a/vm/runtime.h
+++ b/vm/runtime.h
@@ -52,10 +52,6 @@ typedef struct
} program;
} vm_t;
-#define VM_REG_BYTE(REG) ((REG)&0b11111111)
-#define VM_REG_HWORD(REG) ((REG)&0b11111111111111111111111111111111)
-#define VM_REG_WORD(REG) ((REG))
-
err_t vm_execute(vm_t *);
err_t vm_execute_all(vm_t *);