diff options
Diffstat (limited to 'lvm.c')
| -rw-r--r-- | lvm.c | 23 |
1 files changed, 13 insertions, 10 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lvm.c,v 1.245 2002/07/08 18:21:33 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 1.246 2002/07/08 20:22:08 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 | */ |
| @@ -80,16 +80,16 @@ static void traceexec (lua_State *L) { | |||
| 80 | if (mask & LUA_MASKLINE) { | 80 | if (mask & LUA_MASKLINE) { |
| 81 | CallInfo *ci = L->ci; | 81 | CallInfo *ci = L->ci; |
| 82 | Proto *p = ci_func(ci)->l.p; | 82 | Proto *p = ci_func(ci)->l.p; |
| 83 | int newline = getline(p, pcRel(*ci->pc, p)); | 83 | int newline = getline(p, pcRel(*ci->u.l.pc, p)); |
| 84 | if (pcRel(*ci->pc, p) == 0) /* tracing may be starting now? */ | 84 | if (pcRel(*ci->u.l.pc, p) == 0) /* tracing may be starting now? */ |
| 85 | ci->savedpc = *ci->pc; /* initialize `savedpc' */ | 85 | ci->savedpc = *ci->u.l.pc; /* initialize `savedpc' */ |
| 86 | /* calls linehook when enters a new line or jumps back (loop) */ | 86 | /* calls linehook when enters a new line or jumps back (loop) */ |
| 87 | if (*ci->pc <= ci->savedpc || | 87 | if (*ci->u.l.pc <= ci->savedpc || |
| 88 | newline != getline(p, pcRel(ci->savedpc, p))) { | 88 | newline != getline(p, pcRel(ci->savedpc, p))) { |
| 89 | luaD_callhook(L, LUA_HOOKLINE, newline); | 89 | luaD_callhook(L, LUA_HOOKLINE, newline); |
| 90 | ci = L->ci; /* previous call may reallocate `ci' */ | 90 | ci = L->ci; /* previous call may reallocate `ci' */ |
| 91 | } | 91 | } |
| 92 | ci->savedpc = *ci->pc; | 92 | ci->savedpc = *ci->u.l.pc; |
| 93 | } | 93 | } |
| 94 | } | 94 | } |
| 95 | 95 | ||
| @@ -370,9 +370,11 @@ StkId luaV_execute (lua_State *L) { | |||
| 370 | TObject *k; | 370 | TObject *k; |
| 371 | const Instruction *pc; | 371 | const Instruction *pc; |
| 372 | callentry: /* entry point when calling new functions */ | 372 | callentry: /* entry point when calling new functions */ |
| 373 | L->ci->pc = &pc; | 373 | L->ci->u.l.pc = &pc; |
| 374 | L->ci->pb = &base; | 374 | L->ci->u.l.pb = &base; |
| 375 | pc = L->ci->savedpc; | 375 | pc = L->ci->savedpc; |
| 376 | if (L->hookmask & LUA_MASKCALL) | ||
| 377 | luaD_callhook(L, LUA_HOOKCALL, -1); | ||
| 376 | retentry: /* entry point when returning to old functions */ | 378 | retentry: /* entry point when returning to old functions */ |
| 377 | base = L->ci->base; | 379 | base = L->ci->base; |
| 378 | cl = &clvalue(base - 1)->l; | 380 | cl = &clvalue(base - 1)->l; |
| @@ -619,12 +621,13 @@ StkId luaV_execute (lua_State *L) { | |||
| 619 | if (L->openupval) luaF_close(L, base); | 621 | if (L->openupval) luaF_close(L, base); |
| 620 | b = GETARG_B(i); | 622 | b = GETARG_B(i); |
| 621 | if (b != 0) L->top = ra+b-1; | 623 | if (b != 0) L->top = ra+b-1; |
| 622 | lua_assert(L->ci->pc == &pc); | 624 | lua_assert(L->ci->u.l.pc == &pc); |
| 623 | } | 625 | } |
| 624 | ret: { | 626 | ret: { |
| 625 | CallInfo *ci; | 627 | CallInfo *ci; |
| 626 | ci = L->ci - 1; | 628 | ci = L->ci - 1; |
| 627 | if (ci->pc != &pc) /* previous function was running `here'? */ | 629 | /* previous function was running `here'? */ |
| 630 | if (!isLua(ci) || ci->u.l.pc != &pc) | ||
| 628 | return ra; /* no: return */ | 631 | return ra; /* no: return */ |
| 629 | else { /* yes: continue its execution */ | 632 | else { /* yes: continue its execution */ |
| 630 | int nresults; | 633 | int nresults; |
