diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-06-09 13:48:44 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-06-09 13:48:44 -0300 |
commit | b6f87491afe32140563fe3c546b8812c28a63410 (patch) | |
tree | ac85dff5a850c5d488f1efa4ea95d0d7da99be16 /ltests.c | |
parent | 4bb30f461b146e1d189ee301472953e948699acf (diff) | |
download | lua-b6f87491afe32140563fe3c546b8812c28a63410.tar.gz lua-b6f87491afe32140563fe3c546b8812c28a63410.tar.bz2 lua-b6f87491afe32140563fe3c546b8812c28a63410.zip |
in hash nodes, keys are stored in separate pieces to avoid wasting
space with alignments
Diffstat (limited to 'ltests.c')
-rw-r--r-- | ltests.c | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 2.217 2017/05/04 13:32:01 roberto Exp $ | 2 | ** $Id: ltests.c,v 2.218 2017/05/31 18:54:58 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 | */ |
@@ -253,8 +253,10 @@ static void checktable (global_State *g, Table *h) { | |||
253 | checkvalref(g, hgc, &h->array[i]); | 253 | checkvalref(g, hgc, &h->array[i]); |
254 | for (n = gnode(h, 0); n < limit; n++) { | 254 | for (n = gnode(h, 0); n < limit; n++) { |
255 | if (!ttisnil(gval(n))) { | 255 | if (!ttisnil(gval(n))) { |
256 | lua_assert(!ttisnil(gkey(n))); | 256 | TValue k; |
257 | checkvalref(g, hgc, gkey(n)); | 257 | getnodekey(g->mainthread, &k, n); |
258 | lua_assert(!keyisnil(n)); | ||
259 | checkvalref(g, hgc, &k); | ||
258 | checkvalref(g, hgc, gval(n)); | 260 | checkvalref(g, hgc, gval(n)); |
259 | } | 261 | } |
260 | } | 262 | } |
@@ -802,10 +804,12 @@ static int table_query (lua_State *L) { | |||
802 | lua_pushnil(L); | 804 | lua_pushnil(L); |
803 | } | 805 | } |
804 | else if ((i -= t->sizearray) < sizenode(t)) { | 806 | else if ((i -= t->sizearray) < sizenode(t)) { |
807 | TValue k; | ||
808 | getnodekey(L, &k, gnode(t, i)); | ||
805 | if (!ttisnil(gval(gnode(t, i))) || | 809 | if (!ttisnil(gval(gnode(t, i))) || |
806 | ttisnil(gkey(gnode(t, i))) || | 810 | ttisnil(&k) || |
807 | ttisnumber(gkey(gnode(t, i)))) { | 811 | ttisnumber(&k)) { |
808 | pushobject(L, gkey(gnode(t, i))); | 812 | pushobject(L, &k); |
809 | } | 813 | } |
810 | else | 814 | else |
811 | lua_pushliteral(L, "<undef>"); | 815 | lua_pushliteral(L, "<undef>"); |