aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2011-08-11 22:04:38 +0200
committerMike Pall <mike>2011-08-11 22:04:38 +0200
commit05ef03e2d04ccde3c881166268575308315a6ea0 (patch)
treea3c2088217fadb18663422ba74a67e114a39037c
parente8fa76feace720c8348f08fd0e0c9f0656277987 (diff)
downloadluajit-05ef03e2d04ccde3c881166268575308315a6ea0.tar.gz
luajit-05ef03e2d04ccde3c881166268575308315a6ea0.tar.bz2
luajit-05ef03e2d04ccde3c881166268575308315a6ea0.zip
Don't bother to chain NOPs.
-rw-r--r--src/lj_opt_dce.c4
-rw-r--r--src/lj_opt_mem.c8
-rw-r--r--src/lj_record.c2
3 files changed, 6 insertions, 8 deletions
diff --git a/src/lj_opt_dce.c b/src/lj_opt_dce.c
index 253fe3d2..0587262d 100644
--- a/src/lj_opt_dce.c
+++ b/src/lj_opt_dce.c
@@ -47,17 +47,15 @@ static void dce_propagate(jit_State *J)
47 pchain[ir->o] = &ir->prev; 47 pchain[ir->o] = &ir->prev;
48 } else if (!ir_sideeff(ir)) { 48 } else if (!ir_sideeff(ir)) {
49 *pchain[ir->o] = ir->prev; /* Reroute original instruction chain. */ 49 *pchain[ir->o] = ir->prev; /* Reroute original instruction chain. */
50 *pchain[IR_NOP] = (IRRef1)ins;
51 ir->t.irt = IRT_NIL; 50 ir->t.irt = IRT_NIL;
52 ir->o = IR_NOP; /* Replace instruction with NOP. */ 51 ir->o = IR_NOP; /* Replace instruction with NOP. */
53 ir->op1 = ir->op2 = 0; 52 ir->op1 = ir->op2 = 0;
54 pchain[IR_NOP] = &ir->prev; 53 ir->prev = 0;
55 continue; 54 continue;
56 } 55 }
57 if (ir->op1 >= REF_FIRST) irt_setmark(IR(ir->op1)->t); 56 if (ir->op1 >= REF_FIRST) irt_setmark(IR(ir->op1)->t);
58 if (ir->op2 >= REF_FIRST) irt_setmark(IR(ir->op2)->t); 57 if (ir->op2 >= REF_FIRST) irt_setmark(IR(ir->op2)->t);
59 } 58 }
60 *pchain[IR_NOP] = 0; /* Terminate NOP chain. */
61} 59}
62 60
63/* Dead Code Elimination. 61/* Dead Code Elimination.
diff --git a/src/lj_opt_mem.c b/src/lj_opt_mem.c
index 40064639..a90d0979 100644
--- a/src/lj_opt_mem.c
+++ b/src/lj_opt_mem.c
@@ -323,7 +323,7 @@ TRef LJ_FASTCALL lj_opt_dse_ahstore(jit_State *J)
323 goto doemit; /* No elimination possible. */ 323 goto doemit; /* No elimination possible. */
324 /* Remove redundant store from chain and replace with NOP. */ 324 /* Remove redundant store from chain and replace with NOP. */
325 *refp = store->prev; 325 *refp = store->prev;
326 store->o = IR_NOP; /* Unchained NOP -- does anybody care? */ 326 store->o = IR_NOP;
327 store->t.irt = IRT_NIL; 327 store->t.irt = IRT_NIL;
328 store->op1 = store->op2 = 0; 328 store->op1 = store->op2 = 0;
329 store->prev = 0; 329 store->prev = 0;
@@ -418,7 +418,7 @@ TRef LJ_FASTCALL lj_opt_dse_ustore(jit_State *J)
418 goto doemit; /* No elimination possible. */ 418 goto doemit; /* No elimination possible. */
419 /* Remove redundant store from chain and replace with NOP. */ 419 /* Remove redundant store from chain and replace with NOP. */
420 *refp = store->prev; 420 *refp = store->prev;
421 store->o = IR_NOP; /* Unchained NOP -- does anybody care? */ 421 store->o = IR_NOP;
422 store->t.irt = IRT_NIL; 422 store->t.irt = IRT_NIL;
423 store->op1 = store->op2 = 0; 423 store->op1 = store->op2 = 0;
424 store->prev = 0; 424 store->prev = 0;
@@ -511,7 +511,7 @@ TRef LJ_FASTCALL lj_opt_dse_fstore(jit_State *J)
511 goto doemit; /* No elimination possible. */ 511 goto doemit; /* No elimination possible. */
512 /* Remove redundant store from chain and replace with NOP. */ 512 /* Remove redundant store from chain and replace with NOP. */
513 *refp = store->prev; 513 *refp = store->prev;
514 store->o = IR_NOP; /* Unchained NOP -- does anybody care? */ 514 store->o = IR_NOP;
515 store->t.irt = IRT_NIL; 515 store->t.irt = IRT_NIL;
516 store->op1 = store->op2 = 0; 516 store->op1 = store->op2 = 0;
517 store->prev = 0; 517 store->prev = 0;
@@ -761,7 +761,7 @@ TRef LJ_FASTCALL lj_opt_dse_xstore(jit_State *J)
761 goto doemit; /* No elimination possible. */ 761 goto doemit; /* No elimination possible. */
762 /* Remove redundant store from chain and replace with NOP. */ 762 /* Remove redundant store from chain and replace with NOP. */
763 *refp = store->prev; 763 *refp = store->prev;
764 store->o = IR_NOP; /* Unchained NOP -- does anybody care? */ 764 store->o = IR_NOP;
765 store->t.irt = IRT_NIL; 765 store->t.irt = IRT_NIL;
766 store->op1 = store->op2 = 0; 766 store->op1 = store->op2 = 0;
767 store->prev = 0; 767 store->prev = 0;
diff --git a/src/lj_record.c b/src/lj_record.c
index e4c59bf4..0deaade1 100644
--- a/src/lj_record.c
+++ b/src/lj_record.c
@@ -67,7 +67,7 @@ static void rec_check_ir(jit_State *J)
67 if (ir->prev) { 67 if (ir->prev) {
68 lua_assert(ir->prev >= nk); 68 lua_assert(ir->prev >= nk);
69 lua_assert(i >= REF_BIAS ? ir->prev < i : ir->prev > i); 69 lua_assert(i >= REF_BIAS ? ir->prev < i : ir->prev > i);
70 lua_assert(IR(ir->prev)->o == ir->o); 70 lua_assert(ir->o == IR_NOP || IR(ir->prev)->o == ir->o);
71 } 71 }
72 } 72 }
73} 73}