first version of Lua "stackless"

This commit is contained in:
Roberto Ierusalimschy
2001-12-18 18:52:30 -02:00
parent 101cee3032
commit e04f7ed450
8 changed files with 49 additions and 50 deletions

View File

@@ -69,6 +69,24 @@ typedef struct stringtable {
} stringtable;
/*
** informations about a call
*/
typedef struct CallInfo {
StkId base; /* base for called function */
const Instruction *savedpc;
lua_Hook linehook;
/* extra information for debugging */
const Instruction **pc;
int lastpc; /* last pc traced */
int line; /* current line */
int refi; /* current index in `lineinfo' */
} CallInfo;
#define ci_func(ci) (clvalue((ci)->base - 1))
/*
** `global state', shared by all threads of this state
*/
@@ -98,6 +116,9 @@ struct lua_State {
StkId stack_last; /* last free slot in the stack */
StkId stack; /* stack base */
int stacksize;
CallInfo *end_ci; /* points after end of ci array*/
CallInfo *base_ci; /* array of CallInfo's */
int size_ci; /* size of array `base_ci' */
global_State *_G;
lua_Hook callhook;
lua_Hook linehook;
@@ -106,7 +127,6 @@ struct lua_State {
UpVal *openupval; /* list of open upvalues in this stack */
lua_State *next; /* circular double linked list of states */
lua_State *previous;
CallInfo basefunc;
};