Selaa lähdekoodia

Add IR_XBAR, a barrier against XLOAD/XSTORE optimizations.

Mike Pall 14 vuotta sitten
vanhempi
commit
97d0874ff5
4 muutettua tiedostoa jossa 6 lisäystä ja 2 poistoa
  1. 1 1
      src/lj_asm.c
  2. 2 1
      src/lj_ir.h
  3. 1 0
      src/lj_opt_fold.c
  4. 2 0
      src/lj_opt_mem.c

+ 1 - 1
src/lj_asm.c

@@ -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;
 

+ 2 - 1
src/lj_ir.h

@@ -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) \

+ 1 - 0
src/lj_opt_fold.c

@@ -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)

+ 2 - 0
src/lj_opt_mem.c

@@ -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)) {