Bläddra i källkod

Use an explicit flag to signal SINK tags for a trace.

Mike Pall 13 år sedan
förälder
incheckning
24fa85760c
3 ändrade filer med 7 tillägg och 7 borttagningar
  1. 3 4
      src/lj_asm.c
  2. 2 1
      src/lj_jit.h
  3. 2 2
      src/lj_opt_sink.c

+ 3 - 4
src/lj_asm.c

@@ -1538,9 +1538,10 @@ static void asm_tail_link(ASMState *as)
 /* -- Trace setup --------------------------------------------------------- */
 
 /* Clear reg/sp for all instructions and add register hints. */
-static void asm_setup_regsp(ASMState *as, int sink)
+static void asm_setup_regsp(ASMState *as)
 {
   GCtrace *T = as->T;
+  int sink = T->sinktags;
   IRRef nins = T->nins;
   IRIns *ir, *lastir;
   int inloop;
@@ -1768,7 +1769,6 @@ void lj_asm_trace(jit_State *J, GCtrace *T)
   ASMState as_;
   ASMState *as = &as_;
   MCode *origtop;
-  int sink;
 
   /* Ensure an initialized instruction beyond the last one for HIOP checks. */
   J->cur.nins = lj_ir_nextins(J);
@@ -1789,7 +1789,6 @@ void lj_asm_trace(jit_State *J, GCtrace *T)
   as->mcp = as->mctop;
   as->mclim = as->mcbot + MCLIM_REDZONE;
   asm_setup_target(as);
-  sink = (IR(REF_BASE)->prev == 1);
 
   do {
     as->mcp = as->mctop;
@@ -1805,7 +1804,7 @@ void lj_asm_trace(jit_State *J, GCtrace *T)
     as->gcsteps = 0;
     as->sectref = as->loopref;
     as->fuseref = (as->flags & JIT_F_OPT_FUSE) ? as->loopref : FUSE_DISABLED;
-    asm_setup_regsp(as, sink);
+    asm_setup_regsp(as);
     if (!as->loopref)
       asm_tail_link(as);
 

+ 2 - 1
src/lj_jit.h

@@ -233,7 +233,8 @@ typedef struct GCtrace {
   TraceNo1 root;	/* Root trace of side trace (or 0 for root traces). */
   TraceNo1 nextroot;	/* Next root trace for same prototype. */
   TraceNo1 nextside;	/* Next side trace of same root trace. */
-  uint16_t unused2;
+  uint8_t sinktags;	/* Trace has SINK tags. */
+  uint8_t unused1;
 #ifdef LUAJIT_USE_GDBJIT
   void *gdbjit_entry;	/* GDB JIT entry. */
 #endif

+ 2 - 2
src/lj_opt_sink.c

@@ -163,7 +163,7 @@ static void sink_remark_phi(jit_State *J)
   } while (remark);
 }
 
-/* Sweep instructions and mark sunken allocations and stores. */
+/* Sweep instructions and tag sunken allocations and stores. */
 static void sink_sweep_ins(jit_State *J)
 {
   IRIns *ir, *irfirst = IR(J->cur.nk);
@@ -194,6 +194,7 @@ static void sink_sweep_ins(jit_State *J)
       if (!irt_ismarked(ir->t)) {
 	ir->t.irt &= ~IRT_GUARD;
 	ir->prev = REGSP(RID_SINK, 0);
+	J->cur.sinktags = 1;  /* Signal present SINK tags to assembler. */
       } else {
 	irt_clearmark(ir->t);
 	ir->prev = REGSP_INIT;
@@ -216,7 +217,6 @@ static void sink_sweep_ins(jit_State *J)
       break;
     }
   }
-  IR(REF_BASE)->prev = 1;  /* Signal SINK flags to assembler. */
 }
 
 /* Allocation sinking and store sinking.