new type 'StackValue' for stack elements
(we may want to put extra info there in the future)
This commit is contained in:
10
lstate.c
10
lstate.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lstate.c,v 2.139 2017/05/04 13:32:01 roberto Exp roberto $
|
||||
** $Id: lstate.c,v 2.140 2017/05/26 19:14:29 roberto Exp roberto $
|
||||
** Global State
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@@ -143,10 +143,10 @@ void luaE_shrinkCI (lua_State *L) {
|
||||
static void stack_init (lua_State *L1, lua_State *L) {
|
||||
int i; CallInfo *ci;
|
||||
/* initialize stack array */
|
||||
L1->stack = luaM_newvector(L, BASIC_STACK_SIZE, TValue);
|
||||
L1->stack = luaM_newvector(L, BASIC_STACK_SIZE, StackValue);
|
||||
L1->stacksize = BASIC_STACK_SIZE;
|
||||
for (i = 0; i < BASIC_STACK_SIZE; i++)
|
||||
setnilvalue(L1->stack + i); /* erase new stack */
|
||||
setnilvalue(s2v(L1->stack + i)); /* erase new stack */
|
||||
L1->top = L1->stack;
|
||||
L1->stack_last = L1->stack + L1->stacksize - EXTRA_STACK;
|
||||
/* initialize first ci */
|
||||
@@ -154,7 +154,7 @@ static void stack_init (lua_State *L1, lua_State *L) {
|
||||
ci->next = ci->previous = NULL;
|
||||
ci->callstatus = 0;
|
||||
ci->func = L1->top;
|
||||
setnilvalue(L1->top++); /* 'function' entry for this 'ci' */
|
||||
setnilvalue(s2v(L1->top++)); /* 'function' entry for this 'ci' */
|
||||
ci->top = L1->top + LUA_MINSTACK;
|
||||
L1->ci = ci;
|
||||
}
|
||||
@@ -258,7 +258,7 @@ LUA_API lua_State *lua_newthread (lua_State *L) {
|
||||
L1->next = g->allgc;
|
||||
g->allgc = obj2gco(L1);
|
||||
/* anchor it on L stack */
|
||||
setthvalue(L, L->top, L1);
|
||||
setthvalue2s(L, L->top, L1);
|
||||
api_incr_top(L);
|
||||
preinit_thread(L1, g);
|
||||
L1->hookmask = L->hookmask;
|
||||
|
||||
Reference in New Issue
Block a user