From 24fa85760cb29c68ff726c97c1ab67a3c0e1bd68 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Wed, 11 Jul 2012 16:45:15 +0200 Subject: [PATCH] Use an explicit flag to signal SINK tags for a trace. --- src/lj_asm.c | 7 +++---- src/lj_jit.h | 3 ++- src/lj_opt_sink.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lj_asm.c b/src/lj_asm.c index ce2a70d7..5ad14003 100644 --- a/src/lj_asm.c +++ b/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); diff --git a/src/lj_jit.h b/src/lj_jit.h index 1ec54fe7..43a99392 100644 --- a/src/lj_jit.h +++ b/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 diff --git a/src/lj_opt_sink.c b/src/lj_opt_sink.c index b7a3af2d..28291d77 100644 --- a/src/lj_opt_sink.c +++ b/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.