| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This file was generated automatically by gen-template.py for 'armv5te'. |
| 3 | * |
| 4 | * --> DO NOT EDIT <-- |
| 5 | */ |
| 6 | |
| 7 | /* File: armv5te/header.S */ |
| 8 | /* |
| 9 | * Copyright (C) 2008 The Android Open Source Project |
| 10 | * |
| 11 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 12 | * you may not use this file except in compliance with the License. |
| 13 | * You may obtain a copy of the License at |
| 14 | * |
| 15 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 16 | * |
| 17 | * Unless required by applicable law or agreed to in writing, software |
| 18 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 20 | * See the License for the specific language governing permissions and |
| 21 | * limitations under the License. |
| 22 | */ |
| 23 | |
| 24 | #if defined(WITH_JIT) |
| 25 | |
| 26 | /* |
| 27 | * ARMv5 definitions and declarations. |
| 28 | */ |
| 29 | |
| 30 | /* |
| 31 | ARM EABI general notes: |
| 32 | |
| 33 | r0-r3 hold first 4 args to a method; they are not preserved across method calls |
| 34 | r4-r8 are available for general use |
| 35 | r9 is given special treatment in some situations, but not for us |
| 36 | r10 (sl) seems to be generally available |
| 37 | r11 (fp) is used by gcc (unless -fomit-frame-pointer is set) |
| 38 | r12 (ip) is scratch -- not preserved across method calls |
| 39 | r13 (sp) should be managed carefully in case a signal arrives |
| 40 | r14 (lr) must be preserved |
| 41 | r15 (pc) can be tinkered with directly |
| 42 | |
| 43 | r0 holds returns of <= 4 bytes |
| 44 | r0-r1 hold returns of 8 bytes, low word in r0 |
| 45 | |
| 46 | Callee must save/restore r4+ (except r12) if it modifies them. |
| 47 | |
| 48 | Stack is "full descending". Only the arguments that don't fit in the first 4 |
| 49 | registers are placed on the stack. "sp" points at the first stacked argument |
| 50 | (i.e. the 5th arg). |
| 51 | |
| 52 | VFP: single-precision results in s0, double-precision results in d0. |
| 53 | |
| 54 | In the EABI, "sp" must be 64-bit aligned on entry to a function, and any |
| 55 | 64-bit quantities (long long, double) must be 64-bit aligned. |
| 56 | */ |
| 57 | |
| 58 | /* |
| 59 | JIT and ARM notes: |
| 60 | |
| 61 | The following registers have fixed assignments: |
| 62 | |
| 63 | reg nick purpose |
| 64 | r5 rFP interpreted frame pointer, used for accessing locals and args |
| 65 | r6 rGLUE MterpGlue pointer |
| 66 | |
| 67 | The following registers have fixed assignments in mterp but are scratch |
| 68 | registers in compiled code |
| 69 | |
| 70 | reg nick purpose |
| 71 | r4 rPC interpreted program counter, used for fetching instructions |
| Andy McFadden | 1da1216 | 2009-06-05 16:19:13 -0700 | [diff] [blame] | 72 | r7 rINST first 16-bit code unit of current instruction |
| 73 | r8 rIBASE interpreted instruction base pointer, used for computed goto |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 74 | |
| 75 | Macros are provided for common operations. Each macro MUST emit only |
| 76 | one instruction to make instruction-counting easier. They MUST NOT alter |
| 77 | unspecified registers or condition codes. |
| 78 | */ |
| 79 | |
| 80 | /* single-purpose registers, given names for clarity */ |
| 81 | #define rPC r4 |
| 82 | #define rFP r5 |
| 83 | #define rGLUE r6 |
| Andy McFadden | 1da1216 | 2009-06-05 16:19:13 -0700 | [diff] [blame] | 84 | #define rINST r7 |
| 85 | #define rIBASE r8 |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 86 | |
| 87 | /* |
| 88 | * Given a frame pointer, find the stack save area. |
| 89 | * |
| 90 | * In C this is "((StackSaveArea*)(_fp) -1)". |
| 91 | */ |
| 92 | #define SAVEAREA_FROM_FP(_reg, _fpreg) \ |
| 93 | sub _reg, _fpreg, #sizeofStackSaveArea |
| 94 | |
| Bill Buzbee | 9a8c75a | 2009-11-08 14:31:20 -0800 | [diff] [blame^] | 95 | #define EXPORT_PC() \ |
| 96 | str rPC, [rFP, #(-sizeofStackSaveArea + offStackSaveArea_currentPc)] |
| 97 | |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 98 | /* |
| 99 | * This is a #include, not a %include, because we want the C pre-processor |
| 100 | * to expand the macros into assembler assignment statements. |
| 101 | */ |
| 102 | #include "../../../mterp/common/asm-constants.h" |
| 103 | |
| 104 | |
| 105 | /* File: armv5te/platform.S */ |
| 106 | /* |
| 107 | * =========================================================================== |
| 108 | * CPU-version-specific defines |
| 109 | * =========================================================================== |
| 110 | */ |
| 111 | |
| 112 | /* |
| 113 | * Macro for "MOV LR,PC / LDR PC,xxx", which is not allowed pre-ARMv5. |
| 114 | * Jump to subroutine. |
| 115 | * |
| 116 | * May modify IP and LR. |
| 117 | */ |
| 118 | .macro LDR_PC_LR source |
| 119 | mov lr, pc |
| 120 | ldr pc, \source |
| 121 | .endm |
| 122 | |
| 123 | |
| 124 | .global dvmCompilerTemplateStart |
| 125 | .type dvmCompilerTemplateStart, %function |
| 126 | .text |
| 127 | |
| 128 | dvmCompilerTemplateStart: |
| 129 | |
| 130 | /* ------------------------------ */ |
| 131 | .balign 4 |
| 132 | .global dvmCompiler_TEMPLATE_CMP_LONG |
| 133 | dvmCompiler_TEMPLATE_CMP_LONG: |
| 134 | /* File: armv5te/TEMPLATE_CMP_LONG.S */ |
| 135 | /* |
| 136 | * Compare two 64-bit values. Puts 0, 1, or -1 into the destination |
| 137 | * register based on the results of the comparison. |
| 138 | * |
| 139 | * We load the full values with LDM, but in practice many values could |
| 140 | * be resolved by only looking at the high word. This could be made |
| 141 | * faster or slower by splitting the LDM into a pair of LDRs. |
| 142 | * |
| 143 | * If we just wanted to set condition flags, we could do this: |
| 144 | * subs ip, r0, r2 |
| 145 | * sbcs ip, r1, r3 |
| 146 | * subeqs ip, r0, r2 |
| 147 | * Leaving { <0, 0, >0 } in ip. However, we have to set it to a specific |
| 148 | * integer value, which we can do with 2 conditional mov/mvn instructions |
| 149 | * (set 1, set -1; if they're equal we already have 0 in ip), giving |
| 150 | * us a constant 5-cycle path plus a branch at the end to the |
| 151 | * instruction epilogue code. The multi-compare approach below needs |
| 152 | * 2 or 3 cycles + branch if the high word doesn't match, 6 + branch |
| 153 | * in the worst case (the 64-bit values are equal). |
| 154 | */ |
| 155 | /* cmp-long vAA, vBB, vCC */ |
| 156 | cmp r1, r3 @ compare (vBB+1, vCC+1) |
| 157 | blt .LTEMPLATE_CMP_LONG_less @ signed compare on high part |
| 158 | bgt .LTEMPLATE_CMP_LONG_greater |
| 159 | subs r0, r0, r2 @ r0<- r0 - r2 |
| 160 | bxeq lr |
| 161 | bhi .LTEMPLATE_CMP_LONG_greater @ unsigned compare on low part |
| 162 | .LTEMPLATE_CMP_LONG_less: |
| 163 | mvn r0, #0 @ r0<- -1 |
| 164 | bx lr |
| 165 | .LTEMPLATE_CMP_LONG_greater: |
| 166 | mov r0, #1 @ r0<- 1 |
| 167 | bx lr |
| 168 | |
| 169 | |
| 170 | /* ------------------------------ */ |
| 171 | .balign 4 |
| 172 | .global dvmCompiler_TEMPLATE_RETURN |
| 173 | dvmCompiler_TEMPLATE_RETURN: |
| 174 | /* File: armv5te/TEMPLATE_RETURN.S */ |
| 175 | /* |
| 176 | * Unwind a frame from the Dalvik stack for compiled OP_RETURN_XXX. |
| 177 | * If the stored value in returnAddr |
| 178 | * is non-zero, the caller is compiled by the JIT thus return to the |
| 179 | * address in the code cache following the invoke instruction. Otherwise |
| 180 | * return to the special dvmJitToInterpNoChain entry point. |
| 181 | */ |
| 182 | SAVEAREA_FROM_FP(r0, rFP) @ r0<- saveArea (old) |
| 183 | ldr r10, [r0, #offStackSaveArea_prevFrame] @ r10<- saveArea->prevFrame |
| 184 | ldr r8, [rGLUE, #offGlue_pSelfSuspendCount] @ r8<- &suspendCount |
| 185 | ldr rPC, [r0, #offStackSaveArea_savedPc] @ rPC<- saveArea->savedPc |
| Jeff Hao | 97319a8 | 2009-08-12 16:57:15 -0700 | [diff] [blame] | 186 | #if !defined(WITH_SELF_VERIFICATION) |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 187 | ldr r9, [r0, #offStackSaveArea_returnAddr] @ r9<- chaining cell ret |
| Jeff Hao | 97319a8 | 2009-08-12 16:57:15 -0700 | [diff] [blame] | 188 | #else |
| 189 | mov r9, #0 @ disable chaining |
| 190 | #endif |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 191 | ldr r2, [r10, #(offStackSaveArea_method - sizeofStackSaveArea)] |
| 192 | @ r2<- method we're returning to |
| 193 | ldr r3, [rGLUE, #offGlue_self] @ r3<- glue->self |
| 194 | cmp r2, #0 @ break frame? |
| Jeff Hao | 97319a8 | 2009-08-12 16:57:15 -0700 | [diff] [blame] | 195 | #if !defined(WITH_SELF_VERIFICATION) |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 196 | beq 1f @ bail to interpreter |
| Jeff Hao | 97319a8 | 2009-08-12 16:57:15 -0700 | [diff] [blame] | 197 | #else |
| 198 | blxeq lr @ punt to interpreter and compare state |
| 199 | #endif |
| Ben Cheng | 6c10a97 | 2009-10-29 14:39:18 -0700 | [diff] [blame] | 200 | ldr r1, .LdvmJitToInterpNoChain @ defined in footer.S |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 201 | mov rFP, r10 @ publish new FP |
| 202 | ldrne r10, [r2, #offMethod_clazz] @ r10<- method->clazz |
| 203 | ldr r8, [r8] @ r8<- suspendCount |
| 204 | |
| 205 | str r2, [rGLUE, #offGlue_method]@ glue->method = newSave->method |
| Ben Cheng | 6c10a97 | 2009-10-29 14:39:18 -0700 | [diff] [blame] | 206 | ldr r0, [r10, #offClassObject_pDvmDex] @ r0<- method->clazz->pDvmDex |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 207 | str rFP, [r3, #offThread_curFrame] @ self->curFrame = fp |
| 208 | add rPC, rPC, #6 @ publish new rPC (advance 6 bytes) |
| Ben Cheng | 6c10a97 | 2009-10-29 14:39:18 -0700 | [diff] [blame] | 209 | str r0, [rGLUE, #offGlue_methodClassDex] |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 210 | cmp r8, #0 @ check the suspendCount |
| 211 | movne r9, #0 @ clear the chaining cell address |
| 212 | cmp r9, #0 @ chaining cell exists? |
| 213 | blxne r9 @ jump to the chaining cell |
| Ben Cheng | 6c10a97 | 2009-10-29 14:39:18 -0700 | [diff] [blame] | 214 | #if defined(EXIT_STATS) |
| 215 | mov r0, #kCallsiteInterpreted |
| 216 | #endif |
| 217 | mov pc, r1 @ callsite is interpreted |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 218 | 1: |
| 219 | stmia rGLUE, {rPC, rFP} @ SAVE_PC_FP_TO_GLUE() |
| 220 | ldr r2, .LdvmMterpStdBail @ defined in footer.S |
| 221 | mov r1, #0 @ changeInterp = false |
| 222 | mov r0, rGLUE @ Expecting rGLUE in r0 |
| 223 | blx r2 @ exit the interpreter |
| 224 | |
| 225 | /* ------------------------------ */ |
| 226 | .balign 4 |
| 227 | .global dvmCompiler_TEMPLATE_INVOKE_METHOD_NO_OPT |
| 228 | dvmCompiler_TEMPLATE_INVOKE_METHOD_NO_OPT: |
| 229 | /* File: armv5te/TEMPLATE_INVOKE_METHOD_NO_OPT.S */ |
| 230 | /* |
| 231 | * For polymorphic callsites - setup the Dalvik frame and load Dalvik PC |
| 232 | * into rPC then jump to dvmJitToInterpNoChain to dispatch the |
| 233 | * runtime-resolved callee. |
| 234 | */ |
| 235 | @ r0 = methodToCall, r1 = returnCell, rPC = dalvikCallsite |
| 236 | ldrh r7, [r0, #offMethod_registersSize] @ r7<- methodToCall->regsSize |
| 237 | ldrh r2, [r0, #offMethod_outsSize] @ r2<- methodToCall->outsSize |
| 238 | ldr r9, [rGLUE, #offGlue_interpStackEnd] @ r9<- interpStackEnd |
| 239 | ldr r8, [rGLUE, #offGlue_pSelfSuspendCount] @ r8<- &suspendCount |
| 240 | add r3, r1, #1 @ Thumb addr is odd |
| 241 | SAVEAREA_FROM_FP(r1, rFP) @ r1<- stack save area |
| 242 | sub r1, r1, r7, lsl #2 @ r1<- newFp (old savearea - regsSize) |
| 243 | SAVEAREA_FROM_FP(r10, r1) @ r10<- stack save area |
| 244 | sub r10, r10, r2, lsl #2 @ r10<- bottom (newsave - outsSize) |
| 245 | ldr r8, [r8] @ r3<- suspendCount (int) |
| 246 | cmp r10, r9 @ bottom < interpStackEnd? |
| 247 | bxlt lr @ return to raise stack overflow excep. |
| 248 | @ r1 = newFP, r0 = methodToCall, r3 = returnCell, rPC = dalvikCallsite |
| 249 | ldr r9, [r0, #offMethod_clazz] @ r9<- method->clazz |
| 250 | ldr r10, [r0, #offMethod_accessFlags] @ r10<- methodToCall->accessFlags |
| 251 | str rPC, [rFP, #(offStackSaveArea_currentPc - sizeofStackSaveArea)] |
| 252 | str rPC, [r1, #(offStackSaveArea_savedPc - sizeofStackSaveArea)] |
| 253 | ldr rPC, [r0, #offMethod_insns] @ rPC<- methodToCall->insns |
| 254 | |
| 255 | |
| 256 | @ set up newSaveArea |
| 257 | str rFP, [r1, #(offStackSaveArea_prevFrame - sizeofStackSaveArea)] |
| 258 | str r3, [r1, #(offStackSaveArea_returnAddr - sizeofStackSaveArea)] |
| 259 | str r0, [r1, #(offStackSaveArea_method - sizeofStackSaveArea)] |
| 260 | cmp r8, #0 @ suspendCount != 0 |
| 261 | bxne lr @ bail to the interpreter |
| 262 | tst r10, #ACC_NATIVE |
| Jeff Hao | 97319a8 | 2009-08-12 16:57:15 -0700 | [diff] [blame] | 263 | #if !defined(WITH_SELF_VERIFICATION) |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 264 | bne .LinvokeNative |
| Jeff Hao | 97319a8 | 2009-08-12 16:57:15 -0700 | [diff] [blame] | 265 | #else |
| 266 | bxne lr @ bail to the interpreter |
| 267 | #endif |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 268 | |
| 269 | ldr r10, .LdvmJitToInterpNoChain |
| 270 | ldr r3, [r9, #offClassObject_pDvmDex] @ r3<- method->clazz->pDvmDex |
| 271 | ldr r2, [rGLUE, #offGlue_self] @ r2<- glue->self |
| 272 | |
| 273 | @ Update "glue" values for the new method |
| 274 | str r0, [rGLUE, #offGlue_method] @ glue->method = methodToCall |
| 275 | str r3, [rGLUE, #offGlue_methodClassDex] @ glue->methodClassDex = ... |
| 276 | mov rFP, r1 @ fp = newFp |
| 277 | str rFP, [r2, #offThread_curFrame] @ self->curFrame = newFp |
| 278 | |
| 279 | @ Start executing the callee |
| Ben Cheng | 6c10a97 | 2009-10-29 14:39:18 -0700 | [diff] [blame] | 280 | #if defined(EXIT_STATS) |
| 281 | mov r0, #kInlineCacheMiss |
| 282 | #endif |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 283 | mov pc, r10 @ dvmJitToInterpNoChain |
| 284 | |
| 285 | /* ------------------------------ */ |
| 286 | .balign 4 |
| 287 | .global dvmCompiler_TEMPLATE_INVOKE_METHOD_CHAIN |
| 288 | dvmCompiler_TEMPLATE_INVOKE_METHOD_CHAIN: |
| 289 | /* File: armv5te/TEMPLATE_INVOKE_METHOD_CHAIN.S */ |
| 290 | /* |
| 291 | * For monomorphic callsite, setup the Dalvik frame and return to the |
| 292 | * Thumb code through the link register to transfer control to the callee |
| 293 | * method through a dedicated chaining cell. |
| 294 | */ |
| 295 | @ r0 = methodToCall, r1 = returnCell, rPC = dalvikCallsite |
| Ben Cheng | 38329f5 | 2009-07-07 14:19:20 -0700 | [diff] [blame] | 296 | @ methodToCall is guaranteed to be non-native |
| 297 | .LinvokeChain: |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 298 | ldrh r7, [r0, #offMethod_registersSize] @ r7<- methodToCall->regsSize |
| 299 | ldrh r2, [r0, #offMethod_outsSize] @ r2<- methodToCall->outsSize |
| 300 | ldr r9, [rGLUE, #offGlue_interpStackEnd] @ r9<- interpStackEnd |
| 301 | ldr r8, [rGLUE, #offGlue_pSelfSuspendCount] @ r8<- &suspendCount |
| 302 | add r3, r1, #1 @ Thumb addr is odd |
| 303 | SAVEAREA_FROM_FP(r1, rFP) @ r1<- stack save area |
| 304 | sub r1, r1, r7, lsl #2 @ r1<- newFp (old savearea - regsSize) |
| 305 | SAVEAREA_FROM_FP(r10, r1) @ r10<- stack save area |
| 306 | add r12, lr, #2 @ setup the punt-to-interp address |
| 307 | sub r10, r10, r2, lsl #2 @ r10<- bottom (newsave - outsSize) |
| 308 | ldr r8, [r8] @ r3<- suspendCount (int) |
| 309 | cmp r10, r9 @ bottom < interpStackEnd? |
| 310 | bxlt r12 @ return to raise stack overflow excep. |
| 311 | @ r1 = newFP, r0 = methodToCall, r3 = returnCell, rPC = dalvikCallsite |
| 312 | ldr r9, [r0, #offMethod_clazz] @ r9<- method->clazz |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 313 | str rPC, [rFP, #(offStackSaveArea_currentPc - sizeofStackSaveArea)] |
| 314 | str rPC, [r1, #(offStackSaveArea_savedPc - sizeofStackSaveArea)] |
| 315 | ldr rPC, [r0, #offMethod_insns] @ rPC<- methodToCall->insns |
| 316 | |
| 317 | |
| 318 | @ set up newSaveArea |
| 319 | str rFP, [r1, #(offStackSaveArea_prevFrame - sizeofStackSaveArea)] |
| 320 | str r3, [r1, #(offStackSaveArea_returnAddr - sizeofStackSaveArea)] |
| 321 | str r0, [r1, #(offStackSaveArea_method - sizeofStackSaveArea)] |
| 322 | cmp r8, #0 @ suspendCount != 0 |
| 323 | bxne r12 @ bail to the interpreter |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 324 | |
| 325 | ldr r3, [r9, #offClassObject_pDvmDex] @ r3<- method->clazz->pDvmDex |
| 326 | ldr r2, [rGLUE, #offGlue_self] @ r2<- glue->self |
| 327 | |
| 328 | @ Update "glue" values for the new method |
| 329 | str r0, [rGLUE, #offGlue_method] @ glue->method = methodToCall |
| 330 | str r3, [rGLUE, #offGlue_methodClassDex] @ glue->methodClassDex = ... |
| 331 | mov rFP, r1 @ fp = newFp |
| 332 | str rFP, [r2, #offThread_curFrame] @ self->curFrame = newFp |
| 333 | |
| 334 | bx lr @ return to the callee-chaining cell |
| 335 | |
| 336 | |
| 337 | |
| 338 | /* ------------------------------ */ |
| 339 | .balign 4 |
| Ben Cheng | 38329f5 | 2009-07-07 14:19:20 -0700 | [diff] [blame] | 340 | .global dvmCompiler_TEMPLATE_INVOKE_METHOD_PREDICTED_CHAIN |
| 341 | dvmCompiler_TEMPLATE_INVOKE_METHOD_PREDICTED_CHAIN: |
| 342 | /* File: armv5te/TEMPLATE_INVOKE_METHOD_PREDICTED_CHAIN.S */ |
| 343 | /* |
| 344 | * For polymorphic callsite, check whether the cached class pointer matches |
| 345 | * the current one. If so setup the Dalvik frame and return to the |
| 346 | * Thumb code through the link register to transfer control to the callee |
| 347 | * method through a dedicated chaining cell. |
| 348 | * |
| Bill Buzbee | 89efc3d | 2009-07-28 11:22:22 -0700 | [diff] [blame] | 349 | * The predicted chaining cell is declared in ArmLIR.h with the |
| Ben Cheng | 38329f5 | 2009-07-07 14:19:20 -0700 | [diff] [blame] | 350 | * following layout: |
| 351 | * |
| 352 | * typedef struct PredictedChainingCell { |
| 353 | * u4 branch; |
| 354 | * const ClassObject *clazz; |
| 355 | * const Method *method; |
| 356 | * u4 counter; |
| 357 | * } PredictedChainingCell; |
| 358 | * |
| 359 | * Upon returning to the callsite: |
| 360 | * - lr : to branch to the chaining cell |
| 361 | * - lr+2: to punt to the interpreter |
| 362 | * - lr+4: to fully resolve the callee and may rechain. |
| 363 | * r3 <- class |
| 364 | * r9 <- counter |
| 365 | */ |
| 366 | @ r0 = this, r1 = returnCell, r2 = predictedChainCell, rPC = dalvikCallsite |
| 367 | ldr r3, [r0, #offObject_clazz] @ r3 <- this->class |
| 368 | ldr r8, [r2, #4] @ r8 <- predictedChainCell->clazz |
| 369 | ldr r0, [r2, #8] @ r0 <- predictedChainCell->method |
| 370 | ldr r9, [r2, #12] @ r9 <- predictedChainCell->counter |
| 371 | cmp r3, r8 @ predicted class == actual class? |
| 372 | beq .LinvokeChain @ predicted chain is valid |
| 373 | ldr r7, [r3, #offClassObject_vtable] @ r7 <- this->class->vtable |
| 374 | sub r1, r9, #1 @ count-- |
| 375 | str r1, [r2, #12] @ write back to PredictedChainingCell->counter |
| 376 | add lr, lr, #4 @ return to fully-resolve landing pad |
| 377 | /* |
| 378 | * r1 <- count |
| 379 | * r2 <- &predictedChainCell |
| 380 | * r3 <- this->class |
| 381 | * r4 <- dPC |
| 382 | * r7 <- this->class->vtable |
| 383 | */ |
| 384 | bx lr |
| 385 | |
| 386 | /* ------------------------------ */ |
| 387 | .balign 4 |
| 388 | .global dvmCompiler_TEMPLATE_INVOKE_METHOD_NATIVE |
| 389 | dvmCompiler_TEMPLATE_INVOKE_METHOD_NATIVE: |
| 390 | /* File: armv5te/TEMPLATE_INVOKE_METHOD_NATIVE.S */ |
| 391 | @ r0 = methodToCall, r1 = returnCell, rPC = dalvikCallsite |
| 392 | ldrh r7, [r0, #offMethod_registersSize] @ r7<- methodToCall->regsSize |
| 393 | ldr r9, [rGLUE, #offGlue_interpStackEnd] @ r9<- interpStackEnd |
| 394 | ldr r8, [rGLUE, #offGlue_pSelfSuspendCount] @ r8<- &suspendCount |
| 395 | add r3, r1, #1 @ Thumb addr is odd |
| 396 | SAVEAREA_FROM_FP(r1, rFP) @ r1<- stack save area |
| 397 | sub r1, r1, r7, lsl #2 @ r1<- newFp (old savearea - regsSize) |
| 398 | SAVEAREA_FROM_FP(r10, r1) @ r10<- stack save area |
| 399 | ldr r8, [r8] @ r3<- suspendCount (int) |
| 400 | cmp r10, r9 @ bottom < interpStackEnd? |
| 401 | bxlt lr @ return to raise stack overflow excep. |
| 402 | @ r1 = newFP, r0 = methodToCall, r3 = returnCell, rPC = dalvikCallsite |
| 403 | str rPC, [rFP, #(offStackSaveArea_currentPc - sizeofStackSaveArea)] |
| 404 | str rPC, [r1, #(offStackSaveArea_savedPc - sizeofStackSaveArea)] |
| 405 | ldr rPC, [r0, #offMethod_insns] @ rPC<- methodToCall->insns |
| 406 | |
| 407 | |
| 408 | @ set up newSaveArea |
| 409 | str rFP, [r1, #(offStackSaveArea_prevFrame - sizeofStackSaveArea)] |
| 410 | str r3, [r1, #(offStackSaveArea_returnAddr - sizeofStackSaveArea)] |
| 411 | ldr r3, [rGLUE, #offGlue_self] @ r3<- glue->self |
| 412 | str r0, [r1, #(offStackSaveArea_method - sizeofStackSaveArea)] |
| 413 | cmp r8, #0 @ suspendCount != 0 |
| 414 | ldr r8, [r0, #offMethod_nativeFunc] @ r8<- method->nativeFunc |
| Jeff Hao | 97319a8 | 2009-08-12 16:57:15 -0700 | [diff] [blame] | 415 | #if !defined(WITH_SELF_VERIFICATION) |
| Ben Cheng | 38329f5 | 2009-07-07 14:19:20 -0700 | [diff] [blame] | 416 | bxne lr @ bail to the interpreter |
| Jeff Hao | 97319a8 | 2009-08-12 16:57:15 -0700 | [diff] [blame] | 417 | #else |
| 418 | bx lr @ bail to interpreter unconditionally |
| 419 | #endif |
| Ben Cheng | 38329f5 | 2009-07-07 14:19:20 -0700 | [diff] [blame] | 420 | |
| 421 | @ go ahead and transfer control to the native code |
| Andy McFadden | d5ab726 | 2009-08-25 07:19:34 -0700 | [diff] [blame] | 422 | ldr r9, [r3, #offThread_jniLocal_topCookie] @ r9<- thread->localRef->... |
| Ben Cheng | 38329f5 | 2009-07-07 14:19:20 -0700 | [diff] [blame] | 423 | str r1, [r3, #offThread_curFrame] @ self->curFrame = newFp |
| Andy McFadden | d5ab726 | 2009-08-25 07:19:34 -0700 | [diff] [blame] | 424 | str r9, [r1, #(offStackSaveArea_localRefCookie - sizeofStackSaveArea)] |
| 425 | @ newFp->localRefCookie=top |
| Ben Cheng | 38329f5 | 2009-07-07 14:19:20 -0700 | [diff] [blame] | 426 | mov r9, r3 @ r9<- glue->self (preserve) |
| 427 | SAVEAREA_FROM_FP(r10, r1) @ r10<- new stack save area |
| 428 | |
| 429 | mov r2, r0 @ r2<- methodToCall |
| 430 | mov r0, r1 @ r0<- newFP |
| 431 | add r1, rGLUE, #offGlue_retval @ r1<- &retval |
| 432 | |
| 433 | blx r8 @ off to the native code |
| 434 | |
| 435 | @ native return; r9=self, r10=newSaveArea |
| 436 | @ equivalent to dvmPopJniLocals |
| 437 | ldr r2, [r10, #offStackSaveArea_returnAddr] @ r2 = chaining cell ret |
| Andy McFadden | d5ab726 | 2009-08-25 07:19:34 -0700 | [diff] [blame] | 438 | ldr r0, [r10, #offStackSaveArea_localRefCookie] @ r0<- saved->top |
| Ben Cheng | 38329f5 | 2009-07-07 14:19:20 -0700 | [diff] [blame] | 439 | ldr r1, [r9, #offThread_exception] @ check for exception |
| 440 | str rFP, [r9, #offThread_curFrame] @ self->curFrame = fp |
| 441 | cmp r1, #0 @ null? |
| Andy McFadden | d5ab726 | 2009-08-25 07:19:34 -0700 | [diff] [blame] | 442 | str r0, [r9, #offThread_jniLocal_topCookie] @ new top <- old top |
| Ben Cheng | 38329f5 | 2009-07-07 14:19:20 -0700 | [diff] [blame] | 443 | bne .LhandleException @ no, handle exception |
| 444 | bx r2 |
| 445 | |
| 446 | |
| 447 | /* ------------------------------ */ |
| 448 | .balign 4 |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 449 | .global dvmCompiler_TEMPLATE_CMPG_DOUBLE |
| 450 | dvmCompiler_TEMPLATE_CMPG_DOUBLE: |
| 451 | /* File: armv5te/TEMPLATE_CMPG_DOUBLE.S */ |
| 452 | /* File: armv5te/TEMPLATE_CMPL_DOUBLE.S */ |
| 453 | /* |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 454 | * For the JIT: incoming arguments in r0-r1, r2-r3 |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 455 | * result in r0 |
| 456 | * |
| 457 | * Compare two floating-point values. Puts 0, 1, or -1 into the |
| 458 | * destination register based on the results of the comparison. |
| 459 | * |
| 460 | * Provide a "naninst" instruction that puts 1 or -1 into r1 depending |
| 461 | * on what value we'd like to return when one of the operands is NaN. |
| 462 | * |
| 463 | * See OP_CMPL_FLOAT for an explanation. |
| 464 | * |
| 465 | * For: cmpl-double, cmpg-double |
| 466 | */ |
| 467 | /* op vAA, vBB, vCC */ |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 468 | push {r0-r3} @ save operands |
| 469 | mov r11, lr @ save return address |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 470 | LDR_PC_LR ".L__aeabi_cdcmple" @ PIC way of "bl __aeabi_cdcmple" |
| 471 | bhi .LTEMPLATE_CMPG_DOUBLE_gt_or_nan @ C set and Z clear, disambiguate |
| 472 | mvncc r0, #0 @ (less than) r1<- -1 |
| 473 | moveq r0, #0 @ (equal) r1<- 0, trumps less than |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 474 | add sp, #16 @ drop unused operands |
| 475 | bx r11 |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 476 | |
| 477 | @ Test for NaN with a second comparison. EABI forbids testing bit |
| 478 | @ patterns, and we can't represent 0x7fc00000 in immediate form, so |
| 479 | @ make the library call. |
| 480 | .LTEMPLATE_CMPG_DOUBLE_gt_or_nan: |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 481 | pop {r2-r3} @ restore operands in reverse order |
| 482 | pop {r0-r1} @ restore operands in reverse order |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 483 | LDR_PC_LR ".L__aeabi_cdcmple" @ r0<- Z set if eq, C clear if < |
| 484 | movcc r0, #1 @ (greater than) r1<- 1 |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 485 | bxcc r11 |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 486 | mov r0, #1 @ r1<- 1 or -1 for NaN |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 487 | bx r11 |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 488 | |
| 489 | |
| 490 | |
| 491 | /* ------------------------------ */ |
| 492 | .balign 4 |
| 493 | .global dvmCompiler_TEMPLATE_CMPL_DOUBLE |
| 494 | dvmCompiler_TEMPLATE_CMPL_DOUBLE: |
| 495 | /* File: armv5te/TEMPLATE_CMPL_DOUBLE.S */ |
| 496 | /* |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 497 | * For the JIT: incoming arguments in r0-r1, r2-r3 |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 498 | * result in r0 |
| 499 | * |
| 500 | * Compare two floating-point values. Puts 0, 1, or -1 into the |
| 501 | * destination register based on the results of the comparison. |
| 502 | * |
| 503 | * Provide a "naninst" instruction that puts 1 or -1 into r1 depending |
| 504 | * on what value we'd like to return when one of the operands is NaN. |
| 505 | * |
| 506 | * See OP_CMPL_FLOAT for an explanation. |
| 507 | * |
| 508 | * For: cmpl-double, cmpg-double |
| 509 | */ |
| 510 | /* op vAA, vBB, vCC */ |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 511 | push {r0-r3} @ save operands |
| 512 | mov r11, lr @ save return address |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 513 | LDR_PC_LR ".L__aeabi_cdcmple" @ PIC way of "bl __aeabi_cdcmple" |
| 514 | bhi .LTEMPLATE_CMPL_DOUBLE_gt_or_nan @ C set and Z clear, disambiguate |
| 515 | mvncc r0, #0 @ (less than) r1<- -1 |
| 516 | moveq r0, #0 @ (equal) r1<- 0, trumps less than |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 517 | add sp, #16 @ drop unused operands |
| 518 | bx r11 |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 519 | |
| 520 | @ Test for NaN with a second comparison. EABI forbids testing bit |
| 521 | @ patterns, and we can't represent 0x7fc00000 in immediate form, so |
| 522 | @ make the library call. |
| 523 | .LTEMPLATE_CMPL_DOUBLE_gt_or_nan: |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 524 | pop {r2-r3} @ restore operands in reverse order |
| 525 | pop {r0-r1} @ restore operands in reverse order |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 526 | LDR_PC_LR ".L__aeabi_cdcmple" @ r0<- Z set if eq, C clear if < |
| 527 | movcc r0, #1 @ (greater than) r1<- 1 |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 528 | bxcc r11 |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 529 | mvn r0, #0 @ r1<- 1 or -1 for NaN |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 530 | bx r11 |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 531 | |
| 532 | |
| 533 | /* ------------------------------ */ |
| 534 | .balign 4 |
| 535 | .global dvmCompiler_TEMPLATE_CMPG_FLOAT |
| 536 | dvmCompiler_TEMPLATE_CMPG_FLOAT: |
| 537 | /* File: armv5te/TEMPLATE_CMPG_FLOAT.S */ |
| 538 | /* File: armv5te/TEMPLATE_CMPL_FLOAT.S */ |
| 539 | /* |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 540 | * For the JIT: incoming arguments in r0-r1, r2-r3 |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 541 | * result in r0 |
| 542 | * |
| 543 | * Compare two floating-point values. Puts 0, 1, or -1 into the |
| 544 | * destination register based on the results of the comparison. |
| 545 | * |
| 546 | * Provide a "naninst" instruction that puts 1 or -1 into r1 depending |
| 547 | * on what value we'd like to return when one of the operands is NaN. |
| 548 | * |
| 549 | * The operation we're implementing is: |
| 550 | * if (x == y) |
| 551 | * return 0; |
| 552 | * else if (x < y) |
| 553 | * return -1; |
| 554 | * else if (x > y) |
| 555 | * return 1; |
| 556 | * else |
| 557 | * return {-1,1}; // one or both operands was NaN |
| 558 | * |
| 559 | * The straightforward implementation requires 3 calls to functions |
| 560 | * that return a result in r0. We can do it with two calls if our |
| 561 | * EABI library supports __aeabi_cfcmple (only one if we want to check |
| 562 | * for NaN directly): |
| 563 | * check x <= y |
| 564 | * if <, return -1 |
| 565 | * if ==, return 0 |
| 566 | * check y <= x |
| 567 | * if <, return 1 |
| 568 | * return {-1,1} |
| 569 | * |
| 570 | * for: cmpl-float, cmpg-float |
| 571 | */ |
| 572 | /* op vAA, vBB, vCC */ |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 573 | mov r9, r0 @ Save copies - we may need to redo |
| 574 | mov r10, r1 |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 575 | mov r11, lr @ save return address |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 576 | LDR_PC_LR ".L__aeabi_cfcmple" @ cmp <=: C clear if <, Z set if eq |
| 577 | bhi .LTEMPLATE_CMPG_FLOAT_gt_or_nan @ C set and Z clear, disambiguate |
| 578 | mvncc r0, #0 @ (less than) r0<- -1 |
| 579 | moveq r0, #0 @ (equal) r0<- 0, trumps less than |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 580 | bx r11 |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 581 | @ Test for NaN with a second comparison. EABI forbids testing bit |
| 582 | @ patterns, and we can't represent 0x7fc00000 in immediate form, so |
| 583 | @ make the library call. |
| 584 | .LTEMPLATE_CMPG_FLOAT_gt_or_nan: |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 585 | mov r0, r10 @ restore in reverse order |
| 586 | mov r1, r9 |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 587 | LDR_PC_LR ".L__aeabi_cfcmple" @ r0<- Z set if eq, C clear if < |
| 588 | movcc r0, #1 @ (greater than) r1<- 1 |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 589 | bxcc r11 |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 590 | mov r0, #1 @ r1<- 1 or -1 for NaN |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 591 | bx r11 |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 592 | |
| 593 | |
| 594 | |
| 595 | |
| 596 | /* ------------------------------ */ |
| 597 | .balign 4 |
| 598 | .global dvmCompiler_TEMPLATE_CMPL_FLOAT |
| 599 | dvmCompiler_TEMPLATE_CMPL_FLOAT: |
| 600 | /* File: armv5te/TEMPLATE_CMPL_FLOAT.S */ |
| 601 | /* |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 602 | * For the JIT: incoming arguments in r0-r1, r2-r3 |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 603 | * result in r0 |
| 604 | * |
| 605 | * Compare two floating-point values. Puts 0, 1, or -1 into the |
| 606 | * destination register based on the results of the comparison. |
| 607 | * |
| 608 | * Provide a "naninst" instruction that puts 1 or -1 into r1 depending |
| 609 | * on what value we'd like to return when one of the operands is NaN. |
| 610 | * |
| 611 | * The operation we're implementing is: |
| 612 | * if (x == y) |
| 613 | * return 0; |
| 614 | * else if (x < y) |
| 615 | * return -1; |
| 616 | * else if (x > y) |
| 617 | * return 1; |
| 618 | * else |
| 619 | * return {-1,1}; // one or both operands was NaN |
| 620 | * |
| 621 | * The straightforward implementation requires 3 calls to functions |
| 622 | * that return a result in r0. We can do it with two calls if our |
| 623 | * EABI library supports __aeabi_cfcmple (only one if we want to check |
| 624 | * for NaN directly): |
| 625 | * check x <= y |
| 626 | * if <, return -1 |
| 627 | * if ==, return 0 |
| 628 | * check y <= x |
| 629 | * if <, return 1 |
| 630 | * return {-1,1} |
| 631 | * |
| 632 | * for: cmpl-float, cmpg-float |
| 633 | */ |
| 634 | /* op vAA, vBB, vCC */ |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 635 | mov r9, r0 @ Save copies - we may need to redo |
| 636 | mov r10, r1 |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 637 | mov r11, lr @ save return address |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 638 | LDR_PC_LR ".L__aeabi_cfcmple" @ cmp <=: C clear if <, Z set if eq |
| 639 | bhi .LTEMPLATE_CMPL_FLOAT_gt_or_nan @ C set and Z clear, disambiguate |
| 640 | mvncc r0, #0 @ (less than) r0<- -1 |
| 641 | moveq r0, #0 @ (equal) r0<- 0, trumps less than |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 642 | bx r11 |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 643 | @ Test for NaN with a second comparison. EABI forbids testing bit |
| 644 | @ patterns, and we can't represent 0x7fc00000 in immediate form, so |
| 645 | @ make the library call. |
| 646 | .LTEMPLATE_CMPL_FLOAT_gt_or_nan: |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 647 | mov r0, r10 @ restore in reverse order |
| 648 | mov r1, r9 |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 649 | LDR_PC_LR ".L__aeabi_cfcmple" @ r0<- Z set if eq, C clear if < |
| 650 | movcc r0, #1 @ (greater than) r1<- 1 |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 651 | bxcc r11 |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 652 | mvn r0, #0 @ r1<- 1 or -1 for NaN |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 653 | bx r11 |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 654 | |
| 655 | |
| 656 | |
| 657 | /* ------------------------------ */ |
| 658 | .balign 4 |
| 659 | .global dvmCompiler_TEMPLATE_MUL_LONG |
| 660 | dvmCompiler_TEMPLATE_MUL_LONG: |
| 661 | /* File: armv5te/TEMPLATE_MUL_LONG.S */ |
| 662 | /* |
| 663 | * Signed 64-bit integer multiply. |
| 664 | * |
| 665 | * For JIT: op1 in r0/r1, op2 in r2/r3, return in r0/r1 |
| 666 | * |
| 667 | * Consider WXxYZ (r1r0 x r3r2) with a long multiply: |
| 668 | * WX |
| 669 | * x YZ |
| 670 | * -------- |
| 671 | * ZW ZX |
| 672 | * YW YX |
| 673 | * |
| 674 | * The low word of the result holds ZX, the high word holds |
| 675 | * (ZW+YX) + (the high overflow from ZX). YW doesn't matter because |
| 676 | * it doesn't fit in the low 64 bits. |
| 677 | * |
| 678 | * Unlike most ARM math operations, multiply instructions have |
| 679 | * restrictions on using the same register more than once (Rd and Rm |
| 680 | * cannot be the same). |
| 681 | */ |
| 682 | /* mul-long vAA, vBB, vCC */ |
| 683 | mul ip, r2, r1 @ ip<- ZxW |
| 684 | umull r9, r10, r2, r0 @ r9/r10 <- ZxX |
| 685 | mla r2, r0, r3, ip @ r2<- YxX + (ZxW) |
| 686 | add r10, r2, r10 @ r10<- r10 + low(ZxW + (YxX)) |
| 687 | mov r0,r9 |
| 688 | mov r1,r10 |
| 689 | bx lr |
| 690 | |
| 691 | /* ------------------------------ */ |
| 692 | .balign 4 |
| 693 | .global dvmCompiler_TEMPLATE_SHL_LONG |
| 694 | dvmCompiler_TEMPLATE_SHL_LONG: |
| 695 | /* File: armv5te/TEMPLATE_SHL_LONG.S */ |
| 696 | /* |
| 697 | * Long integer shift. This is different from the generic 32/64-bit |
| 698 | * binary operations because vAA/vBB are 64-bit but vCC (the shift |
| 699 | * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low |
| 700 | * 6 bits. |
| 701 | */ |
| 702 | /* shl-long vAA, vBB, vCC */ |
| 703 | and r2, r2, #63 @ r2<- r2 & 0x3f |
| 704 | mov r1, r1, asl r2 @ r1<- r1 << r2 |
| 705 | rsb r3, r2, #32 @ r3<- 32 - r2 |
| 706 | orr r1, r1, r0, lsr r3 @ r1<- r1 | (r0 << (32-r2)) |
| 707 | subs ip, r2, #32 @ ip<- r2 - 32 |
| 708 | movpl r1, r0, asl ip @ if r2 >= 32, r1<- r0 << (r2-32) |
| 709 | mov r0, r0, asl r2 @ r0<- r0 << r2 |
| 710 | bx lr |
| 711 | |
| 712 | /* ------------------------------ */ |
| 713 | .balign 4 |
| 714 | .global dvmCompiler_TEMPLATE_SHR_LONG |
| 715 | dvmCompiler_TEMPLATE_SHR_LONG: |
| 716 | /* File: armv5te/TEMPLATE_SHR_LONG.S */ |
| 717 | /* |
| 718 | * Long integer shift. This is different from the generic 32/64-bit |
| 719 | * binary operations because vAA/vBB are 64-bit but vCC (the shift |
| 720 | * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low |
| 721 | * 6 bits. |
| 722 | */ |
| 723 | /* shr-long vAA, vBB, vCC */ |
| 724 | and r2, r2, #63 @ r0<- r0 & 0x3f |
| 725 | mov r0, r0, lsr r2 @ r0<- r2 >> r2 |
| 726 | rsb r3, r2, #32 @ r3<- 32 - r2 |
| 727 | orr r0, r0, r1, asl r3 @ r0<- r0 | (r1 << (32-r2)) |
| 728 | subs ip, r2, #32 @ ip<- r2 - 32 |
| 729 | movpl r0, r1, asr ip @ if r2 >= 32, r0<-r1 >> (r2-32) |
| 730 | mov r1, r1, asr r2 @ r1<- r1 >> r2 |
| 731 | bx lr |
| 732 | |
| 733 | |
| 734 | /* ------------------------------ */ |
| 735 | .balign 4 |
| 736 | .global dvmCompiler_TEMPLATE_USHR_LONG |
| 737 | dvmCompiler_TEMPLATE_USHR_LONG: |
| 738 | /* File: armv5te/TEMPLATE_USHR_LONG.S */ |
| 739 | /* |
| 740 | * Long integer shift. This is different from the generic 32/64-bit |
| 741 | * binary operations because vAA/vBB are 64-bit but vCC (the shift |
| 742 | * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low |
| 743 | * 6 bits. |
| 744 | */ |
| 745 | /* ushr-long vAA, vBB, vCC */ |
| 746 | and r2, r2, #63 @ r0<- r0 & 0x3f |
| 747 | mov r0, r0, lsr r2 @ r0<- r2 >> r2 |
| 748 | rsb r3, r2, #32 @ r3<- 32 - r2 |
| 749 | orr r0, r0, r1, asl r3 @ r0<- r0 | (r1 << (32-r2)) |
| 750 | subs ip, r2, #32 @ ip<- r2 - 32 |
| 751 | movpl r0, r1, lsr ip @ if r2 >= 32, r0<-r1 >>> (r2-32) |
| 752 | mov r1, r1, lsr r2 @ r1<- r1 >>> r2 |
| 753 | bx lr |
| 754 | |
| 755 | |
| Ben Cheng | 4f48917 | 2009-09-27 17:08:35 -0700 | [diff] [blame] | 756 | /* ------------------------------ */ |
| 757 | .balign 4 |
| 758 | .global dvmCompiler_TEMPLATE_THROW_EXCEPTION_COMMON |
| 759 | dvmCompiler_TEMPLATE_THROW_EXCEPTION_COMMON: |
| 760 | /* File: armv5te/TEMPLATE_THROW_EXCEPTION_COMMON.S */ |
| 761 | /* |
| 762 | * Throw an exception from JIT'ed code. |
| 763 | * On entry: |
| 764 | * r0 Dalvik PC that raises the exception |
| 765 | */ |
| 766 | b .LhandleException |
| 767 | |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 768 | /* ------------------------------ */ |
| 769 | .balign 4 |
| 770 | .global dvmCompiler_TEMPLATE_SAVE_STATE |
| 771 | dvmCompiler_TEMPLATE_SAVE_STATE: |
| 772 | /* File: armv5te/TEMPLATE_SAVE_STATE.S */ |
| 773 | /* |
| 774 | * This handler performs a register save for selfVerification mode. |
| 775 | * On entry: |
| 776 | * Top of stack + 4: r7 value to save |
| 777 | * Top of stack + 0: r0 value to save |
| 778 | * r0 - offset from rGLUE to the beginning of the heapArgSpace record |
| 779 | * r7 - the value of regMap |
| 780 | * |
| 781 | * The handler must save regMap, r0-r12 and then return with r0-r12 |
| 782 | * with their original values (note that this means r0 and r7 must take |
| 783 | * the values on the stack - not the ones in those registers on entry. |
| 784 | * Finally, the two registers previously pushed must be popped. |
| 785 | */ |
| 786 | add r0, r0, rGLUE @ pointer to heapArgSpace |
| 787 | stmia r0!, {r7} @ save regMap |
| 788 | ldr r7, [r13, #0] @ recover r0 value |
| 789 | stmia r0!, {r7} @ save r0 |
| 790 | ldr r7, [r13, #4] @ recover r7 value |
| 791 | stmia r0!, {r1-r12} |
| 792 | pop {r0, r7} @ recover r0, r7 |
| 793 | bx lr |
| 794 | |
| 795 | /* ------------------------------ */ |
| 796 | .balign 4 |
| 797 | .global dvmCompiler_TEMPLATE_RESTORE_STATE |
| 798 | dvmCompiler_TEMPLATE_RESTORE_STATE: |
| 799 | /* File: armv5te/TEMPLATE_RESTORE_STATE.S */ |
| 800 | /* |
| 801 | * This handler restores state following a selfVerification memory access. |
| 802 | * On entry: |
| 803 | * r0 - offset from rGLUE to the 1st element of the coreRegs save array. |
| 804 | */ |
| 805 | add r0, r0, rGLUE @ pointer to heapArgSpace.coreRegs[0] |
| 806 | ldmia r0, {r0-r12} |
| 807 | bx lr |
| 808 | |
| Bill Buzbee | fd023aa | 2009-11-02 09:23:49 -0800 | [diff] [blame] | 809 | /* ------------------------------ */ |
| 810 | .balign 4 |
| 811 | .global dvmCompiler_TEMPLATE_STRING_COMPARETO |
| 812 | dvmCompiler_TEMPLATE_STRING_COMPARETO: |
| 813 | /* File: armv5te/TEMPLATE_STRING_COMPARETO.S */ |
| 814 | /* |
| 815 | * String's compareTo. |
| 816 | * |
| 817 | * Requires r0/r1 to have been previously checked for null. Will |
| 818 | * return negative if this's string is < comp, 0 if they are the |
| 819 | * same and positive if >. |
| 820 | * |
| 821 | * IMPORTANT NOTE: |
| 822 | * |
| 823 | * This code relies on hard-coded offsets for string objects, and must be |
| 824 | * kept in sync with definitions in UtfString.h. See asm-constants.h |
| 825 | * |
| 826 | * On entry: |
| 827 | * r0: this object pointer |
| 828 | * r1: comp object pointer |
| 829 | * |
| 830 | */ |
| 831 | |
| 832 | mov r2, r0 @ this to r2, opening up r0 for return value |
| 833 | subs r0, r2, r1 @ Same? |
| 834 | bxeq lr |
| 835 | |
| 836 | ldr r4, [r2, #STRING_FIELDOFF_OFFSET] |
| 837 | ldr r9, [r1, #STRING_FIELDOFF_OFFSET] |
| 838 | ldr r7, [r2, #STRING_FIELDOFF_COUNT] |
| 839 | ldr r10, [r1, #STRING_FIELDOFF_COUNT] |
| 840 | ldr r2, [r2, #STRING_FIELDOFF_VALUE] |
| 841 | ldr r1, [r1, #STRING_FIELDOFF_VALUE] |
| 842 | |
| 843 | /* |
| 844 | * At this point, we have: |
| 845 | * value: r2/r1 |
| 846 | * offset: r4/r9 |
| 847 | * count: r7/r10 |
| 848 | * We're going to compute |
| 849 | * r11 <- countDiff |
| 850 | * r10 <- minCount |
| 851 | */ |
| 852 | subs r11, r7, r10 |
| 853 | movls r10, r7 |
| 854 | |
| 855 | /* Now, build pointers to the string data */ |
| 856 | add r2, r2, r4, lsl #1 |
| 857 | add r1, r1, r9, lsl #1 |
| 858 | /* |
| 859 | * Note: data pointers point to previous element so we can use pre-index |
| 860 | * mode with base writeback. |
| 861 | */ |
| 862 | add r2, #16-2 @ offset to contents[-1] |
| 863 | add r1, #16-2 @ offset to contents[-1] |
| 864 | |
| 865 | /* |
| 866 | * At this point we have: |
| 867 | * r2: *this string data |
| 868 | * r1: *comp string data |
| 869 | * r10: iteration count for comparison |
| 870 | * r11: value to return if the first part of the string is equal |
| 871 | * r0: reserved for result |
| 872 | * r3, r4, r7, r8, r9, r12 available for loading string data |
| 873 | */ |
| 874 | |
| 875 | cmp r10, #3 |
| 876 | blt do_remainder |
| 877 | loopback_triple: |
| 878 | ldrh r3, [r2, #2]! |
| 879 | ldrh r4, [r1, #2]! |
| 880 | ldrh r7, [r2, #2]! |
| 881 | ldrh r8, [r1, #2]! |
| 882 | ldrh r9, [r2, #2]! |
| 883 | ldrh r12,[r1, #2]! |
| 884 | subs r0, r3, r4 |
| 885 | subeqs r0, r7, r8 |
| 886 | subeqs r0, r9, r12 |
| 887 | bxne lr |
| 888 | subs r10, #3 |
| 889 | bgt loopback_triple |
| 890 | |
| 891 | do_remainder: |
| 892 | cmp r10, #0 |
| 893 | beq returnDiff |
| 894 | |
| 895 | loopback_single: |
| 896 | ldrh r3, [r2, #2]! |
| 897 | ldrh r4, [r1, #2]! |
| 898 | subs r0, r3, r4 |
| 899 | bxne lr |
| 900 | subs r10, #1 |
| 901 | bne loopback_single |
| 902 | |
| 903 | returnDiff: |
| 904 | mov r0, r11 |
| 905 | bx lr |
| 906 | |
| 907 | |
| 908 | /* ------------------------------ */ |
| 909 | .balign 4 |
| 910 | .global dvmCompiler_TEMPLATE_STRING_INDEXOF |
| 911 | dvmCompiler_TEMPLATE_STRING_INDEXOF: |
| 912 | /* File: armv5te/TEMPLATE_STRING_INDEXOF.S */ |
| 913 | /* |
| 914 | * String's indexOf. |
| 915 | * |
| 916 | * Requires r0 to have been previously checked for null. Will |
| 917 | * return index of match of r1 in r0. |
| 918 | * |
| 919 | * IMPORTANT NOTE: |
| 920 | * |
| 921 | * This code relies on hard-coded offsets for string objects, and must be |
| 922 | * kept in sync wth definitions in UtfString.h See asm-constants.h |
| 923 | * |
| 924 | * On entry: |
| 925 | * r0: string object pointer |
| 926 | * r1: char to match |
| 927 | * r2: Starting offset in string data |
| 928 | */ |
| 929 | |
| 930 | ldr r7, [r0, #STRING_FIELDOFF_OFFSET] |
| 931 | ldr r8, [r0, #STRING_FIELDOFF_COUNT] |
| 932 | ldr r0, [r0, #STRING_FIELDOFF_VALUE] |
| 933 | |
| 934 | /* |
| 935 | * At this point, we have: |
| Bill Buzbee | 4902449 | 2009-11-03 16:52:53 -0800 | [diff] [blame] | 936 | * r0: object pointer |
| 937 | * r1: char to match |
| 938 | * r2: starting offset |
| 939 | * r7: offset |
| 940 | * r8: string length |
| Bill Buzbee | fd023aa | 2009-11-02 09:23:49 -0800 | [diff] [blame] | 941 | */ |
| 942 | |
| Bill Buzbee | 4902449 | 2009-11-03 16:52:53 -0800 | [diff] [blame] | 943 | /* Build pointer to start of string data */ |
| 944 | add r0, #16 |
| 945 | add r0, r0, r7, lsl #1 |
| 946 | |
| 947 | /* Save a copy of starting data in r7 */ |
| 948 | mov r7, r0 |
| 949 | |
| Bill Buzbee | fd023aa | 2009-11-02 09:23:49 -0800 | [diff] [blame] | 950 | /* Clamp start to [0..count] */ |
| 951 | cmp r2, #0 |
| 952 | movlt r2, #0 |
| 953 | cmp r2, r8 |
| Bill Buzbee | 4902449 | 2009-11-03 16:52:53 -0800 | [diff] [blame] | 954 | movgt r2, r8 |
| Bill Buzbee | fd023aa | 2009-11-02 09:23:49 -0800 | [diff] [blame] | 955 | |
| Bill Buzbee | 4902449 | 2009-11-03 16:52:53 -0800 | [diff] [blame] | 956 | /* Build pointer to start of data to compare and pre-bias */ |
| Bill Buzbee | fd023aa | 2009-11-02 09:23:49 -0800 | [diff] [blame] | 957 | add r0, r0, r2, lsl #1 |
| Bill Buzbee | 4902449 | 2009-11-03 16:52:53 -0800 | [diff] [blame] | 958 | sub r0, #2 |
| 959 | |
| 960 | /* Compute iteration count */ |
| 961 | sub r8, r2 |
| Bill Buzbee | fd023aa | 2009-11-02 09:23:49 -0800 | [diff] [blame] | 962 | |
| 963 | /* |
| 964 | * At this point we have: |
| Bill Buzbee | 4902449 | 2009-11-03 16:52:53 -0800 | [diff] [blame] | 965 | * r0: start of data to test |
| 966 | * r1: chat to compare |
| 967 | * r8: iteration count |
| 968 | * r7: original start of string |
| 969 | * r3, r4, r9, r10, r11, r12 available for loading string data |
| Bill Buzbee | fd023aa | 2009-11-02 09:23:49 -0800 | [diff] [blame] | 970 | */ |
| 971 | |
| Bill Buzbee | 4902449 | 2009-11-03 16:52:53 -0800 | [diff] [blame] | 972 | sub r8, #4 |
| 973 | blt indexof_remainder |
| Bill Buzbee | fd023aa | 2009-11-02 09:23:49 -0800 | [diff] [blame] | 974 | |
| Bill Buzbee | 4902449 | 2009-11-03 16:52:53 -0800 | [diff] [blame] | 975 | indexof_loop4: |
| Bill Buzbee | fd023aa | 2009-11-02 09:23:49 -0800 | [diff] [blame] | 976 | ldrh r3, [r0, #2]! |
| 977 | ldrh r4, [r0, #2]! |
| Bill Buzbee | 4902449 | 2009-11-03 16:52:53 -0800 | [diff] [blame] | 978 | ldrh r10, [r0, #2]! |
| 979 | ldrh r11, [r0, #2]! |
| Bill Buzbee | fd023aa | 2009-11-02 09:23:49 -0800 | [diff] [blame] | 980 | cmp r3, r1 |
| 981 | beq match_0 |
| 982 | cmp r4, r1 |
| 983 | beq match_1 |
| Bill Buzbee | 4902449 | 2009-11-03 16:52:53 -0800 | [diff] [blame] | 984 | cmp r10, r1 |
| Bill Buzbee | fd023aa | 2009-11-02 09:23:49 -0800 | [diff] [blame] | 985 | beq match_2 |
| Bill Buzbee | 4902449 | 2009-11-03 16:52:53 -0800 | [diff] [blame] | 986 | cmp r11, r1 |
| Bill Buzbee | fd023aa | 2009-11-02 09:23:49 -0800 | [diff] [blame] | 987 | beq match_3 |
| 988 | subs r8, #4 |
| Bill Buzbee | 4902449 | 2009-11-03 16:52:53 -0800 | [diff] [blame] | 989 | bge indexof_loop4 |
| Bill Buzbee | fd023aa | 2009-11-02 09:23:49 -0800 | [diff] [blame] | 990 | |
| Bill Buzbee | 4902449 | 2009-11-03 16:52:53 -0800 | [diff] [blame] | 991 | indexof_remainder: |
| 992 | adds r8, #4 |
| 993 | beq indexof_nomatch |
| Bill Buzbee | fd023aa | 2009-11-02 09:23:49 -0800 | [diff] [blame] | 994 | |
| Bill Buzbee | 4902449 | 2009-11-03 16:52:53 -0800 | [diff] [blame] | 995 | indexof_loop1: |
| Bill Buzbee | fd023aa | 2009-11-02 09:23:49 -0800 | [diff] [blame] | 996 | ldrh r3, [r0, #2]! |
| 997 | cmp r3, r1 |
| 998 | beq match_3 |
| 999 | subs r8, #1 |
| Bill Buzbee | 4902449 | 2009-11-03 16:52:53 -0800 | [diff] [blame] | 1000 | bne indexof_loop1 |
| Bill Buzbee | fd023aa | 2009-11-02 09:23:49 -0800 | [diff] [blame] | 1001 | |
| Bill Buzbee | 4902449 | 2009-11-03 16:52:53 -0800 | [diff] [blame] | 1002 | indexof_nomatch: |
| Bill Buzbee | fd023aa | 2009-11-02 09:23:49 -0800 | [diff] [blame] | 1003 | mov r0, #-1 |
| 1004 | bx lr |
| 1005 | |
| 1006 | match_0: |
| 1007 | sub r0, #6 |
| Bill Buzbee | 4902449 | 2009-11-03 16:52:53 -0800 | [diff] [blame] | 1008 | sub r0, r7 |
| 1009 | asr r0, r0, #1 |
| Bill Buzbee | fd023aa | 2009-11-02 09:23:49 -0800 | [diff] [blame] | 1010 | bx lr |
| 1011 | match_1: |
| 1012 | sub r0, #4 |
| Bill Buzbee | 4902449 | 2009-11-03 16:52:53 -0800 | [diff] [blame] | 1013 | sub r0, r7 |
| 1014 | asr r0, r0, #1 |
| Bill Buzbee | fd023aa | 2009-11-02 09:23:49 -0800 | [diff] [blame] | 1015 | bx lr |
| 1016 | match_2: |
| 1017 | sub r0, #2 |
| Bill Buzbee | 4902449 | 2009-11-03 16:52:53 -0800 | [diff] [blame] | 1018 | sub r0, r7 |
| 1019 | asr r0, r0, #1 |
| Bill Buzbee | fd023aa | 2009-11-02 09:23:49 -0800 | [diff] [blame] | 1020 | bx lr |
| 1021 | match_3: |
| Bill Buzbee | 4902449 | 2009-11-03 16:52:53 -0800 | [diff] [blame] | 1022 | sub r0, r7 |
| 1023 | asr r0, r0, #1 |
| Bill Buzbee | fd023aa | 2009-11-02 09:23:49 -0800 | [diff] [blame] | 1024 | bx lr |
| 1025 | |
| 1026 | |
| Bill Buzbee | 9a8c75a | 2009-11-08 14:31:20 -0800 | [diff] [blame^] | 1027 | /* ------------------------------ */ |
| 1028 | .balign 4 |
| 1029 | .global dvmCompiler_TEMPLATE_INTERPRET |
| 1030 | dvmCompiler_TEMPLATE_INTERPRET: |
| 1031 | /* File: armv5te/TEMPLATE_INTERPRET.S */ |
| 1032 | /* |
| 1033 | * This handler transfers control to the interpeter without performing |
| 1034 | * any lookups. It may be called either as part of a normal chaining |
| 1035 | * operation, or from the transition code in header.S. We distinquish |
| 1036 | * the two cases by looking at the link register. If called from a |
| 1037 | * translation chain, it will point to the chaining Dalvik PC + 1. |
| 1038 | * On entry: |
| 1039 | * lr - if NULL: |
| 1040 | * r1 - the Dalvik PC to begin interpretation. |
| 1041 | * else |
| 1042 | * [lr, #-1] contains Dalvik PC to begin interpretation |
| 1043 | * rGLUE - pointer to interpState |
| 1044 | * rFP - Dalvik frame pointer |
| 1045 | */ |
| 1046 | cmp lr, #0 |
| 1047 | ldrne r1,[lr, #-1] |
| 1048 | ldr r2, .LinterpPunt |
| 1049 | mov r0, r1 @ set Dalvik PC |
| 1050 | bx r2 |
| 1051 | @ doesn't return |
| 1052 | |
| 1053 | .LinterpPunt: |
| 1054 | .word dvmJitToInterpPunt |
| 1055 | |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1056 | .size dvmCompilerTemplateStart, .-dvmCompilerTemplateStart |
| 1057 | /* File: armv5te/footer.S */ |
| 1058 | /* |
| 1059 | * =========================================================================== |
| 1060 | * Common subroutines and data |
| 1061 | * =========================================================================== |
| 1062 | */ |
| 1063 | |
| 1064 | .text |
| 1065 | .align 2 |
| 1066 | .LinvokeNative: |
| 1067 | @ Prep for the native call |
| 1068 | @ r1 = newFP, r0 = methodToCall |
| 1069 | ldr r3, [rGLUE, #offGlue_self] @ r3<- glue->self |
| Andy McFadden | d5ab726 | 2009-08-25 07:19:34 -0700 | [diff] [blame] | 1070 | ldr r9, [r3, #offThread_jniLocal_topCookie] @ r9<- thread->localRef->... |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1071 | str r1, [r3, #offThread_curFrame] @ self->curFrame = newFp |
| Andy McFadden | d5ab726 | 2009-08-25 07:19:34 -0700 | [diff] [blame] | 1072 | str r9, [r1, #(offStackSaveArea_localRefCookie - sizeofStackSaveArea)] |
| 1073 | @ newFp->localRefCookie=top |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1074 | mov r9, r3 @ r9<- glue->self (preserve) |
| 1075 | SAVEAREA_FROM_FP(r10, r1) @ r10<- new stack save area |
| 1076 | |
| 1077 | mov r2, r0 @ r2<- methodToCall |
| 1078 | mov r0, r1 @ r0<- newFP |
| 1079 | add r1, rGLUE, #offGlue_retval @ r1<- &retval |
| 1080 | |
| 1081 | LDR_PC_LR "[r2, #offMethod_nativeFunc]" |
| 1082 | |
| 1083 | @ native return; r9=self, r10=newSaveArea |
| 1084 | @ equivalent to dvmPopJniLocals |
| 1085 | ldr r2, [r10, #offStackSaveArea_returnAddr] @ r2 = chaining cell ret |
| Andy McFadden | d5ab726 | 2009-08-25 07:19:34 -0700 | [diff] [blame] | 1086 | ldr r0, [r10, #offStackSaveArea_localRefCookie] @ r0<- saved->top |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1087 | ldr r1, [r9, #offThread_exception] @ check for exception |
| 1088 | str rFP, [r9, #offThread_curFrame] @ self->curFrame = fp |
| 1089 | cmp r1, #0 @ null? |
| Andy McFadden | d5ab726 | 2009-08-25 07:19:34 -0700 | [diff] [blame] | 1090 | str r0, [r9, #offThread_jniLocal_topCookie] @ new top <- old top |
| Ben Cheng | 4f48917 | 2009-09-27 17:08:35 -0700 | [diff] [blame] | 1091 | ldr r0, [r10, #offStackSaveArea_savedPc] @ reload rPC |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1092 | bne .LhandleException @ no, handle exception |
| 1093 | bx r2 |
| 1094 | |
| Ben Cheng | 4f48917 | 2009-09-27 17:08:35 -0700 | [diff] [blame] | 1095 | /* |
| 1096 | * On entry: |
| 1097 | * r0 Faulting Dalvik PC |
| 1098 | */ |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1099 | .LhandleException: |
| Ben Cheng | 4f48917 | 2009-09-27 17:08:35 -0700 | [diff] [blame] | 1100 | ldr r1, .LdvmMterpCommonExceptionThrown @ PIC way of getting &func |
| Ben Cheng | cc6600c | 2009-06-22 14:45:16 -0700 | [diff] [blame] | 1101 | ldr rIBASE, .LdvmAsmInstructionStart @ same as above |
| Ben Cheng | 4f48917 | 2009-09-27 17:08:35 -0700 | [diff] [blame] | 1102 | mov rPC, r0 @ reload the faulting Dalvik address |
| 1103 | mov pc, r1 @ branch to dvmMterpCommonExceptionThrown |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1104 | |
| 1105 | .align 2 |
| 1106 | .LdvmAsmInstructionStart: |
| 1107 | .word dvmAsmInstructionStart |
| 1108 | .LdvmJitToInterpNoChain: |
| 1109 | .word dvmJitToInterpNoChain |
| 1110 | .LdvmMterpStdBail: |
| 1111 | .word dvmMterpStdBail |
| Ben Cheng | cc6600c | 2009-06-22 14:45:16 -0700 | [diff] [blame] | 1112 | .LdvmMterpCommonExceptionThrown: |
| 1113 | .word dvmMterpCommonExceptionThrown |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1114 | .L__aeabi_cdcmple: |
| 1115 | .word __aeabi_cdcmple |
| 1116 | .L__aeabi_cfcmple: |
| 1117 | .word __aeabi_cfcmple |
| 1118 | |
| 1119 | .global dmvCompilerTemplateEnd |
| 1120 | dmvCompilerTemplateEnd: |
| 1121 | |
| 1122 | #endif /* WITH_JIT */ |
| 1123 | |