diff options
Diffstat (limited to 'src/buildvm_arm.dasc')
-rw-r--r-- | src/buildvm_arm.dasc | 61 |
1 files changed, 55 insertions, 6 deletions
diff --git a/src/buildvm_arm.dasc b/src/buildvm_arm.dasc index 68f33d97..9032c9c2 100644 --- a/src/buildvm_arm.dasc +++ b/src/buildvm_arm.dasc | |||
@@ -172,6 +172,7 @@ | |||
172 | |// Macros to test operand types. | 172 | |// Macros to test operand types. |
173 | |.macro checktp, reg, tp; cmn reg, #-tp; .endmacro | 173 | |.macro checktp, reg, tp; cmn reg, #-tp; .endmacro |
174 | |.macro checktpeq, reg, tp; cmneq reg, #-tp; .endmacro | 174 | |.macro checktpeq, reg, tp; cmneq reg, #-tp; .endmacro |
175 | |.macro checktpne, reg, tp; cmnne reg, #-tp; .endmacro | ||
175 | |.macro checkstr, reg, target; checktp reg, LJ_TSTR; bne target; .endmacro | 176 | |.macro checkstr, reg, target; checktp reg, LJ_TSTR; bne target; .endmacro |
176 | |.macro checktab, reg, target; checktp reg, LJ_TTAB; bne target; .endmacro | 177 | |.macro checktab, reg, target; checktp reg, LJ_TTAB; bne target; .endmacro |
177 | |.macro checkfunc, reg, target; checktp reg, LJ_TFUNC; bne target; .endmacro | 178 | |.macro checkfunc, reg, target; checktp reg, LJ_TFUNC; bne target; .endmacro |
@@ -674,6 +675,18 @@ static void build_subroutines(BuildCtx *ctx) | |||
674 | | // Returns 0/1 or TValue * (metamethod). | 675 | | // Returns 0/1 or TValue * (metamethod). |
675 | | b <3 | 676 | | b <3 |
676 | | | 677 | | |
678 | |->vmeta_equal_cd: | ||
679 | #if LJ_HASFFI | ||
680 | | sub PC, PC, #4 | ||
681 | | str BASE, L->base | ||
682 | | mov CARG1, L | ||
683 | | mov CARG2, INS | ||
684 | | str PC, SAVE_PC | ||
685 | | bl extern lj_meta_equal_cd // (lua_State *L, BCIns op) | ||
686 | | // Returns 0/1 or TValue * (metamethod). | ||
687 | | b <3 | ||
688 | #endif | ||
689 | | | ||
677 | |//-- Arithmetic metamethods --------------------------------------------- | 690 | |//-- Arithmetic metamethods --------------------------------------------- |
678 | | | 691 | | |
679 | |->vmeta_arith_vn: | 692 | |->vmeta_arith_vn: |
@@ -2084,6 +2097,11 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
2084 | | bls ->BC_ISNEN_Z | 2097 | | bls ->BC_ISNEN_Z |
2085 | } | 2098 | } |
2086 | | // Either or both types are not numbers. | 2099 | | // Either or both types are not numbers. |
2100 | if (LJ_HASFFI) { | ||
2101 | | checktp CARG2, LJ_TCDATA | ||
2102 | | checktpne CARG4, LJ_TCDATA | ||
2103 | | beq ->vmeta_equal_cd | ||
2104 | } | ||
2087 | | cmp CARG2, CARG4 // Compare types. | 2105 | | cmp CARG2, CARG4 // Compare types. |
2088 | | bne >2 // Not the same type? | 2106 | | bne >2 // Not the same type? |
2089 | | checktp CARG2, LJ_TISPRI | 2107 | | checktp CARG2, LJ_TISPRI |
@@ -2137,13 +2155,27 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
2137 | | add PC, PC, #4 | 2155 | | add PC, PC, #4 |
2138 | | add RB, PC, RB, lsl #2 | 2156 | | add RB, PC, RB, lsl #2 |
2139 | | checktp CARG2, LJ_TSTR | 2157 | | checktp CARG2, LJ_TSTR |
2140 | | cmpeq CARG1, CARG3 | 2158 | if (LJ_HASFFI) { |
2159 | | bne >7 | ||
2160 | | cmp CARG1, CARG3 | ||
2161 | } else { | ||
2162 | | cmpeq CARG1, CARG3 | ||
2163 | } | ||
2141 | if (vk) { | 2164 | if (vk) { |
2142 | | subeq PC, RB, #0x20000 | 2165 | | subeq PC, RB, #0x20000 |
2166 | |1: | ||
2143 | } else { | 2167 | } else { |
2168 | |1: | ||
2144 | | subne PC, RB, #0x20000 | 2169 | | subne PC, RB, #0x20000 |
2145 | } | 2170 | } |
2146 | | ins_next | 2171 | | ins_next |
2172 | | | ||
2173 | if (LJ_HASFFI) { | ||
2174 | |7: | ||
2175 | | checktp CARG2, LJ_TCDATA | ||
2176 | | bne <1 | ||
2177 | | b ->vmeta_equal_cd | ||
2178 | } | ||
2147 | break; | 2179 | break; |
2148 | 2180 | ||
2149 | case BC_ISEQN: case BC_ISNEN: | 2181 | case BC_ISEQN: case BC_ISNEN: |
@@ -2167,17 +2199,23 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
2167 | | cmp CARG1, CARG3 | 2199 | | cmp CARG1, CARG3 |
2168 | if (vk) { | 2200 | if (vk) { |
2169 | | subeq PC, RB, #0x20000 | 2201 | | subeq PC, RB, #0x20000 |
2202 | |1: | ||
2170 | } else { | 2203 | } else { |
2204 | |1: | ||
2171 | | subne PC, RB, #0x20000 | 2205 | | subne PC, RB, #0x20000 |
2172 | } | 2206 | } |
2173 | |1: | 2207 | |2: |
2174 | | ins_next | 2208 | | ins_next |
2175 | | | 2209 | | |
2176 | |3: // CARG12 is not an integer. | 2210 | |3: // CARG12 is not an integer. |
2177 | if (!vk) { | 2211 | if (LJ_HASFFI) { |
2178 | | subhi PC, RB, #0x20000 | 2212 | | bhi >7 |
2213 | } else { | ||
2214 | if (!vk) { | ||
2215 | | subhi PC, RB, #0x20000 | ||
2216 | } | ||
2217 | | bhi <2 | ||
2179 | } | 2218 | } |
2180 | | bhi <1 | ||
2181 | | // CARG12 is a number. | 2219 | | // CARG12 is a number. |
2182 | | checktp CARG4, LJ_TISNUM | 2220 | | checktp CARG4, LJ_TISNUM |
2183 | | movlo RA, RB // Save RB. | 2221 | | movlo RA, RB // Save RB. |
@@ -2196,7 +2234,14 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
2196 | } else { | 2234 | } else { |
2197 | | subne PC, RA, #0x20000 | 2235 | | subne PC, RA, #0x20000 |
2198 | } | 2236 | } |
2199 | | b <1 | 2237 | | b <2 |
2238 | | | ||
2239 | if (LJ_HASFFI) { | ||
2240 | |7: | ||
2241 | | checktp CARG2, LJ_TCDATA | ||
2242 | | bne <1 | ||
2243 | | b ->vmeta_equal_cd | ||
2244 | } | ||
2200 | break; | 2245 | break; |
2201 | 2246 | ||
2202 | case BC_ISEQP: case BC_ISNEP: | 2247 | case BC_ISEQP: case BC_ISNEP: |
@@ -2207,6 +2252,10 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop) | |||
2207 | | add PC, PC, #4 | 2252 | | add PC, PC, #4 |
2208 | | mvn RC, RC | 2253 | | mvn RC, RC |
2209 | | add RB, PC, RB, lsl #2 | 2254 | | add RB, PC, RB, lsl #2 |
2255 | if (LJ_HASFFI) { | ||
2256 | | checktp CARG2, LJ_TCDATA | ||
2257 | | beq ->vmeta_equal_cd | ||
2258 | } | ||
2210 | | cmp CARG2, RC | 2259 | | cmp CARG2, RC |
2211 | if (vk) { | 2260 | if (vk) { |
2212 | | subeq PC, RB, #0x20000 | 2261 | | subeq PC, RB, #0x20000 |