diff options
Diffstat (limited to 'src/vm_arm.dasc')
-rw-r--r-- | src/vm_arm.dasc | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/vm_arm.dasc b/src/vm_arm.dasc index b728d52f..559d20bd 100644 --- a/src/vm_arm.dasc +++ b/src/vm_arm.dasc | |||
@@ -2082,6 +2082,55 @@ static void build_subroutines(BuildCtx *ctx) | |||
2082 | | ldr INS, [PC, #-4] | 2082 | | ldr INS, [PC, #-4] |
2083 | | bx CRET1 | 2083 | | bx CRET1 |
2084 | | | 2084 | | |
2085 | |->cont_stitch: // Trace stitching. | ||
2086 | |.if JIT | ||
2087 | | // RA = resultptr, CARG4 = meta base | ||
2088 | | ldr RB, SAVE_MULTRES | ||
2089 | | ldr INS, [PC, #-4] | ||
2090 | | ldr CARG3, [CARG4, #-24] // Save previous trace number. | ||
2091 | | subs RB, RB, #8 | ||
2092 | | decode_RA8 RC, INS // Call base. | ||
2093 | | beq >2 | ||
2094 | |1: // Move results down. | ||
2095 | | ldrd CARG12, [RA] | ||
2096 | | add RA, RA, #8 | ||
2097 | | subs RB, RB, #8 | ||
2098 | | strd CARG12, [BASE, RC] | ||
2099 | | add RC, RC, #8 | ||
2100 | | bne <1 | ||
2101 | |2: | ||
2102 | | decode_RA8 RA, INS | ||
2103 | | decode_RB8 RB, INS | ||
2104 | | add RA, RA, RB | ||
2105 | | ldr CARG1, [DISPATCH, #DISPATCH_J(trace)] | ||
2106 | |3: | ||
2107 | | cmp RA, RC | ||
2108 | | mvn CARG2, #~LJ_TNIL | ||
2109 | | bhi >9 // More results wanted? | ||
2110 | | | ||
2111 | | ldr TRACE:RA, [CARG1, CARG3, lsl #2] | ||
2112 | | ldrh RC, TRACE:RA->link | ||
2113 | | cmp RC, CARG3 | ||
2114 | | beq ->cont_nop // Blacklisted. | ||
2115 | | cmp RC, #0 | ||
2116 | | bne =>BC_JLOOP // Jump to stitched trace. | ||
2117 | | | ||
2118 | | // Stitch a new trace to the previous trace. | ||
2119 | | str CARG3, [DISPATCH, #DISPATCH_J(exitno)] | ||
2120 | | str L, [DISPATCH, #DISPATCH_J(L)] | ||
2121 | | str BASE, L->base | ||
2122 | | sub CARG1, DISPATCH, #-GG_DISP2J | ||
2123 | | mov CARG2, PC | ||
2124 | | bl extern lj_dispatch_stitch // (jit_State *J, const BCIns *pc) | ||
2125 | | ldr BASE, L->base | ||
2126 | | b ->cont_nop | ||
2127 | | | ||
2128 | |9: // Fill up results with nil. | ||
2129 | | strd CARG12, [BASE, RC] | ||
2130 | | add RC, RC, #8 | ||
2131 | | b <3 | ||
2132 | |.endif | ||
2133 | | | ||
2085 | |->vm_profhook: // Dispatch target for profiler hook. | 2134 | |->vm_profhook: // Dispatch target for profiler hook. |
2086 | #if LJ_HASPROFILE | 2135 | #if LJ_HASPROFILE |
2087 | | mov CARG1, L | 2136 | | mov CARG1, L |
@@ -2166,6 +2215,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
2166 | | lsrlo RC, INS, #16 // No: Decode operands A*8 and D. | 2215 | | lsrlo RC, INS, #16 // No: Decode operands A*8 and D. |
2167 | | subhs RC, RC, #8 | 2216 | | subhs RC, RC, #8 |
2168 | | addhs RA, RA, BASE // Yes: RA = BASE+framesize*8, RC = nargs*8 | 2217 | | addhs RA, RA, BASE // Yes: RA = BASE+framesize*8, RC = nargs*8 |
2218 | | ldrhs CARG3, [BASE, FRAME_FUNC] | ||
2169 | | bx OP | 2219 | | bx OP |
2170 | | | 2220 | | |
2171 | |3: // Rethrow error from the right C frame. | 2221 | |3: // Rethrow error from the right C frame. |