diff options
Diffstat (limited to 'src/vm_mips.dasc')
-rw-r--r-- | src/vm_mips.dasc | 58 |
1 files changed, 56 insertions, 2 deletions
diff --git a/src/vm_mips.dasc b/src/vm_mips.dasc index f45a5c49..094ffe38 100644 --- a/src/vm_mips.dasc +++ b/src/vm_mips.dasc | |||
@@ -2011,6 +2011,60 @@ static void build_subroutines(BuildCtx *ctx) | |||
2011 | | jr CRET1 | 2011 | | jr CRET1 |
2012 | |. lw INS, -4(PC) | 2012 | |. lw INS, -4(PC) |
2013 | | | 2013 | | |
2014 | |->cont_stitch: // Trace stitching. | ||
2015 | |.if JIT | ||
2016 | | // RA = resultptr, RB = meta base | ||
2017 | | lw INS, -4(PC) | ||
2018 | | lw TMP3, -24+LO(RB) // Save previous trace number. | ||
2019 | | decode_RA8a RC, INS | ||
2020 | | addiu AT, MULTRES, -8 | ||
2021 | | decode_RA8b RC | ||
2022 | | beqz AT, >2 | ||
2023 | |. addu RC, BASE, RC // Call base. | ||
2024 | |1: // Move results down. | ||
2025 | | ldc1 f0, 0(RA) | ||
2026 | | addiu AT, AT, -8 | ||
2027 | | addiu RA, RA, 8 | ||
2028 | | sdc1 f0, 0(RC) | ||
2029 | | bnez AT, <1 | ||
2030 | |. addiu RC, RC, 8 | ||
2031 | |2: | ||
2032 | | decode_RA8a RA, INS | ||
2033 | | decode_RB8a RB, INS | ||
2034 | | decode_RA8b RA | ||
2035 | | decode_RB8b RB | ||
2036 | | addu RA, RA, RB | ||
2037 | | lw TMP1, DISPATCH_J(trace)(DISPATCH) | ||
2038 | | addu RA, BASE, RA | ||
2039 | |3: | ||
2040 | | sltu AT, RC, RA | ||
2041 | | bnez AT, >9 // More results wanted? | ||
2042 | |. sll TMP2, TMP3, 2 | ||
2043 | | | ||
2044 | | addu TMP2, TMP1, TMP2 | ||
2045 | | lw TRACE:TMP2, 0(TMP2) | ||
2046 | | lhu RD, TRACE:TMP2->link | ||
2047 | | beq RD, TMP3, ->cont_nop // Blacklisted. | ||
2048 | |. load_got lj_dispatch_stitch | ||
2049 | | bnez RD, =>BC_JLOOP // Jump to stitched trace. | ||
2050 | |. sll RD, RD, 3 | ||
2051 | | | ||
2052 | | // Stitch a new trace to the previous trace. | ||
2053 | | sw TMP3, DISPATCH_J(exitno)(DISPATCH) | ||
2054 | | sw L, DISPATCH_J(L)(DISPATCH) | ||
2055 | | sw BASE, L->base | ||
2056 | | addiu CARG1, DISPATCH, GG_DISP2J | ||
2057 | | call_intern lj_dispatch_stitch // (jit_State *J, const BCIns *pc) | ||
2058 | |. move CARG2, PC | ||
2059 | | b ->cont_nop | ||
2060 | |. lw BASE, L->base | ||
2061 | | | ||
2062 | |9: | ||
2063 | | sw TISNIL, HI(RC) | ||
2064 | | b <3 | ||
2065 | |. addiu RC, RC, 8 | ||
2066 | |.endif | ||
2067 | | | ||
2014 | |->vm_profhook: // Dispatch target for profiler hook. | 2068 | |->vm_profhook: // Dispatch target for profiler hook. |
2015 | #if LJ_HASPROFILE | 2069 | #if LJ_HASPROFILE |
2016 | | load_got lj_dispatch_profile | 2070 | | load_got lj_dispatch_profile |
@@ -2091,13 +2145,13 @@ static void build_subroutines(BuildCtx *ctx) | |||
2091 | | sw BASE, L->base | 2145 | | sw BASE, L->base |
2092 | |1: | 2146 | |1: |
2093 | | bltz CRET1, >3 // Check for error from exit. | 2147 | | bltz CRET1, >3 // Check for error from exit. |
2094 | |. lw LFUNC:TMP1, FRAME_FUNC(BASE) | 2148 | |. lw LFUNC:RB, FRAME_FUNC(BASE) |
2095 | | lui TMP3, 0x59c0 // TOBIT = 2^52 + 2^51 (float). | 2149 | | lui TMP3, 0x59c0 // TOBIT = 2^52 + 2^51 (float). |
2096 | | sll MULTRES, CRET1, 3 | 2150 | | sll MULTRES, CRET1, 3 |
2097 | | li TISNIL, LJ_TNIL | 2151 | | li TISNIL, LJ_TNIL |
2098 | | sw MULTRES, SAVE_MULTRES | 2152 | | sw MULTRES, SAVE_MULTRES |
2099 | | mtc1 TMP3, TOBIT | 2153 | | mtc1 TMP3, TOBIT |
2100 | | lw TMP1, LFUNC:TMP1->pc | 2154 | | lw TMP1, LFUNC:RB->pc |
2101 | | sw r0, DISPATCH_GL(jit_base)(DISPATCH) | 2155 | | sw r0, DISPATCH_GL(jit_base)(DISPATCH) |
2102 | | lw KBASE, PC2PROTO(k)(TMP1) | 2156 | | lw KBASE, PC2PROTO(k)(TMP1) |
2103 | | cvt.d.s TOBIT, TOBIT | 2157 | | cvt.d.s TOBIT, TOBIT |