diff options
-rw-r--r-- | src/lj_opt_mem.c | 6 | ||||
-rw-r--r-- | src/lj_record.c | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/lj_opt_mem.c b/src/lj_opt_mem.c index 09de2f05..455b0ca6 100644 --- a/src/lj_opt_mem.c +++ b/src/lj_opt_mem.c | |||
@@ -186,6 +186,7 @@ static TRef fwd_ahload(jit_State *J, IRRef xref) | |||
186 | fwd_aa_tab_clear(J, tab, tab)) { | 186 | fwd_aa_tab_clear(J, tab, tab)) { |
187 | /* A NEWREF with a number key may end up pointing to the array part. | 187 | /* A NEWREF with a number key may end up pointing to the array part. |
188 | ** But it's referenced from HSTORE and not found in the ASTORE chain. | 188 | ** But it's referenced from HSTORE and not found in the ASTORE chain. |
189 | ** Or a NEWREF may rehash the table and move unrelated number keys. | ||
189 | ** For now simply consider this a conflict without forwarding anything. | 190 | ** For now simply consider this a conflict without forwarding anything. |
190 | */ | 191 | */ |
191 | if (xr->o == IR_AREF) { | 192 | if (xr->o == IR_AREF) { |
@@ -196,6 +197,11 @@ static TRef fwd_ahload(jit_State *J, IRRef xref) | |||
196 | goto cselim; | 197 | goto cselim; |
197 | ref2 = newref->prev; | 198 | ref2 = newref->prev; |
198 | } | 199 | } |
200 | } else { | ||
201 | IRIns *key = IR(xr->op2); | ||
202 | if (key->o == IR_KSLOT) key = IR(key->op1); | ||
203 | if (irt_isnum(key->t) && J->chain[IR_NEWREF] > tab) | ||
204 | goto cselim; | ||
199 | } | 205 | } |
200 | /* NEWREF inhibits CSE for HREF, and dependent FLOADs from HREFK/AREF. | 206 | /* NEWREF inhibits CSE for HREF, and dependent FLOADs from HREFK/AREF. |
201 | ** But the above search for conflicting stores was limited by xref. | 207 | ** But the above search for conflicting stores was limited by xref. |
diff --git a/src/lj_record.c b/src/lj_record.c index 79ee6172..b2639cbc 100644 --- a/src/lj_record.c +++ b/src/lj_record.c | |||
@@ -1600,6 +1600,8 @@ TRef lj_record_idx(jit_State *J, RecordIndex *ix) | |||
1600 | TRef key = ix->key; | 1600 | TRef key = ix->key; |
1601 | if (tref_isinteger(key)) /* NEWREF needs a TValue as a key. */ | 1601 | if (tref_isinteger(key)) /* NEWREF needs a TValue as a key. */ |
1602 | key = emitir(IRTN(IR_CONV), key, IRCONV_NUM_INT); | 1602 | key = emitir(IRTN(IR_CONV), key, IRCONV_NUM_INT); |
1603 | else if (tref_isnumber(key) && tref_isk(key) && tvismzero(&ix->keyv)) | ||
1604 | key = lj_ir_knum_zero(J); /* Canonicalize -0.0 to +0.0. */ | ||
1603 | xref = emitir(IRT(IR_NEWREF, IRT_PGC), ix->tab, key); | 1605 | xref = emitir(IRT(IR_NEWREF, IRT_PGC), ix->tab, key); |
1604 | keybarrier = 0; /* NEWREF already takes care of the key barrier. */ | 1606 | keybarrier = 0; /* NEWREF already takes care of the key barrier. */ |
1605 | #ifdef LUAJIT_ENABLE_TABLE_BUMP | 1607 | #ifdef LUAJIT_ENABLE_TABLE_BUMP |