aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2010-02-15 17:36:29 +0100
committerMike Pall <mike>2010-02-15 17:36:29 +0100
commit3452bfcf8cb2dc67819485c7b011e5c6a59310f8 (patch)
treeef9296179854170d517ed02bdfc51f2003ceedf0 /src
parentb838cd8dca67c8ea251faf71408a9d4c45fd0daf (diff)
downloadluajit-3452bfcf8cb2dc67819485c7b011e5c6a59310f8.tar.gz
luajit-3452bfcf8cb2dc67819485c7b011e5c6a59310f8.tar.bz2
luajit-3452bfcf8cb2dc67819485c7b011e5c6a59310f8.zip
Add generic function handling for debug modules.
Don't call record vmevent for non-Lua functions.
Diffstat (limited to 'src')
-rw-r--r--src/lib_jit.c7
-rw-r--r--src/lj_trace.c25
2 files changed, 18 insertions, 14 deletions
diff --git a/src/lib_jit.c b/src/lib_jit.c
index a5829dc3..0ee5ad0d 100644
--- a/src/lib_jit.c
+++ b/src/lib_jit.c
@@ -197,9 +197,12 @@ LJLIB_CF(jit_util_funcinfo)
197 } else { 197 } else {
198 GCfunc *fn = funcV(L->base); 198 GCfunc *fn = funcV(L->base);
199 GCtab *t; 199 GCtab *t;
200 lua_createtable(L, 0, 2); /* Increment hash size if fields are added. */ 200 lua_createtable(L, 0, 4); /* Increment hash size if fields are added. */
201 t = tabV(L->top-1); 201 t = tabV(L->top-1);
202 setintfield(L, t, "ffid", fn->c.ffid); 202 if (!iscfunc(fn))
203 setintfield(L, t, "ffid", fn->c.ffid);
204 setnumV(lj_tab_setstr(L, t, lj_str_newlit(L, "addr")),
205 cast_num((intptr_t)fn->c.f));
203 setintfield(L, t, "upvalues", fn->c.nupvalues); 206 setintfield(L, t, "upvalues", fn->c.nupvalues);
204 } 207 }
205 return 1; 208 return 1;
diff --git a/src/lj_trace.c b/src/lj_trace.c
index b5946346..7b366d54 100644
--- a/src/lj_trace.c
+++ b/src/lj_trace.c
@@ -475,17 +475,18 @@ static TValue *trace_state(lua_State *L, lua_CFunction dummy, void *ud)
475 475
476 case LJ_TRACE_RECORD: 476 case LJ_TRACE_RECORD:
477 setvmstate(J2G(J), RECORD); 477 setvmstate(J2G(J), RECORD);
478 lj_vmevent_send(L, RECORD, 478 if (J->pt)
479 setintV(L->top++, J->curtrace); 479 lj_vmevent_send(L, RECORD,
480 setfuncV(L, L->top++, J->fn); 480 setintV(L->top++, J->curtrace);
481 setintV(L->top++, proto_bcpos(J->pt, J->pc)); 481 setfuncV(L, L->top++, J->fn);
482 setintV(L->top++, J->framedepth); 482 setintV(L->top++, proto_bcpos(J->pt, J->pc));
483 if (bcmode_mm(bc_op(*J->pc)) == MM_call) { 483 setintV(L->top++, J->framedepth);
484 cTValue *o = &L->base[bc_a(*J->pc)]; 484 if (bcmode_mm(bc_op(*J->pc)) == MM_call) {
485 if (bc_op(*J->pc) == BC_ITERC) o -= 3; 485 cTValue *o = &L->base[bc_a(*J->pc)];
486 copyTV(L, L->top++, o); 486 if (bc_op(*J->pc) == BC_ITERC) o -= 3;
487 } 487 copyTV(L, L->top++, o);
488 ); 488 }
489 );
489 lj_record_ins(J); 490 lj_record_ins(J);
490 break; 491 break;
491 492
@@ -537,7 +538,7 @@ void lj_trace_ins(jit_State *J, const BCIns *pc)
537 /* Note: J->L must already be set. pc is the true bytecode PC here. */ 538 /* Note: J->L must already be set. pc is the true bytecode PC here. */
538 J->pc = pc; 539 J->pc = pc;
539 J->fn = curr_func(J->L); 540 J->fn = curr_func(J->L);
540 J->pt = funcproto(J->fn); 541 J->pt = isluafunc(J->fn) ? funcproto(J->fn) : NULL;
541 while (lj_vm_cpcall(J->L, NULL, (void *)J, trace_state) != 0) 542 while (lj_vm_cpcall(J->L, NULL, (void *)J, trace_state) != 0)
542 J->state = LJ_TRACE_ERR; 543 J->state = LJ_TRACE_ERR;
543} 544}