diff options
-rw-r--r-- | src/lj_asm.c | 7 | ||||
-rw-r--r-- | src/lj_asm_arm.h | 7 | ||||
-rw-r--r-- | src/lj_asm_mips.h | 8 | ||||
-rw-r--r-- | src/lj_asm_ppc.h | 8 | ||||
-rw-r--r-- | src/lj_asm_x86.h | 8 |
5 files changed, 21 insertions, 17 deletions
diff --git a/src/lj_asm.c b/src/lj_asm.c index cfdfa99f..1708c360 100644 --- a/src/lj_asm.c +++ b/src/lj_asm.c | |||
@@ -1366,6 +1366,7 @@ static void asm_head_side(ASMState *as) | |||
1366 | RegSet allow = RSET_ALL; /* Inverse of all coalesced registers. */ | 1366 | RegSet allow = RSET_ALL; /* Inverse of all coalesced registers. */ |
1367 | RegSet live = RSET_EMPTY; /* Live parent registers. */ | 1367 | RegSet live = RSET_EMPTY; /* Live parent registers. */ |
1368 | RegSet pallow = RSET_GPR; /* Registers needed by the parent stack check. */ | 1368 | RegSet pallow = RSET_GPR; /* Registers needed by the parent stack check. */ |
1369 | Reg pbase; | ||
1369 | IRIns *irp = &as->parent->ir[REF_BASE]; /* Parent base. */ | 1370 | IRIns *irp = &as->parent->ir[REF_BASE]; /* Parent base. */ |
1370 | int32_t spadj, spdelta; | 1371 | int32_t spadj, spdelta; |
1371 | int pass2 = 0; | 1372 | int pass2 = 0; |
@@ -1377,7 +1378,11 @@ static void asm_head_side(ASMState *as) | |||
1377 | as->snapno = 0; | 1378 | as->snapno = 0; |
1378 | asm_snap_alloc(as); | 1379 | asm_snap_alloc(as); |
1379 | } | 1380 | } |
1380 | allow = asm_head_side_base(as, irp, allow); | 1381 | pbase = asm_head_side_base(as, irp); |
1382 | if (pbase != RID_NONE) { | ||
1383 | rset_clear(allow, pbase); | ||
1384 | rset_clear(pallow, pbase); | ||
1385 | } | ||
1381 | 1386 | ||
1382 | /* Scan all parent SLOADs and collect register dependencies. */ | 1387 | /* Scan all parent SLOADs and collect register dependencies. */ |
1383 | for (i = as->stopins; i > REF_BASE; i--) { | 1388 | for (i = as->stopins; i > REF_BASE; i--) { |
diff --git a/src/lj_asm_arm.h b/src/lj_asm_arm.h index 262fa59e..57575874 100644 --- a/src/lj_asm_arm.h +++ b/src/lj_asm_arm.h | |||
@@ -2114,7 +2114,7 @@ static void asm_head_root_base(ASMState *as) | |||
2114 | } | 2114 | } |
2115 | 2115 | ||
2116 | /* Coalesce BASE register for a side trace. */ | 2116 | /* Coalesce BASE register for a side trace. */ |
2117 | static RegSet asm_head_side_base(ASMState *as, IRIns *irp, RegSet allow) | 2117 | static Reg asm_head_side_base(ASMState *as, IRIns *irp) |
2118 | { | 2118 | { |
2119 | IRIns *ir; | 2119 | IRIns *ir; |
2120 | asm_head_lreg(as); | 2120 | asm_head_lreg(as); |
@@ -2122,16 +2122,15 @@ static RegSet asm_head_side_base(ASMState *as, IRIns *irp, RegSet allow) | |||
2122 | if (ra_hasreg(ir->r) && (rset_test(as->modset, ir->r) || irt_ismarked(ir->t))) | 2122 | if (ra_hasreg(ir->r) && (rset_test(as->modset, ir->r) || irt_ismarked(ir->t))) |
2123 | ra_spill(as, ir); | 2123 | ra_spill(as, ir); |
2124 | if (ra_hasspill(irp->s)) { | 2124 | if (ra_hasspill(irp->s)) { |
2125 | rset_clear(allow, ra_dest(as, ir, allow)); | 2125 | return ra_dest(as, ir, RSET_GPR); |
2126 | } else { | 2126 | } else { |
2127 | Reg r = irp->r; | 2127 | Reg r = irp->r; |
2128 | lua_assert(ra_hasreg(r)); | 2128 | lua_assert(ra_hasreg(r)); |
2129 | rset_clear(allow, r); | ||
2130 | if (r != ir->r && !rset_test(as->freeset, r)) | 2129 | if (r != ir->r && !rset_test(as->freeset, r)) |
2131 | ra_restore(as, regcost_ref(as->cost[r])); | 2130 | ra_restore(as, regcost_ref(as->cost[r])); |
2132 | ra_destreg(as, ir, r); | 2131 | ra_destreg(as, ir, r); |
2132 | return r; | ||
2133 | } | 2133 | } |
2134 | return allow; | ||
2135 | } | 2134 | } |
2136 | 2135 | ||
2137 | /* -- Tail of trace ------------------------------------------------------- */ | 2136 | /* -- Tail of trace ------------------------------------------------------- */ |
diff --git a/src/lj_asm_mips.h b/src/lj_asm_mips.h index 1d4c8a25..10a5dbe9 100644 --- a/src/lj_asm_mips.h +++ b/src/lj_asm_mips.h | |||
@@ -1732,7 +1732,7 @@ static void asm_head_root_base(ASMState *as) | |||
1732 | } | 1732 | } |
1733 | 1733 | ||
1734 | /* Coalesce BASE register for a side trace. */ | 1734 | /* Coalesce BASE register for a side trace. */ |
1735 | static RegSet asm_head_side_base(ASMState *as, IRIns *irp, RegSet allow) | 1735 | static Reg asm_head_side_base(ASMState *as, IRIns *irp) |
1736 | { | 1736 | { |
1737 | IRIns *ir = IR(REF_BASE); | 1737 | IRIns *ir = IR(REF_BASE); |
1738 | Reg r = ir->r; | 1738 | Reg r = ir->r; |
@@ -1742,15 +1742,15 @@ static RegSet asm_head_side_base(ASMState *as, IRIns *irp, RegSet allow) | |||
1742 | if (rset_test(as->modset, r) || irt_ismarked(ir->t)) | 1742 | if (rset_test(as->modset, r) || irt_ismarked(ir->t)) |
1743 | ir->r = RID_INIT; /* No inheritance for modified BASE register. */ | 1743 | ir->r = RID_INIT; /* No inheritance for modified BASE register. */ |
1744 | if (irp->r == r) { | 1744 | if (irp->r == r) { |
1745 | rset_clear(allow, r); /* Mark same BASE register as coalesced. */ | 1745 | return r; /* Same BASE register already coalesced. */ |
1746 | } else if (ra_hasreg(irp->r) && rset_test(as->freeset, irp->r)) { | 1746 | } else if (ra_hasreg(irp->r) && rset_test(as->freeset, irp->r)) { |
1747 | rset_clear(allow, irp->r); | ||
1748 | emit_move(as, r, irp->r); /* Move from coalesced parent reg. */ | 1747 | emit_move(as, r, irp->r); /* Move from coalesced parent reg. */ |
1748 | return irp->r; | ||
1749 | } else { | 1749 | } else { |
1750 | emit_getgl(as, r, jit_base); /* Otherwise reload BASE. */ | 1750 | emit_getgl(as, r, jit_base); /* Otherwise reload BASE. */ |
1751 | } | 1751 | } |
1752 | } | 1752 | } |
1753 | return allow; | 1753 | return RID_NONE; |
1754 | } | 1754 | } |
1755 | 1755 | ||
1756 | /* -- Tail of trace ------------------------------------------------------- */ | 1756 | /* -- Tail of trace ------------------------------------------------------- */ |
diff --git a/src/lj_asm_ppc.h b/src/lj_asm_ppc.h index 5fd35d2e..d7d743a6 100644 --- a/src/lj_asm_ppc.h +++ b/src/lj_asm_ppc.h | |||
@@ -1915,7 +1915,7 @@ static void asm_head_root_base(ASMState *as) | |||
1915 | } | 1915 | } |
1916 | 1916 | ||
1917 | /* Coalesce BASE register for a side trace. */ | 1917 | /* Coalesce BASE register for a side trace. */ |
1918 | static RegSet asm_head_side_base(ASMState *as, IRIns *irp, RegSet allow) | 1918 | static Reg asm_head_side_base(ASMState *as, IRIns *irp) |
1919 | { | 1919 | { |
1920 | IRIns *ir = IR(REF_BASE); | 1920 | IRIns *ir = IR(REF_BASE); |
1921 | Reg r = ir->r; | 1921 | Reg r = ir->r; |
@@ -1924,15 +1924,15 @@ static RegSet asm_head_side_base(ASMState *as, IRIns *irp, RegSet allow) | |||
1924 | if (rset_test(as->modset, r) || irt_ismarked(ir->t)) | 1924 | if (rset_test(as->modset, r) || irt_ismarked(ir->t)) |
1925 | ir->r = RID_INIT; /* No inheritance for modified BASE register. */ | 1925 | ir->r = RID_INIT; /* No inheritance for modified BASE register. */ |
1926 | if (irp->r == r) { | 1926 | if (irp->r == r) { |
1927 | rset_clear(allow, r); /* Mark same BASE register as coalesced. */ | 1927 | return r; /* Same BASE register already coalesced. */ |
1928 | } else if (ra_hasreg(irp->r) && rset_test(as->freeset, irp->r)) { | 1928 | } else if (ra_hasreg(irp->r) && rset_test(as->freeset, irp->r)) { |
1929 | rset_clear(allow, irp->r); | ||
1930 | emit_mr(as, r, irp->r); /* Move from coalesced parent reg. */ | 1929 | emit_mr(as, r, irp->r); /* Move from coalesced parent reg. */ |
1930 | return irp->r; | ||
1931 | } else { | 1931 | } else { |
1932 | emit_getgl(as, r, jit_base); /* Otherwise reload BASE. */ | 1932 | emit_getgl(as, r, jit_base); /* Otherwise reload BASE. */ |
1933 | } | 1933 | } |
1934 | } | 1934 | } |
1935 | return allow; | 1935 | return RID_NONE; |
1936 | } | 1936 | } |
1937 | 1937 | ||
1938 | /* -- Tail of trace ------------------------------------------------------- */ | 1938 | /* -- Tail of trace ------------------------------------------------------- */ |
diff --git a/src/lj_asm_x86.h b/src/lj_asm_x86.h index 8b529086..bfbdb112 100644 --- a/src/lj_asm_x86.h +++ b/src/lj_asm_x86.h | |||
@@ -2502,7 +2502,7 @@ static void asm_head_root_base(ASMState *as) | |||
2502 | } | 2502 | } |
2503 | 2503 | ||
2504 | /* Coalesce or reload BASE register for a side trace. */ | 2504 | /* Coalesce or reload BASE register for a side trace. */ |
2505 | static RegSet asm_head_side_base(ASMState *as, IRIns *irp, RegSet allow) | 2505 | static Reg asm_head_side_base(ASMState *as, IRIns *irp) |
2506 | { | 2506 | { |
2507 | IRIns *ir = IR(REF_BASE); | 2507 | IRIns *ir = IR(REF_BASE); |
2508 | Reg r = ir->r; | 2508 | Reg r = ir->r; |
@@ -2511,15 +2511,15 @@ static RegSet asm_head_side_base(ASMState *as, IRIns *irp, RegSet allow) | |||
2511 | if (rset_test(as->modset, r) || irt_ismarked(ir->t)) | 2511 | if (rset_test(as->modset, r) || irt_ismarked(ir->t)) |
2512 | ir->r = RID_INIT; /* No inheritance for modified BASE register. */ | 2512 | ir->r = RID_INIT; /* No inheritance for modified BASE register. */ |
2513 | if (irp->r == r) { | 2513 | if (irp->r == r) { |
2514 | rset_clear(allow, r); /* Mark same BASE register as coalesced. */ | 2514 | return r; /* Same BASE register already coalesced. */ |
2515 | } else if (ra_hasreg(irp->r) && rset_test(as->freeset, irp->r)) { | 2515 | } else if (ra_hasreg(irp->r) && rset_test(as->freeset, irp->r)) { |
2516 | rset_clear(allow, irp->r); | ||
2517 | emit_rr(as, XO_MOV, r, irp->r); /* Move from coalesced parent reg. */ | 2516 | emit_rr(as, XO_MOV, r, irp->r); /* Move from coalesced parent reg. */ |
2517 | return irp->r; | ||
2518 | } else { | 2518 | } else { |
2519 | emit_getgl(as, r, jit_base); /* Otherwise reload BASE. */ | 2519 | emit_getgl(as, r, jit_base); /* Otherwise reload BASE. */ |
2520 | } | 2520 | } |
2521 | } | 2521 | } |
2522 | return allow; | 2522 | return RID_NONE; |
2523 | } | 2523 | } |
2524 | 2524 | ||
2525 | /* -- Tail of trace ------------------------------------------------------- */ | 2525 | /* -- Tail of trace ------------------------------------------------------- */ |