aboutsummaryrefslogtreecommitdiff
path: root/lcode.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lcode.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lcode.c b/lcode.c
index e6a98bb6..8f08302e 100644
--- a/lcode.c
+++ b/lcode.c
@@ -563,13 +563,13 @@ static int addk (FuncState *fs, Proto *f, TValue *v) {
563static int k2proto (FuncState *fs, TValue *key, TValue *v) { 563static int k2proto (FuncState *fs, TValue *key, TValue *v) {
564 TValue val; 564 TValue val;
565 Proto *f = fs->f; 565 Proto *f = fs->f;
566 int tag = luaH_get(fs->ls->h, key, &val); /* query scanner table */ 566 int tag = luaH_get(fs->kcache, key, &val); /* query scanner table */
567 int k; 567 int k;
568 if (tag == LUA_VNUMINT) { /* is there an index there? */ 568 if (!tagisempty(tag)) { /* is there an index there? */
569 k = cast_int(ivalue(&val)); 569 k = cast_int(ivalue(&val));
570 lua_assert(k < fs->nk);
570 /* correct value? (warning: must distinguish floats from integers!) */ 571 /* correct value? (warning: must distinguish floats from integers!) */
571 if (k < fs->nk && ttypetag(&f->k[k]) == ttypetag(v) && 572 if (ttypetag(&f->k[k]) == ttypetag(v) && luaV_rawequalobj(&f->k[k], v))
572 luaV_rawequalobj(&f->k[k], v))
573 return k; /* reuse index */ 573 return k; /* reuse index */
574 } 574 }
575 /* constant not found; create a new entry */ 575 /* constant not found; create a new entry */
@@ -577,7 +577,7 @@ static int k2proto (FuncState *fs, TValue *key, TValue *v) {
577 /* cache for reuse; numerical value does not need GC barrier; 577 /* cache for reuse; numerical value does not need GC barrier;
578 table has no metatable, so it does not need to invalidate cache */ 578 table has no metatable, so it does not need to invalidate cache */
579 setivalue(&val, k); 579 setivalue(&val, k);
580 luaH_set(fs->ls->L, fs->ls->h, key, &val); 580 luaH_set(fs->ls->L, fs->kcache, key, &val);
581 return k; 581 return k;
582} 582}
583 583
@@ -659,7 +659,7 @@ static int nilK (FuncState *fs) {
659 TValue k, v; 659 TValue k, v;
660 setnilvalue(&v); 660 setnilvalue(&v);
661 /* cannot use nil as key; instead use table itself to represent nil */ 661 /* cannot use nil as key; instead use table itself to represent nil */
662 sethvalue(fs->ls->L, &k, fs->ls->h); 662 sethvalue(fs->ls->L, &k, fs->kcache);
663 return k2proto(fs, &k, &v); 663 return k2proto(fs, &k, &v);
664} 664}
665 665