diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-06-27 16:00:36 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-06-27 16:00:36 -0300 |
commit | c07cebbbf622a949747349a219b2ba5973c4359c (patch) | |
tree | 58a0a056d96692d545f01323715dbf08227b11f1 | |
parent | afef009fcea199bd4eff28ea6e5206b59cda9939 (diff) | |
download | lua-c07cebbbf622a949747349a219b2ba5973c4359c.tar.gz lua-c07cebbbf622a949747349a219b2ba5973c4359c.tar.bz2 lua-c07cebbbf622a949747349a219b2ba5973c4359c.zip |
details
-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 | } |