summaryrefslogtreecommitdiff
path: root/src/lj_opt_mem.c
diff options
context:
space:
mode:
authorMike Pall <mike>2012-06-28 15:10:52 +0200
committerMike Pall <mike>2012-06-28 15:10:52 +0200
commita9bf455b96e6a6717e53051efbe4cb95e17a7e92 (patch)
tree542040435ec936185b8a73aaea97d308d4203393 /src/lj_opt_mem.c
parent0d1056eeed34cf349938188b177406b6cab91257 (diff)
downloadluajit-a9bf455b96e6a6717e53051efbe4cb95e17a7e92.tar.gz
luajit-a9bf455b96e6a6717e53051efbe4cb95e17a7e92.tar.bz2
luajit-a9bf455b96e6a6717e53051efbe4cb95e17a7e92.zip
Add HREFK forwarding. Eliminate HREFK guard for TDUP refs.
Diffstat (limited to '')
-rw-r--r--src/lj_opt_mem.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/lj_opt_mem.c b/src/lj_opt_mem.c
index a0bfba19..a7e0d35e 100644
--- a/src/lj_opt_mem.c
+++ b/src/lj_opt_mem.c
@@ -21,6 +21,7 @@
21/* Some local macros to save typing. Undef'd at the end. */ 21/* Some local macros to save typing. Undef'd at the end. */
22#define IR(ref) (&J->cur.ir[(ref)]) 22#define IR(ref) (&J->cur.ir[(ref)])
23#define fins (&J->fold.ins) 23#define fins (&J->fold.ins)
24#define fleft (&J->fold.left)
24#define fright (&J->fold.right) 25#define fright (&J->fold.right)
25 26
26/* 27/*
@@ -255,6 +256,30 @@ TRef LJ_FASTCALL lj_opt_fwd_hload(jit_State *J)
255 return EMITFOLD; 256 return EMITFOLD;
256} 257}
257 258
259/* HREFK forwarding. */
260TRef LJ_FASTCALL lj_opt_fwd_hrefk(jit_State *J)
261{
262 IRRef tab = fleft->op1;
263 IRRef ref = J->chain[IR_NEWREF];
264 while (ref > tab) {
265 IRIns *newref = IR(ref);
266 if (tab == newref->op1) {
267 if (fright->op1 == newref->op2)
268 return ref; /* Forward from NEWREF. */
269 else
270 goto docse;
271 } else if (aa_table(J, tab, newref->op1) != ALIAS_NO) {
272 goto docse;
273 }
274 ref = newref->prev;
275 }
276 /* No conflicting NEWREF: key location unchanged for HREFK of TDUP. */
277 if (IR(tab)->o == IR_TDUP)
278 fins->t.irt &= ~IRT_GUARD; /* Drop HREFK guard. */
279docse:
280 return CSEFOLD;
281}
282
258/* Check whether HREF of TNEW/TDUP can be folded to niltv. */ 283/* Check whether HREF of TNEW/TDUP can be folded to niltv. */
259int LJ_FASTCALL lj_opt_fwd_href_nokey(jit_State *J) 284int LJ_FASTCALL lj_opt_fwd_href_nokey(jit_State *J)
260{ 285{
@@ -872,6 +897,7 @@ int lj_opt_fwd_wasnonnil(jit_State *J, IROpT loadop, IRRef xref)
872 897
873#undef IR 898#undef IR
874#undef fins 899#undef fins
900#undef fleft
875#undef fright 901#undef fright
876 902
877#endif 903#endif