]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Merge branch 'master' into v2.1
authorMike Pall <mike>
Sun, 16 Apr 2023 11:29:58 +0000 (13:29 +0200)
committerMike Pall <mike>
Sun, 16 Apr 2023 11:29:58 +0000 (13:29 +0200)
1  2 
src/lj_opt_mem.c
src/lj_record.c

index 09de2f0518a9f2948586a31676fcfae1261fe9ad,5b1ad898d8cc082ea1768e4da2e9e060f2112806..455b0ca646c3ded65a468b3671a6ffefa8e8ef9c
@@@ -182,10 -151,10 +182,11 @@@ static TRef fwd_ahload(jit_State *J, IR
      IRIns *ir = (xr->o == IR_HREFK || xr->o == IR_AREF) ? IR(xr->op1) : xr;
      IRRef tab = ir->op1;
      ir = IR(tab);
 -    if (ir->o == IR_TNEW || (ir->o == IR_TDUP && irref_isk(xr->op2))) {
 +    if ((ir->o == IR_TNEW || (ir->o == IR_TDUP && irref_isk(xr->op2))) &&
 +      fwd_aa_tab_clear(J, tab, tab)) {
        /* 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.
+       ** Or a NEWREF may rehash the table and move unrelated number keys.
        ** For now simply consider this a conflict without forwarding anything.
        */
        if (xr->o == IR_AREF) {
diff --cc src/lj_record.c
index 79ee61728b1f2660f74d25022dab54de462bcd56,10a14a6f87c505822098624f5200deae88a9366a..b2639cbc59c3315f697e2f74d53b647a462950ce
@@@ -1600,12 -1256,10 +1600,14 @@@ TRef lj_record_idx(jit_State *J, Record
        TRef key = ix->key;
        if (tref_isinteger(key))  /* NEWREF needs a TValue as a key. */
          key = emitir(IRTN(IR_CONV), key, IRCONV_NUM_INT);
 -      xref = emitir(IRT(IR_NEWREF, IRT_P32), ix->tab, key);
+       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);
        keybarrier = 0;  /* NEWREF already takes care of the key barrier. */
 +#ifdef LUAJIT_ENABLE_TABLE_BUMP
 +      if ((J->flags & JIT_F_OPT_SINK))  /* Avoid a separate flag. */
 +        rec_idx_bump(J, ix);
 +#endif
        }
      } else if (!lj_opt_fwd_wasnonnil(J, loadop, tref_ref(xref))) {
        /* Cannot derive that the previous value was non-nil, must do checks. */