diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-01-18 15:39:06 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-01-18 15:39:06 -0200 |
commit | 448517e47e40814f6ee12eae8dd6c3120f1d48bb (patch) | |
tree | 46884b1c0793e05276f5ee3111d7b52f6535a268 | |
parent | 931ee346e34aeb9d46bbf99f5da1f628a9812050 (diff) | |
download | lua-448517e47e40814f6ee12eae8dd6c3120f1d48bb.tar.gz lua-448517e47e40814f6ee12eae8dd6c3120f1d48bb.tar.bz2 lua-448517e47e40814f6ee12eae8dd6c3120f1d48bb.zip |
no more linehook field in CallInfo
-rw-r--r-- | ldo.c | 4 | ||||
-rw-r--r-- | lstate.h | 1 | ||||
-rw-r--r-- | lvm.c | 18 |
3 files changed, 14 insertions, 9 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 1.1 2001/11/29 22:14:34 rieru Exp rieru $ | 2 | ** $Id: ldo.c,v 1.154 2002/01/11 20:27:41 roberto Exp $ |
3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -148,12 +148,12 @@ StkId luaD_precall (lua_State *L, StkId func) { | |||
148 | if (!cl->isC) { /* Lua function? prepare its call */ | 148 | if (!cl->isC) { /* Lua function? prepare its call */ |
149 | StkId base = func+1; | 149 | StkId base = func+1; |
150 | Proto *p = cl->p; | 150 | Proto *p = cl->p; |
151 | ci->linehook = L->linehook; | ||
152 | ci->savedpc = p->code; /* starting point */ | 151 | ci->savedpc = p->code; /* starting point */ |
153 | if (p->is_vararg) /* varargs? */ | 152 | if (p->is_vararg) /* varargs? */ |
154 | adjust_varargs(L, base, p->numparams); | 153 | adjust_varargs(L, base, p->numparams); |
155 | if (base > L->stack_last - p->maxstacksize) | 154 | if (base > L->stack_last - p->maxstacksize) |
156 | luaD_stackerror(L); | 155 | luaD_stackerror(L); |
156 | ci->line = 0; | ||
157 | ci->top = base + p->maxstacksize; | 157 | ci->top = base + p->maxstacksize; |
158 | while (L->top < ci->top) | 158 | while (L->top < ci->top) |
159 | setnilvalue(L->top++); | 159 | setnilvalue(L->top++); |
@@ -82,7 +82,6 @@ typedef struct stringtable { | |||
82 | typedef struct CallInfo { | 82 | typedef struct CallInfo { |
83 | StkId base; /* base for called function */ | 83 | StkId base; /* base for called function */ |
84 | const Instruction *savedpc; | 84 | const Instruction *savedpc; |
85 | lua_Hook linehook; | ||
86 | StkId top; /* top for this function (when it's a Lua function) */ | 85 | StkId top; /* top for this function (when it's a Lua function) */ |
87 | const Instruction **pc; | 86 | const Instruction **pc; |
88 | /* extra information for line tracing */ | 87 | /* extra information for line tracing */ |
@@ -66,10 +66,17 @@ static void traceexec (lua_State *L, lua_Hook linehook) { | |||
66 | int *lineinfo = ci_func(ci)->l.p->lineinfo; | 66 | int *lineinfo = ci_func(ci)->l.p->lineinfo; |
67 | int pc = cast(int, *ci->pc - ci_func(ci)->l.p->code) - 1; | 67 | int pc = cast(int, *ci->pc - ci_func(ci)->l.p->code) - 1; |
68 | int newline; | 68 | int newline; |
69 | if (pc == 0) { /* may be first time? */ | 69 | if (ci->line == -1) return; /* no linehooks for this function */ |
70 | ci->line = 1; | 70 | else if (ci->line == 0) { /* first linehook? */ |
71 | ci->refi = 0; | 71 | if (pc == 0) { /* function is starting now? */ |
72 | ci->lastpc = pc+1; /* make sure it will call linehook */ | 72 | ci->line = 1; |
73 | ci->refi = 0; | ||
74 | ci->lastpc = pc+1; /* make sure it will call linehook */ | ||
75 | } | ||
76 | else { /* function started without hooks: */ | ||
77 | ci->line = -1; /* keep it that way */ | ||
78 | return; | ||
79 | } | ||
73 | } | 80 | } |
74 | newline = luaG_getline(lineinfo, pc, ci->line, &ci->refi); | 81 | newline = luaG_getline(lineinfo, pc, ci->line, &ci->refi); |
75 | /* calls linehook when enters a new line or jumps back (loop) */ | 82 | /* calls linehook when enters a new line or jumps back (loop) */ |
@@ -315,7 +322,7 @@ StkId luaV_execute (lua_State *L) { | |||
315 | base = L->ci->base; | 322 | base = L->ci->base; |
316 | cl = &clvalue(base - 1)->l; | 323 | cl = &clvalue(base - 1)->l; |
317 | k = cl->p->k; | 324 | k = cl->p->k; |
318 | linehook = L->ci->linehook; | 325 | linehook = L->linehook; |
319 | L->ci->pc = &pc; | 326 | L->ci->pc = &pc; |
320 | pc = L->ci->savedpc; | 327 | pc = L->ci->savedpc; |
321 | L->ci->savedpc = NULL; | 328 | L->ci->savedpc = NULL; |
@@ -513,7 +520,6 @@ StkId luaV_execute (lua_State *L) { | |||
513 | int nresults; | 520 | int nresults; |
514 | lua_assert(ttype(ci->base-1) == LUA_TFUNCTION); | 521 | lua_assert(ttype(ci->base-1) == LUA_TFUNCTION); |
515 | base = ci->base; /* restore previous values */ | 522 | base = ci->base; /* restore previous values */ |
516 | linehook = ci->linehook; | ||
517 | cl = &clvalue(base - 1)->l; | 523 | cl = &clvalue(base - 1)->l; |
518 | k = cl->p->k; | 524 | k = cl->p->k; |
519 | pc = ci->savedpc; | 525 | pc = ci->savedpc; |