diff options
Diffstat (limited to 'src/lj_asm.c')
-rw-r--r-- | src/lj_asm.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/lj_asm.c b/src/lj_asm.c index 15685d85..6ea5bc93 100644 --- a/src/lj_asm.c +++ b/src/lj_asm.c | |||
@@ -778,6 +778,23 @@ static int asm_snap_canremat(ASMState *as) | |||
778 | return 0; | 778 | return 0; |
779 | } | 779 | } |
780 | 780 | ||
781 | /* Check whether a sunk store corresponds to an allocation. */ | ||
782 | static int asm_sunk_store(ASMState *as, IRIns *ira, IRIns *irs) | ||
783 | { | ||
784 | if (irs->s == 255) { | ||
785 | if (irs->o == IR_ASTORE || irs->o == IR_HSTORE || | ||
786 | irs->o == IR_FSTORE || irs->o == IR_XSTORE) { | ||
787 | IRIns *irk = IR(irs->op1); | ||
788 | if (irk->o == IR_AREF || irk->o == IR_HREFK) | ||
789 | irk = IR(irk->op1); | ||
790 | return (IR(irk->op1) == ira); | ||
791 | } | ||
792 | return 0; | ||
793 | } else { | ||
794 | return (ira + irs->s == irs); /* Quick check. */ | ||
795 | } | ||
796 | } | ||
797 | |||
781 | /* Allocate register or spill slot for a ref that escapes to a snapshot. */ | 798 | /* Allocate register or spill slot for a ref that escapes to a snapshot. */ |
782 | static void asm_snap_alloc1(ASMState *as, IRRef ref) | 799 | static void asm_snap_alloc1(ASMState *as, IRRef ref) |
783 | { | 800 | { |
@@ -795,8 +812,8 @@ static void asm_snap_alloc1(ASMState *as, IRRef ref) | |||
795 | else { /* Allocate stored values for TNEW, TDUP and CNEW. */ | 812 | else { /* Allocate stored values for TNEW, TDUP and CNEW. */ |
796 | IRIns *irs; | 813 | IRIns *irs; |
797 | lua_assert(ir->o == IR_TNEW || ir->o == IR_TDUP || ir->o == IR_CNEW); | 814 | lua_assert(ir->o == IR_TNEW || ir->o == IR_TDUP || ir->o == IR_CNEW); |
798 | for (irs = IR(as->curins); irs > ir; irs--) | 815 | for (irs = IR(as->snapref-1); irs > ir; irs--) |
799 | if (irs->r == RID_SINK && ir + irs->s == irs) { | 816 | if (irs->r == RID_SINK && asm_sunk_store(as, ir, irs)) { |
800 | lua_assert(irs->o == IR_ASTORE || irs->o == IR_HSTORE || | 817 | lua_assert(irs->o == IR_ASTORE || irs->o == IR_HSTORE || |
801 | irs->o == IR_FSTORE || irs->o == IR_XSTORE); | 818 | irs->o == IR_FSTORE || irs->o == IR_XSTORE); |
802 | asm_snap_alloc1(as, irs->op2); | 819 | asm_snap_alloc1(as, irs->op2); |