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.h29
1 files changed, 10 insertions, 19 deletions
diff --git a/src/lj_obj.h b/src/lj_obj.h
index 6d6782b4..e85cf703 100644
--- a/src/lj_obj.h
+++ b/src/lj_obj.h
@@ -286,12 +286,6 @@ typedef struct GCcdataVar {
286#define SCALE_NUM_GCO ((int32_t)sizeof(lua_Number)/sizeof(GCRef)) 286#define SCALE_NUM_GCO ((int32_t)sizeof(lua_Number)/sizeof(GCRef))
287#define round_nkgc(n) (((n) + SCALE_NUM_GCO-1) & ~(SCALE_NUM_GCO-1)) 287#define round_nkgc(n) (((n) + SCALE_NUM_GCO-1) & ~(SCALE_NUM_GCO-1))
288 288
289typedef struct VarInfo {
290 GCRef name; /* Local variable name. */
291 BCPos startpc; /* First point where the local variable is active. */
292 BCPos endpc; /* First point where the local variable is dead. */
293} VarInfo;
294
295typedef struct GCproto { 289typedef struct GCproto {
296 GCHeader; 290 GCHeader;
297 uint8_t numparams; /* Number of parameters. */ 291 uint8_t numparams; /* Number of parameters. */
@@ -308,11 +302,11 @@ typedef struct GCproto {
308 uint16_t trace; /* Anchor for chain of root traces. */ 302 uint16_t trace; /* Anchor for chain of root traces. */
309 /* ------ The following fields are for debugging/tracebacks only ------ */ 303 /* ------ The following fields are for debugging/tracebacks only ------ */
310 GCRef chunkname; /* Name of the chunk this function was defined in. */ 304 GCRef chunkname; /* Name of the chunk this function was defined in. */
311 BCLine lastlinedefined; /* Last line of the function definition. */ 305 BCLine firstline; /* First line of the function definition. */
312 MSize sizevarinfo; /* Size of local var info array. */ 306 BCLine numline; /* Number of lines for the function definition. */
313 MRef varinfo; /* Names and extents of local variables. */ 307 MRef lineinfo; /* Compressed map from bytecode ins. to source line. */
314 MRef uvname; /* Array of upvalue names (GCRef of GCstr). */ 308 MRef uvinfo; /* Upvalue names. */
315 MRef lineinfo; /* Map from bytecode instructions to source lines. */ 309 MRef varinfo; /* Names and compressed extents of local variables. */
316} GCproto; 310} GCproto;
317 311
318#define PROTO_IS_VARARG 0x01 312#define PROTO_IS_VARARG 0x01
@@ -331,14 +325,11 @@ typedef struct GCproto {
331#define proto_bcpos(pt, pc) ((BCPos)((pc) - proto_bc(pt))) 325#define proto_bcpos(pt, pc) ((BCPos)((pc) - proto_bc(pt)))
332#define proto_uv(pt) (mref((pt)->uv, uint16_t)) 326#define proto_uv(pt) (mref((pt)->uv, uint16_t))
333 327
334#define proto_uvname(pt, idx) \ 328#define proto_chunkname(pt) (strref((pt)->chunkname))
335 check_exp((uintptr_t)(idx) < (pt)->sizeuv, \ 329#define proto_chunknamestr(pt) (strdata(proto_chunkname((pt))))
336 gco2str(gcref(mref((pt)->uvname, GCRef)[(idx)]))) 330#define proto_lineinfo(pt) (mref((pt)->lineinfo, const void))
337#define proto_chunkname(pt) (gco2str(gcref((pt)->chunkname))) 331#define proto_uvinfo(pt) (mref((pt)->uvinfo, const uint8_t))
338#define proto_lineinfo(pt) (mref((pt)->lineinfo, BCLine)) 332#define proto_varinfo(pt) (mref((pt)->varinfo, const uint8_t))
339#define proto_line(pt, pos) \
340 check_exp((uintptr_t)(pos) < (pt)->sizebc, proto_lineinfo(pt)[(pos)])
341#define proto_varinfo(pt) (mref((pt)->varinfo, VarInfo))
342 333
343/* -- Upvalue object ------------------------------------------------------ */ 334/* -- Upvalue object ------------------------------------------------------ */
344 335