Add IR_XBAR, a barrier against XLOAD/XSTORE optimizations.

This commit is contained in:
Mike Pall 2011-02-07 21:59:25 +01:00
parent 0a50356b6f
commit 97d0874ff5
4 changed files with 6 additions and 2 deletions

View File

@ -3991,7 +3991,7 @@ static void asm_ir(ASMState *as, IRIns *ir)
switch ((IROp)ir->o) {
/* Miscellaneous ops. */
case IR_LOOP: asm_loop(as); break;
case IR_NOP: lua_assert(!ra_used(ir)); break;
case IR_NOP: case IR_XBAR: lua_assert(!ra_used(ir)); break;
case IR_PHI: asm_phi(as, ir); break;
case IR_HIOP: asm_hiop(as, ir); break;

View File

@ -115,9 +115,10 @@
_(CNEW, AW, ref, ref) \
_(CNEWI, NW, ref, ref) /* CSE is ok, not marked as A. */ \
\
/* Write barriers. */ \
/* Barriers. */ \
_(TBAR, S , ref, ___) \
_(OBAR, S , ref, ref) \
_(XBAR, S , ___, ___) \
\
/* Type conversions. */ \
_(CONV, N , ref, lit) \

View File

@ -1895,6 +1895,7 @@ LJFOLD(NEWREF any any) /* Treated like a store. */
LJFOLD(CALLS any any)
LJFOLD(CALLL any any) /* Safeguard fallback. */
LJFOLD(CALLXS any any)
LJFOLD(XBAR)
LJFOLD(RETF any any) /* Modifies BASE. */
LJFOLD(TNEW any any)
LJFOLD(TDUP any)

View File

@ -676,6 +676,7 @@ TRef LJ_FASTCALL lj_opt_fwd_xload(jit_State *J)
ref = J->chain[IR_XSTORE];
retry:
if (J->chain[IR_CALLXS] > lim) lim = J->chain[IR_CALLXS];
if (J->chain[IR_XBAR] > lim) lim = J->chain[IR_XBAR];
while (ref > lim) {
IRIns *store = IR(ref);
switch (aa_xref(J, xr, fins, store)) {
@ -738,6 +739,7 @@ TRef LJ_FASTCALL lj_opt_dse_xstore(jit_State *J)
IRRef1 *refp = &J->chain[IR_XSTORE];
IRRef ref = *refp;
if (J->chain[IR_CALLXS] > lim) lim = J->chain[IR_CALLXS];
if (J->chain[IR_XBAR] > lim) lim = J->chain[IR_XBAR];
while (ref > lim) { /* Search for redundant or conflicting stores. */
IRIns *store = IR(ref);
switch (aa_xref(J, xr, fins, store)) {