@@ -182,10 +182,10 @@ static const char *upvalname (const Proto *p, int uv) {
182
182
183
183
184
184
static const char * findvararg (CallInfo * ci , int n , StkId * pos ) {
185
- if (clLvalue (s2v (ci -> func ))-> p -> is_vararg ) {
185
+ if (clLvalue (s2v (ci -> func . p ))-> p -> is_vararg ) {
186
186
int nextra = ci -> u .l .nextraargs ;
187
187
if (n >= - nextra ) { /* 'n' is negative */
188
- * pos = ci -> func - nextra - (n + 1 );
188
+ * pos = ci -> func . p - nextra - (n + 1 );
189
189
return "(vararg)" ; /* generic name for any vararg */
190
190
}
191
191
}
@@ -194,7 +194,7 @@ static const char *findvararg (CallInfo *ci, int n, StkId *pos) {
194
194
195
195
196
196
const char * luaG_findlocal (lua_State * L , CallInfo * ci , int n , StkId * pos ) {
197
- StkId base = ci -> func + 1 ;
197
+ StkId base = ci -> func . p + 1 ;
198
198
const char * name = NULL ;
199
199
if (isLua (ci )) {
200
200
if (n < 0 ) /* access to vararg values? */
@@ -203,7 +203,7 @@ const char *luaG_findlocal (lua_State *L, CallInfo *ci, int n, StkId *pos) {
203
203
name = luaF_getlocalname (ci_func (ci )-> p , n , currentpc (ci ));
204
204
}
205
205
if (name == NULL ) { /* no 'standard' name? */
206
- StkId limit = (ci == L -> ci ) ? L -> top : ci -> next -> func ;
206
+ StkId limit = (ci == L -> ci ) ? L -> top . p : ci -> next -> func . p ;
207
207
if (limit - base >= n && n > 0 ) { /* is 'n' inside 'ci' stack? */
208
208
/* generic name for any valid slot */
209
209
name = isLua (ci ) ? "(temporary)" : "(C temporary)" ;
@@ -221,16 +221,16 @@ LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) {
221
221
const char * name ;
222
222
lua_lock (L );
223
223
if (ar == NULL ) { /* information about non-active function? */
224
- if (!isLfunction (s2v (L -> top - 1 ))) /* not a Lua function? */
224
+ if (!isLfunction (s2v (L -> top . p - 1 ))) /* not a Lua function? */
225
225
name = NULL ;
226
226
else /* consider live variables at function start (parameters) */
227
- name = luaF_getlocalname (clLvalue (s2v (L -> top - 1 ))-> p , n , 0 );
227
+ name = luaF_getlocalname (clLvalue (s2v (L -> top . p - 1 ))-> p , n , 0 );
228
228
}
229
229
else { /* active function; get information through 'ar' */
230
230
StkId pos = NULL ; /* to avoid warnings */
231
231
name = luaG_findlocal (L , ar -> i_ci , n , & pos );
232
232
if (name ) {
233
- setobjs2s (L , L -> top , pos );
233
+ setobjs2s (L , L -> top . p , pos );
234
234
api_incr_top (L );
235
235
}
236
236
}
@@ -245,8 +245,8 @@ LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) {
245
245
lua_lock (L );
246
246
name = luaG_findlocal (L , ar -> i_ci , n , & pos );
247
247
if (name ) {
248
- setobjs2s (L , pos , L -> top - 1 );
249
- L -> top -- ; /* pop value */
248
+ setobjs2s (L , pos , L -> top . p - 1 );
249
+ L -> top . p -- ; /* pop value */
250
250
}
251
251
lua_unlock (L );
252
252
return name ;
@@ -289,7 +289,7 @@ static int nextline (const Proto *p, int currentline, int pc) {
289
289
290
290
static void collectvalidlines (lua_State * L , Closure * f ) {
291
291
if (noLuaClosure (f )) {
292
- setnilvalue (s2v (L -> top ));
292
+ setnilvalue (s2v (L -> top . p ));
293
293
api_incr_top (L );
294
294
}
295
295
else {
@@ -298,7 +298,7 @@ static void collectvalidlines (lua_State *L, Closure *f) {
298
298
const Proto * p = f -> l .p ;
299
299
int currentline = p -> linedefined ;
300
300
Table * t = luaH_new (L ); /* new table to store active lines */
301
- sethvalue2s (L , L -> top , t ); /* push it on stack */
301
+ sethvalue2s (L , L -> top . p , t ); /* push it on stack */
302
302
api_incr_top (L );
303
303
setbtvalue (& v ); /* boolean 'true' to be the value of all indices */
304
304
if (!p -> is_vararg ) /* regular function? */
@@ -388,20 +388,20 @@ LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) {
388
388
lua_lock (L );
389
389
if (* what == '>' ) {
390
390
ci = NULL ;
391
- func = s2v (L -> top - 1 );
391
+ func = s2v (L -> top . p - 1 );
392
392
api_check (L , ttisfunction (func ), "function expected" );
393
393
what ++ ; /* skip the '>' */
394
- L -> top -- ; /* pop function */
394
+ L -> top . p -- ; /* pop function */
395
395
}
396
396
else {
397
397
ci = ar -> i_ci ;
398
- func = s2v (ci -> func );
398
+ func = s2v (ci -> func . p );
399
399
lua_assert (ttisfunction (func ));
400
400
}
401
401
cl = ttisclosure (func ) ? clvalue (func ) : NULL ;
402
402
status = auxgetinfo (L , what , ar , cl , ci );
403
403
if (strchr (what , 'f' )) {
404
- setobj2s (L , L -> top , func );
404
+ setobj2s (L , L -> top . p , func );
405
405
api_incr_top (L );
406
406
}
407
407
if (strchr (what , 'L' ))
@@ -663,7 +663,7 @@ static const char *funcnamefromcall (lua_State *L, CallInfo *ci,
663
663
*/
664
664
static int isinstack (CallInfo * ci , const TValue * o ) {
665
665
StkId pos ;
666
- for (pos = ci -> func + 1 ; pos < ci -> top ; pos ++ ) {
666
+ for (pos = ci -> func . p + 1 ; pos < ci -> top . p ; pos ++ ) {
667
667
if (o == s2v (pos ))
668
668
return 1 ;
669
669
}
@@ -681,7 +681,7 @@ static const char *getupvalname (CallInfo *ci, const TValue *o,
681
681
LClosure * c = ci_func (ci );
682
682
int i ;
683
683
for (i = 0 ; i < c -> nupvalues ; i ++ ) {
684
- if (c -> upvals [i ]-> v == o ) {
684
+ if (c -> upvals [i ]-> v . p == o ) {
685
685
* name = upvalname (c -> p , i );
686
686
return "upvalue" ;
687
687
}
@@ -710,7 +710,7 @@ static const char *varinfo (lua_State *L, const TValue *o) {
710
710
kind = getupvalname (ci , o , & name ); /* check whether 'o' is an upvalue */
711
711
if (!kind && isinstack (ci , o )) /* no? try a register */
712
712
kind = getobjname (ci_func (ci )-> p , currentpc (ci ),
713
- cast_int (cast (StkId , o ) - (ci -> func + 1 )), & name );
713
+ cast_int (cast (StkId , o ) - (ci -> func . p + 1 )), & name );
714
714
}
715
715
return formatvarinfo (L , kind , name );
716
716
}
@@ -807,10 +807,10 @@ l_noret luaG_errormsg (lua_State *L) {
807
807
if (L -> errfunc != 0 ) { /* is there an error handling function? */
808
808
StkId errfunc = restorestack (L , L -> errfunc );
809
809
lua_assert (ttisfunction (s2v (errfunc )));
810
- setobjs2s (L , L -> top , L -> top - 1 ); /* move argument */
811
- setobjs2s (L , L -> top - 1 , errfunc ); /* push function */
812
- L -> top ++ ; /* assume EXTRA_STACK */
813
- luaD_callnoyield (L , L -> top - 2 , 1 ); /* call it */
810
+ setobjs2s (L , L -> top . p , L -> top . p - 1 ); /* move argument */
811
+ setobjs2s (L , L -> top . p - 1 , errfunc ); /* push function */
812
+ L -> top . p ++ ; /* assume EXTRA_STACK */
813
+ luaD_callnoyield (L , L -> top . p - 2 , 1 ); /* call it */
814
814
}
815
815
luaD_throw (L , LUA_ERRRUN );
816
816
}
@@ -826,8 +826,8 @@ l_noret luaG_runerror (lua_State *L, const char *fmt, ...) {
826
826
va_end (argp );
827
827
if (isLua (ci )) { /* if Lua function, add source:line information */
828
828
luaG_addinfo (L , msg , ci_func (ci )-> p -> source , getcurrentline (ci ));
829
- setobjs2s (L , L -> top - 2 , L -> top - 1 ); /* remove 'msg' from the stack */
830
- L -> top -- ;
829
+ setobjs2s (L , L -> top . p - 2 , L -> top . p - 1 ); /* remove 'msg' */
830
+ L -> top . p -- ;
831
831
}
832
832
luaG_errormsg (L );
833
833
}
@@ -872,7 +872,7 @@ static int changedline (const Proto *p, int oldpc, int newpc) {
872
872
** invalid; if so, use zero as a valid value. (A wrong but valid 'oldpc'
873
873
** at most causes an extra call to a line hook.)
874
874
** This function is not "Protected" when called, so it should correct
875
- ** 'L->top' before calling anything that can run the GC.
875
+ ** 'L->top.p ' before calling anything that can run the GC.
876
876
*/
877
877
int luaG_traceexec (lua_State * L , const Instruction * pc ) {
878
878
CallInfo * ci = L -> ci ;
@@ -895,7 +895,7 @@ int luaG_traceexec (lua_State *L, const Instruction *pc) {
895
895
return 1 ; /* do not call hook again (VM yielded, so it did not move) */
896
896
}
897
897
if (!isIT (* (ci -> u .l .savedpc - 1 ))) /* top not being used? */
898
- L -> top = ci -> top ; /* correct top */
898
+ L -> top . p = ci -> top . p ; /* correct top */
899
899
if (counthook )
900
900
luaD_hook (L , LUA_HOOKCOUNT , -1 , 0 , 0 ); /* call count hook */
901
901
if (mask & LUA_MASKLINE ) {
0 commit comments