diff options
Diffstat (limited to 'lstate.h')
-rw-r--r-- | lstate.h | 31 |
1 files changed, 21 insertions, 10 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.h,v 1.88 2002/07/08 20:22:08 roberto Exp roberto $ | 2 | ** $Id: lstate.h,v 1.89 2002/07/16 14:26:56 roberto Exp roberto $ |
3 | ** Global State | 3 | ** Global State |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -65,7 +65,7 @@ struct lua_longjmp; /* defined in ldo.c */ | |||
65 | #define registry(L) (L->globs + 2) | 65 | #define registry(L) (L->globs + 2) |
66 | 66 | ||
67 | 67 | ||
68 | /* space to handle TM calls and other temporary overflows */ | 68 | /* extra stack space to handle TM calls and some other extras */ |
69 | #define EXTRA_STACK 5 | 69 | #define EXTRA_STACK 5 |
70 | 70 | ||
71 | 71 | ||
@@ -88,10 +88,10 @@ typedef struct stringtable { | |||
88 | typedef struct CallInfo { | 88 | typedef struct CallInfo { |
89 | StkId base; /* base for called function */ | 89 | StkId base; /* base for called function */ |
90 | StkId top; /* top for this function */ | 90 | StkId top; /* top for this function */ |
91 | const Instruction *savedpc; /* NULL means not a Lua function */ | 91 | const Instruction **pc; /* points to `pc' variable in `luaV_execute' */ |
92 | union { | 92 | union { |
93 | struct { /* for Lua functions */ | 93 | struct { /* for Lua functions */ |
94 | const Instruction **pc; /* points to `pc' variable in `luaV_execute' */ | 94 | const Instruction *savedpc; |
95 | StkId *pb; /* points to `base' variable in `luaV_execute' */ | 95 | StkId *pb; /* points to `base' variable in `luaV_execute' */ |
96 | } l; | 96 | } l; |
97 | struct { /* for C functions */ | 97 | struct { /* for C functions */ |
@@ -101,7 +101,15 @@ typedef struct CallInfo { | |||
101 | } CallInfo; | 101 | } CallInfo; |
102 | 102 | ||
103 | 103 | ||
104 | #define isLua(ci) ((ci)->savedpc != NULL) | 104 | /* |
105 | ** informations about a `protection' (error recovery points) | ||
106 | */ | ||
107 | typedef struct Protection { | ||
108 | ptrdiff_t ci; | ||
109 | ptrdiff_t top; | ||
110 | int allowhooks; | ||
111 | } Protection; | ||
112 | |||
105 | 113 | ||
106 | #define ci_func(ci) (clvalue((ci)->base - 1)) | 114 | #define ci_func(ci) (clvalue((ci)->base - 1)) |
107 | 115 | ||
@@ -133,22 +141,25 @@ typedef struct global_State { | |||
133 | struct lua_State { | 141 | struct lua_State { |
134 | LUA_USERSTATE | 142 | LUA_USERSTATE |
135 | StkId top; /* first free slot in the stack */ | 143 | StkId top; /* first free slot in the stack */ |
144 | global_State *l_G; | ||
136 | CallInfo *ci; /* call info for current function */ | 145 | CallInfo *ci; /* call info for current function */ |
137 | StkId stack_last; /* last free slot in the stack */ | 146 | StkId stack_last; /* last free slot in the stack */ |
138 | StkId stack; /* stack base */ | 147 | StkId stack; /* stack base */ |
148 | int stacksize; | ||
139 | CallInfo *end_ci; /* points after end of ci array*/ | 149 | CallInfo *end_ci; /* points after end of ci array*/ |
140 | CallInfo *base_ci; /* array of CallInfo's */ | 150 | CallInfo *base_ci; /* array of CallInfo's */ |
141 | global_State *l_G; | 151 | int size_ci; /* size of array `base_ci' */ |
142 | int hookmask; | 152 | int hookmask; |
143 | ls_count hookcount; | 153 | ls_count hookcount; |
144 | lua_Hook hook; | 154 | lua_Hook hook; |
145 | TObject globs[NUMGLOBS]; /* registry, table of globals, etc. */ | ||
146 | struct lua_longjmp *errorJmp; /* current error recover point */ | ||
147 | UpVal *openupval; /* list of open upvalues in this stack */ | 155 | UpVal *openupval; /* list of open upvalues in this stack */ |
156 | struct lua_longjmp *errorJmp; /* current error recover point */ | ||
157 | Protection *toreset; /* array of pending pcall resets */ | ||
158 | int number_toreset; | ||
159 | int size_toreset; | ||
148 | lua_State *next; /* circular double linked list of states */ | 160 | lua_State *next; /* circular double linked list of states */ |
149 | lua_State *previous; | 161 | lua_State *previous; |
150 | int stacksize; | 162 | TObject globs[NUMGLOBS]; /* registry, table of globals, etc. */ |
151 | int size_ci; /* size of array `base_ci' */ | ||
152 | }; | 163 | }; |
153 | 164 | ||
154 | 165 | ||