basic VM stuff

This commit is contained in:
2026-05-26 20:36:14 +02:00
parent 8e8b01b7d9
commit 20f9ee0a14
6 changed files with 62 additions and 12 deletions

View File

@@ -25,7 +25,7 @@ typedef enum noomV_ObjTag {
typedef struct noomV_Object {
noomV_ObjTag tag;
bool marked;
noom_bool_t marked;
struct noomV_Object *next;
struct noomV_Object *nextGray;
} noomV_Object;
@@ -43,9 +43,9 @@ typedef enum noomV_ValueTag : unsigned char {
typedef struct noomV_Value {
noomV_ValueTag tag;
// for stack slots
bool autoclose;
noom_bool_t autoclose;
// pointer to value
bool isptr;
noom_bool_t isptr;
union {
noom_bool_t boolean;
noom_int_t integer;
@@ -184,7 +184,7 @@ typedef struct noomV_Function {
noomV_String *chunkname;
noomV_Inst *code;
noomV_Value *consts;
noomV_Function **protos;
struct noomV_Function **protos;
noomV_UpvalDesc *upvals;
noomV_LocalDesc *locals;
unsigned int codesize;
@@ -260,7 +260,7 @@ typedef struct noomV_Function {
typedef struct noomV_CallFrame {
// stack index of function
unsigned int funcIdx;
bool isC;
noom_bool_t isC;
union {
struct {
//
@@ -293,6 +293,10 @@ struct noom_LuaVM {
noomV_Table *registry;
noomV_Thread *mainThread;
noomV_Thread *currentThread;
noom_LuaVersion version;
};
noomV_Object *noomV_allocObj(noom_LuaVM *vm, noomV_ObjTag tag, noom_uint_t size);
void noomV_freeObj(noomV_Object *obj);
#endif