aboutsummaryrefslogtreecommitdiff
path: root/src/vm_arm.dasc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/vm_arm.dasc93
1 files changed, 93 insertions, 0 deletions
diff --git a/src/vm_arm.dasc b/src/vm_arm.dasc
index c46d9243..d999d5ff 100644
--- a/src/vm_arm.dasc
+++ b/src/vm_arm.dasc
@@ -615,6 +615,16 @@ static void build_subroutines(BuildCtx *ctx)
615 | ldr LFUNC:CARG3, [BASE, FRAME_FUNC] // Guaranteed to be a function here. 615 | ldr LFUNC:CARG3, [BASE, FRAME_FUNC] // Guaranteed to be a function here.
616 | b ->vm_call_dispatch_f 616 | b ->vm_call_dispatch_f
617 | 617 |
618 |->vmeta_tgetr:
619 | .IOS mov RC, BASE
620 | bl extern lj_tab_getinth // (GCtab *t, int32_t key)
621 | // Returns cTValue * or NULL.
622 | .IOS mov BASE, RC
623 | cmp CRET1, #0
624 | ldrdne CARG12, [CRET1]
625 | mvneq CARG2, #~LJ_TNIL
626 | b ->BC_TGETR_Z
627 |
618 |//----------------------------------------------------------------------- 628 |//-----------------------------------------------------------------------
619 | 629 |
620 |->vmeta_tsets1: 630 |->vmeta_tsets1:
@@ -672,6 +682,15 @@ static void build_subroutines(BuildCtx *ctx)
672 | ldr LFUNC:CARG3, [BASE, FRAME_FUNC] // Guaranteed to be a function here. 682 | ldr LFUNC:CARG3, [BASE, FRAME_FUNC] // Guaranteed to be a function here.
673 | b ->vm_call_dispatch_f 683 | b ->vm_call_dispatch_f
674 | 684 |
685 |->vmeta_tsetr:
686 | str BASE, L->base
687 | .IOS mov RC, BASE
688 | str PC, SAVE_PC
689 | bl extern lj_tab_setinth // (lua_State *L, GCtab *t, int32_t key)
690 | // Returns TValue *.
691 | .IOS mov BASE, RC
692 | b ->BC_TSETR_Z
693 |
675 |//-- Comparison metamethods --------------------------------------------- 694 |//-- Comparison metamethods ---------------------------------------------
676 | 695 |
677 |->vmeta_comp: 696 |->vmeta_comp:
@@ -736,6 +755,17 @@ static void build_subroutines(BuildCtx *ctx)
736 | b <3 755 | b <3
737 |.endif 756 |.endif
738 | 757 |
758 |->vmeta_istype:
759 | sub PC, PC, #4
760 | str BASE, L->base
761 | mov CARG1, L
762 | lsr CARG2, RA, #3
763 | mov CARG3, RC
764 | str PC, SAVE_PC
765 | bl extern lj_meta_istype // (lua_State *L, BCReg ra, BCReg tp)
766 | .IOS ldr BASE, L->base
767 | b ->cont_nop
768 |
739 |//-- Arithmetic metamethods --------------------------------------------- 769 |//-- Arithmetic metamethods ---------------------------------------------
740 | 770 |
741 |->vmeta_arith_vn: 771 |->vmeta_arith_vn:
@@ -2821,6 +2851,25 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
2821 | ins_next 2851 | ins_next
2822 break; 2852 break;
2823 2853
2854 case BC_ISTYPE:
2855 | // RA = src*8, RC = -type
2856 | ldrd CARG12, [BASE, RA]
2857 | ins_next1
2858 | cmn CARG2, RC
2859 | ins_next2
2860 | bne ->vmeta_istype
2861 | ins_next3
2862 break;
2863 case BC_ISNUM:
2864 | // RA = src*8, RC = -(TISNUM-1)
2865 | ldrd CARG12, [BASE, RA]
2866 | ins_next1
2867 | checktp CARG2, LJ_TISNUM
2868 | ins_next2
2869 | bhs ->vmeta_istype
2870 | ins_next3
2871 break;
2872
2824 /* -- Unary ops --------------------------------------------------------- */ 2873 /* -- Unary ops --------------------------------------------------------- */
2825 2874
2826 case BC_MOV: 2875 case BC_MOV:
@@ -3491,6 +3540,24 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
3491 | bne <1 // 'no __index' flag set: done. 3540 | bne <1 // 'no __index' flag set: done.
3492 | b ->vmeta_tgetb 3541 | b ->vmeta_tgetb
3493 break; 3542 break;
3543 case BC_TGETR:
3544 | decode_RB8 RB, INS
3545 | decode_RC8 RC, INS
3546 | // RA = dst*8, RB = table*8, RC = key*8
3547 | ldr TAB:CARG1, [BASE, RB]
3548 | ldr CARG2, [BASE, RC]
3549 | ldr CARG4, TAB:CARG1->array
3550 | ldr CARG3, TAB:CARG1->asize
3551 | add CARG4, CARG4, CARG2, lsl #3
3552 | cmp CARG2, CARG3 // In array part?
3553 | bhs ->vmeta_tgetr
3554 | ldrd CARG12, [CARG4]
3555 |->BC_TGETR_Z:
3556 | ins_next1
3557 | ins_next2
3558 | strd CARG12, [BASE, RA]
3559 | ins_next3
3560 break;
3494 3561
3495 case BC_TSETV: 3562 case BC_TSETV:
3496 | decode_RB8 RB, INS 3563 | decode_RB8 RB, INS
@@ -3661,6 +3728,32 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
3661 | barrierback TAB:CARG1, INS, CARG3 3728 | barrierback TAB:CARG1, INS, CARG3
3662 | b <2 3729 | b <2
3663 break; 3730 break;
3731 case BC_TSETR:
3732 | decode_RB8 RB, INS
3733 | decode_RC8 RC, INS
3734 | // RA = dst*8, RB = table*8, RC = key*8
3735 | ldr TAB:CARG2, [BASE, RB]
3736 | ldr CARG3, [BASE, RC]
3737 | ldrb INS, TAB:CARG2->marked
3738 | ldr CARG1, TAB:CARG2->array
3739 | ldr CARG4, TAB:CARG2->asize
3740 | tst INS, #LJ_GC_BLACK // isblack(table)
3741 | add CARG1, CARG1, CARG3, lsl #3
3742 | bne >7
3743 |2:
3744 | cmp CARG3, CARG4 // In array part?
3745 | bhs ->vmeta_tsetr
3746 |->BC_TSETR_Z:
3747 | ldrd CARG34, [BASE, RA]
3748 | ins_next1
3749 | ins_next2
3750 | strd CARG34, [CARG1]
3751 | ins_next3
3752 |
3753 |7: // Possible table write barrier for the value. Skip valiswhite check.
3754 | barrierback TAB:CARG2, INS, RB
3755 | b <2
3756 break;
3664 3757
3665 case BC_TSETM: 3758 case BC_TSETM:
3666 | // RA = base*8 (table at base-1), RC = num_const (start index) 3759 | // RA = base*8 (table at base-1), RC = num_const (start index)