forked from NeoFlock/noom
documented the vm more
This commit is contained in:
12
src/vm.h
12
src/vm.h
@@ -51,6 +51,7 @@ typedef struct noomV_Value {
|
|||||||
noom_int_t integer;
|
noom_int_t integer;
|
||||||
noom_float_t number;
|
noom_float_t number;
|
||||||
noomV_Object *obj;
|
noomV_Object *obj;
|
||||||
|
struct noomV_Pointer *ptr;
|
||||||
};
|
};
|
||||||
} noomV_Value;
|
} noomV_Value;
|
||||||
|
|
||||||
@@ -64,8 +65,15 @@ typedef struct noomV_String {
|
|||||||
typedef struct noomV_Table {
|
typedef struct noomV_Table {
|
||||||
noomV_Object obj;
|
noomV_Object obj;
|
||||||
struct noomV_Table *meta;
|
struct noomV_Table *meta;
|
||||||
|
// amount of entries allocated
|
||||||
noom_uint_t entries;
|
noom_uint_t entries;
|
||||||
|
// how many entries are defined.
|
||||||
|
// Note, this includes keys with null values, which are still scanned.
|
||||||
|
noom_uint_t used;
|
||||||
|
// cache of #t, for faster subsequent fetches
|
||||||
noom_uint_t len;
|
noom_uint_t len;
|
||||||
|
// actual values. Given index i, V[i] is the key and V[i+entries] is the value.
|
||||||
|
// This is because we mostly read the key, so we should put more keys in cache.
|
||||||
noomV_Value *entrydata;
|
noomV_Value *entrydata;
|
||||||
} noomV_Table;
|
} noomV_Table;
|
||||||
|
|
||||||
@@ -166,6 +174,7 @@ typedef struct noomV_Inst {
|
|||||||
typedef struct noomV_UpvalDesc {
|
typedef struct noomV_UpvalDesc {
|
||||||
char *name;
|
char *name;
|
||||||
unsigned char idx;
|
unsigned char idx;
|
||||||
|
// whether the index is a stack index
|
||||||
noom_bool_t isStack;
|
noom_bool_t isStack;
|
||||||
} noomV_UpvalDesc;
|
} noomV_UpvalDesc;
|
||||||
|
|
||||||
@@ -188,7 +197,9 @@ typedef struct noomV_Function {
|
|||||||
noomV_UpvalDesc *upvals;
|
noomV_UpvalDesc *upvals;
|
||||||
noomV_LocalDesc *locals;
|
noomV_LocalDesc *locals;
|
||||||
unsigned int codesize;
|
unsigned int codesize;
|
||||||
|
// line of function
|
||||||
unsigned int linedefined;
|
unsigned int linedefined;
|
||||||
|
// line of end
|
||||||
unsigned int lastlinedefined;
|
unsigned int lastlinedefined;
|
||||||
// very size limited
|
// very size limited
|
||||||
// ░░░░░░░░░ ░ ▒░░▒ ▒░ ░░ ░
|
// ░░░░░░░░░ ░ ▒░░▒ ▒░ ░░ ░
|
||||||
@@ -296,6 +307,7 @@ struct noom_LuaVM {
|
|||||||
noom_LuaVersion version;
|
noom_LuaVersion version;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Allocating objects
|
||||||
noomV_Object *noomV_allocObj(noom_LuaVM *vm, noomV_ObjTag tag, noom_uint_t size);
|
noomV_Object *noomV_allocObj(noom_LuaVM *vm, noomV_ObjTag tag, noom_uint_t size);
|
||||||
void noomV_freeObj(noomV_Object *obj);
|
void noomV_freeObj(noomV_Object *obj);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user