aboutsummaryrefslogtreecommitdiff
path: root/lib/inst.h
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-11-01 22:07:08 +0000
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-11-01 22:07:08 +0000
commit0649b3f3804fa1b8924eed9214f33bce6a2c06e8 (patch)
tree1ad6cf4b4da09eebdbaf368e5104f0bbc882ba8d /lib/inst.h
parent44125d7ad9fedbe693136969bf4a11d8c33bcab1 (diff)
downloadovm-0649b3f3804fa1b8924eed9214f33bce6a2c06e8.tar.gz
ovm-0649b3f3804fa1b8924eed9214f33bce6a2c06e8.tar.bz2
ovm-0649b3f3804fa1b8924eed9214f33bce6a2c06e8.zip
Added stack based versions of MSET and MGET
Essentially they use the stack for their one and only operand. This allows user level control, in particular it allows for loops to work correctly while using these operands.
Diffstat (limited to 'lib/inst.h')
-rw-r--r--lib/inst.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/inst.h b/lib/inst.h
index 21fc6a1..5671b47 100644
--- a/lib/inst.h
+++ b/lib/inst.h
@@ -48,12 +48,23 @@ typedef enum
OP_MALLOC_BYTE,
OP_MALLOC_HWORD,
OP_MALLOC_WORD,
+
OP_MSET_BYTE,
OP_MSET_HWORD,
OP_MSET_WORD,
+
+ OP_MSET_STACK_BYTE,
+ OP_MSET_STACK_HWORD,
+ OP_MSET_STACK_WORD,
+
OP_MGET_BYTE,
OP_MGET_HWORD,
OP_MGET_WORD,
+
+ OP_MGET_STACK_BYTE,
+ OP_MGET_STACK_HWORD,
+ OP_MGET_STACK_WORD,
+
OP_MDELETE,
OP_MSIZE,
@@ -187,10 +198,12 @@ inst_t *insts_read_bytecode_file(FILE *, size_t *);
((inst_t){.opcode = OP_MALLOC_##TYPE, .operand = DWORD(OP)})
#define INST_MSET(TYPE, OP) \
((inst_t){.opcode = OP_MSET_##TYPE, .operand = DWORD(OP)})
+#define INST_MSET_STACK(TYPE) ((inst_t){.opcode = OP_MSET_STACK_##TYPE})
#define INST_MGET(TYPE, OP) \
((inst_t){.opcode = OP_MGET_##TYPE, .operand = DWORD(OP)})
-#define INST_MDELETE ((inst_t){.opcode = OP_MDELETE})
-#define INST_MSIZE ((inst_t){.opcode = OP_MSIZE})
+#define INST_MGET_STACK(TYPE) ((inst_t){.opcode = OP_MGET_STACK_##TYPE})
+#define INST_MDELETE ((inst_t){.opcode = OP_MDELETE})
+#define INST_MSIZE ((inst_t){.opcode = OP_MSIZE})
#define INST_NOT(TYPE) ((inst_t){.opcode = OP_NOT_##TYPE})
#define INST_OR(TYPE) ((inst_t){.opcode = OP_OR_##TYPE})