summaryrefslogtreecommitdiff
path: root/src/lj_obj.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_obj.h')
-rw-r--r--src/lj_obj.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lj_obj.h b/src/lj_obj.h
index b01bd97b..defb2088 100644
--- a/src/lj_obj.h
+++ b/src/lj_obj.h
@@ -537,15 +537,18 @@ MMDEF(MMENUM)
537 537
538/* GC root IDs. */ 538/* GC root IDs. */
539typedef enum { 539typedef enum {
540 GCROOT_MMNAME, /* Metamethod names. */
541 GCROOT_MMNAME_LAST = GCROOT_MMNAME + MM_MAX-1,
540 GCROOT_BASEMT, /* Metatables for base types. */ 542 GCROOT_BASEMT, /* Metatables for base types. */
541 GCROOT_BASEMT_NUM = ~LJ_TNUMX, /* Last base metatable. */ 543 GCROOT_BASEMT_NUM = GCROOT_BASEMT + ~LJ_TNUMX,
542 GCROOT_IO_INPUT, /* Userdata for default I/O input file. */ 544 GCROOT_IO_INPUT, /* Userdata for default I/O input file. */
543 GCROOT_IO_OUTPUT, /* Userdata for default I/O output file. */ 545 GCROOT_IO_OUTPUT, /* Userdata for default I/O output file. */
544 GCROOT__MAX 546 GCROOT_MAX
545} GCRootID; 547} GCRootID;
546 548
547#define basemt_it(g, it) ((g)->gcroot[GCROOT_BASEMT+~(it)]) 549#define basemt_it(g, it) ((g)->gcroot[GCROOT_BASEMT+~(it)])
548#define basemt_obj(g, o) ((g)->gcroot[GCROOT_BASEMT+itypemap(o)]) 550#define basemt_obj(g, o) ((g)->gcroot[GCROOT_BASEMT+itypemap(o)])
551#define mmname_str(g, mm) (strref((g)->gcroot[GCROOT_MMNAME+(mm)]))
549 552
550typedef struct GCState { 553typedef struct GCState {
551 MSize total; /* Memory currently allocated. */ 554 MSize total; /* Memory currently allocated. */
@@ -595,8 +598,7 @@ typedef struct global_State {
595 BCIns bc_cfunc_ext; /* Bytecode for external C function calls. */ 598 BCIns bc_cfunc_ext; /* Bytecode for external C function calls. */
596 GCRef jit_L; /* Current JIT code lua_State or NULL. */ 599 GCRef jit_L; /* Current JIT code lua_State or NULL. */
597 MRef jit_base; /* Current JIT code L->base. */ 600 MRef jit_base; /* Current JIT code L->base. */
598 GCRef gcroot[GCROOT__MAX]; /* GC roots. */ 601 GCRef gcroot[GCROOT_MAX]; /* GC roots. */
599 GCRef mmname[MM_MAX]; /* Array holding metamethod names. */
600} global_State; 602} global_State;
601 603
602#define mainthread(g) (&gcref(g->mainthref)->th) 604#define mainthread(g) (&gcref(g->mainthref)->th)