diff options
author | Mike Pall <mike> | 2012-06-11 00:49:47 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2012-06-11 00:49:47 +0200 |
commit | 02acb39b1009eaba1fe64d58c3e56cbc2a2c344e (patch) | |
tree | 9004e5af79b25552aa80e271031b740448ce6ae2 /src | |
parent | c99439b3be6104c48fc5c6139826466c8d7f356d (diff) | |
download | luajit-02acb39b1009eaba1fe64d58c3e56cbc2a2c344e.tar.gz luajit-02acb39b1009eaba1fe64d58c3e56cbc2a2c344e.tar.bz2 luajit-02acb39b1009eaba1fe64d58c3e56cbc2a2c344e.zip |
ARM: Cleanup interpreter.
Use DynASM defines instead of C defines.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 6 | ||||
-rw-r--r-- | src/vm_arm.dasc | 270 |
2 files changed, 141 insertions, 135 deletions
diff --git a/src/Makefile b/src/Makefile index 9d21c3fb..c100bd3c 100644 --- a/src/Makefile +++ b/src/Makefile | |||
@@ -390,6 +390,11 @@ ifeq (x64,$(TARGET_LJARCH)) | |||
390 | DASM_AFLAGS+= -D X64 | 390 | DASM_AFLAGS+= -D X64 |
391 | DASM_ARCH= x86 | 391 | DASM_ARCH= x86 |
392 | else | 392 | else |
393 | ifeq (arm,$(TARGET_LJARCH)) | ||
394 | ifeq (iOS,$(TARGET_SYS)) | ||
395 | DASM_AFLAGS+= -D IOS | ||
396 | endif | ||
397 | else | ||
393 | ifeq (ppc,$(TARGET_LJARCH)) | 398 | ifeq (ppc,$(TARGET_LJARCH)) |
394 | ifneq (,$(findstring LJ_ARCH_SQRT 1,$(TARGET_TESTARCH))) | 399 | ifneq (,$(findstring LJ_ARCH_SQRT 1,$(TARGET_TESTARCH))) |
395 | DASM_AFLAGS+= -D SQRT | 400 | DASM_AFLAGS+= -D SQRT |
@@ -403,6 +408,7 @@ ifeq (ppc,$(TARGET_LJARCH)) | |||
403 | endif | 408 | endif |
404 | endif | 409 | endif |
405 | endif | 410 | endif |
411 | endif | ||
406 | 412 | ||
407 | DASM_FLAGS= $(DASM_XFLAGS) $(DASM_AFLAGS) | 413 | DASM_FLAGS= $(DASM_XFLAGS) $(DASM_AFLAGS) |
408 | DASM_DASC= vm_$(DASM_ARCH).dasc | 414 | DASM_DASC= vm_$(DASM_ARCH).dasc |
diff --git a/src/vm_arm.dasc b/src/vm_arm.dasc index 3a039402..aa5fbc88 100644 --- a/src/vm_arm.dasc +++ b/src/vm_arm.dasc | |||
@@ -217,10 +217,10 @@ | |||
217 | | str tmp, tab->gclist | 217 | | str tmp, tab->gclist |
218 | |.endmacro | 218 | |.endmacro |
219 | | | 219 | | |
220 | |.macro IOS, a, b | 220 | |.macro .IOS, a, b |
221 | ||if (LJ_TARGET_IOS) { | 221 | |.if IOS |
222 | | a, b | 222 | | a, b |
223 | ||} | 223 | |.endif |
224 | |.endmacro | 224 | |.endmacro |
225 | | | 225 | | |
226 | |//----------------------------------------------------------------------- | 226 | |//----------------------------------------------------------------------- |
@@ -502,22 +502,22 @@ static void build_subroutines(BuildCtx *ctx) | |||
502 | | ldr CARG1, [BASE, #-16] // Get continuation. | 502 | | ldr CARG1, [BASE, #-16] // Get continuation. |
503 | | mov CARG4, BASE | 503 | | mov CARG4, BASE |
504 | | mov BASE, RB // Restore caller BASE. | 504 | | mov BASE, RB // Restore caller BASE. |
505 | #if LJ_HASFFI | 505 | |.if FFI |
506 | | cmp CARG1, #1 | 506 | | cmp CARG1, #1 |
507 | #endif | 507 | |.endif |
508 | | ldr PC, [CARG4, #-12] // Restore PC from [cont|PC]. | 508 | | ldr PC, [CARG4, #-12] // Restore PC from [cont|PC]. |
509 | | ldr CARG3, LFUNC:CARG3->field_pc | 509 | | ldr CARG3, LFUNC:CARG3->field_pc |
510 | | mvn INS, #~LJ_TNIL | 510 | | mvn INS, #~LJ_TNIL |
511 | | add CARG2, RA, RC | 511 | | add CARG2, RA, RC |
512 | | str INS, [CARG2, #-4] // Ensure one valid arg. | 512 | | str INS, [CARG2, #-4] // Ensure one valid arg. |
513 | #if LJ_HASFFI | 513 | |.if FFI |
514 | | bls >1 | 514 | | bls >1 |
515 | #endif | 515 | |.endif |
516 | | ldr KBASE, [CARG3, #PC2PROTO(k)] | 516 | | ldr KBASE, [CARG3, #PC2PROTO(k)] |
517 | | // BASE = base, RA = resultptr, CARG4 = meta base | 517 | | // BASE = base, RA = resultptr, CARG4 = meta base |
518 | | bx CARG1 | 518 | | bx CARG1 |
519 | | | 519 | | |
520 | #if LJ_HASFFI | 520 | |.if FFI |
521 | |1: | 521 | |1: |
522 | | beq ->cont_ffi_callback // cont = 1: return from FFI callback. | 522 | | beq ->cont_ffi_callback // cont = 1: return from FFI callback. |
523 | | // cont = 0: tailcall from C function. | 523 | | // cont = 0: tailcall from C function. |
@@ -525,7 +525,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
525 | | sub CARG4, CARG4, #16 | 525 | | sub CARG4, CARG4, #16 |
526 | | sub RC, CARG4, BASE | 526 | | sub RC, CARG4, BASE |
527 | | b ->vm_call_tail | 527 | | b ->vm_call_tail |
528 | #endif | 528 | |.endif |
529 | | | 529 | | |
530 | |->cont_cat: // RA = resultptr, CARG4 = meta base | 530 | |->cont_cat: // RA = resultptr, CARG4 = meta base |
531 | | ldr INS, [PC, #-4] | 531 | | ldr INS, [PC, #-4] |
@@ -578,7 +578,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
578 | | str PC, SAVE_PC | 578 | | str PC, SAVE_PC |
579 | | bl extern lj_meta_tget // (lua_State *L, TValue *o, TValue *k) | 579 | | bl extern lj_meta_tget // (lua_State *L, TValue *o, TValue *k) |
580 | | // Returns TValue * (finished) or NULL (metamethod). | 580 | | // Returns TValue * (finished) or NULL (metamethod). |
581 | | IOS ldr BASE, L->base | 581 | | .IOS ldr BASE, L->base |
582 | | cmp CRET1, #0 | 582 | | cmp CRET1, #0 |
583 | | beq >3 | 583 | | beq >3 |
584 | | ldrd CARG34, [CRET1] | 584 | | ldrd CARG34, [CRET1] |
@@ -633,7 +633,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
633 | | str PC, SAVE_PC | 633 | | str PC, SAVE_PC |
634 | | bl extern lj_meta_tset // (lua_State *L, TValue *o, TValue *k) | 634 | | bl extern lj_meta_tset // (lua_State *L, TValue *o, TValue *k) |
635 | | // Returns TValue * (finished) or NULL (metamethod). | 635 | | // Returns TValue * (finished) or NULL (metamethod). |
636 | | IOS ldr BASE, L->base | 636 | | .IOS ldr BASE, L->base |
637 | | cmp CRET1, #0 | 637 | | cmp CRET1, #0 |
638 | | ldrd CARG34, [BASE, RA] | 638 | | ldrd CARG34, [BASE, RA] |
639 | | beq >3 | 639 | | beq >3 |
@@ -667,7 +667,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
667 | | bl extern lj_meta_comp // (lua_State *L, TValue *o1, *o2, int op) | 667 | | bl extern lj_meta_comp // (lua_State *L, TValue *o1, *o2, int op) |
668 | | // Returns 0/1 or TValue * (metamethod). | 668 | | // Returns 0/1 or TValue * (metamethod). |
669 | |3: | 669 | |3: |
670 | | IOS ldr BASE, L->base | 670 | | .IOS ldr BASE, L->base |
671 | | cmp CRET1, #1 | 671 | | cmp CRET1, #1 |
672 | | bhi ->vmeta_binop | 672 | | bhi ->vmeta_binop |
673 | |4: | 673 | |4: |
@@ -707,7 +707,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
707 | | b <3 | 707 | | b <3 |
708 | | | 708 | | |
709 | |->vmeta_equal_cd: | 709 | |->vmeta_equal_cd: |
710 | #if LJ_HASFFI | 710 | |.if FFI |
711 | | sub PC, PC, #4 | 711 | | sub PC, PC, #4 |
712 | | str BASE, L->base | 712 | | str BASE, L->base |
713 | | mov CARG1, L | 713 | | mov CARG1, L |
@@ -716,7 +716,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
716 | | bl extern lj_meta_equal_cd // (lua_State *L, BCIns op) | 716 | | bl extern lj_meta_equal_cd // (lua_State *L, BCIns op) |
717 | | // Returns 0/1 or TValue * (metamethod). | 717 | | // Returns 0/1 or TValue * (metamethod). |
718 | | b <3 | 718 | | b <3 |
719 | #endif | 719 | |.endif |
720 | | | 720 | | |
721 | |//-- Arithmetic metamethods --------------------------------------------- | 721 | |//-- Arithmetic metamethods --------------------------------------------- |
722 | | | 722 | | |
@@ -755,7 +755,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
755 | | str OP, ARG5 | 755 | | str OP, ARG5 |
756 | | bl extern lj_meta_arith // (lua_State *L, TValue *ra,*rb,*rc, BCReg op) | 756 | | bl extern lj_meta_arith // (lua_State *L, TValue *ra,*rb,*rc, BCReg op) |
757 | | // Returns NULL (finished) or TValue * (metamethod). | 757 | | // Returns NULL (finished) or TValue * (metamethod). |
758 | | IOS ldr BASE, L->base | 758 | | .IOS ldr BASE, L->base |
759 | | cmp CRET1, #0 | 759 | | cmp CRET1, #0 |
760 | | beq ->cont_nop | 760 | | beq ->cont_nop |
761 | | | 761 | | |
@@ -776,7 +776,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
776 | | str PC, SAVE_PC | 776 | | str PC, SAVE_PC |
777 | | bl extern lj_meta_len // (lua_State *L, TValue *o) | 777 | | bl extern lj_meta_len // (lua_State *L, TValue *o) |
778 | | // Returns NULL (retry) or TValue * (metamethod base). | 778 | | // Returns NULL (retry) or TValue * (metamethod base). |
779 | | IOS ldr BASE, L->base | 779 | | .IOS ldr BASE, L->base |
780 | #ifdef LUAJIT_ENABLE_LUA52COMPAT | 780 | #ifdef LUAJIT_ENABLE_LUA52COMPAT |
781 | | cmp CRET1, #0 | 781 | | cmp CRET1, #0 |
782 | | bne ->vmeta_binop // Binop call for compatibility. | 782 | | bne ->vmeta_binop // Binop call for compatibility. |
@@ -795,9 +795,9 @@ static void build_subroutines(BuildCtx *ctx) | |||
795 | | sub CARG2, BASE, #8 | 795 | | sub CARG2, BASE, #8 |
796 | | str PC, SAVE_PC | 796 | | str PC, SAVE_PC |
797 | | add CARG3, BASE, NARGS8:RC | 797 | | add CARG3, BASE, NARGS8:RC |
798 | | IOS mov RA, BASE | 798 | | .IOS mov RA, BASE |
799 | | bl extern lj_meta_call // (lua_State *L, TValue *func, TValue *top) | 799 | | bl extern lj_meta_call // (lua_State *L, TValue *func, TValue *top) |
800 | | IOS mov BASE, RA | 800 | | .IOS mov BASE, RA |
801 | | ldr LFUNC:CARG3, [BASE, FRAME_FUNC] // Guaranteed to be a function here. | 801 | | ldr LFUNC:CARG3, [BASE, FRAME_FUNC] // Guaranteed to be a function here. |
802 | | add NARGS8:RC, NARGS8:RC, #8 // Got one more argument now. | 802 | | add NARGS8:RC, NARGS8:RC, #8 // Got one more argument now. |
803 | | ins_call | 803 | | ins_call |
@@ -810,7 +810,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
810 | | str PC, SAVE_PC | 810 | | str PC, SAVE_PC |
811 | | add CARG3, RA, NARGS8:RC | 811 | | add CARG3, RA, NARGS8:RC |
812 | | bl extern lj_meta_call // (lua_State *L, TValue *func, TValue *top) | 812 | | bl extern lj_meta_call // (lua_State *L, TValue *func, TValue *top) |
813 | | IOS ldr BASE, L->base | 813 | | .IOS ldr BASE, L->base |
814 | | ldr LFUNC:CARG3, [RA, FRAME_FUNC] // Guaranteed to be a function here. | 814 | | ldr LFUNC:CARG3, [RA, FRAME_FUNC] // Guaranteed to be a function here. |
815 | | ldr PC, [BASE, FRAME_PC] | 815 | | ldr PC, [BASE, FRAME_PC] |
816 | | add NARGS8:RC, NARGS8:RC, #8 // Got one more argument now. | 816 | | add NARGS8:RC, NARGS8:RC, #8 // Got one more argument now. |
@@ -824,19 +824,19 @@ static void build_subroutines(BuildCtx *ctx) | |||
824 | | mov CARG2, RA | 824 | | mov CARG2, RA |
825 | | str PC, SAVE_PC | 825 | | str PC, SAVE_PC |
826 | | bl extern lj_meta_for // (lua_State *L, TValue *base) | 826 | | bl extern lj_meta_for // (lua_State *L, TValue *base) |
827 | | IOS ldr BASE, L->base | 827 | | .IOS ldr BASE, L->base |
828 | #if LJ_HASJIT | 828 | |.if JIT |
829 | | ldrb OP, [PC, #-4] | 829 | | ldrb OP, [PC, #-4] |
830 | #endif | 830 | |.endif |
831 | | ldr INS, [PC, #-4] | 831 | | ldr INS, [PC, #-4] |
832 | #if LJ_HASJIT | 832 | |.if JIT |
833 | | cmp OP, #BC_JFORI | 833 | | cmp OP, #BC_JFORI |
834 | #endif | 834 | |.endif |
835 | | decode_RA8 RA, INS | 835 | | decode_RA8 RA, INS |
836 | | decode_RD RC, INS | 836 | | decode_RD RC, INS |
837 | #if LJ_HASJIT | 837 | |.if JIT |
838 | | beq =>BC_JFORI | 838 | | beq =>BC_JFORI |
839 | #endif | 839 | |.endif |
840 | | b =>BC_FORI | 840 | | b =>BC_FORI |
841 | | | 841 | | |
842 | |//----------------------------------------------------------------------- | 842 | |//----------------------------------------------------------------------- |
@@ -979,10 +979,10 @@ static void build_subroutines(BuildCtx *ctx) | |||
979 | | checktab CARG4, ->fff_fallback | 979 | | checktab CARG4, ->fff_fallback |
980 | | mov CARG1, L | 980 | | mov CARG1, L |
981 | | add CARG3, BASE, #8 | 981 | | add CARG3, BASE, #8 |
982 | | IOS mov RA, BASE | 982 | | .IOS mov RA, BASE |
983 | | bl extern lj_tab_get // (lua_State *L, GCtab *t, cTValue *key) | 983 | | bl extern lj_tab_get // (lua_State *L, GCtab *t, cTValue *key) |
984 | | // Returns cTValue *. | 984 | | // Returns cTValue *. |
985 | | IOS mov BASE, RA | 985 | | .IOS mov BASE, RA |
986 | | ldrd CARG12, [CRET1] | 986 | | ldrd CARG12, [CRET1] |
987 | | b ->fff_restv | 987 | | b ->fff_restv |
988 | | | 988 | | |
@@ -1033,7 +1033,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
1033 | | str PC, SAVE_PC | 1033 | | str PC, SAVE_PC |
1034 | | bl extern lj_tab_next // (lua_State *L, GCtab *t, TValue *key) | 1034 | | bl extern lj_tab_next // (lua_State *L, GCtab *t, TValue *key) |
1035 | | // Returns 0 at end of traversal. | 1035 | | // Returns 0 at end of traversal. |
1036 | | IOS ldr BASE, L->base | 1036 | | .IOS ldr BASE, L->base |
1037 | | cmp CRET1, #0 | 1037 | | cmp CRET1, #0 |
1038 | | mvneq CRET2, #~LJ_TNIL | 1038 | | mvneq CRET2, #~LJ_TNIL |
1039 | | beq ->fff_restv // End of traversal: return nil. | 1039 | | beq ->fff_restv // End of traversal: return nil. |
@@ -1085,10 +1085,10 @@ static void build_subroutines(BuildCtx *ctx) | |||
1085 | | mov CARG2, CARG3 | 1085 | | mov CARG2, CARG3 |
1086 | | cmp RB, #0 | 1086 | | cmp RB, #0 |
1087 | | beq ->fff_res | 1087 | | beq ->fff_res |
1088 | | IOS mov RA, BASE | 1088 | | .IOS mov RA, BASE |
1089 | | bl extern lj_tab_getinth // (GCtab *t, int32_t key) | 1089 | | bl extern lj_tab_getinth // (GCtab *t, int32_t key) |
1090 | | // Returns cTValue * or NULL. | 1090 | | // Returns cTValue * or NULL. |
1091 | | IOS mov BASE, RA | 1091 | | .IOS mov BASE, RA |
1092 | | cmp CRET1, #0 | 1092 | | cmp CRET1, #0 |
1093 | | beq ->fff_res | 1093 | | beq ->fff_res |
1094 | | ldrd CARG12, [CRET1] | 1094 | | ldrd CARG12, [CRET1] |
@@ -1382,17 +1382,17 @@ static void build_subroutines(BuildCtx *ctx) | |||
1382 | | | 1382 | | |
1383 | |.macro math_extern, func | 1383 | |.macro math_extern, func |
1384 | | .ffunc_n math_ .. func | 1384 | | .ffunc_n math_ .. func |
1385 | | IOS mov RA, BASE | 1385 | | .IOS mov RA, BASE |
1386 | | bl extern func | 1386 | | bl extern func |
1387 | | IOS mov BASE, RA | 1387 | | .IOS mov BASE, RA |
1388 | | b ->fff_restv | 1388 | | b ->fff_restv |
1389 | |.endmacro | 1389 | |.endmacro |
1390 | | | 1390 | | |
1391 | |.macro math_extern2, func | 1391 | |.macro math_extern2, func |
1392 | | .ffunc_nn math_ .. func | 1392 | | .ffunc_nn math_ .. func |
1393 | | IOS mov RA, BASE | 1393 | | .IOS mov RA, BASE |
1394 | | bl extern func | 1394 | | bl extern func |
1395 | | IOS mov BASE, RA | 1395 | | .IOS mov BASE, RA |
1396 | | b ->fff_restv | 1396 | | b ->fff_restv |
1397 | |.endmacro | 1397 | |.endmacro |
1398 | | | 1398 | | |
@@ -1424,16 +1424,16 @@ static void build_subroutines(BuildCtx *ctx) | |||
1424 | | bhs ->fff_fallback | 1424 | | bhs ->fff_fallback |
1425 | | checktp CARG4, LJ_TISNUM | 1425 | | checktp CARG4, LJ_TISNUM |
1426 | | bne ->fff_fallback | 1426 | | bne ->fff_fallback |
1427 | | IOS mov RA, BASE | 1427 | | .IOS mov RA, BASE |
1428 | | bl extern ldexp // (double x, int exp) | 1428 | | bl extern ldexp // (double x, int exp) |
1429 | | IOS mov BASE, RA | 1429 | | .IOS mov BASE, RA |
1430 | | b ->fff_restv | 1430 | | b ->fff_restv |
1431 | | | 1431 | | |
1432 | |.ffunc_n math_frexp | 1432 | |.ffunc_n math_frexp |
1433 | | mov CARG3, sp | 1433 | | mov CARG3, sp |
1434 | | IOS mov RA, BASE | 1434 | | .IOS mov RA, BASE |
1435 | | bl extern frexp | 1435 | | bl extern frexp |
1436 | | IOS mov BASE, RA | 1436 | | .IOS mov BASE, RA |
1437 | | ldr CARG3, [sp] | 1437 | | ldr CARG3, [sp] |
1438 | | mvn CARG4, #~LJ_TISNUM | 1438 | | mvn CARG4, #~LJ_TISNUM |
1439 | | ldr PC, [BASE, FRAME_PC] | 1439 | | ldr PC, [BASE, FRAME_PC] |
@@ -1445,9 +1445,9 @@ static void build_subroutines(BuildCtx *ctx) | |||
1445 | |.ffunc_n math_modf | 1445 | |.ffunc_n math_modf |
1446 | | sub CARG3, BASE, #8 | 1446 | | sub CARG3, BASE, #8 |
1447 | | ldr PC, [BASE, FRAME_PC] | 1447 | | ldr PC, [BASE, FRAME_PC] |
1448 | | IOS mov RA, BASE | 1448 | | .IOS mov RA, BASE |
1449 | | bl extern modf | 1449 | | bl extern modf |
1450 | | IOS mov BASE, RA | 1450 | | .IOS mov BASE, RA |
1451 | | mov RC, #(2+1)*8 | 1451 | | mov RC, #(2+1)*8 |
1452 | | strd CARG12, [BASE] | 1452 | | strd CARG12, [BASE] |
1453 | | b ->fff_res | 1453 | | b ->fff_res |
@@ -1662,10 +1662,10 @@ static void build_subroutines(BuildCtx *ctx) | |||
1662 | | | 1662 | | |
1663 | |.ffunc_1 table_getn | 1663 | |.ffunc_1 table_getn |
1664 | | checktab CARG2, ->fff_fallback | 1664 | | checktab CARG2, ->fff_fallback |
1665 | | IOS mov RA, BASE | 1665 | | .IOS mov RA, BASE |
1666 | | bl extern lj_tab_len // (GCtab *t) | 1666 | | bl extern lj_tab_len // (GCtab *t) |
1667 | | // Returns uint32_t (but less than 2^31). | 1667 | | // Returns uint32_t (but less than 2^31). |
1668 | | IOS mov BASE, RA | 1668 | | .IOS mov BASE, RA |
1669 | | mvn CARG2, #~LJ_TISNUM | 1669 | | mvn CARG2, #~LJ_TISNUM |
1670 | | b ->fff_restv | 1670 | | b ->fff_restv |
1671 | | | 1671 | | |
@@ -1839,7 +1839,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
1839 | |//----------------------------------------------------------------------- | 1839 | |//----------------------------------------------------------------------- |
1840 | | | 1840 | | |
1841 | |->vm_record: // Dispatch target for recording phase. | 1841 | |->vm_record: // Dispatch target for recording phase. |
1842 | #if LJ_HASJIT | 1842 | |.if JIT |
1843 | | ldrb CARG1, [DISPATCH, #DISPATCH_GL(hookmask)] | 1843 | | ldrb CARG1, [DISPATCH, #DISPATCH_GL(hookmask)] |
1844 | | tst CARG1, #HOOK_VMEVENT // No recording while in vmevent. | 1844 | | tst CARG1, #HOOK_VMEVENT // No recording while in vmevent. |
1845 | | bne >5 | 1845 | | bne >5 |
@@ -1851,7 +1851,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
1851 | | tst CARG1, #LUA_MASKLINE|LUA_MASKCOUNT | 1851 | | tst CARG1, #LUA_MASKLINE|LUA_MASKCOUNT |
1852 | | strne CARG2, [DISPATCH, #DISPATCH_GL(hookcount)] | 1852 | | strne CARG2, [DISPATCH, #DISPATCH_GL(hookcount)] |
1853 | | b >1 | 1853 | | b >1 |
1854 | #endif | 1854 | |.endif |
1855 | | | 1855 | | |
1856 | |->vm_rethook: // Dispatch target for return hooks. | 1856 | |->vm_rethook: // Dispatch target for return hooks. |
1857 | | ldrb CARG1, [DISPATCH, #DISPATCH_GL(hookmask)] | 1857 | | ldrb CARG1, [DISPATCH, #DISPATCH_GL(hookmask)] |
@@ -1898,7 +1898,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
1898 | | b <4 | 1898 | | b <4 |
1899 | | | 1899 | | |
1900 | |->vm_hotloop: // Hot loop counter underflow. | 1900 | |->vm_hotloop: // Hot loop counter underflow. |
1901 | #if LJ_HASJIT | 1901 | |.if JIT |
1902 | | ldr LFUNC:CARG3, [BASE, FRAME_FUNC] // Same as curr_topL(L). | 1902 | | ldr LFUNC:CARG3, [BASE, FRAME_FUNC] // Same as curr_topL(L). |
1903 | | sub CARG1, DISPATCH, #-GG_DISP2J | 1903 | | sub CARG1, DISPATCH, #-GG_DISP2J |
1904 | | str PC, SAVE_PC | 1904 | | str PC, SAVE_PC |
@@ -1911,19 +1911,19 @@ static void build_subroutines(BuildCtx *ctx) | |||
1911 | | str CARG3, L->top | 1911 | | str CARG3, L->top |
1912 | | bl extern lj_trace_hot // (jit_State *J, const BCIns *pc) | 1912 | | bl extern lj_trace_hot // (jit_State *J, const BCIns *pc) |
1913 | | b <3 | 1913 | | b <3 |
1914 | #endif | 1914 | |.endif |
1915 | | | 1915 | | |
1916 | |->vm_callhook: // Dispatch target for call hooks. | 1916 | |->vm_callhook: // Dispatch target for call hooks. |
1917 | | mov CARG2, PC | 1917 | | mov CARG2, PC |
1918 | #if LJ_HASJIT | 1918 | |.if JIT |
1919 | | b >1 | 1919 | | b >1 |
1920 | #endif | 1920 | |.endif |
1921 | | | 1921 | | |
1922 | |->vm_hotcall: // Hot call counter underflow. | 1922 | |->vm_hotcall: // Hot call counter underflow. |
1923 | #if LJ_HASJIT | 1923 | |.if JIT |
1924 | | orr CARG2, PC, #1 | 1924 | | orr CARG2, PC, #1 |
1925 | |1: | 1925 | |1: |
1926 | #endif | 1926 | |.endif |
1927 | | add CARG4, BASE, RC | 1927 | | add CARG4, BASE, RC |
1928 | | str PC, SAVE_PC | 1928 | | str PC, SAVE_PC |
1929 | | mov CARG1, L | 1929 | | mov CARG1, L |
@@ -1947,7 +1947,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
1947 | |//----------------------------------------------------------------------- | 1947 | |//----------------------------------------------------------------------- |
1948 | | | 1948 | | |
1949 | |->vm_exit_handler: | 1949 | |->vm_exit_handler: |
1950 | #if LJ_HASJIT | 1950 | |.if JIT |
1951 | | sub sp, sp, #12 | 1951 | | sub sp, sp, #12 |
1952 | | push {r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12} | 1952 | | push {r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12} |
1953 | | ldr CARG1, [sp, #64] // Load original value of lr. | 1953 | | ldr CARG1, [sp, #64] // Load original value of lr. |
@@ -1982,10 +1982,10 @@ static void build_subroutines(BuildCtx *ctx) | |||
1982 | | ldr PC, SAVE_PC // Get SAVE_PC. | 1982 | | ldr PC, SAVE_PC // Get SAVE_PC. |
1983 | | str L, SAVE_L // Set SAVE_L (on-trace resume/yield). | 1983 | | str L, SAVE_L // Set SAVE_L (on-trace resume/yield). |
1984 | | b >1 | 1984 | | b >1 |
1985 | #endif | 1985 | |.endif |
1986 | |->vm_exit_interp: | 1986 | |->vm_exit_interp: |
1987 | | // CARG1 = MULTRES or negated error code, BASE, PC and DISPATCH set. | 1987 | | // CARG1 = MULTRES or negated error code, BASE, PC and DISPATCH set. |
1988 | #if LJ_HASJIT | 1988 | |.if JIT |
1989 | | ldr L, SAVE_L | 1989 | | ldr L, SAVE_L |
1990 | |1: | 1990 | |1: |
1991 | | cmp CARG1, #0 | 1991 | | cmp CARG1, #0 |
@@ -2016,7 +2016,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
2016 | | rsb CARG2, CARG1, #0 | 2016 | | rsb CARG2, CARG1, #0 |
2017 | | mov CARG1, L | 2017 | | mov CARG1, L |
2018 | | bl extern lj_err_throw // (lua_State *L, int errcode) | 2018 | | bl extern lj_err_throw // (lua_State *L, int errcode) |
2019 | #endif | 2019 | |.endif |
2020 | | | 2020 | | |
2021 | |//----------------------------------------------------------------------- | 2021 | |//----------------------------------------------------------------------- |
2022 | |//-- Math helper functions ---------------------------------------------- | 2022 | |//-- Math helper functions ---------------------------------------------- |
@@ -2077,7 +2077,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
2077 | | vm_round ceil | 2077 | | vm_round ceil |
2078 | | | 2078 | | |
2079 | |->vm_trunc: | 2079 | |->vm_trunc: |
2080 | #if LJ_HASJIT | 2080 | |.if JIT |
2081 | | lsl CARG3, CARG2, #1 | 2081 | | lsl CARG3, CARG2, #1 |
2082 | | adds RB, CARG3, #0x00200000 | 2082 | | adds RB, CARG3, #0x00200000 |
2083 | | andpl CARG2, CARG2, #0x80000000 // |x| < 1? hi = sign(x), lo = 0. | 2083 | | andpl CARG2, CARG2, #0x80000000 // |x| < 1? hi = sign(x), lo = 0. |
@@ -2091,7 +2091,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
2091 | | subs RB, RB, #32 | 2091 | | subs RB, RB, #32 |
2092 | | andpl CARG2, CARG2, CARG4, lsl RB // |x| <= 2^20: hi &= himask | 2092 | | andpl CARG2, CARG2, CARG4, lsl RB // |x| <= 2^20: hi &= himask |
2093 | | bx lr | 2093 | | bx lr |
2094 | #endif | 2094 | |.endif |
2095 | | | 2095 | | |
2096 | | // double lj_vm_mod(double dividend, double divisor); | 2096 | | // double lj_vm_mod(double dividend, double divisor); |
2097 | |->vm_mod: | 2097 | |->vm_mod: |
@@ -2159,7 +2159,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
2159 | | eorlo CARG2, CARG2, #0x80000000 | 2159 | | eorlo CARG2, CARG2, #0x80000000 |
2160 | | biceq CARG2, CARG2, #0x80000000 | 2160 | | biceq CARG2, CARG2, #0x80000000 |
2161 | | bxls lr | 2161 | | bxls lr |
2162 | #if LJ_HASJIT | 2162 | |.if JIT |
2163 | | cmp OP, #9 | 2163 | | cmp OP, #9 |
2164 | | blo extern atan2 | 2164 | | blo extern atan2 |
2165 | | beq >9 // No support needed for IR_LDEXP. | 2165 | | beq >9 // No support needed for IR_LDEXP. |
@@ -2180,9 +2180,9 @@ static void build_subroutines(BuildCtx *ctx) | |||
2180 | | movlo CARG1, CARG3 | 2180 | | movlo CARG1, CARG3 |
2181 | | movlo CARG2, CARG4 | 2181 | | movlo CARG2, CARG4 |
2182 | | pop {r4, pc} | 2182 | | pop {r4, pc} |
2183 | #else | 2183 | |.else |
2184 | | NYI // Other operations only needed by JIT compiler. | 2184 | | NYI // Other operations only needed by JIT compiler. |
2185 | #endif | 2185 | |.endif |
2186 | | | 2186 | | |
2187 | |//----------------------------------------------------------------------- | 2187 | |//----------------------------------------------------------------------- |
2188 | |//-- Miscellaneous functions -------------------------------------------- | 2188 | |//-- Miscellaneous functions -------------------------------------------- |
@@ -2195,7 +2195,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
2195 | |// Handler for callback functions. | 2195 | |// Handler for callback functions. |
2196 | |// Saveregs already performed. Callback slot number in [sp], g in r12. | 2196 | |// Saveregs already performed. Callback slot number in [sp], g in r12. |
2197 | |->vm_ffi_callback: | 2197 | |->vm_ffi_callback: |
2198 | #if LJ_HASFFI | 2198 | |.if FFI |
2199 | |.type CTSTATE, CTState, PC | 2199 | |.type CTSTATE, CTState, PC |
2200 | | ldr CTSTATE, GL:r12->ctype_state | 2200 | | ldr CTSTATE, GL:r12->ctype_state |
2201 | | add DISPATCH, r12, #GG_G2DISP | 2201 | | add DISPATCH, r12, #GG_G2DISP |
@@ -2221,10 +2221,10 @@ static void build_subroutines(BuildCtx *ctx) | |||
2221 | | lsl MASKR8, MASKR8, #3 // MASKR8 = 255*8. | 2221 | | lsl MASKR8, MASKR8, #3 // MASKR8 = 255*8. |
2222 | | st_vmstate CARG2 | 2222 | | st_vmstate CARG2 |
2223 | | ins_callt | 2223 | | ins_callt |
2224 | #endif | 2224 | |.endif |
2225 | | | 2225 | | |
2226 | |->cont_ffi_callback: // Return from FFI callback. | 2226 | |->cont_ffi_callback: // Return from FFI callback. |
2227 | #if LJ_HASFFI | 2227 | |.if FFI |
2228 | | ldr CTSTATE, [DISPATCH, #DISPATCH_GL(ctype_state)] | 2228 | | ldr CTSTATE, [DISPATCH, #DISPATCH_GL(ctype_state)] |
2229 | | str BASE, L->base | 2229 | | str BASE, L->base |
2230 | | str CARG4, L->top | 2230 | | str CARG4, L->top |
@@ -2234,11 +2234,11 @@ static void build_subroutines(BuildCtx *ctx) | |||
2234 | | bl extern lj_ccallback_leave // (CTState *cts, TValue *o) | 2234 | | bl extern lj_ccallback_leave // (CTState *cts, TValue *o) |
2235 | | ldrd CARG12, CTSTATE->cb.gpr[0] | 2235 | | ldrd CARG12, CTSTATE->cb.gpr[0] |
2236 | | b ->vm_leave_unw | 2236 | | b ->vm_leave_unw |
2237 | #endif | 2237 | |.endif |
2238 | | | 2238 | | |
2239 | |->vm_ffi_call: // Call C function via FFI. | 2239 | |->vm_ffi_call: // Call C function via FFI. |
2240 | | // Caveat: needs special frame unwinding, see below. | 2240 | | // Caveat: needs special frame unwinding, see below. |
2241 | #if LJ_HASFFI | 2241 | |.if FFI |
2242 | | .type CCSTATE, CCallState, r4 | 2242 | | .type CCSTATE, CCallState, r4 |
2243 | | push {CCSTATE, r5, r11, lr} | 2243 | | push {CCSTATE, r5, r11, lr} |
2244 | | mov CCSTATE, CARG1 | 2244 | | mov CCSTATE, CARG1 |
@@ -2265,7 +2265,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
2265 | | str CRET1, CCSTATE->gpr[0] | 2265 | | str CRET1, CCSTATE->gpr[0] |
2266 | | str CRET2, CCSTATE->gpr[1] | 2266 | | str CRET2, CCSTATE->gpr[1] |
2267 | | pop {CCSTATE, r5, r11, pc} | 2267 | | pop {CCSTATE, r5, r11, pc} |
2268 | #endif | 2268 | |.endif |
2269 | |// Note: vm_ffi_call must be the last function in this object file! | 2269 | |// Note: vm_ffi_call must be the last function in this object file! |
2270 | | | 2270 | | |
2271 | |//----------------------------------------------------------------------- | 2271 | |//----------------------------------------------------------------------- |
@@ -2361,11 +2361,11 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
2361 | | bls ->BC_ISNEN_Z | 2361 | | bls ->BC_ISNEN_Z |
2362 | } | 2362 | } |
2363 | | // Either or both types are not numbers. | 2363 | | // Either or both types are not numbers. |
2364 | if (LJ_HASFFI) { | 2364 | |.if FFI |
2365 | | checktp CARG2, LJ_TCDATA | 2365 | | checktp CARG2, LJ_TCDATA |
2366 | | checktpne CARG4, LJ_TCDATA | 2366 | | checktpne CARG4, LJ_TCDATA |
2367 | | beq ->vmeta_equal_cd | 2367 | | beq ->vmeta_equal_cd |
2368 | } | 2368 | |.endif |
2369 | | cmp CARG2, CARG4 // Compare types. | 2369 | | cmp CARG2, CARG4 // Compare types. |
2370 | | bne >2 // Not the same type? | 2370 | | bne >2 // Not the same type? |
2371 | | checktp CARG2, LJ_TISPRI | 2371 | | checktp CARG2, LJ_TISPRI |
@@ -2421,12 +2421,12 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
2421 | | add PC, PC, #4 | 2421 | | add PC, PC, #4 |
2422 | | add RB, PC, RB, lsl #2 | 2422 | | add RB, PC, RB, lsl #2 |
2423 | | checktp CARG2, LJ_TSTR | 2423 | | checktp CARG2, LJ_TSTR |
2424 | if (LJ_HASFFI) { | 2424 | |.if FFI |
2425 | | bne >7 | 2425 | | bne >7 |
2426 | | cmp CARG1, CARG3 | 2426 | | cmp CARG1, CARG3 |
2427 | } else { | 2427 | |.else |
2428 | | cmpeq CARG1, CARG3 | 2428 | | cmpeq CARG1, CARG3 |
2429 | } | 2429 | |.endif |
2430 | if (vk) { | 2430 | if (vk) { |
2431 | | subeq PC, RB, #0x20000 | 2431 | | subeq PC, RB, #0x20000 |
2432 | |1: | 2432 | |1: |
@@ -2436,12 +2436,12 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
2436 | } | 2436 | } |
2437 | | ins_next | 2437 | | ins_next |
2438 | | | 2438 | | |
2439 | if (LJ_HASFFI) { | 2439 | |.if FFI |
2440 | |7: | 2440 | |7: |
2441 | | checktp CARG2, LJ_TCDATA | 2441 | | checktp CARG2, LJ_TCDATA |
2442 | | bne <1 | 2442 | | bne <1 |
2443 | | b ->vmeta_equal_cd | 2443 | | b ->vmeta_equal_cd |
2444 | } | 2444 | |.endif |
2445 | break; | 2445 | break; |
2446 | 2446 | ||
2447 | case BC_ISEQN: case BC_ISNEN: | 2447 | case BC_ISEQN: case BC_ISNEN: |
@@ -2474,14 +2474,14 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
2474 | | ins_next | 2474 | | ins_next |
2475 | | | 2475 | | |
2476 | |3: // CARG12 is not an integer. | 2476 | |3: // CARG12 is not an integer. |
2477 | if (LJ_HASFFI) { | 2477 | |.if FFI |
2478 | | bhi >7 | 2478 | | bhi >7 |
2479 | } else { | 2479 | |.else |
2480 | if (!vk) { | 2480 | if (!vk) { |
2481 | | subhi PC, RB, #0x20000 | 2481 | | subhi PC, RB, #0x20000 |
2482 | } | ||
2483 | | bhi <2 | ||
2484 | } | 2482 | } |
2483 | | bhi <2 | ||
2484 | |.endif | ||
2485 | | // CARG12 is a number. | 2485 | | // CARG12 is a number. |
2486 | | checktp CARG4, LJ_TISNUM | 2486 | | checktp CARG4, LJ_TISNUM |
2487 | | movlo RA, RB // Save RB. | 2487 | | movlo RA, RB // Save RB. |
@@ -2502,12 +2502,12 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
2502 | } | 2502 | } |
2503 | | b <2 | 2503 | | b <2 |
2504 | | | 2504 | | |
2505 | if (LJ_HASFFI) { | 2505 | |.if FFI |
2506 | |7: | 2506 | |7: |
2507 | | checktp CARG2, LJ_TCDATA | 2507 | | checktp CARG2, LJ_TCDATA |
2508 | | bne <1 | 2508 | | bne <1 |
2509 | | b ->vmeta_equal_cd | 2509 | | b ->vmeta_equal_cd |
2510 | } | 2510 | |.endif |
2511 | break; | 2511 | break; |
2512 | 2512 | ||
2513 | case BC_ISEQP: case BC_ISNEP: | 2513 | case BC_ISEQP: case BC_ISNEP: |
@@ -2518,10 +2518,10 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
2518 | | add PC, PC, #4 | 2518 | | add PC, PC, #4 |
2519 | | mvn RC, RC | 2519 | | mvn RC, RC |
2520 | | add RB, PC, RB, lsl #2 | 2520 | | add RB, PC, RB, lsl #2 |
2521 | if (LJ_HASFFI) { | 2521 | |.if FFI |
2522 | | checktp CARG2, LJ_TCDATA | 2522 | | checktp CARG2, LJ_TCDATA |
2523 | | beq ->vmeta_equal_cd | 2523 | | beq ->vmeta_equal_cd |
2524 | } | 2524 | |.endif |
2525 | | cmp CARG2, RC | 2525 | | cmp CARG2, RC |
2526 | if (vk) { | 2526 | if (vk) { |
2527 | | subeq PC, RB, #0x20000 | 2527 | | subeq PC, RB, #0x20000 |
@@ -2620,10 +2620,10 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
2620 | |3: | 2620 | |3: |
2621 | #endif | 2621 | #endif |
2622 | |->BC_LEN_Z: | 2622 | |->BC_LEN_Z: |
2623 | | IOS mov RC, BASE | 2623 | | .IOS mov RC, BASE |
2624 | | bl extern lj_tab_len // (GCtab *t) | 2624 | | bl extern lj_tab_len // (GCtab *t) |
2625 | | // Returns uint32_t (but less than 2^31). | 2625 | | // Returns uint32_t (but less than 2^31). |
2626 | | IOS mov BASE, RC | 2626 | | .IOS mov BASE, RC |
2627 | | b <1 | 2627 | | b <1 |
2628 | #ifdef LUAJIT_ENABLE_LUA52COMPAT | 2628 | #ifdef LUAJIT_ENABLE_LUA52COMPAT |
2629 | |9: | 2629 | |9: |
@@ -2729,9 +2729,9 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
2729 | | ins_arithpre | 2729 | | ins_arithpre |
2730 | | ins_arithfallback ins_arithcheck_num | 2730 | | ins_arithfallback ins_arithcheck_num |
2731 | |.if "fpcall" == "extern pow" | 2731 | |.if "fpcall" == "extern pow" |
2732 | | IOS mov RC, BASE | 2732 | | .IOS mov RC, BASE |
2733 | | bl fpcall | 2733 | | bl fpcall |
2734 | | IOS mov BASE, RC | 2734 | | .IOS mov BASE, RC |
2735 | |.else | 2735 | |.else |
2736 | | bl fpcall | 2736 | | bl fpcall |
2737 | |.endif | 2737 | |.endif |
@@ -2798,7 +2798,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
2798 | | ins_next3 | 2798 | | ins_next3 |
2799 | break; | 2799 | break; |
2800 | case BC_KCDATA: | 2800 | case BC_KCDATA: |
2801 | #if LJ_HASFFI | 2801 | |.if FFI |
2802 | | // RA = dst*8, RC = cdata_const (~) | 2802 | | // RA = dst*8, RC = cdata_const (~) |
2803 | | mvn RC, RC | 2803 | | mvn RC, RC |
2804 | | ins_next1 | 2804 | | ins_next1 |
@@ -2807,7 +2807,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
2807 | | ins_next2 | 2807 | | ins_next2 |
2808 | | strd CARG12, [BASE, RA] | 2808 | | strd CARG12, [BASE, RA] |
2809 | | ins_next3 | 2809 | | ins_next3 |
2810 | #endif | 2810 | |.endif |
2811 | break; | 2811 | break; |
2812 | case BC_KSHORT: | 2812 | case BC_KSHORT: |
2813 | | // RA = dst*8, (RC = int16_literal) | 2813 | | // RA = dst*8, (RC = int16_literal) |
@@ -2892,14 +2892,14 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
2892 | | sub CARG1, DISPATCH, #-GG_DISP2G | 2892 | | sub CARG1, DISPATCH, #-GG_DISP2G |
2893 | | tst RC, #LJ_GC_WHITES | 2893 | | tst RC, #LJ_GC_WHITES |
2894 | | // Crossed a write barrier. Move the barrier forward. | 2894 | | // Crossed a write barrier. Move the barrier forward. |
2895 | if (LJ_TARGET_IOS) { | 2895 | |.if IOS |
2896 | | beq <1 | 2896 | | beq <1 |
2897 | | mov RC, BASE | 2897 | | mov RC, BASE |
2898 | | bl extern lj_gc_barrieruv // (global_State *g, TValue *tv) | 2898 | | bl extern lj_gc_barrieruv // (global_State *g, TValue *tv) |
2899 | | mov BASE, RC | 2899 | | mov BASE, RC |
2900 | } else { | 2900 | |.else |
2901 | | blne extern lj_gc_barrieruv // (global_State *g, TValue *tv) | 2901 | | blne extern lj_gc_barrieruv // (global_State *g, TValue *tv) |
2902 | } | 2902 | |.endif |
2903 | | b <1 | 2903 | | b <1 |
2904 | break; | 2904 | break; |
2905 | case BC_USETS: | 2905 | case BC_USETS: |
@@ -2926,14 +2926,14 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
2926 | | cmpne RC, #0 | 2926 | | cmpne RC, #0 |
2927 | | sub CARG1, DISPATCH, #-GG_DISP2G | 2927 | | sub CARG1, DISPATCH, #-GG_DISP2G |
2928 | | // Crossed a write barrier. Move the barrier forward. | 2928 | | // Crossed a write barrier. Move the barrier forward. |
2929 | if (LJ_TARGET_IOS) { | 2929 | |.if IOS |
2930 | | beq <1 | 2930 | | beq <1 |
2931 | | mov RC, BASE | 2931 | | mov RC, BASE |
2932 | | bl extern lj_gc_barrieruv // (global_State *g, TValue *tv) | 2932 | | bl extern lj_gc_barrieruv // (global_State *g, TValue *tv) |
2933 | | mov BASE, RC | 2933 | | mov BASE, RC |
2934 | } else { | 2934 | |.else |
2935 | | blne extern lj_gc_barrieruv // (global_State *g, TValue *tv) | 2935 | | blne extern lj_gc_barrieruv // (global_State *g, TValue *tv) |
2936 | } | 2936 | |.endif |
2937 | | b <1 | 2937 | | b <1 |
2938 | break; | 2938 | break; |
2939 | case BC_USETN: | 2939 | case BC_USETN: |
@@ -3377,7 +3377,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
3377 | | str PC, SAVE_PC | 3377 | | str PC, SAVE_PC |
3378 | | bl extern lj_tab_reasize // (lua_State *L, GCtab *t, int nasize) | 3378 | | bl extern lj_tab_reasize // (lua_State *L, GCtab *t, int nasize) |
3379 | | // Must not reallocate the stack. | 3379 | | // Must not reallocate the stack. |
3380 | | IOS ldr BASE, L->base | 3380 | | .IOS ldr BASE, L->base |
3381 | | b <1 | 3381 | | b <1 |
3382 | | | 3382 | | |
3383 | |7: // Possible table write barrier for any value. Skip valiswhite check. | 3383 | |7: // Possible table write barrier for any value. Skip valiswhite check. |
@@ -3484,9 +3484,9 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
3484 | 3484 | ||
3485 | case BC_ITERN: | 3485 | case BC_ITERN: |
3486 | | // RA = base*8, (RB = nresults+1, RC = nargs+1 (2+1)) | 3486 | | // RA = base*8, (RB = nresults+1, RC = nargs+1 (2+1)) |
3487 | #if LJ_HASJIT | 3487 | |.if JIT |
3488 | | // NYI: add hotloop, record BC_ITERN. | 3488 | | // NYI: add hotloop, record BC_ITERN. |
3489 | #endif | 3489 | |.endif |
3490 | | add RA, BASE, RA | 3490 | | add RA, BASE, RA |
3491 | | ldr TAB:RB, [RA, #-16] | 3491 | | ldr TAB:RB, [RA, #-16] |
3492 | | ldr CARG1, [RA, #-8] // Get index from control var. | 3492 | | ldr CARG1, [RA, #-8] // Get index from control var. |
@@ -3737,9 +3737,9 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
3737 | |.define FOR_EXT, [RA, #24]; .define FOR_TEXT, [RA, #28] | 3737 | |.define FOR_EXT, [RA, #24]; .define FOR_TEXT, [RA, #28] |
3738 | 3738 | ||
3739 | case BC_FORL: | 3739 | case BC_FORL: |
3740 | #if LJ_HASJIT | 3740 | |.if JIT |
3741 | | hotloop | 3741 | | hotloop |
3742 | #endif | 3742 | |.endif |
3743 | | // Fall through. Assumes BC_IFORL follows. | 3743 | | // Fall through. Assumes BC_IFORL follows. |
3744 | break; | 3744 | break; |
3745 | 3745 | ||
@@ -3860,9 +3860,9 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
3860 | break; | 3860 | break; |
3861 | 3861 | ||
3862 | case BC_ITERL: | 3862 | case BC_ITERL: |
3863 | #if LJ_HASJIT | 3863 | |.if JIT |
3864 | | hotloop | 3864 | | hotloop |
3865 | #endif | 3865 | |.endif |
3866 | | // Fall through. Assumes BC_IITERL follows. | 3866 | | // Fall through. Assumes BC_IITERL follows. |
3867 | break; | 3867 | break; |
3868 | 3868 | ||
@@ -3891,9 +3891,9 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
3891 | | // RA = base*8, RC = target (loop extent) | 3891 | | // RA = base*8, RC = target (loop extent) |
3892 | | // Note: RA/RC is only used by trace recorder to determine scope/extent | 3892 | | // Note: RA/RC is only used by trace recorder to determine scope/extent |
3893 | | // This opcode does NOT jump, it's only purpose is to detect a hot loop. | 3893 | | // This opcode does NOT jump, it's only purpose is to detect a hot loop. |
3894 | #if LJ_HASJIT | 3894 | |.if JIT |
3895 | | hotloop | 3895 | | hotloop |
3896 | #endif | 3896 | |.endif |
3897 | | // Fall through. Assumes BC_ILOOP follows. | 3897 | | // Fall through. Assumes BC_ILOOP follows. |
3898 | break; | 3898 | break; |
3899 | 3899 | ||
@@ -3903,7 +3903,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
3903 | break; | 3903 | break; |
3904 | 3904 | ||
3905 | case BC_JLOOP: | 3905 | case BC_JLOOP: |
3906 | #if LJ_HASJIT | 3906 | |.if JIT |
3907 | | // RA = base (ignored), RC = traceno | 3907 | | // RA = base (ignored), RC = traceno |
3908 | | ldr CARG1, [DISPATCH, #DISPATCH_J(trace)] | 3908 | | ldr CARG1, [DISPATCH, #DISPATCH_J(trace)] |
3909 | | mov CARG2, #0 // Traces on ARM don't store the trace number, so use 0. | 3909 | | mov CARG2, #0 // Traces on ARM don't store the trace number, so use 0. |
@@ -3913,7 +3913,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
3913 | | str BASE, [DISPATCH, #DISPATCH_GL(jit_base)] | 3913 | | str BASE, [DISPATCH, #DISPATCH_GL(jit_base)] |
3914 | | str L, [DISPATCH, #DISPATCH_GL(jit_L)] | 3914 | | str L, [DISPATCH, #DISPATCH_GL(jit_L)] |
3915 | | bx RA | 3915 | | bx RA |
3916 | #endif | 3916 | |.endif |
3917 | break; | 3917 | break; |
3918 | 3918 | ||
3919 | case BC_JMP: | 3919 | case BC_JMP: |
@@ -3926,9 +3926,9 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
3926 | /* -- Function headers -------------------------------------------------- */ | 3926 | /* -- Function headers -------------------------------------------------- */ |
3927 | 3927 | ||
3928 | case BC_FUNCF: | 3928 | case BC_FUNCF: |
3929 | #if LJ_HASJIT | 3929 | |.if JIT |
3930 | | hotcall | 3930 | | hotcall |
3931 | #endif | 3931 | |.endif |
3932 | case BC_FUNCV: /* NYI: compiled vararg functions. */ | 3932 | case BC_FUNCV: /* NYI: compiled vararg functions. */ |
3933 | | // Fall through. Assumes BC_IFUNCF/BC_IFUNCV follow. | 3933 | | // Fall through. Assumes BC_IFUNCF/BC_IFUNCV follow. |
3934 | break; | 3934 | break; |