diff options
author | Mike Pall <mike> | 2011-04-16 23:31:30 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2011-04-16 23:32:44 +0200 |
commit | 32db4525d9e02aba29cf393025afcb1febff8458 (patch) | |
tree | 179d4617303fd90b7dca7c30974671bd9bf7f010 /src | |
parent | add553edd89e8e8472439d17b14c06c1d983ba6b (diff) | |
download | luajit-32db4525d9e02aba29cf393025afcb1febff8458.tar.gz luajit-32db4525d9e02aba29cf393025afcb1febff8458.tar.bz2 luajit-32db4525d9e02aba29cf393025afcb1febff8458.zip |
ARM: Misc. fixes for interpreter.
Diffstat (limited to 'src')
-rw-r--r-- | src/buildvm.h | 2 | ||||
-rw-r--r-- | src/buildvm_arm.dasc | 49 |
2 files changed, 27 insertions, 24 deletions
diff --git a/src/buildvm.h b/src/buildvm.h index 011ada2a..a24d9453 100644 --- a/src/buildvm.h +++ b/src/buildvm.h | |||
@@ -16,7 +16,7 @@ | |||
16 | #include "lj_arch.h" | 16 | #include "lj_arch.h" |
17 | 17 | ||
18 | /* Hardcoded limits. Increase as needed. */ | 18 | /* Hardcoded limits. Increase as needed. */ |
19 | #define BUILD_MAX_RELOC 100 /* Max. number of relocations. */ | 19 | #define BUILD_MAX_RELOC 200 /* Max. number of relocations. */ |
20 | #define BUILD_MAX_FOLD 4096 /* Max. number of fold rules. */ | 20 | #define BUILD_MAX_FOLD 4096 /* Max. number of fold rules. */ |
21 | 21 | ||
22 | /* Prefix for scanned library definitions. */ | 22 | /* Prefix for scanned library definitions. */ |
diff --git a/src/buildvm_arm.dasc b/src/buildvm_arm.dasc index b0338702..905e0ada 100644 --- a/src/buildvm_arm.dasc +++ b/src/buildvm_arm.dasc | |||
@@ -1544,27 +1544,27 @@ static void build_subroutines(BuildCtx *ctx) | |||
1544 | |->vm_tobit_fb: | 1544 | |->vm_tobit_fb: |
1545 | | bhi ->fff_fallback | 1545 | | bhi ->fff_fallback |
1546 | |->vm_tobit: | 1546 | |->vm_tobit: |
1547 | | lsl CARG3, CARG2, #1 | 1547 | | lsl RB, CARG2, #1 |
1548 | | adds CARG3, CARG3, #0x00200000 | 1548 | | adds RB, RB, #0x00200000 |
1549 | | movpl CARG1, #0 // |x| < 1? | 1549 | | movpl CARG1, #0 // |x| < 1? |
1550 | | bxpl lr | 1550 | | bxpl lr |
1551 | | mvn CARG4, #0x3e0 | 1551 | | mvn CARG4, #0x3e0 |
1552 | | subs CARG3, CARG4, CARG3, asr #21 | 1552 | | subs RB, CARG4, RB, asr #21 |
1553 | | bmi >1 // |x| >= 2^32? | 1553 | | bmi >1 // |x| >= 2^32? |
1554 | | lsl CARG4, CARG2, #11 | 1554 | | lsl CARG4, CARG2, #11 |
1555 | | orr CARG4, CARG4, #0x80000000 | 1555 | | orr CARG4, CARG4, #0x80000000 |
1556 | | orr CARG4, CARG4, CARG1, lsr #21 | 1556 | | orr CARG4, CARG4, CARG1, lsr #21 |
1557 | | cmp CARG2, #0 | 1557 | | cmp CARG2, #0 |
1558 | | lsr CARG1, CARG4, CARG3 | 1558 | | lsr CARG1, CARG4, RB |
1559 | | rsblt CARG1, CARG1, #0 | 1559 | | rsblt CARG1, CARG1, #0 |
1560 | | bx lr | 1560 | | bx lr |
1561 | |1: | 1561 | |1: |
1562 | | add CARG3, CARG3, #21 | 1562 | | add RB, RB, #21 |
1563 | | lsr CARG4, CARG1, CARG3 | 1563 | | lsr CARG4, CARG1, RB |
1564 | | rsb CARG3, CARG3, #20 | 1564 | | rsb RB, RB, #20 |
1565 | | lsl CARG1, CARG2, #12 | 1565 | | lsl CARG1, CARG2, #12 |
1566 | | cmp CARG2, #0 | 1566 | | cmp CARG2, #0 |
1567 | | orr CARG1, CARG4, CARG1, lsl CARG3 | 1567 | | orr CARG1, CARG4, CARG1, lsl RB |
1568 | | rsblt CARG1, CARG1, #0 | 1568 | | rsblt CARG1, CARG1, #0 |
1569 | | bx lr | 1569 | | bx lr |
1570 | | | 1570 | | |
@@ -2120,6 +2120,9 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
2120 | | ins_next | 2120 | | ins_next |
2121 | | | 2121 | | |
2122 | |3: // CARG12 is not an integer. | 2122 | |3: // CARG12 is not an integer. |
2123 | if (!vk) { | ||
2124 | | subhi PC, RB, #0x20000 | ||
2125 | } | ||
2123 | | bhi <1 | 2126 | | bhi <1 |
2124 | | // CARG12 is a number. | 2127 | | // CARG12 is a number. |
2125 | | checktp CARG4, LJ_TISNUM | 2128 | | checktp CARG4, LJ_TISNUM |
@@ -2396,8 +2399,8 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
2396 | | mvn RC, RC | 2399 | | mvn RC, RC |
2397 | | ins_next1 | 2400 | | ins_next1 |
2398 | | ldr CARG1, [KBASE, RC, lsl #2] | 2401 | | ldr CARG1, [KBASE, RC, lsl #2] |
2399 | | ins_next2 | ||
2400 | | mvn CARG2, #~LJ_TSTR | 2402 | | mvn CARG2, #~LJ_TSTR |
2403 | | ins_next2 | ||
2401 | | strd CARG12, [BASE, RA] | 2404 | | strd CARG12, [BASE, RA] |
2402 | | ins_next3 | 2405 | | ins_next3 |
2403 | break; | 2406 | break; |
@@ -2890,7 +2893,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
2890 | | b <3 // No 2nd write barrier needed. | 2893 | | b <3 // No 2nd write barrier needed. |
2891 | | | 2894 | | |
2892 | |7: // Possible table write barrier for the value. Skip valiswhite check. | 2895 | |7: // Possible table write barrier for the value. Skip valiswhite check. |
2893 | | barrierback TAB:CARG1, CARG2, CARG3 | 2896 | | barrierback TAB:RB, CARG2, CARG3 |
2894 | | b <3 | 2897 | | b <3 |
2895 | break; | 2898 | break; |
2896 | case BC_TSETB: | 2899 | case BC_TSETB: |
@@ -2939,23 +2942,23 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
2939 | |1: | 2942 | |1: |
2940 | | ldr RB, SAVE_MULTRES | 2943 | | ldr RB, SAVE_MULTRES |
2941 | | ldr TAB:CARG2, [RA, #-8] // Guaranteed to be a table. | 2944 | | ldr TAB:CARG2, [RA, #-8] // Guaranteed to be a table. |
2942 | | ldr CARG4, [KBASE, RC, lsl #3] // Integer constant is in lo-word. | 2945 | | ldr CARG1, [KBASE, RC, lsl #3] // Integer constant is in lo-word. |
2943 | | subs RB, RB, #8 | 2946 | | subs RB, RB, #8 |
2944 | | ldr CARG1, TAB:CARG2->asize | 2947 | | ldr CARG4, TAB:CARG2->asize |
2945 | | beq >4 // Nothing to copy? | 2948 | | beq >4 // Nothing to copy? |
2946 | | add CARG3, CARG4, RB, lsr #3 | 2949 | | add CARG3, CARG1, RB, lsr #3 |
2947 | | cmp CARG3, CARG1 | 2950 | | cmp CARG3, CARG4 |
2948 | | ldr CARG1, TAB:CARG2->array | 2951 | | ldr CARG4, TAB:CARG2->array |
2949 | | add RB, RA, RB | 2952 | | add RB, RA, RB |
2950 | | bhi >5 | 2953 | | bhi >5 |
2951 | | add INS, CARG1, CARG4, lsl #3 | 2954 | | add INS, CARG4, CARG1, lsl #3 |
2952 | | ldrb CARG4, TAB:CARG2->marked | 2955 | | ldrb CARG1, TAB:CARG2->marked |
2953 | |3: // Copy result slots to table. | 2956 | |3: // Copy result slots to table. |
2954 | | ldrd CARG12, [RA], #8 | 2957 | | ldrd CARG34, [RA], #8 |
2955 | | strd CARG12, [INS], #8 | 2958 | | strd CARG34, [INS], #8 |
2956 | | cmp RA, RB | 2959 | | cmp RA, RB |
2957 | | blo <3 | 2960 | | blo <3 |
2958 | | tst CARG4, #LJ_GC_BLACK // isblack(table) | 2961 | | tst CARG1, #LJ_GC_BLACK // isblack(table) |
2959 | | bne >7 | 2962 | | bne >7 |
2960 | |4: | 2963 | |4: |
2961 | | ins_next | 2964 | | ins_next |
@@ -2969,7 +2972,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
2969 | | b <1 | 2972 | | b <1 |
2970 | | | 2973 | | |
2971 | |7: // Possible table write barrier for any value. Skip valiswhite check. | 2974 | |7: // Possible table write barrier for any value. Skip valiswhite check. |
2972 | | barrierback TAB:RB, CARG4, CARG1 | 2975 | | barrierback TAB:RB, CARG1, CARG2 |
2973 | | b <4 | 2976 | | b <4 |
2974 | break; | 2977 | break; |
2975 | 2978 | ||
@@ -3010,13 +3013,13 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
3010 | | checkfunc CARG4, ->vmeta_callt | 3013 | | checkfunc CARG4, ->vmeta_callt |
3011 | | ldr PC, [BASE, FRAME_PC] | 3014 | | ldr PC, [BASE, FRAME_PC] |
3012 | |->BC_CALLT2_Z: | 3015 | |->BC_CALLT2_Z: |
3013 | | str LFUNC:CARG3, [BASE, FRAME_FUNC] // Copy function down, but keep PC. | 3016 | | mov RB, #0 |
3014 | | ldrb CARG4, LFUNC:CARG3->ffid | 3017 | | ldrb CARG4, LFUNC:CARG3->ffid |
3015 | | tst PC, #FRAME_TYPE | 3018 | | tst PC, #FRAME_TYPE |
3016 | | bne >7 | 3019 | | bne >7 |
3017 | |1: | 3020 | |1: |
3021 | | str LFUNC:CARG3, [BASE, FRAME_FUNC] // Copy function down, but keep PC. | ||
3018 | | cmp NARGS8:RC, #0 | 3022 | | cmp NARGS8:RC, #0 |
3019 | | mov RB, #0 | ||
3020 | | beq >3 | 3023 | | beq >3 |
3021 | |2: | 3024 | |2: |
3022 | | ldrd CARG12, [RA, RB] | 3025 | | ldrd CARG12, [RA, RB] |