aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2022-05-03 20:51:29 +0200
committerMike Pall <mike>2022-05-03 20:51:29 +0200
commit91bc6b8ad1f373c1ce9003dc024b2e21fad0e444 (patch)
tree3cb1a71493853178cb55c380093fdf9f6b5ffb20 /src
parent3ee3c9cfa988339f1bf3068530515e2a6fb179d2 (diff)
downloadluajit-91bc6b8ad1f373c1ce9003dc024b2e21fad0e444.tar.gz
luajit-91bc6b8ad1f373c1ce9003dc024b2e21fad0e444.tar.bz2
luajit-91bc6b8ad1f373c1ce9003dc024b2e21fad0e444.zip
LJ_GC64: Fix HREFK optimization.
Contributed by XmiliaH.
Diffstat (limited to 'src')
-rw-r--r--src/lj_record.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lj_record.c b/src/lj_record.c
index a56876c5..b92db957 100644
--- a/src/lj_record.c
+++ b/src/lj_record.c
@@ -1448,16 +1448,16 @@ static TRef rec_idx_key(jit_State *J, RecordIndex *ix, IRRef *rbref,
1448 key = emitir(IRTN(IR_CONV), key, IRCONV_NUM_INT); 1448 key = emitir(IRTN(IR_CONV), key, IRCONV_NUM_INT);
1449 if (tref_isk(key)) { 1449 if (tref_isk(key)) {
1450 /* Optimize lookup of constant hash keys. */ 1450 /* Optimize lookup of constant hash keys. */
1451 MSize hslot = (MSize)((char *)ix->oldv - (char *)&noderef(t->node)[0].val); 1451 GCSize hslot = (GCSize)((char *)ix->oldv-(char *)&noderef(t->node)[0].val);
1452 if (t->hmask > 0 && hslot <= t->hmask*(MSize)sizeof(Node) && 1452 if (hslot <= t->hmask*(GCSize)sizeof(Node) &&
1453 hslot <= 65535*(MSize)sizeof(Node)) { 1453 hslot <= 65535*(GCSize)sizeof(Node)) {
1454 TRef node, kslot, hm; 1454 TRef node, kslot, hm;
1455 *rbref = J->cur.nins; /* Mark possible rollback point. */ 1455 *rbref = J->cur.nins; /* Mark possible rollback point. */
1456 *rbguard = J->guardemit; 1456 *rbguard = J->guardemit;
1457 hm = emitir(IRTI(IR_FLOAD), ix->tab, IRFL_TAB_HMASK); 1457 hm = emitir(IRTI(IR_FLOAD), ix->tab, IRFL_TAB_HMASK);
1458 emitir(IRTGI(IR_EQ), hm, lj_ir_kint(J, (int32_t)t->hmask)); 1458 emitir(IRTGI(IR_EQ), hm, lj_ir_kint(J, (int32_t)t->hmask));
1459 node = emitir(IRT(IR_FLOAD, IRT_PGC), ix->tab, IRFL_TAB_NODE); 1459 node = emitir(IRT(IR_FLOAD, IRT_PGC), ix->tab, IRFL_TAB_NODE);
1460 kslot = lj_ir_kslot(J, key, hslot / sizeof(Node)); 1460 kslot = lj_ir_kslot(J, key, (IRRef)(hslot / sizeof(Node)));
1461 return emitir(IRTG(IR_HREFK, IRT_PGC), node, kslot); 1461 return emitir(IRTG(IR_HREFK, IRT_PGC), node, kslot);
1462 } 1462 }
1463 } 1463 }