summaryrefslogtreecommitdiff
path: root/src/lj_debug.c
diff options
context:
space:
mode:
authorMike Pall <mike>2015-01-03 15:04:38 +0100
committerMike Pall <mike>2015-01-03 15:04:38 +0100
commit054e6abe37450344e20b373ec326055071029e9b (patch)
treed3abbe61e643f4f59797d2aea24cc3a0643df53b /src/lj_debug.c
parenta13dfd66c3427f9cc94044f261a526042b0d02f5 (diff)
downloadluajit-054e6abe37450344e20b373ec326055071029e9b.tar.gz
luajit-054e6abe37450344e20b373ec326055071029e9b.tar.bz2
luajit-054e6abe37450344e20b373ec326055071029e9b.zip
Add LJ_FR2 mode: Two-slot frame info.
Diffstat (limited to 'src/lj_debug.c')
-rw-r--r--src/lj_debug.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lj_debug.c b/src/lj_debug.c
index 1b794753..e9117b31 100644
--- a/src/lj_debug.c
+++ b/src/lj_debug.c
@@ -24,7 +24,7 @@
24/* Get frame corresponding to a level. */ 24/* Get frame corresponding to a level. */
25cTValue *lj_debug_frame(lua_State *L, int level, int *size) 25cTValue *lj_debug_frame(lua_State *L, int level, int *size)
26{ 26{
27 cTValue *frame, *nextframe, *bot = tvref(L->stack); 27 cTValue *frame, *nextframe, *bot = tvref(L->stack)+LJ_FR2;
28 /* Traverse frames backwards. */ 28 /* Traverse frames backwards. */
29 for (nextframe = frame = L->base-1; frame > bot; ) { 29 for (nextframe = frame = L->base-1; frame > bot; ) {
30 if (frame_gc(frame) == obj2gco(L)) 30 if (frame_gc(frame) == obj2gco(L))
@@ -184,7 +184,7 @@ static TValue *debug_localname(lua_State *L, const lua_Debug *ar,
184 TValue *nextframe = size ? frame + size : NULL; 184 TValue *nextframe = size ? frame + size : NULL;
185 GCfunc *fn = frame_func(frame); 185 GCfunc *fn = frame_func(frame);
186 BCPos pc = debug_framepc(L, fn, nextframe); 186 BCPos pc = debug_framepc(L, fn, nextframe);
187 if (!nextframe) nextframe = L->top; 187 if (!nextframe) nextframe = L->top+LJ_FR2;
188 if ((int)slot1 < 0) { /* Negative slot number is for varargs. */ 188 if ((int)slot1 < 0) { /* Negative slot number is for varargs. */
189 if (pc != NO_BCPOS) { 189 if (pc != NO_BCPOS) {
190 GCproto *pt = funcproto(fn); 190 GCproto *pt = funcproto(fn);
@@ -194,7 +194,7 @@ static TValue *debug_localname(lua_State *L, const lua_Debug *ar,
194 nextframe = frame; 194 nextframe = frame;
195 frame = frame_prevd(frame); 195 frame = frame_prevd(frame);
196 } 196 }
197 if (frame + slot1 < nextframe) { 197 if (frame + slot1+LJ_FR2 < nextframe) {
198 *name = "(*vararg)"; 198 *name = "(*vararg)";
199 return frame+slot1; 199 return frame+slot1;
200 } 200 }
@@ -205,7 +205,7 @@ static TValue *debug_localname(lua_State *L, const lua_Debug *ar,
205 if (pc != NO_BCPOS && 205 if (pc != NO_BCPOS &&
206 (*name = debug_varname(funcproto(fn), pc, slot1-1)) != NULL) 206 (*name = debug_varname(funcproto(fn), pc, slot1-1)) != NULL)
207 ; 207 ;
208 else if (slot1 > 0 && frame + slot1 < nextframe) 208 else if (slot1 > 0 && frame + slot1+LJ_FR2 < nextframe)
209 *name = "(*temporary)"; 209 *name = "(*temporary)";
210 return frame+slot1; 210 return frame+slot1;
211} 211}
@@ -268,7 +268,7 @@ restart:
268 *name = strdata(gco2str(proto_kgc(pt, ~(ptrdiff_t)bc_c(ins)))); 268 *name = strdata(gco2str(proto_kgc(pt, ~(ptrdiff_t)bc_c(ins))));
269 if (ip > proto_bc(pt)) { 269 if (ip > proto_bc(pt)) {
270 BCIns insp = ip[-1]; 270 BCIns insp = ip[-1];
271 if (bc_op(insp) == BC_MOV && bc_a(insp) == ra+1 && 271 if (bc_op(insp) == BC_MOV && bc_a(insp) == ra+1+LJ_FR2 &&
272 bc_d(insp) == bc_b(ins)) 272 bc_d(insp) == bc_b(ins))
273 return "method"; 273 return "method";
274 } 274 }
@@ -290,7 +290,7 @@ const char *lj_debug_funcname(lua_State *L, cTValue *frame, const char **name)
290 cTValue *pframe; 290 cTValue *pframe;
291 GCfunc *fn; 291 GCfunc *fn;
292 BCPos pc; 292 BCPos pc;
293 if (frame <= tvref(L->stack)) 293 if (frame <= tvref(L->stack)+LJ_FR2)
294 return NULL; 294 return NULL;
295 if (frame_isvarg(frame)) 295 if (frame_isvarg(frame))
296 frame = frame_prevd(frame); 296 frame = frame_prevd(frame);