lua

A copy of the Lua development repository
Log | Files | Refs | README

commit 448517e47e40814f6ee12eae8dd6c3120f1d48bb
parent 931ee346e34aeb9d46bbf99f5da1f628a9812050
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Fri, 18 Jan 2002 15:38:44 -0200

no more linehook field in CallInfo

Diffstat:
Mldo.c | 4++--
Mlstate.h | 1-
Mlvm.c | 18++++++++++++------
3 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/ldo.c b/ldo.c @@ -1,5 +1,5 @@ /* -** $Id: ldo.c,v 1.1 2001/11/29 22:14:34 rieru Exp rieru $ +** $Id: ldo.c,v 1.154 2002/01/11 20:27:41 roberto Exp $ ** Stack and Call structure of Lua ** See Copyright Notice in lua.h */ @@ -148,12 +148,12 @@ StkId luaD_precall (lua_State *L, StkId func) { if (!cl->isC) { /* Lua function? prepare its call */ StkId base = func+1; Proto *p = cl->p; - ci->linehook = L->linehook; ci->savedpc = p->code; /* starting point */ if (p->is_vararg) /* varargs? */ adjust_varargs(L, base, p->numparams); if (base > L->stack_last - p->maxstacksize) luaD_stackerror(L); + ci->line = 0; ci->top = base + p->maxstacksize; while (L->top < ci->top) setnilvalue(L->top++); diff --git a/lstate.h b/lstate.h @@ -82,7 +82,6 @@ typedef struct stringtable { typedef struct CallInfo { StkId base; /* base for called function */ const Instruction *savedpc; - lua_Hook linehook; StkId top; /* top for this function (when it's a Lua function) */ const Instruction **pc; /* extra information for line tracing */ diff --git a/lvm.c b/lvm.c @@ -66,10 +66,17 @@ static void traceexec (lua_State *L, lua_Hook linehook) { int *lineinfo = ci_func(ci)->l.p->lineinfo; int pc = cast(int, *ci->pc - ci_func(ci)->l.p->code) - 1; int newline; - if (pc == 0) { /* may be first time? */ - ci->line = 1; - ci->refi = 0; - ci->lastpc = pc+1; /* make sure it will call linehook */ + if (ci->line == -1) return; /* no linehooks for this function */ + else if (ci->line == 0) { /* first linehook? */ + if (pc == 0) { /* function is starting now? */ + ci->line = 1; + ci->refi = 0; + ci->lastpc = pc+1; /* make sure it will call linehook */ + } + else { /* function started without hooks: */ + ci->line = -1; /* keep it that way */ + return; + } } newline = luaG_getline(lineinfo, pc, ci->line, &ci->refi); /* calls linehook when enters a new line or jumps back (loop) */ @@ -315,7 +322,7 @@ StkId luaV_execute (lua_State *L) { base = L->ci->base; cl = &clvalue(base - 1)->l; k = cl->p->k; - linehook = L->ci->linehook; + linehook = L->linehook; L->ci->pc = &pc; pc = L->ci->savedpc; L->ci->savedpc = NULL; @@ -513,7 +520,6 @@ StkId luaV_execute (lua_State *L) { int nresults; lua_assert(ttype(ci->base-1) == LUA_TFUNCTION); base = ci->base; /* restore previous values */ - linehook = ci->linehook; cl = &clvalue(base - 1)->l; k = cl->p->k; pc = ci->savedpc;