diff options
author | Mike Pall <mike> | 2011-06-28 23:23:34 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2011-06-28 23:23:34 +0200 |
commit | deeb8196c4d4085f3cc5a3389b568de7da739190 (patch) | |
tree | 6b5e9840f785f3fff3348ef1c9aee494cdf06431 /src/lib_jit.c | |
parent | 3dbae4ffc2ba8f6ebf8adf86742521bce6dbf8f8 (diff) | |
download | luajit-deeb8196c4d4085f3cc5a3389b568de7da739190.tar.gz luajit-deeb8196c4d4085f3cc5a3389b568de7da739190.tar.bz2 luajit-deeb8196c4d4085f3cc5a3389b568de7da739190.zip |
Reorganize trace linking and track link types.
Diffstat (limited to 'src/lib_jit.c')
-rw-r--r-- | src/lib_jit.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib_jit.c b/src/lib_jit.c index 66b3856a..d1f24f52 100644 --- a/src/lib_jit.c +++ b/src/lib_jit.c | |||
@@ -276,18 +276,26 @@ static GCtrace *jit_checktrace(lua_State *L) | |||
276 | return NULL; | 276 | return NULL; |
277 | } | 277 | } |
278 | 278 | ||
279 | /* Names of link types. ORDER LJ_TRLINK */ | ||
280 | static const char *const jit_trlinkname[] = { | ||
281 | "none", "root", "loop", "tail-recursion", "up-recursion", "down-recursion", | ||
282 | "interpreter", "return" | ||
283 | }; | ||
284 | |||
279 | /* local info = jit.util.traceinfo(tr) */ | 285 | /* local info = jit.util.traceinfo(tr) */ |
280 | LJLIB_CF(jit_util_traceinfo) | 286 | LJLIB_CF(jit_util_traceinfo) |
281 | { | 287 | { |
282 | GCtrace *T = jit_checktrace(L); | 288 | GCtrace *T = jit_checktrace(L); |
283 | if (T) { | 289 | if (T) { |
284 | GCtab *t; | 290 | GCtab *t; |
285 | lua_createtable(L, 0, 4); /* Increment hash size if fields are added. */ | 291 | lua_createtable(L, 0, 8); /* Increment hash size if fields are added. */ |
286 | t = tabV(L->top-1); | 292 | t = tabV(L->top-1); |
287 | setintfield(L, t, "nins", (int32_t)T->nins - REF_BIAS - 1); | 293 | setintfield(L, t, "nins", (int32_t)T->nins - REF_BIAS - 1); |
288 | setintfield(L, t, "nk", REF_BIAS - (int32_t)T->nk); | 294 | setintfield(L, t, "nk", REF_BIAS - (int32_t)T->nk); |
289 | setintfield(L, t, "link", T->link); | 295 | setintfield(L, t, "link", T->link); |
290 | setintfield(L, t, "nexit", T->nsnap); | 296 | setintfield(L, t, "nexit", T->nsnap); |
297 | setstrV(L, L->top++, lj_str_newz(L, jit_trlinkname[T->linktype])); | ||
298 | lua_setfield(L, -2, "linktype"); | ||
291 | /* There are many more fields. Add them only when needed. */ | 299 | /* There are many more fields. Add them only when needed. */ |
292 | return 1; | 300 | return 1; |
293 | } | 301 | } |