diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2022-10-29 12:06:37 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2022-10-29 12:06:37 -0300 |
commit | 413a393e6222482f46599e138bebac162610a572 (patch) | |
tree | 181517f8ec8d56f9101de33f4891729044f244de /ltests.c | |
parent | ba089bcb08a0efc6c26fb5c1e3c9d61c00cc012c (diff) | |
download | lua-413a393e6222482f46599e138bebac162610a572.tar.gz lua-413a393e6222482f46599e138bebac162610a572.tar.bz2 lua-413a393e6222482f46599e138bebac162610a572.zip |
Stack indices changed to union's
That will allow to change pointers to offsets while reallocating
the stack.
Diffstat (limited to 'ltests.c')
-rw-r--r-- | ltests.c | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -44,7 +44,7 @@ | |||
44 | void *l_Trick = 0; | 44 | void *l_Trick = 0; |
45 | 45 | ||
46 | 46 | ||
47 | #define obj_at(L,k) s2v(L->ci->func + (k)) | 47 | #define obj_at(L,k) s2v(L->ci->func.p + (k)) |
48 | 48 | ||
49 | 49 | ||
50 | static int runC (lua_State *L, lua_State *L1, const char *pc); | 50 | static int runC (lua_State *L, lua_State *L1, const char *pc); |
@@ -57,7 +57,7 @@ static void setnameval (lua_State *L, const char *name, int val) { | |||
57 | 57 | ||
58 | 58 | ||
59 | static void pushobject (lua_State *L, const TValue *o) { | 59 | static void pushobject (lua_State *L, const TValue *o) { |
60 | setobj2s(L, L->top, o); | 60 | setobj2s(L, L->top.p, o); |
61 | api_incr_top(L); | 61 | api_incr_top(L); |
62 | } | 62 | } |
63 | 63 | ||
@@ -419,7 +419,7 @@ static void checkLclosure (global_State *g, LClosure *cl) { | |||
419 | if (uv) { | 419 | if (uv) { |
420 | checkobjrefN(g, clgc, uv); | 420 | checkobjrefN(g, clgc, uv); |
421 | if (!upisopen(uv)) | 421 | if (!upisopen(uv)) |
422 | checkvalref(g, obj2gco(uv), uv->v); | 422 | checkvalref(g, obj2gco(uv), uv->v.p); |
423 | } | 423 | } |
424 | } | 424 | } |
425 | } | 425 | } |
@@ -428,7 +428,7 @@ static void checkLclosure (global_State *g, LClosure *cl) { | |||
428 | static int lua_checkpc (CallInfo *ci) { | 428 | static int lua_checkpc (CallInfo *ci) { |
429 | if (!isLua(ci)) return 1; | 429 | if (!isLua(ci)) return 1; |
430 | else { | 430 | else { |
431 | StkId f = ci->func; | 431 | StkId f = ci->func.p; |
432 | Proto *p = clLvalue(s2v(f))->p; | 432 | Proto *p = clLvalue(s2v(f))->p; |
433 | return p->code <= ci->u.l.savedpc && | 433 | return p->code <= ci->u.l.savedpc && |
434 | ci->u.l.savedpc <= p->code + p->sizecode; | 434 | ci->u.l.savedpc <= p->code + p->sizecode; |
@@ -441,19 +441,19 @@ static void checkstack (global_State *g, lua_State *L1) { | |||
441 | CallInfo *ci; | 441 | CallInfo *ci; |
442 | UpVal *uv; | 442 | UpVal *uv; |
443 | assert(!isdead(g, L1)); | 443 | assert(!isdead(g, L1)); |
444 | if (L1->stack == NULL) { /* incomplete thread? */ | 444 | if (L1->stack.p == NULL) { /* incomplete thread? */ |
445 | assert(L1->openupval == NULL && L1->ci == NULL); | 445 | assert(L1->openupval == NULL && L1->ci == NULL); |
446 | return; | 446 | return; |
447 | } | 447 | } |
448 | for (uv = L1->openupval; uv != NULL; uv = uv->u.open.next) | 448 | for (uv = L1->openupval; uv != NULL; uv = uv->u.open.next) |
449 | assert(upisopen(uv)); /* must be open */ | 449 | assert(upisopen(uv)); /* must be open */ |
450 | assert(L1->top <= L1->stack_last); | 450 | assert(L1->top.p <= L1->stack_last.p); |
451 | assert(L1->tbclist <= L1->top); | 451 | assert(L1->tbclist.p <= L1->top.p); |
452 | for (ci = L1->ci; ci != NULL; ci = ci->previous) { | 452 | for (ci = L1->ci; ci != NULL; ci = ci->previous) { |
453 | assert(ci->top <= L1->stack_last); | 453 | assert(ci->top.p <= L1->stack_last.p); |
454 | assert(lua_checkpc(ci)); | 454 | assert(lua_checkpc(ci)); |
455 | } | 455 | } |
456 | for (o = L1->stack; o < L1->stack_last; o++) | 456 | for (o = L1->stack.p; o < L1->stack_last.p; o++) |
457 | checkliveness(L1, s2v(o)); /* entire stack must have valid values */ | 457 | checkliveness(L1, s2v(o)); /* entire stack must have valid values */ |
458 | } | 458 | } |
459 | 459 | ||
@@ -465,7 +465,7 @@ static void checkrefs (global_State *g, GCObject *o) { | |||
465 | break; | 465 | break; |
466 | } | 466 | } |
467 | case LUA_VUPVAL: { | 467 | case LUA_VUPVAL: { |
468 | checkvalref(g, o, gco2upv(o)->v); | 468 | checkvalref(g, o, gco2upv(o)->v.p); |
469 | break; | 469 | break; |
470 | } | 470 | } |
471 | case LUA_VTABLE: { | 471 | case LUA_VTABLE: { |
@@ -980,7 +980,7 @@ static int hash_query (lua_State *L) { | |||
980 | 980 | ||
981 | static int stacklevel (lua_State *L) { | 981 | static int stacklevel (lua_State *L) { |
982 | unsigned long a = 0; | 982 | unsigned long a = 0; |
983 | lua_pushinteger(L, (L->top - L->stack)); | 983 | lua_pushinteger(L, (L->top.p - L->stack.p)); |
984 | lua_pushinteger(L, stacksize(L)); | 984 | lua_pushinteger(L, stacksize(L)); |
985 | lua_pushinteger(L, L->nCcalls); | 985 | lua_pushinteger(L, L->nCcalls); |
986 | lua_pushinteger(L, L->nci); | 986 | lua_pushinteger(L, L->nci); |
@@ -1040,7 +1040,7 @@ static int string_query (lua_State *L) { | |||
1040 | TString *ts; | 1040 | TString *ts; |
1041 | int n = 0; | 1041 | int n = 0; |
1042 | for (ts = tb->hash[s]; ts != NULL; ts = ts->u.hnext) { | 1042 | for (ts = tb->hash[s]; ts != NULL; ts = ts->u.hnext) { |
1043 | setsvalue2s(L, L->top, ts); | 1043 | setsvalue2s(L, L->top.p, ts); |
1044 | api_incr_top(L); | 1044 | api_incr_top(L); |
1045 | n++; | 1045 | n++; |
1046 | } | 1046 | } |