diff options
author | Mike Pall <mike> | 2011-06-05 23:35:43 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2011-06-05 23:36:49 +0200 |
commit | a175754ab74e35b9d6b1a81b94019d7a720813c1 (patch) | |
tree | 67a83b2c97bf6a53881465e5b4a328fd0077c9d8 | |
parent | 7ad4908a4880523c5822d006055dc5d6db4556ea (diff) | |
download | luajit-a175754ab74e35b9d6b1a81b94019d7a720813c1.tar.gz luajit-a175754ab74e35b9d6b1a81b94019d7a720813c1.tar.bz2 luajit-a175754ab74e35b9d6b1a81b94019d7a720813c1.zip |
PPC: Add lj_vm_floor which is callable from C.
-rw-r--r-- | src/buildvm_ppc.dasc | 17 | ||||
-rw-r--r-- | src/buildvm_ppcspe.h | 377 |
2 files changed, 205 insertions, 189 deletions
diff --git a/src/buildvm_ppc.dasc b/src/buildvm_ppc.dasc index b9564621..c257de45 100644 --- a/src/buildvm_ppc.dasc +++ b/src/buildvm_ppc.dasc | |||
@@ -1963,14 +1963,14 @@ static void build_subroutines(BuildCtx *ctx) | |||
1963 | |// | 1963 | |// |
1964 | |.macro vm_round, name, mode | 1964 | |.macro vm_round, name, mode |
1965 | | // Used temporaries: TMP0, TMP1, TMP2, TMP3. | 1965 | | // Used temporaries: TMP0, TMP1, TMP2, TMP3. |
1966 | |->name: // Input: CARG2, output: CRET2 | 1966 | |->name.._efd: // Input: CARG2, output: CRET2 |
1967 | | evmergehi CARG1, CARG2, CARG2 | 1967 | | evmergehi CARG1, CARG2, CARG2 |
1968 | |->name.._hilo: | 1968 | |->name.._hilo: |
1969 | | // Input: CARG1 (hi), CARG2 (hi, lo), output: CRET2 | 1969 | | // Input: CARG1 (hi), CARG2 (hi, lo), output: CRET2 |
1970 | | rlwinm TMP2, CARG1, 12, 21, 31 | 1970 | | rlwinm TMP2, CARG1, 12, 21, 31 |
1971 | | addic. TMP2, TMP2, -1023 // exp = exponent(x) - 1023 | 1971 | | addic. TMP2, TMP2, -1023 // exp = exponent(x) - 1023 |
1972 | | li TMP1, -1 | 1972 | | li TMP1, -1 |
1973 | | cmplwi cr1, TMP2, 51 // 0 <= exp < 51? | 1973 | | cmplwi cr1, TMP2, 51 // 0 <= exp <= 51? |
1974 | | subfic TMP0, TMP2, 52 | 1974 | | subfic TMP0, TMP2, 52 |
1975 | | bgt cr1, >1 | 1975 | | bgt cr1, >1 |
1976 | | lus TMP3, 0xfff0 | 1976 | | lus TMP3, 0xfff0 |
@@ -2022,12 +2022,19 @@ static void build_subroutines(BuildCtx *ctx) | |||
2022 | | blr | 2022 | | blr |
2023 | |.endmacro | 2023 | |.endmacro |
2024 | | | 2024 | | |
2025 | |->vm_floor: | ||
2026 | | mflr CARG3 | ||
2027 | | bl ->vm_floor_hilo | ||
2028 | | mtlr CARG3 | ||
2029 | | evmergehi CRET1, CRET2, CRET2 | ||
2030 | | blr | ||
2031 | | | ||
2025 | | vm_round vm_floor, 0 | 2032 | | vm_round vm_floor, 0 |
2026 | | vm_round vm_ceil, 1 | 2033 | | vm_round vm_ceil, 1 |
2027 | #if LJ_HASJIT | 2034 | #if LJ_HASJIT |
2028 | | vm_round vm_trunc, 2 | 2035 | | vm_round vm_trunc, 2 |
2029 | #else | 2036 | #else |
2030 | |->vm_trunc: | 2037 | |->vm_trunc_efd: |
2031 | |->vm_trunc_hilo: | 2038 | |->vm_trunc_hilo: |
2032 | #endif | 2039 | #endif |
2033 | | | 2040 | | |
@@ -2060,7 +2067,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
2060 | |2: | 2067 | |2: |
2061 | | cmplwi CARG5, 5; beq >1; bgt >2 | 2068 | | cmplwi CARG5, 5; beq >1; bgt >2 |
2062 | | evmr CARG3, CARG2; efddiv CRET2, CARG2, CARG4; evmr RB, CARG4 | 2069 | | evmr CARG3, CARG2; efddiv CRET2, CARG2, CARG4; evmr RB, CARG4 |
2063 | | mflr RC; bl ->vm_floor; mtlr RC | 2070 | | mflr RC; bl ->vm_floor_efd; mtlr RC |
2064 | | efdmul CRET2, CRET2, RB; efdsub CRET2, CARG3, CRET2 | 2071 | | efdmul CRET2, CRET2, RB; efdsub CRET2, CARG3, CRET2 |
2065 | | evmergehi CRET1, CRET2, CRET2; blr | 2072 | | evmergehi CRET1, CRET2, CRET2; blr |
2066 | |1: | 2073 | |1: |
@@ -2387,7 +2394,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
2387 | | ins_arithpre RD, SAVE0 | 2394 | | ins_arithpre RD, SAVE0 |
2388 | |->BC_MODVN_Z: | 2395 | |->BC_MODVN_Z: |
2389 | | efddiv CARG2, RD, SAVE0 | 2396 | | efddiv CARG2, RD, SAVE0 |
2390 | | bl ->vm_floor // floor(b/c) | 2397 | | bl ->vm_floor_efd // floor(b/c) |
2391 | | efdmul TMP0, CRET2, SAVE0 | 2398 | | efdmul TMP0, CRET2, SAVE0 |
2392 | | ins_next1 | 2399 | | ins_next1 |
2393 | | efdsub TMP0, RD, TMP0 // b - floor(b/c)*c | 2400 | | efdsub TMP0, RD, TMP0 // b - floor(b/c)*c |
diff --git a/src/buildvm_ppcspe.h b/src/buildvm_ppcspe.h index 30497fc7..59cd96fa 100644 --- a/src/buildvm_ppcspe.h +++ b/src/buildvm_ppcspe.h | |||
@@ -12,7 +12,7 @@ | |||
12 | #define DASM_SECTION_CODE_OP 0 | 12 | #define DASM_SECTION_CODE_OP 0 |
13 | #define DASM_SECTION_CODE_SUB 1 | 13 | #define DASM_SECTION_CODE_SUB 1 |
14 | #define DASM_MAXSECTION 2 | 14 | #define DASM_MAXSECTION 2 |
15 | static const unsigned int build_actionlist[4954] = { | 15 | static const unsigned int build_actionlist[4961] = { |
16 | 0x00010001, | 16 | 0x00010001, |
17 | 0x00060014, | 17 | 0x00060014, |
18 | 0x72000000, | 18 | 0x72000000, |
@@ -2637,6 +2637,13 @@ static const unsigned int build_actionlist[4954] = { | |||
2637 | 0x7c810808, | 2637 | 0x7c810808, |
2638 | 0x00000000, | 2638 | 0x00000000, |
2639 | 0x00060092, | 2639 | 0x00060092, |
2640 | 0x7ca802a6, | ||
2641 | 0x48000001, | ||
2642 | 0x00050059, | ||
2643 | 0x7ca803a6, | ||
2644 | 0x1064222c, | ||
2645 | 0x4e800020, | ||
2646 | 0x00060093, | ||
2640 | 0x1064222c, | 2647 | 0x1064222c, |
2641 | 0x00060059, | 2648 | 0x00060059, |
2642 | 0x5469657e, | 2649 | 0x5469657e, |
@@ -2674,7 +2681,7 @@ static const unsigned int build_actionlist[4954] = { | |||
2674 | 0x5103007e, | 2681 | 0x5103007e, |
2675 | 0x1083022d, | 2682 | 0x1083022d, |
2676 | 0x4e800020, | 2683 | 0x4e800020, |
2677 | 0x00060093, | 2684 | 0x00060094, |
2678 | 0x1064222c, | 2685 | 0x1064222c, |
2679 | 0x0006005b, | 2686 | 0x0006005b, |
2680 | 0x5469657e, | 2687 | 0x5469657e, |
@@ -2713,9 +2720,9 @@ static const unsigned int build_actionlist[4954] = { | |||
2713 | 0x1083022d, | 2720 | 0x1083022d, |
2714 | 0x4e800020, | 2721 | 0x4e800020, |
2715 | 0x00000000, | 2722 | 0x00000000, |
2716 | 0x00060094, | ||
2717 | 0x1064222c, | ||
2718 | 0x00060095, | 2723 | 0x00060095, |
2724 | 0x1064222c, | ||
2725 | 0x00060096, | ||
2719 | 0x5469657e, | 2726 | 0x5469657e, |
2720 | 0x3529fc01, | 2727 | 0x3529fc01, |
2721 | 0x3900ffff, | 2728 | 0x3900ffff, |
@@ -2736,18 +2743,18 @@ static const unsigned int build_actionlist[4954] = { | |||
2736 | 0x1088022d, | 2743 | 0x1088022d, |
2737 | 0x4e800020, | 2744 | 0x4e800020, |
2738 | 0x00000000, | 2745 | 0x00000000, |
2739 | 0x00060094, | ||
2740 | 0x00060095, | 2746 | 0x00060095, |
2741 | 0x00000000, | ||
2742 | 0x00060096, | 2747 | 0x00060096, |
2743 | 0x00000000, | 2748 | 0x00000000, |
2744 | 0x7c810808, | ||
2745 | 0x00000000, | ||
2746 | 0x00060097, | 2749 | 0x00060097, |
2747 | 0x00000000, | 2750 | 0x00000000, |
2748 | 0x7c810808, | 2751 | 0x7c810808, |
2749 | 0x00000000, | 2752 | 0x00000000, |
2750 | 0x00060098, | 2753 | 0x00060098, |
2754 | 0x00000000, | ||
2755 | 0x7c810808, | ||
2756 | 0x00000000, | ||
2757 | 0x00060099, | ||
2751 | 0x1083222d, | 2758 | 0x1083222d, |
2752 | 0x28070001, | 2759 | 0x28070001, |
2753 | 0x10c5322d, | 2760 | 0x10c5322d, |
@@ -2786,7 +2793,7 @@ static const unsigned int build_actionlist[4954] = { | |||
2786 | 0x11463217, | 2793 | 0x11463217, |
2787 | 0x7d6802a6, | 2794 | 0x7d6802a6, |
2788 | 0x48000001, | 2795 | 0x48000001, |
2789 | 0x00050092, | 2796 | 0x00050093, |
2790 | 0x7d6803a6, | 2797 | 0x7d6803a6, |
2791 | 0x108452e8, | 2798 | 0x108452e8, |
2792 | 0x108522e1, | 2799 | 0x108522e1, |
@@ -2808,7 +2815,7 @@ static const unsigned int build_actionlist[4954] = { | |||
2808 | 0x4e800020, | 2815 | 0x4e800020, |
2809 | 0x0006000c, | 2816 | 0x0006000c, |
2810 | 0x7c810808, | 2817 | 0x7c810808, |
2811 | 0x00060099, | 2818 | 0x0006009a, |
2812 | 0x00000000, | 2819 | 0x00000000, |
2813 | 0x7c810808, | 2820 | 0x7c810808, |
2814 | 0x00000000, | 2821 | 0x00000000, |
@@ -3270,10 +3277,10 @@ static const unsigned int build_actionlist[4954] = { | |||
3270 | 0x40830000, | 3277 | 0x40830000, |
3271 | 0x0005083d, | 3278 | 0x0005083d, |
3272 | 0x00000000, | 3279 | 0x00000000, |
3273 | 0x0006009a, | 3280 | 0x0006009b, |
3274 | 0x108caae9, | 3281 | 0x108caae9, |
3275 | 0x48000001, | 3282 | 0x48000001, |
3276 | 0x00050092, | 3283 | 0x00050093, |
3277 | 0x1004aae8, | 3284 | 0x1004aae8, |
3278 | 0x80f00000, | 3285 | 0x80f00000, |
3279 | 0x3a100004, | 3286 | 0x3a100004, |
@@ -3308,7 +3315,7 @@ static const unsigned int build_actionlist[4954] = { | |||
3308 | 0x0005083d, | 3315 | 0x0005083d, |
3309 | 0x00000000, | 3316 | 0x00000000, |
3310 | 0x48000000, | 3317 | 0x48000000, |
3311 | 0x0005009a, | 3318 | 0x0005009b, |
3312 | 0x00000000, | 3319 | 0x00000000, |
3313 | 0x108e5300, | 3320 | 0x108e5300, |
3314 | 0x10ce5b00, | 3321 | 0x10ce5b00, |
@@ -3743,10 +3750,10 @@ static const unsigned int build_actionlist[4954] = { | |||
3743 | 0x7d6f402e, | 3750 | 0x7d6f402e, |
3744 | 0x00000000, | 3751 | 0x00000000, |
3745 | 0x48000000, | 3752 | 0x48000000, |
3746 | 0x0005009b, | 3753 | 0x0005009c, |
3747 | 0x00000000, | 3754 | 0x00000000, |
3748 | 0x48000000, | 3755 | 0x48000000, |
3749 | 0x0005009c, | 3756 | 0x0005009d, |
3750 | 0x00000000, | 3757 | 0x00000000, |
3751 | 0x114e5300, | 3758 | 0x114e5300, |
3752 | 0x116e5b00, | 3759 | 0x116e5b00, |
@@ -3802,7 +3809,7 @@ static const unsigned int build_actionlist[4954] = { | |||
3802 | 0x0006000f, | 3809 | 0x0006000f, |
3803 | 0x100bba34, | 3810 | 0x100bba34, |
3804 | 0x41800000, | 3811 | 0x41800000, |
3805 | 0x0005089b, | 3812 | 0x0005089c, |
3806 | 0x48000000, | 3813 | 0x48000000, |
3807 | 0x0005002f, | 3814 | 0x0005002f, |
3808 | 0x00000000, | 3815 | 0x00000000, |
@@ -3814,7 +3821,7 @@ static const unsigned int build_actionlist[4954] = { | |||
3814 | 0x7d6f402e, | 3821 | 0x7d6f402e, |
3815 | 0x40800000, | 3822 | 0x40800000, |
3816 | 0x0005082c, | 3823 | 0x0005082c, |
3817 | 0x0006009b, | 3824 | 0x0006009c, |
3818 | 0x800a0000, | 3825 | 0x800a0000, |
3819 | 0x00098200, | 3826 | 0x00098200, |
3820 | 0x810b0000, | 3827 | 0x810b0000, |
@@ -3981,7 +3988,7 @@ static const unsigned int build_actionlist[4954] = { | |||
3981 | 0x0006000f, | 3988 | 0x0006000f, |
3982 | 0x100bba34, | 3989 | 0x100bba34, |
3983 | 0x41800000, | 3990 | 0x41800000, |
3984 | 0x0005089c, | 3991 | 0x0005089d, |
3985 | 0x48000000, | 3992 | 0x48000000, |
3986 | 0x00050033, | 3993 | 0x00050033, |
3987 | 0x00060011, | 3994 | 0x00060011, |
@@ -4006,7 +4013,7 @@ static const unsigned int build_actionlist[4954] = { | |||
4006 | 0x7d6f402e, | 4013 | 0x7d6f402e, |
4007 | 0x40800000, | 4014 | 0x40800000, |
4008 | 0x00050830, | 4015 | 0x00050830, |
4009 | 0x0006009c, | 4016 | 0x0006009d, |
4010 | 0x800a0000, | 4017 | 0x800a0000, |
4011 | 0x00098200, | 4018 | 0x00098200, |
4012 | 0x810b0000, | 4019 | 0x810b0000, |
@@ -4607,7 +4614,7 @@ static const unsigned int build_actionlist[4954] = { | |||
4607 | 0x6a080000, | 4614 | 0x6a080000, |
4608 | 0x00090200, | 4615 | 0x00090200, |
4609 | 0x40820000, | 4616 | 0x40820000, |
4610 | 0x0005089d, | 4617 | 0x0005089e, |
4611 | 0x00060017, | 4618 | 0x00060017, |
4612 | 0x80f0fffc, | 4619 | 0x80f0fffc, |
4613 | 0x2c0c0008, | 4620 | 0x2c0c0008, |
@@ -4658,7 +4665,7 @@ static const unsigned int build_actionlist[4954] = { | |||
4658 | 0x13494320, | 4665 | 0x13494320, |
4659 | 0x48000000, | 4666 | 0x48000000, |
4660 | 0x0005000f, | 4667 | 0x0005000f, |
4661 | 0x0006009d, | 4668 | 0x0006009e, |
4662 | 0x71090000, | 4669 | 0x71090000, |
4663 | 0x00090200, | 4670 | 0x00090200, |
4664 | 0x40820000, | 4671 | 0x40820000, |
@@ -4676,7 +4683,7 @@ static const unsigned int build_actionlist[4954] = { | |||
4676 | 0x6a080000, | 4683 | 0x6a080000, |
4677 | 0x00090200, | 4684 | 0x00090200, |
4678 | 0x40820000, | 4685 | 0x40820000, |
4679 | 0x0005089d, | 4686 | 0x0005089e, |
4680 | 0x80f0fffc, | 4687 | 0x80f0fffc, |
4681 | 0x392efff8, | 4688 | 0x392efff8, |
4682 | 0x54ea5d78, | 4689 | 0x54ea5d78, |
@@ -5097,8 +5104,9 @@ enum { | |||
5097 | GLOB_vm_exit_handler, | 5104 | GLOB_vm_exit_handler, |
5098 | GLOB_vm_exit_interp, | 5105 | GLOB_vm_exit_interp, |
5099 | GLOB_vm_floor, | 5106 | GLOB_vm_floor, |
5100 | GLOB_vm_ceil, | 5107 | GLOB_vm_floor_efd, |
5101 | GLOB_vm_trunc, | 5108 | GLOB_vm_ceil_efd, |
5109 | GLOB_vm_trunc_efd, | ||
5102 | GLOB_vm_trunc_hilo, | 5110 | GLOB_vm_trunc_hilo, |
5103 | GLOB_vm_powi, | 5111 | GLOB_vm_powi, |
5104 | GLOB_vm_foldfpm, | 5112 | GLOB_vm_foldfpm, |
@@ -5238,8 +5246,9 @@ static const char *const globnames[] = { | |||
5238 | "vm_exit_handler", | 5246 | "vm_exit_handler", |
5239 | "vm_exit_interp", | 5247 | "vm_exit_interp", |
5240 | "vm_floor", | 5248 | "vm_floor", |
5241 | "vm_ceil", | 5249 | "vm_floor_efd", |
5242 | "vm_trunc", | 5250 | "vm_ceil_efd", |
5251 | "vm_trunc_efd", | ||
5243 | "vm_trunc_hilo", | 5252 | "vm_trunc_hilo", |
5244 | "vm_powi", | 5253 | "vm_powi", |
5245 | "vm_foldfpm", | 5254 | "vm_foldfpm", |
@@ -5407,21 +5416,21 @@ static void build_subroutines(BuildCtx *ctx) | |||
5407 | #endif | 5416 | #endif |
5408 | dasm_put(Dst, 2623); | 5417 | dasm_put(Dst, 2623); |
5409 | #if LJ_HASJIT | 5418 | #if LJ_HASJIT |
5410 | dasm_put(Dst, 2700); | 5419 | dasm_put(Dst, 2707); |
5411 | #else | 5420 | #else |
5412 | dasm_put(Dst, 2723); | 5421 | dasm_put(Dst, 2730); |
5413 | #endif | 5422 | #endif |
5414 | dasm_put(Dst, 2726); | 5423 | dasm_put(Dst, 2733); |
5415 | #if LJ_HASJIT | 5424 | #if LJ_HASJIT |
5416 | dasm_put(Dst, 2728); | 5425 | dasm_put(Dst, 2735); |
5417 | #endif | 5426 | #endif |
5418 | dasm_put(Dst, 2730); | 5427 | dasm_put(Dst, 2737); |
5419 | #if LJ_HASJIT | 5428 | #if LJ_HASJIT |
5420 | dasm_put(Dst, 2732); | 5429 | dasm_put(Dst, 2739); |
5421 | #endif | 5430 | #endif |
5422 | dasm_put(Dst, 2734); | 5431 | dasm_put(Dst, 2741); |
5423 | #if LJ_HASFFI | 5432 | #if LJ_HASFFI |
5424 | dasm_put(Dst, 2797); | 5433 | dasm_put(Dst, 2804); |
5425 | #endif | 5434 | #endif |
5426 | } | 5435 | } |
5427 | 5436 | ||
@@ -5429,7 +5438,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
5429 | static void build_ins(BuildCtx *ctx, BCOp op, int defop) | 5438 | static void build_ins(BuildCtx *ctx, BCOp op, int defop) |
5430 | { | 5439 | { |
5431 | int vk = 0; | 5440 | int vk = 0; |
5432 | dasm_put(Dst, 2799, defop); | 5441 | dasm_put(Dst, 2806, defop); |
5433 | 5442 | ||
5434 | switch (op) { | 5443 | switch (op) { |
5435 | 5444 | ||
@@ -5438,112 +5447,112 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
5438 | /* Remember: all ops branch for a true comparison, fall through otherwise. */ | 5447 | /* Remember: all ops branch for a true comparison, fall through otherwise. */ |
5439 | 5448 | ||
5440 | case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT: | 5449 | case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT: |
5441 | dasm_put(Dst, 2801, -(BCBIAS_J*4 >> 16)); | 5450 | dasm_put(Dst, 2808, -(BCBIAS_J*4 >> 16)); |
5442 | if (op == BC_ISLE || op == BC_ISGT) { | 5451 | if (op == BC_ISLE || op == BC_ISGT) { |
5443 | dasm_put(Dst, 2815); | 5452 | dasm_put(Dst, 2822); |
5444 | } | 5453 | } |
5445 | if (op == BC_ISLT || op == BC_ISLE) { | 5454 | if (op == BC_ISLT || op == BC_ISLE) { |
5446 | dasm_put(Dst, 2818); | 5455 | dasm_put(Dst, 2825); |
5447 | } else { | 5456 | } else { |
5448 | dasm_put(Dst, 2820); | 5457 | dasm_put(Dst, 2827); |
5449 | } | 5458 | } |
5450 | dasm_put(Dst, 2822); | 5459 | dasm_put(Dst, 2829); |
5451 | break; | 5460 | break; |
5452 | 5461 | ||
5453 | case BC_ISEQV: case BC_ISNEV: | 5462 | case BC_ISEQV: case BC_ISNEV: |
5454 | vk = op == BC_ISEQV; | 5463 | vk = op == BC_ISEQV; |
5455 | dasm_put(Dst, 2833, -(BCBIAS_J*4 >> 16)); | 5464 | dasm_put(Dst, 2840, -(BCBIAS_J*4 >> 16)); |
5456 | if (vk) { | 5465 | if (vk) { |
5457 | dasm_put(Dst, 2847); | 5466 | dasm_put(Dst, 2854); |
5458 | } else { | 5467 | } else { |
5459 | dasm_put(Dst, 2849); | 5468 | dasm_put(Dst, 2856); |
5460 | } | 5469 | } |
5461 | dasm_put(Dst, 2851, ~LJ_TISPRI, ~LJ_TISTABUD); | 5470 | dasm_put(Dst, 2858, ~LJ_TISPRI, ~LJ_TISTABUD); |
5462 | if (vk) { | 5471 | if (vk) { |
5463 | dasm_put(Dst, 2873); | 5472 | dasm_put(Dst, 2880); |
5464 | } else { | 5473 | } else { |
5465 | dasm_put(Dst, 2875); | 5474 | dasm_put(Dst, 2882); |
5466 | } | 5475 | } |
5467 | dasm_put(Dst, 2877); | 5476 | dasm_put(Dst, 2884); |
5468 | if (vk) { | 5477 | if (vk) { |
5469 | dasm_put(Dst, 2879); | 5478 | dasm_put(Dst, 2886); |
5470 | } else { | 5479 | } else { |
5471 | dasm_put(Dst, 2881); | 5480 | dasm_put(Dst, 2888); |
5472 | } | 5481 | } |
5473 | dasm_put(Dst, 2883, Dt6(->metatable), 1-vk, Dt6(->nomm), 1<<MM_eq); | 5482 | dasm_put(Dst, 2890, Dt6(->metatable), 1-vk, Dt6(->nomm), 1<<MM_eq); |
5474 | break; | 5483 | break; |
5475 | 5484 | ||
5476 | case BC_ISEQS: case BC_ISNES: | 5485 | case BC_ISEQS: case BC_ISNES: |
5477 | vk = op == BC_ISEQS; | 5486 | vk = op == BC_ISEQS; |
5478 | dasm_put(Dst, 2904, 32-1, -(BCBIAS_J*4 >> 16)); | 5487 | dasm_put(Dst, 2911, 32-1, -(BCBIAS_J*4 >> 16)); |
5479 | if (vk) { | 5488 | if (vk) { |
5480 | dasm_put(Dst, 2918); | 5489 | dasm_put(Dst, 2925); |
5481 | } else { | 5490 | } else { |
5482 | dasm_put(Dst, 2920); | 5491 | dasm_put(Dst, 2927); |
5483 | } | 5492 | } |
5484 | dasm_put(Dst, 2922); | 5493 | dasm_put(Dst, 2929); |
5485 | break; | 5494 | break; |
5486 | 5495 | ||
5487 | case BC_ISEQN: case BC_ISNEN: | 5496 | case BC_ISEQN: case BC_ISNEN: |
5488 | vk = op == BC_ISEQN; | 5497 | vk = op == BC_ISEQN; |
5489 | dasm_put(Dst, 2933, -(BCBIAS_J*4 >> 16)); | 5498 | dasm_put(Dst, 2940, -(BCBIAS_J*4 >> 16)); |
5490 | if (vk) { | 5499 | if (vk) { |
5491 | dasm_put(Dst, 2947); | 5500 | dasm_put(Dst, 2954); |
5492 | } else { | 5501 | } else { |
5493 | dasm_put(Dst, 2950); | 5502 | dasm_put(Dst, 2957); |
5494 | } | 5503 | } |
5495 | dasm_put(Dst, 2952); | 5504 | dasm_put(Dst, 2959); |
5496 | if (!vk) { | 5505 | if (!vk) { |
5497 | dasm_put(Dst, 2964); | 5506 | dasm_put(Dst, 2971); |
5498 | } | 5507 | } |
5499 | break; | 5508 | break; |
5500 | 5509 | ||
5501 | case BC_ISEQP: case BC_ISNEP: | 5510 | case BC_ISEQP: case BC_ISNEP: |
5502 | vk = op == BC_ISEQP; | 5511 | vk = op == BC_ISEQP; |
5503 | dasm_put(Dst, 2970, 32-3, -(BCBIAS_J*4 >> 16)); | 5512 | dasm_put(Dst, 2977, 32-3, -(BCBIAS_J*4 >> 16)); |
5504 | if (vk) { | 5513 | if (vk) { |
5505 | dasm_put(Dst, 2982); | 5514 | dasm_put(Dst, 2989); |
5506 | } else { | 5515 | } else { |
5507 | dasm_put(Dst, 2984); | 5516 | dasm_put(Dst, 2991); |
5508 | } | 5517 | } |
5509 | dasm_put(Dst, 2986); | 5518 | dasm_put(Dst, 2993); |
5510 | break; | 5519 | break; |
5511 | 5520 | ||
5512 | /* -- Unary test and copy ops ------------------------------------------- */ | 5521 | /* -- Unary test and copy ops ------------------------------------------- */ |
5513 | 5522 | ||
5514 | case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF: | 5523 | case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF: |
5515 | dasm_put(Dst, 2997); | 5524 | dasm_put(Dst, 3004); |
5516 | if (op == BC_IST || op == BC_ISF) { | 5525 | if (op == BC_IST || op == BC_ISF) { |
5517 | dasm_put(Dst, 3003, -(BCBIAS_J*4 >> 16)); | 5526 | dasm_put(Dst, 3010, -(BCBIAS_J*4 >> 16)); |
5518 | if (op == BC_IST) { | 5527 | if (op == BC_IST) { |
5519 | dasm_put(Dst, 3008); | 5528 | dasm_put(Dst, 3015); |
5520 | } else { | 5529 | } else { |
5521 | dasm_put(Dst, 3010); | 5530 | dasm_put(Dst, 3017); |
5522 | } | 5531 | } |
5523 | } else { | 5532 | } else { |
5524 | if (op == BC_ISTC) { | 5533 | if (op == BC_ISTC) { |
5525 | dasm_put(Dst, 3012); | 5534 | dasm_put(Dst, 3019); |
5526 | } else { | 5535 | } else { |
5527 | dasm_put(Dst, 3015); | 5536 | dasm_put(Dst, 3022); |
5528 | } | 5537 | } |
5529 | dasm_put(Dst, 3018, -(BCBIAS_J*4 >> 16)); | 5538 | dasm_put(Dst, 3025, -(BCBIAS_J*4 >> 16)); |
5530 | } | 5539 | } |
5531 | dasm_put(Dst, 3025); | 5540 | dasm_put(Dst, 3032); |
5532 | break; | 5541 | break; |
5533 | 5542 | ||
5534 | /* -- Unary ops --------------------------------------------------------- */ | 5543 | /* -- Unary ops --------------------------------------------------------- */ |
5535 | 5544 | ||
5536 | case BC_MOV: | 5545 | case BC_MOV: |
5537 | dasm_put(Dst, 3036); | 5546 | dasm_put(Dst, 3043); |
5538 | break; | 5547 | break; |
5539 | case BC_NOT: | 5548 | case BC_NOT: |
5540 | dasm_put(Dst, 3049, LJ_TTRUE); | 5549 | dasm_put(Dst, 3056, LJ_TTRUE); |
5541 | break; | 5550 | break; |
5542 | case BC_UNM: | 5551 | case BC_UNM: |
5543 | dasm_put(Dst, 3065); | 5552 | dasm_put(Dst, 3072); |
5544 | break; | 5553 | break; |
5545 | case BC_LEN: | 5554 | case BC_LEN: |
5546 | dasm_put(Dst, 3082, Dt5(->len)); | 5555 | dasm_put(Dst, 3089, Dt5(->len)); |
5547 | break; | 5556 | break; |
5548 | 5557 | ||
5549 | /* -- Binary ops -------------------------------------------------------- */ | 5558 | /* -- Binary ops -------------------------------------------------------- */ |
@@ -5553,262 +5562,262 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
5553 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); | 5562 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); |
5554 | switch (vk) { | 5563 | switch (vk) { |
5555 | case 0: | 5564 | case 0: |
5556 | dasm_put(Dst, 3110); | 5565 | dasm_put(Dst, 3117); |
5557 | break; | 5566 | break; |
5558 | case 1: | 5567 | case 1: |
5559 | dasm_put(Dst, 3116); | 5568 | dasm_put(Dst, 3123); |
5560 | break; | 5569 | break; |
5561 | default: | 5570 | default: |
5562 | dasm_put(Dst, 3122); | 5571 | dasm_put(Dst, 3129); |
5563 | break; | 5572 | break; |
5564 | } | 5573 | } |
5565 | dasm_put(Dst, 3129); | 5574 | dasm_put(Dst, 3136); |
5566 | break; | 5575 | break; |
5567 | case BC_SUBVN: case BC_SUBNV: case BC_SUBVV: | 5576 | case BC_SUBVN: case BC_SUBNV: case BC_SUBVV: |
5568 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); | 5577 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); |
5569 | switch (vk) { | 5578 | switch (vk) { |
5570 | case 0: | 5579 | case 0: |
5571 | dasm_put(Dst, 3142); | 5580 | dasm_put(Dst, 3149); |
5572 | break; | 5581 | break; |
5573 | case 1: | 5582 | case 1: |
5574 | dasm_put(Dst, 3148); | 5583 | dasm_put(Dst, 3155); |
5575 | break; | 5584 | break; |
5576 | default: | 5585 | default: |
5577 | dasm_put(Dst, 3154); | 5586 | dasm_put(Dst, 3161); |
5578 | break; | 5587 | break; |
5579 | } | 5588 | } |
5580 | dasm_put(Dst, 3161); | 5589 | dasm_put(Dst, 3168); |
5581 | break; | 5590 | break; |
5582 | case BC_MULVN: case BC_MULNV: case BC_MULVV: | 5591 | case BC_MULVN: case BC_MULNV: case BC_MULVV: |
5583 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); | 5592 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); |
5584 | switch (vk) { | 5593 | switch (vk) { |
5585 | case 0: | 5594 | case 0: |
5586 | dasm_put(Dst, 3174); | 5595 | dasm_put(Dst, 3181); |
5587 | break; | 5596 | break; |
5588 | case 1: | 5597 | case 1: |
5589 | dasm_put(Dst, 3180); | 5598 | dasm_put(Dst, 3187); |
5590 | break; | 5599 | break; |
5591 | default: | 5600 | default: |
5592 | dasm_put(Dst, 3186); | 5601 | dasm_put(Dst, 3193); |
5593 | break; | 5602 | break; |
5594 | } | 5603 | } |
5595 | dasm_put(Dst, 3193); | 5604 | dasm_put(Dst, 3200); |
5596 | break; | 5605 | break; |
5597 | case BC_DIVVN: case BC_DIVNV: case BC_DIVVV: | 5606 | case BC_DIVVN: case BC_DIVNV: case BC_DIVVV: |
5598 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); | 5607 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); |
5599 | switch (vk) { | 5608 | switch (vk) { |
5600 | case 0: | 5609 | case 0: |
5601 | dasm_put(Dst, 3206); | 5610 | dasm_put(Dst, 3213); |
5602 | break; | 5611 | break; |
5603 | case 1: | 5612 | case 1: |
5604 | dasm_put(Dst, 3212); | 5613 | dasm_put(Dst, 3219); |
5605 | break; | 5614 | break; |
5606 | default: | 5615 | default: |
5607 | dasm_put(Dst, 3218); | 5616 | dasm_put(Dst, 3225); |
5608 | break; | 5617 | break; |
5609 | } | 5618 | } |
5610 | dasm_put(Dst, 3225); | 5619 | dasm_put(Dst, 3232); |
5611 | break; | 5620 | break; |
5612 | case BC_MODVN: | 5621 | case BC_MODVN: |
5613 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); | 5622 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); |
5614 | switch (vk) { | 5623 | switch (vk) { |
5615 | case 0: | 5624 | case 0: |
5616 | dasm_put(Dst, 3238); | 5625 | dasm_put(Dst, 3245); |
5617 | break; | 5626 | break; |
5618 | case 1: | 5627 | case 1: |
5619 | dasm_put(Dst, 3244); | 5628 | dasm_put(Dst, 3251); |
5620 | break; | 5629 | break; |
5621 | default: | 5630 | default: |
5622 | dasm_put(Dst, 3250); | 5631 | dasm_put(Dst, 3257); |
5623 | break; | 5632 | break; |
5624 | } | 5633 | } |
5625 | dasm_put(Dst, 3257); | 5634 | dasm_put(Dst, 3264); |
5626 | break; | 5635 | break; |
5627 | case BC_MODNV: case BC_MODVV: | 5636 | case BC_MODNV: case BC_MODVV: |
5628 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); | 5637 | vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); |
5629 | switch (vk) { | 5638 | switch (vk) { |
5630 | case 0: | 5639 | case 0: |
5631 | dasm_put(Dst, 3275); | 5640 | dasm_put(Dst, 3282); |
5632 | break; | 5641 | break; |
5633 | case 1: | 5642 | case 1: |
5634 | dasm_put(Dst, 3281); | 5643 | dasm_put(Dst, 3288); |
5635 | break; | 5644 | break; |
5636 | default: | 5645 | default: |
5637 | dasm_put(Dst, 3287); | 5646 | dasm_put(Dst, 3294); |
5638 | break; | 5647 | break; |
5639 | } | 5648 | } |
5640 | dasm_put(Dst, 3294); | 5649 | dasm_put(Dst, 3301); |
5641 | break; | 5650 | break; |
5642 | case BC_POW: | 5651 | case BC_POW: |
5643 | dasm_put(Dst, 3297); | 5652 | dasm_put(Dst, 3304); |
5644 | break; | 5653 | break; |
5645 | 5654 | ||
5646 | case BC_CAT: | 5655 | case BC_CAT: |
5647 | dasm_put(Dst, 3319, Dt1(->base), 32-3, Dt1(->base)); | 5656 | dasm_put(Dst, 3326, Dt1(->base), 32-3, Dt1(->base)); |
5648 | break; | 5657 | break; |
5649 | 5658 | ||
5650 | /* -- Constant ops ------------------------------------------------------ */ | 5659 | /* -- Constant ops ------------------------------------------------------ */ |
5651 | 5660 | ||
5652 | case BC_KSTR: | 5661 | case BC_KSTR: |
5653 | dasm_put(Dst, 3349, 32-1); | 5662 | dasm_put(Dst, 3356, 32-1); |
5654 | break; | 5663 | break; |
5655 | case BC_KCDATA: | 5664 | case BC_KCDATA: |
5656 | #if LJ_HASFFI | 5665 | #if LJ_HASFFI |
5657 | dasm_put(Dst, 3366, 32-1, LJ_TCDATA); | 5666 | dasm_put(Dst, 3373, 32-1, LJ_TCDATA); |
5658 | #endif | 5667 | #endif |
5659 | break; | 5668 | break; |
5660 | case BC_KSHORT: | 5669 | case BC_KSHORT: |
5661 | dasm_put(Dst, 3385, 32-3); | 5670 | dasm_put(Dst, 3392, 32-3); |
5662 | break; | 5671 | break; |
5663 | case BC_KNUM: | 5672 | case BC_KNUM: |
5664 | dasm_put(Dst, 3401); | 5673 | dasm_put(Dst, 3408); |
5665 | break; | 5674 | break; |
5666 | case BC_KPRI: | 5675 | case BC_KPRI: |
5667 | dasm_put(Dst, 3414, 32-3); | 5676 | dasm_put(Dst, 3421, 32-3); |
5668 | break; | 5677 | break; |
5669 | case BC_KNIL: | 5678 | case BC_KNIL: |
5670 | dasm_put(Dst, 3429); | 5679 | dasm_put(Dst, 3436); |
5671 | break; | 5680 | break; |
5672 | 5681 | ||
5673 | /* -- Upvalue and function ops ------------------------------------------ */ | 5682 | /* -- Upvalue and function ops ------------------------------------------ */ |
5674 | 5683 | ||
5675 | case BC_UGET: | 5684 | case BC_UGET: |
5676 | dasm_put(Dst, 3448, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); | 5685 | dasm_put(Dst, 3455, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); |
5677 | break; | 5686 | break; |
5678 | case BC_USETV: | 5687 | case BC_USETV: |
5679 | dasm_put(Dst, 3469, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, DtA(->closed), -(LJ_TISNUM+1), LJ_TISGCV - (LJ_TISNUM+1), Dt4(->gch.marked), LJ_GC_WHITES, GG_DISP2G); | 5688 | dasm_put(Dst, 3476, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, DtA(->closed), -(LJ_TISNUM+1), LJ_TISGCV - (LJ_TISNUM+1), Dt4(->gch.marked), LJ_GC_WHITES, GG_DISP2G); |
5680 | break; | 5689 | break; |
5681 | case BC_USETS: | 5690 | case BC_USETS: |
5682 | dasm_put(Dst, 3521, 32-1, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, Dt5(->marked), DtA(->closed), LJ_GC_WHITES, GG_DISP2G); | 5691 | dasm_put(Dst, 3528, 32-1, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, Dt5(->marked), DtA(->closed), LJ_GC_WHITES, GG_DISP2G); |
5683 | break; | 5692 | break; |
5684 | case BC_USETN: | 5693 | case BC_USETN: |
5685 | dasm_put(Dst, 3570, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); | 5694 | dasm_put(Dst, 3577, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); |
5686 | break; | 5695 | break; |
5687 | case BC_USETP: | 5696 | case BC_USETP: |
5688 | dasm_put(Dst, 3591, 32-1, offsetof(GCfuncL, uvptr), 32-3, DtA(->v)); | 5697 | dasm_put(Dst, 3598, 32-1, offsetof(GCfuncL, uvptr), 32-3, DtA(->v)); |
5689 | break; | 5698 | break; |
5690 | 5699 | ||
5691 | case BC_UCLO: | 5700 | case BC_UCLO: |
5692 | dasm_put(Dst, 3614, Dt1(->openupval), 32-1, -(BCBIAS_J*4 >> 16), Dt1(->base), Dt1(->base)); | 5701 | dasm_put(Dst, 3621, Dt1(->openupval), 32-1, -(BCBIAS_J*4 >> 16), Dt1(->base), Dt1(->base)); |
5693 | break; | 5702 | break; |
5694 | 5703 | ||
5695 | case BC_FNEW: | 5704 | case BC_FNEW: |
5696 | dasm_put(Dst, 3644, 32-1, Dt1(->base), Dt1(->base)); | 5705 | dasm_put(Dst, 3651, 32-1, Dt1(->base), Dt1(->base)); |
5697 | break; | 5706 | break; |
5698 | 5707 | ||
5699 | /* -- Table ops --------------------------------------------------------- */ | 5708 | /* -- Table ops --------------------------------------------------------- */ |
5700 | 5709 | ||
5701 | case BC_TNEW: | 5710 | case BC_TNEW: |
5702 | case BC_TDUP: | 5711 | case BC_TDUP: |
5703 | dasm_put(Dst, 3670, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base)); | 5712 | dasm_put(Dst, 3677, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base)); |
5704 | if (op == BC_TNEW) { | 5713 | if (op == BC_TNEW) { |
5705 | dasm_put(Dst, 3683); | 5714 | dasm_put(Dst, 3690); |
5706 | } else { | 5715 | } else { |
5707 | dasm_put(Dst, 3691, 32-1); | 5716 | dasm_put(Dst, 3698, 32-1); |
5708 | } | 5717 | } |
5709 | dasm_put(Dst, 3698, Dt1(->base)); | 5718 | dasm_put(Dst, 3705, Dt1(->base)); |
5710 | break; | 5719 | break; |
5711 | 5720 | ||
5712 | case BC_GGET: | 5721 | case BC_GGET: |
5713 | case BC_GSET: | 5722 | case BC_GSET: |
5714 | dasm_put(Dst, 3721, 32-1, Dt7(->env)); | 5723 | dasm_put(Dst, 3728, 32-1, Dt7(->env)); |
5715 | if (op == BC_GGET) { | 5724 | if (op == BC_GGET) { |
5716 | dasm_put(Dst, 3729); | 5725 | dasm_put(Dst, 3736); |
5717 | } else { | 5726 | } else { |
5718 | dasm_put(Dst, 3732); | 5727 | dasm_put(Dst, 3739); |
5719 | } | 5728 | } |
5720 | break; | 5729 | break; |
5721 | 5730 | ||
5722 | case BC_TGETV: | 5731 | case BC_TGETV: |
5723 | dasm_put(Dst, 3735, Dt6(->asize), Dt6(->array), 31-3, Dt6(->metatable), Dt6(->nomm), 1<<MM_index); | 5732 | dasm_put(Dst, 3742, Dt6(->asize), Dt6(->array), 31-3, Dt6(->metatable), Dt6(->nomm), 1<<MM_index); |
5724 | break; | 5733 | break; |
5725 | case BC_TGETS: | 5734 | case BC_TGETS: |
5726 | dasm_put(Dst, 3793, 32-1, Dt6(->hmask), Dt5(->hash), Dt6(->node), 31-5, 31-3, DtB(->key), DtB(->val), DtB(->next), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); | 5735 | dasm_put(Dst, 3800, 32-1, Dt6(->hmask), Dt5(->hash), Dt6(->node), 31-5, 31-3, DtB(->key), DtB(->val), DtB(->next), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); |
5727 | dasm_put(Dst, 3857); | 5736 | dasm_put(Dst, 3864); |
5728 | break; | 5737 | break; |
5729 | case BC_TGETB: | 5738 | case BC_TGETB: |
5730 | dasm_put(Dst, 3862, 32-3, Dt6(->asize), Dt6(->array), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); | 5739 | dasm_put(Dst, 3869, 32-3, Dt6(->asize), Dt6(->array), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); |
5731 | break; | 5740 | break; |
5732 | 5741 | ||
5733 | case BC_TSETV: | 5742 | case BC_TSETV: |
5734 | dasm_put(Dst, 3906, Dt6(->asize), Dt6(->array), 31-3, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex); | 5743 | dasm_put(Dst, 3913, Dt6(->asize), Dt6(->array), 31-3, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex); |
5735 | dasm_put(Dst, 3973, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); | 5744 | dasm_put(Dst, 3980, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); |
5736 | break; | 5745 | break; |
5737 | case BC_TSETS: | 5746 | case BC_TSETS: |
5738 | dasm_put(Dst, 3985, 32-1, Dt6(->hmask), Dt5(->hash), Dt6(->node), Dt6(->nomm), 31-5, 31-3, Dt6(->marked), DtB(->key), DtB(->val), LJ_GC_BLACK, DtB(->val), Dt6(->metatable)); | 5747 | dasm_put(Dst, 3992, 32-1, Dt6(->hmask), Dt5(->hash), Dt6(->node), Dt6(->nomm), 31-5, 31-3, Dt6(->marked), DtB(->key), DtB(->val), LJ_GC_BLACK, DtB(->val), Dt6(->metatable)); |
5739 | dasm_put(Dst, 4046, Dt6(->nomm), 1<<MM_newindex, DtB(->next), Dt6(->metatable), DISPATCH_GL(tmptv), Dt1(->base), Dt6(->nomm), 1<<MM_newindex, Dt1(->base), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain)); | 5748 | dasm_put(Dst, 4053, Dt6(->nomm), 1<<MM_newindex, DtB(->next), Dt6(->metatable), DISPATCH_GL(tmptv), Dt1(->base), Dt6(->nomm), 1<<MM_newindex, Dt1(->base), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain)); |
5740 | dasm_put(Dst, 4097, Dt6(->marked), Dt6(->gclist)); | 5749 | dasm_put(Dst, 4104, Dt6(->marked), Dt6(->gclist)); |
5741 | break; | 5750 | break; |
5742 | case BC_TSETB: | 5751 | case BC_TSETB: |
5743 | dasm_put(Dst, 4104, 32-3, Dt6(->asize), Dt6(->array), Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked)); | 5752 | dasm_put(Dst, 4111, 32-3, Dt6(->asize), Dt6(->array), Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked)); |
5744 | dasm_put(Dst, 4164, Dt6(->gclist)); | 5753 | dasm_put(Dst, 4171, Dt6(->gclist)); |
5745 | break; | 5754 | break; |
5746 | 5755 | ||
5747 | case BC_TSETM: | 5756 | case BC_TSETM: |
5748 | dasm_put(Dst, 4169, 32-3, Dt6(->asize), 31-3, Dt6(->marked), Dt6(->array), LJ_GC_BLACK, Dt1(->base), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); | 5757 | dasm_put(Dst, 4176, 32-3, Dt6(->asize), 31-3, Dt6(->marked), Dt6(->array), LJ_GC_BLACK, Dt1(->base), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); |
5749 | dasm_put(Dst, 4238); | 5758 | dasm_put(Dst, 4245); |
5750 | break; | 5759 | break; |
5751 | 5760 | ||
5752 | /* -- Calls and vararg handling ----------------------------------------- */ | 5761 | /* -- Calls and vararg handling ----------------------------------------- */ |
5753 | 5762 | ||
5754 | case BC_CALLM: | 5763 | case BC_CALLM: |
5755 | dasm_put(Dst, 4241); | 5764 | dasm_put(Dst, 4248); |
5756 | break; | 5765 | break; |
5757 | case BC_CALL: | 5766 | case BC_CALL: |
5758 | dasm_put(Dst, 4243, Dt7(->pc)); | 5767 | dasm_put(Dst, 4250, Dt7(->pc)); |
5759 | break; | 5768 | break; |
5760 | 5769 | ||
5761 | case BC_CALLMT: | 5770 | case BC_CALLMT: |
5762 | dasm_put(Dst, 4263); | 5771 | dasm_put(Dst, 4270); |
5763 | break; | 5772 | break; |
5764 | case BC_CALLT: | 5773 | case BC_CALLT: |
5765 | dasm_put(Dst, 4265, FRAME_TYPE, Dt7(->ffid), FRAME_VARG, Dt7(->pc), -4-8, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); | 5774 | dasm_put(Dst, 4272, FRAME_TYPE, Dt7(->ffid), FRAME_VARG, Dt7(->pc), -4-8, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); |
5766 | dasm_put(Dst, 4330, FRAME_TYPE); | 5775 | dasm_put(Dst, 4337, FRAME_TYPE); |
5767 | break; | 5776 | break; |
5768 | 5777 | ||
5769 | case BC_ITERC: | 5778 | case BC_ITERC: |
5770 | dasm_put(Dst, 4337, Dt7(->pc)); | 5779 | dasm_put(Dst, 4344, Dt7(->pc)); |
5771 | break; | 5780 | break; |
5772 | 5781 | ||
5773 | case BC_ITERN: | 5782 | case BC_ITERN: |
5774 | #if LJ_HASJIT | 5783 | #if LJ_HASJIT |
5775 | #endif | 5784 | #endif |
5776 | dasm_put(Dst, 4363, Dt6(->asize), Dt6(->array), 31-3, -(BCBIAS_J*4 >> 16), Dt6(->hmask), Dt6(->node), 31-5, 31-3, DtB(->key), -(BCBIAS_J*4 >> 16)); | 5785 | dasm_put(Dst, 4370, Dt6(->asize), Dt6(->array), 31-3, -(BCBIAS_J*4 >> 16), Dt6(->hmask), Dt6(->node), 31-5, 31-3, DtB(->key), -(BCBIAS_J*4 >> 16)); |
5777 | dasm_put(Dst, 4442); | 5786 | dasm_put(Dst, 4449); |
5778 | break; | 5787 | break; |
5779 | 5788 | ||
5780 | case BC_ISNEXT: | 5789 | case BC_ISNEXT: |
5781 | dasm_put(Dst, 4446, LJ_TTAB, LJ_TFUNC, LJ_TNIL, Dt8(->ffid), FF_next_N, 32-1, -(BCBIAS_J*4 >> 16), BC_JMP, BC_ITERC, -(BCBIAS_J*4 >> 16)); | 5790 | dasm_put(Dst, 4453, LJ_TTAB, LJ_TFUNC, LJ_TNIL, Dt8(->ffid), FF_next_N, 32-1, -(BCBIAS_J*4 >> 16), BC_JMP, BC_ITERC, -(BCBIAS_J*4 >> 16)); |
5782 | break; | 5791 | break; |
5783 | 5792 | ||
5784 | case BC_VARG: | 5793 | case BC_VARG: |
5785 | dasm_put(Dst, 4497, FRAME_VARG, Dt1(->maxstack), Dt1(->top), Dt1(->base), 32-3, Dt1(->base)); | 5794 | dasm_put(Dst, 4504, FRAME_VARG, Dt1(->maxstack), Dt1(->top), Dt1(->base), 32-3, Dt1(->base)); |
5786 | dasm_put(Dst, 4577); | 5795 | dasm_put(Dst, 4584); |
5787 | break; | 5796 | break; |
5788 | 5797 | ||
5789 | /* -- Returns ----------------------------------------------------------- */ | 5798 | /* -- Returns ----------------------------------------------------------- */ |
5790 | 5799 | ||
5791 | case BC_RETM: | 5800 | case BC_RETM: |
5792 | dasm_put(Dst, 4583); | 5801 | dasm_put(Dst, 4590); |
5793 | break; | 5802 | break; |
5794 | 5803 | ||
5795 | case BC_RET: | 5804 | case BC_RET: |
5796 | dasm_put(Dst, 4585, FRAME_TYPE, FRAME_VARG, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); | 5805 | dasm_put(Dst, 4592, FRAME_TYPE, FRAME_VARG, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); |
5797 | break; | 5806 | break; |
5798 | 5807 | ||
5799 | case BC_RET0: case BC_RET1: | 5808 | case BC_RET0: case BC_RET1: |
5800 | dasm_put(Dst, 4655, FRAME_TYPE, FRAME_VARG); | 5809 | dasm_put(Dst, 4662, FRAME_TYPE, FRAME_VARG); |
5801 | if (op == BC_RET1) { | 5810 | if (op == BC_RET1) { |
5802 | dasm_put(Dst, 4668); | 5811 | dasm_put(Dst, 4675); |
5803 | } | 5812 | } |
5804 | dasm_put(Dst, 4671, Dt7(->pc), PC2PROTO(k)); | 5813 | dasm_put(Dst, 4678, Dt7(->pc), PC2PROTO(k)); |
5805 | break; | 5814 | break; |
5806 | 5815 | ||
5807 | /* -- Loops and branches ------------------------------------------------ */ | 5816 | /* -- Loops and branches ------------------------------------------------ */ |
5808 | 5817 | ||
5809 | case BC_FORL: | 5818 | case BC_FORL: |
5810 | #if LJ_HASJIT | 5819 | #if LJ_HASJIT |
5811 | dasm_put(Dst, 4699); | 5820 | dasm_put(Dst, 4706); |
5812 | #endif | 5821 | #endif |
5813 | break; | 5822 | break; |
5814 | 5823 | ||
@@ -5820,35 +5829,35 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
5820 | case BC_FORI: | 5829 | case BC_FORI: |
5821 | case BC_IFORL: | 5830 | case BC_IFORL: |
5822 | vk = (op == BC_IFORL || op == BC_JFORL); | 5831 | vk = (op == BC_IFORL || op == BC_JFORL); |
5823 | dasm_put(Dst, 4701, FORL_IDX*8, FORL_STEP*8, FORL_STOP*8); | 5832 | dasm_put(Dst, 4708, FORL_IDX*8, FORL_STEP*8, FORL_STOP*8); |
5824 | if (!vk) { | 5833 | if (!vk) { |
5825 | dasm_put(Dst, 4709); | 5834 | dasm_put(Dst, 4716); |
5826 | } | 5835 | } |
5827 | if (vk) { | 5836 | if (vk) { |
5828 | dasm_put(Dst, 4717, FORL_IDX*8); | 5837 | dasm_put(Dst, 4724, FORL_IDX*8); |
5829 | } | 5838 | } |
5830 | dasm_put(Dst, 4721, FORL_EXT*8); | 5839 | dasm_put(Dst, 4728, FORL_EXT*8); |
5831 | if (op != BC_JFORL) { | 5840 | if (op != BC_JFORL) { |
5832 | dasm_put(Dst, 4729, 32-1); | 5841 | dasm_put(Dst, 4736, 32-1); |
5833 | if (op == BC_JFORI) { | 5842 | if (op == BC_JFORI) { |
5834 | dasm_put(Dst, 4733, -(BCBIAS_J*4 >> 16)); | 5843 | dasm_put(Dst, 4740, -(BCBIAS_J*4 >> 16)); |
5835 | } else { | 5844 | } else { |
5836 | dasm_put(Dst, 4736, -(BCBIAS_J*4 >> 16)); | 5845 | dasm_put(Dst, 4743, -(BCBIAS_J*4 >> 16)); |
5837 | } | 5846 | } |
5838 | } | 5847 | } |
5839 | if (op == BC_FORI) { | 5848 | if (op == BC_FORI) { |
5840 | dasm_put(Dst, 4739); | 5849 | dasm_put(Dst, 4746); |
5841 | } else if (op == BC_IFORL) { | 5850 | } else if (op == BC_IFORL) { |
5842 | dasm_put(Dst, 4741); | 5851 | dasm_put(Dst, 4748); |
5843 | } else { | 5852 | } else { |
5844 | dasm_put(Dst, 4743, BC_JLOOP); | 5853 | dasm_put(Dst, 4750, BC_JLOOP); |
5845 | } | 5854 | } |
5846 | dasm_put(Dst, 4746); | 5855 | dasm_put(Dst, 4753); |
5847 | break; | 5856 | break; |
5848 | 5857 | ||
5849 | case BC_ITERL: | 5858 | case BC_ITERL: |
5850 | #if LJ_HASJIT | 5859 | #if LJ_HASJIT |
5851 | dasm_put(Dst, 4761); | 5860 | dasm_put(Dst, 4768); |
5852 | #endif | 5861 | #endif |
5853 | break; | 5862 | break; |
5854 | 5863 | ||
@@ -5857,40 +5866,40 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
5857 | break; | 5866 | break; |
5858 | #endif | 5867 | #endif |
5859 | case BC_IITERL: | 5868 | case BC_IITERL: |
5860 | dasm_put(Dst, 4763); | 5869 | dasm_put(Dst, 4770); |
5861 | if (op == BC_JITERL) { | 5870 | if (op == BC_JITERL) { |
5862 | dasm_put(Dst, 4769); | 5871 | dasm_put(Dst, 4776); |
5863 | } else { | 5872 | } else { |
5864 | dasm_put(Dst, 4771, 32-1, -(BCBIAS_J*4 >> 16)); | 5873 | dasm_put(Dst, 4778, 32-1, -(BCBIAS_J*4 >> 16)); |
5865 | } | 5874 | } |
5866 | dasm_put(Dst, 4778); | 5875 | dasm_put(Dst, 4785); |
5867 | break; | 5876 | break; |
5868 | 5877 | ||
5869 | case BC_LOOP: | 5878 | case BC_LOOP: |
5870 | #if LJ_HASJIT | 5879 | #if LJ_HASJIT |
5871 | dasm_put(Dst, 4790); | 5880 | dasm_put(Dst, 4797); |
5872 | #endif | 5881 | #endif |
5873 | break; | 5882 | break; |
5874 | 5883 | ||
5875 | case BC_ILOOP: | 5884 | case BC_ILOOP: |
5876 | dasm_put(Dst, 4792); | 5885 | dasm_put(Dst, 4799); |
5877 | break; | 5886 | break; |
5878 | 5887 | ||
5879 | case BC_JLOOP: | 5888 | case BC_JLOOP: |
5880 | #if LJ_HASJIT | 5889 | #if LJ_HASJIT |
5881 | dasm_put(Dst, 4803); | 5890 | dasm_put(Dst, 4810); |
5882 | #endif | 5891 | #endif |
5883 | break; | 5892 | break; |
5884 | 5893 | ||
5885 | case BC_JMP: | 5894 | case BC_JMP: |
5886 | dasm_put(Dst, 4805, 32-1, -(BCBIAS_J*4 >> 16)); | 5895 | dasm_put(Dst, 4812, 32-1, -(BCBIAS_J*4 >> 16)); |
5887 | break; | 5896 | break; |
5888 | 5897 | ||
5889 | /* -- Function headers -------------------------------------------------- */ | 5898 | /* -- Function headers -------------------------------------------------- */ |
5890 | 5899 | ||
5891 | case BC_FUNCF: | 5900 | case BC_FUNCF: |
5892 | #if LJ_HASJIT | 5901 | #if LJ_HASJIT |
5893 | dasm_put(Dst, 4821); | 5902 | dasm_put(Dst, 4828); |
5894 | #endif | 5903 | #endif |
5895 | case BC_FUNCV: /* NYI: compiled vararg functions. */ | 5904 | case BC_FUNCV: /* NYI: compiled vararg functions. */ |
5896 | break; | 5905 | break; |
@@ -5900,38 +5909,38 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
5900 | break; | 5909 | break; |
5901 | #endif | 5910 | #endif |
5902 | case BC_IFUNCF: | 5911 | case BC_IFUNCF: |
5903 | dasm_put(Dst, 4823, Dt1(->maxstack), -4+PC2PROTO(numparams), -4+PC2PROTO(k), 31-3); | 5912 | dasm_put(Dst, 4830, Dt1(->maxstack), -4+PC2PROTO(numparams), -4+PC2PROTO(k), 31-3); |
5904 | if (op == BC_JFUNCF) { | 5913 | if (op == BC_JFUNCF) { |
5905 | dasm_put(Dst, 4841); | 5914 | dasm_put(Dst, 4848); |
5906 | } else { | 5915 | } else { |
5907 | dasm_put(Dst, 4843); | 5916 | dasm_put(Dst, 4850); |
5908 | } | 5917 | } |
5909 | dasm_put(Dst, 4852); | 5918 | dasm_put(Dst, 4859); |
5910 | break; | 5919 | break; |
5911 | 5920 | ||
5912 | case BC_JFUNCV: | 5921 | case BC_JFUNCV: |
5913 | #if !LJ_HASJIT | 5922 | #if !LJ_HASJIT |
5914 | break; | 5923 | break; |
5915 | #endif | 5924 | #endif |
5916 | dasm_put(Dst, 4858); | 5925 | dasm_put(Dst, 4865); |
5917 | break; /* NYI: compiled vararg functions. */ | 5926 | break; /* NYI: compiled vararg functions. */ |
5918 | 5927 | ||
5919 | case BC_IFUNCV: | 5928 | case BC_IFUNCV: |
5920 | dasm_put(Dst, 4860, Dt1(->maxstack), 8+FRAME_VARG, -4+PC2PROTO(k), -4+PC2PROTO(numparams)); | 5929 | dasm_put(Dst, 4867, Dt1(->maxstack), 8+FRAME_VARG, -4+PC2PROTO(k), -4+PC2PROTO(numparams)); |
5921 | break; | 5930 | break; |
5922 | 5931 | ||
5923 | case BC_FUNCC: | 5932 | case BC_FUNCC: |
5924 | case BC_FUNCCW: | 5933 | case BC_FUNCCW: |
5925 | if (op == BC_FUNCC) { | 5934 | if (op == BC_FUNCC) { |
5926 | dasm_put(Dst, 4910, Dt8(->f)); | 5935 | dasm_put(Dst, 4917, Dt8(->f)); |
5927 | } else { | 5936 | } else { |
5928 | dasm_put(Dst, 4913, DISPATCH_GL(wrapf)); | 5937 | dasm_put(Dst, 4920, DISPATCH_GL(wrapf)); |
5929 | } | 5938 | } |
5930 | dasm_put(Dst, 4916, Dt1(->maxstack), Dt1(->base), Dt1(->top), ~LJ_VMST_C); | 5939 | dasm_put(Dst, 4923, Dt1(->maxstack), Dt1(->base), Dt1(->top), ~LJ_VMST_C); |
5931 | if (op == BC_FUNCCW) { | 5940 | if (op == BC_FUNCCW) { |
5932 | dasm_put(Dst, 4929, Dt8(->f)); | 5941 | dasm_put(Dst, 4936, Dt8(->f)); |
5933 | } | 5942 | } |
5934 | dasm_put(Dst, 4932, DISPATCH_GL(vmstate), Dt1(->top), 31-3, Dt1(->base), ~LJ_VMST_INTERP, DISPATCH_GL(vmstate)); | 5943 | dasm_put(Dst, 4939, DISPATCH_GL(vmstate), Dt1(->top), 31-3, Dt1(->base), ~LJ_VMST_INTERP, DISPATCH_GL(vmstate)); |
5935 | break; | 5944 | break; |
5936 | 5945 | ||
5937 | /* ---------------------------------------------------------------------- */ | 5946 | /* ---------------------------------------------------------------------- */ |
@@ -5951,7 +5960,7 @@ static int build_backend(BuildCtx *ctx) | |||
5951 | 5960 | ||
5952 | build_subroutines(ctx); | 5961 | build_subroutines(ctx); |
5953 | 5962 | ||
5954 | dasm_put(Dst, 4953); | 5963 | dasm_put(Dst, 4960); |
5955 | for (op = 0; op < BC__MAX; op++) | 5964 | for (op = 0; op < BC__MAX; op++) |
5956 | build_ins(ctx, (BCOp)op, op); | 5965 | build_ins(ctx, (BCOp)op, op); |
5957 | 5966 | ||