diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-11-25 13:27:51 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-11-25 13:27:51 -0200 |
commit | b0f2b288a6b860374b9578d4c51329fc9cd43022 (patch) | |
tree | 82bacf246458c8f97ec22424ff40832df67a52e5 /lvm.c | |
parent | 2b25489b47ad94e6f970f5d9150937734322f24c (diff) | |
download | lua-b0f2b288a6b860374b9578d4c51329fc9cd43022.tar.gz lua-b0f2b288a6b860374b9578d4c51329fc9cd43022.tar.bz2 lua-b0f2b288a6b860374b9578d4c51329fc9cd43022.zip |
new scheme for debug info about tail calls: no more 'fake' stack entries,
but stack entry knows whether it was tail called
Diffstat (limited to 'lvm.c')
-rw-r--r-- | lvm.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.99 2009/09/30 15:38:37 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.100 2009/10/28 12:20:07 roberto Exp roberto $ |
3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -62,7 +62,7 @@ static void traceexec (lua_State *L) { | |||
62 | lu_byte mask = L->hookmask; | 62 | lu_byte mask = L->hookmask; |
63 | if ((mask & LUA_MASKCOUNT) && L->hookcount == 0) { | 63 | if ((mask & LUA_MASKCOUNT) && L->hookcount == 0) { |
64 | resethookcount(L); | 64 | resethookcount(L); |
65 | luaD_callhook(L, LUA_HOOKCOUNT, -1); | 65 | luaD_hook(L, LUA_HOOKCOUNT, -1); |
66 | } | 66 | } |
67 | if (mask & LUA_MASKLINE) { | 67 | if (mask & LUA_MASKLINE) { |
68 | Proto *p = ci_func(ci)->l.p; | 68 | Proto *p = ci_func(ci)->l.p; |
@@ -71,7 +71,7 @@ static void traceexec (lua_State *L) { | |||
71 | if (npc == 0 || /* call linehook when enter a new function, */ | 71 | if (npc == 0 || /* call linehook when enter a new function, */ |
72 | ci->u.l.savedpc <= L->oldpc || /* when jump back (loop), or when */ | 72 | ci->u.l.savedpc <= L->oldpc || /* when jump back (loop), or when */ |
73 | newline != getfuncline(p, pcRel(L->oldpc, p))) /* enter a new line */ | 73 | newline != getfuncline(p, pcRel(L->oldpc, p))) /* enter a new line */ |
74 | luaD_callhook(L, LUA_HOOKLINE, newline); | 74 | luaD_hook(L, LUA_HOOKLINE, newline); |
75 | } | 75 | } |
76 | L->oldpc = ci->u.l.savedpc; | 76 | L->oldpc = ci->u.l.savedpc; |
77 | } | 77 | } |
@@ -679,7 +679,7 @@ void luaV_execute (lua_State *L) { | |||
679 | oci->u.l.base = ofunc + (nci->u.l.base - nfunc); /* correct base */ | 679 | oci->u.l.base = ofunc + (nci->u.l.base - nfunc); /* correct base */ |
680 | oci->top = L->top = ofunc + (L->top - nfunc); /* correct top */ | 680 | oci->top = L->top = ofunc + (L->top - nfunc); /* correct top */ |
681 | oci->u.l.savedpc = nci->u.l.savedpc; | 681 | oci->u.l.savedpc = nci->u.l.savedpc; |
682 | oci->u.l.tailcalls++; /* one more call lost */ | 682 | oci->callstatus |= CIST_TAIL; /* function was tail called */ |
683 | ci = L->ci = oci; /* remove new frame */ | 683 | ci = L->ci = oci; /* remove new frame */ |
684 | lua_assert(L->top == oci->u.l.base + getproto(ofunc)->maxstacksize); | 684 | lua_assert(L->top == oci->u.l.base + getproto(ofunc)->maxstacksize); |
685 | break; /* restart luaV_execute over new Lua function */ | 685 | break; /* restart luaV_execute over new Lua function */ |