diff options
author | Mike Pall <mike> | 2010-09-14 19:58:27 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2010-09-14 19:58:27 +0200 |
commit | 8dc76ee3276e504d739818322e4dff37e6ae1c11 (patch) | |
tree | a46fc1ccfa6b2926f22b322c98412cd99fba09e1 /src | |
parent | 23655bd52ebffd0a4bdb9d34009816f9ca501f04 (diff) | |
download | luajit-8dc76ee3276e504d739818322e4dff37e6ae1c11.tar.gz luajit-8dc76ee3276e504d739818322e4dff37e6ae1c11.tar.bz2 luajit-8dc76ee3276e504d739818322e4dff37e6ae1c11.zip |
Add IR_VLOAD for vararg loads.
Also fixes the broken AA improvement in the last commit.
Diffstat (limited to 'src')
-rw-r--r-- | src/lj_asm.c | 11 | ||||
-rw-r--r-- | src/lj_ir.h | 3 | ||||
-rw-r--r-- | src/lj_opt_fold.c | 1 | ||||
-rw-r--r-- | src/lj_opt_mem.c | 3 | ||||
-rw-r--r-- | src/lj_record.c | 4 |
5 files changed, 13 insertions, 9 deletions
diff --git a/src/lj_asm.c b/src/lj_asm.c index d26d0b4b..e7f2cb72 100644 --- a/src/lj_asm.c +++ b/src/lj_asm.c | |||
@@ -96,7 +96,7 @@ typedef struct ASMState { | |||
96 | #define neverfuse(as) (as->fuseref == FUSE_DISABLED) | 96 | #define neverfuse(as) (as->fuseref == FUSE_DISABLED) |
97 | #define opisfusableload(o) \ | 97 | #define opisfusableload(o) \ |
98 | ((o) == IR_ALOAD || (o) == IR_HLOAD || (o) == IR_ULOAD || \ | 98 | ((o) == IR_ALOAD || (o) == IR_HLOAD || (o) == IR_ULOAD || \ |
99 | (o) == IR_FLOAD || (o) == IR_SLOAD || (o) == IR_XLOAD) | 99 | (o) == IR_FLOAD || (o) == IR_XLOAD || (o) == IR_SLOAD || (o) == IR_VLOAD) |
100 | 100 | ||
101 | /* Instruction selection for XMM moves. */ | 101 | /* Instruction selection for XMM moves. */ |
102 | #define XMM_MOVRR(as) ((as->flags & JIT_F_SPLIT_XMM) ? XO_MOVSD : XO_MOVAPS) | 102 | #define XMM_MOVRR(as) ((as->flags & JIT_F_SPLIT_XMM) ? XO_MOVSD : XO_MOVAPS) |
@@ -1315,6 +1315,9 @@ static Reg asm_fuseload(ASMState *as, IRRef ref, RegSet allow) | |||
1315 | asm_fusexref(as, IR(ir->op1), xallow); | 1315 | asm_fusexref(as, IR(ir->op1), xallow); |
1316 | return RID_MRM; | 1316 | return RID_MRM; |
1317 | } | 1317 | } |
1318 | } else if (ir->o == IR_VLOAD) { | ||
1319 | asm_fuseahuref(as, ir->op1, xallow); | ||
1320 | return RID_MRM; | ||
1318 | } | 1321 | } |
1319 | } | 1322 | } |
1320 | if (!(as->freeset & allow) && | 1323 | if (!(as->freeset & allow) && |
@@ -1978,7 +1981,7 @@ static Reg asm_load_lightud64(ASMState *as, IRIns *ir, int typecheck) | |||
1978 | } | 1981 | } |
1979 | #endif | 1982 | #endif |
1980 | 1983 | ||
1981 | static void asm_ahuload(ASMState *as, IRIns *ir) | 1984 | static void asm_ahuvload(ASMState *as, IRIns *ir) |
1982 | { | 1985 | { |
1983 | lua_assert(irt_isnum(ir->t) || irt_ispri(ir->t) || irt_isaddr(ir->t)); | 1986 | lua_assert(irt_isnum(ir->t) || irt_ispri(ir->t) || irt_isaddr(ir->t)); |
1984 | #if LJ_64 | 1987 | #if LJ_64 |
@@ -3385,7 +3388,9 @@ static void asm_ir(ASMState *as, IRIns *ir) | |||
3385 | case IR_STRREF: asm_strref(as, ir); break; | 3388 | case IR_STRREF: asm_strref(as, ir); break; |
3386 | 3389 | ||
3387 | /* Loads and stores. */ | 3390 | /* Loads and stores. */ |
3388 | case IR_ALOAD: case IR_HLOAD: case IR_ULOAD: asm_ahuload(as, ir); break; | 3391 | case IR_ALOAD: case IR_HLOAD: case IR_ULOAD: case IR_VLOAD: |
3392 | asm_ahuvload(as, ir); | ||
3393 | break; | ||
3389 | case IR_FLOAD: case IR_XLOAD: asm_fxload(as, ir); break; | 3394 | case IR_FLOAD: case IR_XLOAD: asm_fxload(as, ir); break; |
3390 | case IR_SLOAD: asm_sload(as, ir); break; | 3395 | case IR_SLOAD: asm_sload(as, ir); break; |
3391 | 3396 | ||
diff --git a/src/lj_ir.h b/src/lj_ir.h index cc57560d..c483e60f 100644 --- a/src/lj_ir.h +++ b/src/lj_ir.h | |||
@@ -95,8 +95,9 @@ | |||
95 | _(HLOAD, L , ref, ___) \ | 95 | _(HLOAD, L , ref, ___) \ |
96 | _(ULOAD, L , ref, ___) \ | 96 | _(ULOAD, L , ref, ___) \ |
97 | _(FLOAD, L , ref, lit) \ | 97 | _(FLOAD, L , ref, lit) \ |
98 | _(SLOAD, L , lit, lit) \ | ||
99 | _(XLOAD, L , ref, lit) \ | 98 | _(XLOAD, L , ref, lit) \ |
99 | _(SLOAD, L , lit, lit) \ | ||
100 | _(VLOAD, L , ref, ___) \ | ||
100 | \ | 101 | \ |
101 | _(ASTORE, S , ref, ref) \ | 102 | _(ASTORE, S , ref, ref) \ |
102 | _(HSTORE, S , ref, ref) \ | 103 | _(HSTORE, S , ref, ref) \ |
diff --git a/src/lj_opt_fold.c b/src/lj_opt_fold.c index 90520d8c..5a6ea29b 100644 --- a/src/lj_opt_fold.c +++ b/src/lj_opt_fold.c | |||
@@ -1308,6 +1308,7 @@ LJFOLDF(fload_str_len_snew) | |||
1308 | } | 1308 | } |
1309 | 1309 | ||
1310 | LJFOLD(FLOAD any IRFL_STR_LEN) | 1310 | LJFOLD(FLOAD any IRFL_STR_LEN) |
1311 | LJFOLD(VLOAD any any) /* Vararg loads have no corresponding stores. */ | ||
1311 | LJFOLDX(lj_opt_cse) | 1312 | LJFOLDX(lj_opt_cse) |
1312 | 1313 | ||
1313 | /* All other field loads need alias analysis. */ | 1314 | /* All other field loads need alias analysis. */ |
diff --git a/src/lj_opt_mem.c b/src/lj_opt_mem.c index c862e67e..8674ddea 100644 --- a/src/lj_opt_mem.c +++ b/src/lj_opt_mem.c | |||
@@ -102,9 +102,6 @@ static TRef fwd_ahload(jit_State *J, IRRef xref) | |||
102 | IRRef lim = xref; /* Search limit. */ | 102 | IRRef lim = xref; /* Search limit. */ |
103 | IRRef ref; | 103 | IRRef ref; |
104 | 104 | ||
105 | if (IR(xr->op1)->o != IR_FLOAD) /* Varargs have no corresponding stores. */ | ||
106 | goto cselim; | ||
107 | |||
108 | /* Search for conflicting stores. */ | 105 | /* Search for conflicting stores. */ |
109 | ref = J->chain[fins->o+IRDELTA_L2S]; | 106 | ref = J->chain[fins->o+IRDELTA_L2S]; |
110 | while (ref > xref) { | 107 | while (ref > xref) { |
diff --git a/src/lj_record.c b/src/lj_record.c index 42bcca1a..6e396729 100644 --- a/src/lj_record.c +++ b/src/lj_record.c | |||
@@ -1998,7 +1998,7 @@ static void rec_varg(jit_State *J, BCReg dst, ptrdiff_t nresults) | |||
1998 | IRType t = itype2irt(&J->L->base[i-1-nvararg]); | 1998 | IRType t = itype2irt(&J->L->base[i-1-nvararg]); |
1999 | TRef aref = emitir(IRT(IR_AREF, IRT_PTR), | 1999 | TRef aref = emitir(IRT(IR_AREF, IRT_PTR), |
2000 | vbase, lj_ir_kint(J, (int32_t)i)); | 2000 | vbase, lj_ir_kint(J, (int32_t)i)); |
2001 | TRef tr = emitir(IRTG(IR_ALOAD, t), aref, 0); | 2001 | TRef tr = emitir(IRTG(IR_VLOAD, t), aref, 0); |
2002 | if (irtype_ispri(t)) tr = TREF_PRI(t); /* Canonicalize primitives. */ | 2002 | if (irtype_ispri(t)) tr = TREF_PRI(t); /* Canonicalize primitives. */ |
2003 | J->base[dst+i] = tr; | 2003 | J->base[dst+i] = tr; |
2004 | } | 2004 | } |
@@ -2044,7 +2044,7 @@ static void rec_varg(jit_State *J, BCReg dst, ptrdiff_t nresults) | |||
2044 | vbase = emitir(IRT(IR_ADD, IRT_PTR), vbase, lj_ir_kint(J, frofs-8)); | 2044 | vbase = emitir(IRT(IR_ADD, IRT_PTR), vbase, lj_ir_kint(J, frofs-8)); |
2045 | t = itype2irt(&J->L->base[idx-2-nvararg]); | 2045 | t = itype2irt(&J->L->base[idx-2-nvararg]); |
2046 | aref = emitir(IRT(IR_AREF, IRT_PTR), vbase, tridx); | 2046 | aref = emitir(IRT(IR_AREF, IRT_PTR), vbase, tridx); |
2047 | tr = emitir(IRTG(IR_ALOAD, t), aref, 0); | 2047 | tr = emitir(IRTG(IR_VLOAD, t), aref, 0); |
2048 | if (irtype_ispri(t)) tr = TREF_PRI(t); /* Canonicalize primitives. */ | 2048 | if (irtype_ispri(t)) tr = TREF_PRI(t); /* Canonicalize primitives. */ |
2049 | } | 2049 | } |
2050 | J->base[dst-2] = tr; | 2050 | J->base[dst-2] = tr; |