diff options
author | Mike Pall <mike> | 2025-03-10 02:56:07 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2025-03-10 02:56:07 +0100 |
commit | 84cb21ffaf648b472ff3884556e2c413e8abe179 (patch) | |
tree | bf63bb6de4b4893225cecc6023f6c1e90586c28b /src/lj_bcread.c | |
parent | 4f2bb199fe7138247e0b075c886c9e9197cf0271 (diff) | |
download | luajit-84cb21ffaf648b472ff3884556e2c413e8abe179.tar.gz luajit-84cb21ffaf648b472ff3884556e2c413e8abe179.tar.bz2 luajit-84cb21ffaf648b472ff3884556e2c413e8abe179.zip |
REVERT: Change handling of nil value markers in template tables.
Diffstat (limited to 'src/lj_bcread.c')
-rw-r--r-- | src/lj_bcread.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/lj_bcread.c b/src/lj_bcread.c index 37e909b3..ee7d7c18 100644 --- a/src/lj_bcread.c +++ b/src/lj_bcread.c | |||
@@ -179,7 +179,7 @@ static const void *bcread_varinfo(GCproto *pt) | |||
179 | } | 179 | } |
180 | 180 | ||
181 | /* Read a single constant key/value of a template table. */ | 181 | /* Read a single constant key/value of a template table. */ |
182 | static void bcread_ktabk(LexState *ls, TValue *o, GCtab *t) | 182 | static void bcread_ktabk(LexState *ls, TValue *o) |
183 | { | 183 | { |
184 | MSize tp = bcread_uleb128(ls); | 184 | MSize tp = bcread_uleb128(ls); |
185 | if (tp >= BCDUMP_KTAB_STR) { | 185 | if (tp >= BCDUMP_KTAB_STR) { |
@@ -191,8 +191,6 @@ static void bcread_ktabk(LexState *ls, TValue *o, GCtab *t) | |||
191 | } else if (tp == BCDUMP_KTAB_NUM) { | 191 | } else if (tp == BCDUMP_KTAB_NUM) { |
192 | o->u32.lo = bcread_uleb128(ls); | 192 | o->u32.lo = bcread_uleb128(ls); |
193 | o->u32.hi = bcread_uleb128(ls); | 193 | o->u32.hi = bcread_uleb128(ls); |
194 | } else if (tp == BCDUMP_KTAB_NIL) { /* Restore nil value marker. */ | ||
195 | settabV(ls->L, o, t); | ||
196 | } else { | 194 | } else { |
197 | lj_assertLS(tp <= BCDUMP_KTAB_TRUE, "bad constant type %d", tp); | 195 | lj_assertLS(tp <= BCDUMP_KTAB_TRUE, "bad constant type %d", tp); |
198 | setpriV(o, ~tp); | 196 | setpriV(o, ~tp); |
@@ -209,15 +207,15 @@ static GCtab *bcread_ktab(LexState *ls) | |||
209 | MSize i; | 207 | MSize i; |
210 | TValue *o = tvref(t->array); | 208 | TValue *o = tvref(t->array); |
211 | for (i = 0; i < narray; i++, o++) | 209 | for (i = 0; i < narray; i++, o++) |
212 | bcread_ktabk(ls, o, t); | 210 | bcread_ktabk(ls, o); |
213 | } | 211 | } |
214 | if (nhash) { /* Read hash entries. */ | 212 | if (nhash) { /* Read hash entries. */ |
215 | MSize i; | 213 | MSize i; |
216 | for (i = 0; i < nhash; i++) { | 214 | for (i = 0; i < nhash; i++) { |
217 | TValue key; | 215 | TValue key; |
218 | bcread_ktabk(ls, &key, t); | 216 | bcread_ktabk(ls, &key); |
219 | lj_assertLS(!tvisnil(&key), "nil key"); | 217 | lj_assertLS(!tvisnil(&key), "nil key"); |
220 | bcread_ktabk(ls, lj_tab_set(ls->L, t, &key), t); | 218 | bcread_ktabk(ls, lj_tab_set(ls->L, t, &key)); |
221 | } | 219 | } |
222 | } | 220 | } |
223 | return t; | 221 | return t; |