baby steps to remove 'CallInfo': keeping 'L->func' correct

This commit is contained in:
Roberto Ierusalimschy
2017-10-31 15:54:35 -02:00
parent ad5dcdcf0f
commit c5482468fd
5 changed files with 26 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: lstate.c,v 2.141 2017/06/29 15:06:44 roberto Exp roberto $
** $Id: lstate.c,v 2.142 2017/10/11 12:38:45 roberto Exp roberto $
** Global State
** See Copyright Notice in lua.h
*/
@@ -153,8 +153,10 @@ static void stack_init (lua_State *L1, lua_State *L) {
ci = &L1->base_ci;
ci->next = ci->previous = NULL;
ci->callstatus = 0;
ci->func = L1->top;
setnilvalue(s2v(L1->top++)); /* 'function' entry for this 'ci' */
L1->func = ci->func = L1->top;
L1->func->stkci.previous = 0; /* end of linked list */
setnilvalue(s2v(L1->top)); /* 'function' entry for this 'ci' */
L1->top++;
ci->top = L1->top + LUA_MINSTACK;
L1->ci = ci;
}
@@ -215,6 +217,7 @@ static void preinit_thread (lua_State *L, global_State *g) {
G(L) = g;
L->stack = NULL;
L->ci = NULL;
L->func = NULL;
L->nci = 0;
L->stacksize = 0;
L->twups = L; /* thread has no upvalues */