Merge branch 'master' into v2.1

This commit is contained in:
Mike Pall 2023-04-16 13:29:58 +02:00
commit 8bbd58e534
2 changed files with 8 additions and 0 deletions

View File

@ -186,6 +186,7 @@ static TRef fwd_ahload(jit_State *J, IRRef xref)
fwd_aa_tab_clear(J, tab, tab)) { fwd_aa_tab_clear(J, tab, tab)) {
/* A NEWREF with a number key may end up pointing to the array part. /* A NEWREF with a number key may end up pointing to the array part.
** But it's referenced from HSTORE and not found in the ASTORE chain. ** But it's referenced from HSTORE and not found in the ASTORE chain.
** Or a NEWREF may rehash the table and move unrelated number keys.
** For now simply consider this a conflict without forwarding anything. ** For now simply consider this a conflict without forwarding anything.
*/ */
if (xr->o == IR_AREF) { if (xr->o == IR_AREF) {
@ -196,6 +197,11 @@ static TRef fwd_ahload(jit_State *J, IRRef xref)
goto cselim; goto cselim;
ref2 = newref->prev; ref2 = newref->prev;
} }
} else {
IRIns *key = IR(xr->op2);
if (key->o == IR_KSLOT) key = IR(key->op1);
if (irt_isnum(key->t) && J->chain[IR_NEWREF] > tab)
goto cselim;
} }
/* NEWREF inhibits CSE for HREF, and dependent FLOADs from HREFK/AREF. /* NEWREF inhibits CSE for HREF, and dependent FLOADs from HREFK/AREF.
** But the above search for conflicting stores was limited by xref. ** But the above search for conflicting stores was limited by xref.

View File

@ -1600,6 +1600,8 @@ TRef lj_record_idx(jit_State *J, RecordIndex *ix)
TRef key = ix->key; TRef key = ix->key;
if (tref_isinteger(key)) /* NEWREF needs a TValue as a key. */ if (tref_isinteger(key)) /* NEWREF needs a TValue as a key. */
key = emitir(IRTN(IR_CONV), key, IRCONV_NUM_INT); key = emitir(IRTN(IR_CONV), key, IRCONV_NUM_INT);
else if (tref_isnumber(key) && tref_isk(key) && tvismzero(&ix->keyv))
key = lj_ir_knum_zero(J); /* Canonicalize -0.0 to +0.0. */
xref = emitir(IRT(IR_NEWREF, IRT_PGC), ix->tab, key); xref = emitir(IRT(IR_NEWREF, IRT_PGC), ix->tab, key);
keybarrier = 0; /* NEWREF already takes care of the key barrier. */ keybarrier = 0; /* NEWREF already takes care of the key barrier. */
#ifdef LUAJIT_ENABLE_TABLE_BUMP #ifdef LUAJIT_ENABLE_TABLE_BUMP