diff options
Diffstat (limited to '')
-rw-r--r-- | src/vm_x86.dasc | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/vm_x86.dasc b/src/vm_x86.dasc index c2f03d80..451c246b 100644 --- a/src/vm_x86.dasc +++ b/src/vm_x86.dasc | |||
@@ -2697,6 +2697,8 @@ static void build_subroutines(BuildCtx *ctx) | |||
2697 | | mov RB, TMP1 // Get previous trace number. | 2697 | | mov RB, TMP1 // Get previous trace number. |
2698 | | mov RA, [DISPATCH+DISPATCH_J(trace)] | 2698 | | mov RA, [DISPATCH+DISPATCH_J(trace)] |
2699 | | mov TRACE:RD, [RA+RB*4] | 2699 | | mov TRACE:RD, [RA+RB*4] |
2700 | | test TRACE:RD, TRACE:RD | ||
2701 | | jz ->cont_nop | ||
2700 | | movzx RD, word TRACE:RD->link | 2702 | | movzx RD, word TRACE:RD->link |
2701 | | cmp RD, RB | 2703 | | cmp RD, RB |
2702 | | je ->cont_nop // Blacklisted. | 2704 | | je ->cont_nop // Blacklisted. |
@@ -2844,7 +2846,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
2844 | | mov r13, TMPa | 2846 | | mov r13, TMPa |
2845 | | mov r12, TMPQ | 2847 | | mov r12, TMPQ |
2846 | |.endif | 2848 | |.endif |
2847 | | test RD, RD; js >3 // Check for error from exit. | 2849 | | test RD, RD; js >9 // Check for error from exit. |
2848 | | mov L:RB, SAVE_L | 2850 | | mov L:RB, SAVE_L |
2849 | | mov MULTRES, RD | 2851 | | mov MULTRES, RD |
2850 | | mov LFUNC:KBASE, [BASE-8] | 2852 | | mov LFUNC:KBASE, [BASE-8] |
@@ -2860,16 +2862,31 @@ static void build_subroutines(BuildCtx *ctx) | |||
2860 | | add PC, 4 | 2862 | | add PC, 4 |
2861 | | shr RC, 16 | 2863 | | shr RC, 16 |
2862 | | cmp OP, BC_FUNCF // Function header? | 2864 | | cmp OP, BC_FUNCF // Function header? |
2863 | | jb >2 | 2865 | | jb >3 |
2864 | | mov RC, MULTRES // RC/RD holds nres+1. | 2866 | | cmp OP, BC_FUNCC+2 // Fast function? |
2867 | | jae >4 | ||
2865 | |2: | 2868 | |2: |
2869 | | mov RC, MULTRES // RC/RD holds nres+1. | ||
2870 | |3: | ||
2866 | |.if X64 | 2871 | |.if X64 |
2867 | | jmp aword [DISPATCH+OP*8] | 2872 | | jmp aword [DISPATCH+OP*8] |
2868 | |.else | 2873 | |.else |
2869 | | jmp aword [DISPATCH+OP*4] | 2874 | | jmp aword [DISPATCH+OP*4] |
2870 | |.endif | 2875 | |.endif |
2871 | | | 2876 | | |
2872 | |3: // Rethrow error from the right C frame. | 2877 | |4: // Check frame below fast function. |
2878 | | mov RC, [BASE-4] | ||
2879 | | test RC, FRAME_TYPE | ||
2880 | | jnz <2 // Trace stitching continuation? | ||
2881 | | // Otherwise set KBASE for Lua function below fast function. | ||
2882 | | movzx RC, byte [RC-3] | ||
2883 | | not RCa | ||
2884 | | mov LFUNC:KBASE, [BASE+RC*8-8] | ||
2885 | | mov KBASE, LFUNC:KBASE->pc | ||
2886 | | mov KBASE, [KBASE+PC2PROTO(k)] | ||
2887 | | jmp <2 | ||
2888 | | | ||
2889 | |9: // Rethrow error from the right C frame. | ||
2873 | | neg RD | 2890 | | neg RD |
2874 | | mov FCARG1, L:RB | 2891 | | mov FCARG1, L:RB |
2875 | | mov FCARG2, RD | 2892 | | mov FCARG2, RD |