aboutsummaryrefslogtreecommitdiff
path: root/lib/inst.h
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-11-01 21:45:47 +0000
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-11-01 21:45:47 +0000
commitcb1cfde0c44b059bdae147475bcde5cccac2a4e5 (patch)
treec8617b364d836131778733553384bf015c5227a4 /lib/inst.h
parent75649381132924c4cb5e4fa215e200e2457a1434 (diff)
downloadovm-cb1cfde0c44b059bdae147475bcde5cccac2a4e5.tar.gz
ovm-cb1cfde0c44b059bdae147475bcde5cccac2a4e5.tar.bz2
ovm-cb1cfde0c44b059bdae147475bcde5cccac2a4e5.zip
Added instruction to get the size of some allocation
This will allow for more library level code to be written. For example, say you wanted to write a generic byte level reversal algorithm for dynamically sized allocations. Getting the size of the allocation would be fundamental to this operation.
Diffstat (limited to 'lib/inst.h')
-rw-r--r--lib/inst.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/inst.h b/lib/inst.h
index 29cbd55..21fc6a1 100644
--- a/lib/inst.h
+++ b/lib/inst.h
@@ -55,6 +55,7 @@ typedef enum
OP_MGET_HWORD,
OP_MGET_WORD,
OP_MDELETE,
+ OP_MSIZE,
// Boolean operations
OP_NOT_BYTE,
@@ -189,6 +190,7 @@ inst_t *insts_read_bytecode_file(FILE *, size_t *);
#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_NOT(TYPE) ((inst_t){.opcode = OP_NOT_##TYPE})
#define INST_OR(TYPE) ((inst_t){.opcode = OP_OR_##TYPE})