diff options
Diffstat (limited to 'lvm.c')
| -rw-r--r-- | lvm.c | 18 |
1 files changed, 8 insertions, 10 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lvm.c,v 1.116 2000/06/19 18:04:41 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 1.117 2000/06/26 19:28:31 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 | */ |
| @@ -67,17 +67,17 @@ int luaV_tostring (lua_State *L, TObject *obj) { /* LUA_NUMBER */ | |||
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | 69 | ||
| 70 | static void traceexec (lua_State *L, StkId base, int pc) { | 70 | static void traceexec (lua_State *L, StkId base, int pc, StkId top) { |
| 71 | CallInfo *ci = infovalue(base-1); | 71 | CallInfo *ci = infovalue(base-1); |
| 72 | int oldpc = ci->pc; | 72 | int oldpc = ci->pc; |
| 73 | pc--; /* pc has been already incremented */ | ||
| 74 | ci->pc = pc; | 73 | ci->pc = pc; |
| 75 | if (L->linehook && ci->func->f.l->debug) { | 74 | if (L->linehook && ci->func->f.l->debug) { |
| 76 | int *lines = ci->func->f.l->lines; | 75 | int *lines = ci->func->f.l->lines; |
| 77 | LUA_ASSERT(L, lines, "must have debug information"); | 76 | LUA_ASSERT(L, lines, "must have debug information"); |
| 78 | /* calls linehook when jumps back (a loop) or enters a new line */ | 77 | /* calls linehook when jumps back (loop) or enters a new line */ |
| 79 | if (pc <= oldpc || lines[pc] != ci->line) { | 78 | if (pc <= oldpc || lines[pc] != ci->line) { |
| 80 | ci->line = lines[pc]; | 79 | ci->line = lines[pc]; |
| 80 | L->top = top; | ||
| 81 | luaD_lineHook(L, base-2, lines[pc]); | 81 | luaD_lineHook(L, base-2, lines[pc]); |
| 82 | } | 82 | } |
| 83 | } | 83 | } |
| @@ -359,11 +359,9 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) { | |||
| 359 | top = L->top; | 359 | top = L->top; |
| 360 | /* main loop of interpreter */ | 360 | /* main loop of interpreter */ |
| 361 | for (;;) { | 361 | for (;;) { |
| 362 | Instruction i = *pc++; | 362 | if (debug) |
| 363 | if (debug) { | 363 | traceexec(L, base, pc - tf->code, top); |
| 364 | L->top = top; | 364 | {const Instruction i = *pc++; |
| 365 | traceexec(L, base, pc - tf->code); | ||
| 366 | } | ||
| 367 | switch (GET_OPCODE(i)) { | 365 | switch (GET_OPCODE(i)) { |
| 368 | 366 | ||
| 369 | case OP_END: | 367 | case OP_END: |
| @@ -707,5 +705,5 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) { | |||
| 707 | break; | 705 | break; |
| 708 | 706 | ||
| 709 | } | 707 | } |
| 710 | } | 708 | }} |
| 711 | } | 709 | } |
