diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-06-15 11:14:20 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-06-15 11:14:20 -0300 |
commit | 6e600695f8398843a156ce02023f731c6d687ae8 (patch) | |
tree | a3e8ef5078e24b5fbdfdfbd89e949bb6c078b90f /ltests.c | |
parent | 06127927ffb4eb8459523f6c07bf8f22390c31b9 (diff) | |
download | lua-6e600695f8398843a156ce02023f731c6d687ae8.tar.gz lua-6e600695f8398843a156ce02023f731c6d687ae8.tar.bz2 lua-6e600695f8398843a156ce02023f731c6d687ae8.zip |
field 'sizearray' in struct 'Table' changed to 'alimit', which can
be used as a hint for '#t'
Diffstat (limited to 'ltests.c')
-rw-r--r-- | ltests.c | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 2.243 2018/03/09 19:24:45 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 2.244 2018/06/11 14:19:50 roberto Exp roberto $ |
3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -248,10 +248,11 @@ static void checkvalref (global_State *g, GCObject *f, const TValue *t) { | |||
248 | 248 | ||
249 | static void checktable (global_State *g, Table *h) { | 249 | static void checktable (global_State *g, Table *h) { |
250 | unsigned int i; | 250 | unsigned int i; |
251 | unsigned int asize = luaH_realasize(h); | ||
251 | Node *n, *limit = gnode(h, sizenode(h)); | 252 | Node *n, *limit = gnode(h, sizenode(h)); |
252 | GCObject *hgc = obj2gco(h); | 253 | GCObject *hgc = obj2gco(h); |
253 | checkobjref(g, hgc, h->metatable); | 254 | checkobjref(g, hgc, h->metatable); |
254 | for (i = 0; i < h->sizearray; i++) | 255 | for (i = 0; i < asize; i++) |
255 | checkvalref(g, hgc, &h->array[i]); | 256 | checkvalref(g, hgc, &h->array[i]); |
256 | for (n = gnode(h, 0); n < limit; n++) { | 257 | for (n = gnode(h, 0); n < limit; n++) { |
257 | if (!isempty(gval(n))) { | 258 | if (!isempty(gval(n))) { |
@@ -810,19 +811,23 @@ static int stacklevel (lua_State *L) { | |||
810 | static int table_query (lua_State *L) { | 811 | static int table_query (lua_State *L) { |
811 | const Table *t; | 812 | const Table *t; |
812 | int i = cast_int(luaL_optinteger(L, 2, -1)); | 813 | int i = cast_int(luaL_optinteger(L, 2, -1)); |
814 | unsigned int asize; | ||
813 | luaL_checktype(L, 1, LUA_TTABLE); | 815 | luaL_checktype(L, 1, LUA_TTABLE); |
814 | t = hvalue(obj_at(L, 1)); | 816 | t = hvalue(obj_at(L, 1)); |
817 | asize = luaH_realasize(t); | ||
815 | if (i == -1) { | 818 | if (i == -1) { |
816 | lua_pushinteger(L, t->sizearray); | 819 | lua_pushinteger(L, asize); |
817 | lua_pushinteger(L, allocsizenode(t)); | 820 | lua_pushinteger(L, allocsizenode(t)); |
818 | lua_pushinteger(L, isdummy(t) ? 0 : t->lastfree - t->node); | 821 | lua_pushinteger(L, isdummy(t) ? 0 : t->lastfree - t->node); |
822 | lua_pushinteger(L, t->alimit); | ||
823 | return 4; | ||
819 | } | 824 | } |
820 | else if ((unsigned int)i < t->sizearray) { | 825 | else if ((unsigned int)i < asize) { |
821 | lua_pushinteger(L, i); | 826 | lua_pushinteger(L, i); |
822 | pushobject(L, &t->array[i]); | 827 | pushobject(L, &t->array[i]); |
823 | lua_pushnil(L); | 828 | lua_pushnil(L); |
824 | } | 829 | } |
825 | else if ((i -= t->sizearray) < sizenode(t)) { | 830 | else if ((i -= asize) < sizenode(t)) { |
826 | TValue k; | 831 | TValue k; |
827 | getnodekey(L, &k, gnode(t, i)); | 832 | getnodekey(L, &k, gnode(t, i)); |
828 | if (!isempty(gval(gnode(t, i))) || | 833 | if (!isempty(gval(gnode(t, i))) || |