diff options
author | Mike Pall <mike> | 2023-04-16 13:26:18 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2023-04-16 13:26:18 +0200 |
commit | c7db8255e1eb59f933fac7bc9322f0e4f8ddc6e6 (patch) | |
tree | 863ed6206f8d80996209c8017386336523c57334 | |
parent | 96fc114a7a3be3fd2c227d5a0ac53aa50cfb85d1 (diff) | |
download | luajit-c7db8255e1eb59f933fac7bc9322f0e4f8ddc6e6.tar.gz luajit-c7db8255e1eb59f933fac7bc9322f0e4f8ddc6e6.tar.bz2 luajit-c7db8255e1eb59f933fac7bc9322f0e4f8ddc6e6.zip |
Fix TDUP load forwarding after table rehash.
Reported by Sergey Kaplun. #980
-rw-r--r-- | src/lj_opt_mem.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lj_opt_mem.c b/src/lj_opt_mem.c index feec6bb7..5b1ad898 100644 --- a/src/lj_opt_mem.c +++ b/src/lj_opt_mem.c | |||
@@ -154,6 +154,7 @@ static TRef fwd_ahload(jit_State *J, IRRef xref) | |||
154 | if (ir->o == IR_TNEW || (ir->o == IR_TDUP && irref_isk(xr->op2))) { | 154 | if (ir->o == IR_TNEW || (ir->o == IR_TDUP && irref_isk(xr->op2))) { |
155 | /* A NEWREF with a number key may end up pointing to the array part. | 155 | /* A NEWREF with a number key may end up pointing to the array part. |
156 | ** But it's referenced from HSTORE and not found in the ASTORE chain. | 156 | ** But it's referenced from HSTORE and not found in the ASTORE chain. |
157 | ** Or a NEWREF may rehash the table and move unrelated number keys. | ||
157 | ** For now simply consider this a conflict without forwarding anything. | 158 | ** For now simply consider this a conflict without forwarding anything. |
158 | */ | 159 | */ |
159 | if (xr->o == IR_AREF) { | 160 | if (xr->o == IR_AREF) { |
@@ -164,6 +165,11 @@ static TRef fwd_ahload(jit_State *J, IRRef xref) | |||
164 | goto cselim; | 165 | goto cselim; |
165 | ref2 = newref->prev; | 166 | ref2 = newref->prev; |
166 | } | 167 | } |
168 | } else { | ||
169 | IRIns *key = IR(xr->op2); | ||
170 | if (key->o == IR_KSLOT) key = IR(key->op1); | ||
171 | if (irt_isnum(key->t) && J->chain[IR_NEWREF] > tab) | ||
172 | goto cselim; | ||
167 | } | 173 | } |
168 | /* NEWREF inhibits CSE for HREF, and dependent FLOADs from HREFK/AREF. | 174 | /* NEWREF inhibits CSE for HREF, and dependent FLOADs from HREFK/AREF. |
169 | ** But the above search for conflicting stores was limited by xref. | 175 | ** But the above search for conflicting stores was limited by xref. |