Skip to content

Commit

Permalink
LJ_GC64: Fix HREFK optimization.
Browse files Browse the repository at this point in the history
Contributed by XmiliaH.
  • Loading branch information
Mike Pall committed May 3, 2022
1 parent 3ee3c9c commit 91bc6b8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lj_record.c
Expand Up @@ -1448,16 +1448,16 @@ static TRef rec_idx_key(jit_State *J, RecordIndex *ix, IRRef *rbref,
key = emitir(IRTN(IR_CONV), key, IRCONV_NUM_INT);
if (tref_isk(key)) {
/* Optimize lookup of constant hash keys. */
MSize hslot = (MSize)((char *)ix->oldv - (char *)&noderef(t->node)[0].val);
if (t->hmask > 0 && hslot <= t->hmask*(MSize)sizeof(Node) &&
hslot <= 65535*(MSize)sizeof(Node)) {
GCSize hslot = (GCSize)((char *)ix->oldv-(char *)&noderef(t->node)[0].val);
if (hslot <= t->hmask*(GCSize)sizeof(Node) &&
hslot <= 65535*(GCSize)sizeof(Node)) {
TRef node, kslot, hm;
*rbref = J->cur.nins; /* Mark possible rollback point. */
*rbguard = J->guardemit;
hm = emitir(IRTI(IR_FLOAD), ix->tab, IRFL_TAB_HMASK);
emitir(IRTGI(IR_EQ), hm, lj_ir_kint(J, (int32_t)t->hmask));
node = emitir(IRT(IR_FLOAD, IRT_PGC), ix->tab, IRFL_TAB_NODE);
kslot = lj_ir_kslot(J, key, hslot / sizeof(Node));
kslot = lj_ir_kslot(J, key, (IRRef)(hslot / sizeof(Node)));
return emitir(IRTG(IR_HREFK, IRT_PGC), node, kslot);
}
}
Expand Down

0 comments on commit 91bc6b8

Please sign in to comment.