diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-03-07 15:09:25 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-03-07 15:09:25 -0300 |
commit | 6048c4f74d7d63d6c2f5a53cd8e4ee01f6702be9 (patch) | |
tree | 1f8fd00995288958a32ebd8f97863c5f1cb8f776 /lvm.c | |
parent | 5e870f86a255988ca85eda795adc31063ec1ac70 (diff) | |
download | lua-6048c4f74d7d63d6c2f5a53cd8e4ee01f6702be9.tar.gz lua-6048c4f74d7d63d6c2f5a53cd8e4ee01f6702be9.tar.bz2 lua-6048c4f74d7d63d6c2f5a53cd8e4ee01f6702be9.zip |
better way to link callinfo's and stack
Diffstat (limited to 'lvm.c')
-rw-r--r-- | lvm.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 1.173 2001/02/23 20:30:52 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 1.174 2001/03/07 13:22:55 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 | */ |
@@ -51,10 +51,10 @@ int luaV_tostring (lua_State *L, TObject *obj) { /* LUA_NUMBER */ | |||
51 | } | 51 | } |
52 | 52 | ||
53 | 53 | ||
54 | static void traceexec (lua_State *L, StkId base, lua_Hook linehook) { | 54 | static void traceexec (lua_State *L, lua_Hook linehook) { |
55 | CallInfo *ci = infovalue(base-1); | 55 | CallInfo *ci = L->ci; |
56 | int *lineinfo = ci->func->f.l->lineinfo; | 56 | int *lineinfo = ci_func(ci)->f.l->lineinfo; |
57 | int pc = (*ci->pc - ci->func->f.l->code) - 1; | 57 | int pc = (*ci->pc - ci_func(ci)->f.l->code) - 1; |
58 | int newline; | 58 | int newline; |
59 | if (pc == 0) { /* may be first time? */ | 59 | if (pc == 0) { /* may be first time? */ |
60 | ci->line = 1; | 60 | ci->line = 1; |
@@ -65,7 +65,7 @@ static void traceexec (lua_State *L, StkId base, lua_Hook linehook) { | |||
65 | /* calls linehook when enters a new line or jumps back (loop) */ | 65 | /* calls linehook when enters a new line or jumps back (loop) */ |
66 | if (newline != ci->line || pc <= ci->lastpc) { | 66 | if (newline != ci->line || pc <= ci->lastpc) { |
67 | ci->line = newline; | 67 | ci->line = newline; |
68 | luaD_lineHook(L, base-2, newline, linehook); | 68 | luaD_lineHook(L, newline, linehook); |
69 | } | 69 | } |
70 | ci->lastpc = pc; | 70 | ci->lastpc = pc; |
71 | } | 71 | } |
@@ -332,7 +332,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) { | |||
332 | const Instruction *pc = tf->code; | 332 | const Instruction *pc = tf->code; |
333 | TString **const kstr = tf->kstr; | 333 | TString **const kstr = tf->kstr; |
334 | const lua_Hook linehook = L->linehook; | 334 | const lua_Hook linehook = L->linehook; |
335 | infovalue(base-1)->pc = &pc; | 335 | L->ci->pc = &pc; |
336 | if (tf->is_vararg) /* varargs? */ | 336 | if (tf->is_vararg) /* varargs? */ |
337 | adjust_varargs(L, base, tf->numparams); | 337 | adjust_varargs(L, base, tf->numparams); |
338 | luaD_adjusttop(L, base, tf->maxstacksize); | 338 | luaD_adjusttop(L, base, tf->maxstacksize); |
@@ -342,7 +342,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) { | |||
342 | const Instruction i = *pc++; | 342 | const Instruction i = *pc++; |
343 | lua_assert(L->top == base+tf->maxstacksize); | 343 | lua_assert(L->top == base+tf->maxstacksize); |
344 | if (linehook) | 344 | if (linehook) |
345 | traceexec(L, base, linehook); | 345 | traceexec(L, linehook); |
346 | switch (GET_OPCODE(i)) { | 346 | switch (GET_OPCODE(i)) { |
347 | case OP_RETURN: { | 347 | case OP_RETURN: { |
348 | L->top = top; | 348 | L->top = top; |