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.
This commit is contained in:
2023-11-01 21:45:47 +00:00
parent 7564938113
commit cb1cfde0c4
2 changed files with 8 additions and 88 deletions

View File

@@ -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})