Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include "asm_support_mips64.S" |
| 18 | |
| 19 | #include "arch/quick_alloc_entrypoints.S" |
| 20 | |
| 21 | .set noreorder |
| 22 | .balign 16 |
| 23 | |
| 24 | /* Deliver the given exception */ |
| 25 | .extern artDeliverExceptionFromCode |
| 26 | /* Deliver an exception pending on a thread */ |
| 27 | .extern artDeliverPendingExceptionFromCode |
| 28 | |
| 29 | /* |
Goran Jakovljevic | 0456881 | 2015-04-23 15:27:23 +0200 | [diff] [blame] | 30 | * Macro that sets up $gp and stores the previous $gp value to $t8. |
| 31 | * This macro modifies v1 and t8. |
| 32 | */ |
| 33 | .macro SETUP_GP |
| 34 | move $v1, $ra |
| 35 | bal 1f |
| 36 | nop |
| 37 | 1: |
| 38 | .cpsetup $ra, $t8, 1b |
| 39 | move $ra, $v1 |
| 40 | .endm |
| 41 | |
| 42 | /* |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 43 | * Macro that sets up the callee save frame to conform with |
| 44 | * Runtime::CreateCalleeSaveMethod(kSaveAll) |
| 45 | * callee-save: padding + $f24-$f31 + $s0-$s7 + $gp + $ra + $s8 = 19 total + 1x8 bytes padding |
| 46 | */ |
| 47 | .macro SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
| 48 | daddiu $sp, $sp, -160 |
| 49 | .cfi_adjust_cfa_offset 160 |
| 50 | |
| 51 | // Ugly compile-time check, but we only have the preprocessor. |
| 52 | #if (FRAME_SIZE_SAVE_ALL_CALLEE_SAVE != 160) |
| 53 | #error "SAVE_ALL_CALLEE_SAVE_FRAME(MIPS64) size not as expected." |
| 54 | #endif |
| 55 | |
| 56 | sd $ra, 152($sp) |
| 57 | .cfi_rel_offset 31, 152 |
| 58 | sd $s8, 144($sp) |
| 59 | .cfi_rel_offset 30, 144 |
Goran Jakovljevic | 0456881 | 2015-04-23 15:27:23 +0200 | [diff] [blame] | 60 | sd $t8, 136($sp) # t8 holds caller's gp, now save it to the stack. |
| 61 | .cfi_rel_offset 28, 136 # Value from gp is pushed, so set the cfi offset accordingly. |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 62 | sd $s7, 128($sp) |
| 63 | .cfi_rel_offset 23, 128 |
| 64 | sd $s6, 120($sp) |
| 65 | .cfi_rel_offset 22, 120 |
| 66 | sd $s5, 112($sp) |
| 67 | .cfi_rel_offset 21, 112 |
| 68 | sd $s4, 104($sp) |
| 69 | .cfi_rel_offset 20, 104 |
| 70 | sd $s3, 96($sp) |
| 71 | .cfi_rel_offset 19, 96 |
| 72 | sd $s2, 88($sp) |
| 73 | .cfi_rel_offset 18, 88 |
| 74 | sd $s1, 80($sp) |
| 75 | .cfi_rel_offset 17, 80 |
| 76 | sd $s0, 72($sp) |
| 77 | .cfi_rel_offset 16, 72 |
| 78 | |
| 79 | // FP callee-saves |
| 80 | s.d $f31, 64($sp) |
| 81 | s.d $f30, 56($sp) |
| 82 | s.d $f29, 48($sp) |
| 83 | s.d $f28, 40($sp) |
| 84 | s.d $f27, 32($sp) |
| 85 | s.d $f26, 24($sp) |
| 86 | s.d $f25, 16($sp) |
| 87 | s.d $f24, 8($sp) |
| 88 | |
| 89 | # load appropriate callee-save-method |
| 90 | ld $v0, %got(_ZN3art7Runtime9instance_E)($gp) |
| 91 | ld $v0, 0($v0) |
| 92 | THIS_LOAD_REQUIRES_READ_BARRIER |
Mathieu Chartier | bb87e0f | 2015-04-03 11:21:55 -0700 | [diff] [blame] | 93 | lwu $v0, RUNTIME_SAVE_ALL_CALLEE_SAVE_FRAME_OFFSET($v0) |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 94 | sw $v0, 0($sp) # Place Method* at bottom of stack. |
| 95 | sd $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF) # Place sp in Thread::Current()->top_quick_frame. |
| 96 | .endm |
| 97 | |
| 98 | /* |
| 99 | * Macro that sets up the callee save frame to conform with |
| 100 | * Runtime::CreateCalleeSaveMethod(kRefsOnly). Restoration assumes |
| 101 | * non-moving GC. |
| 102 | * Does not include rSUSPEND or rSELF |
| 103 | * callee-save: padding + $s2-$s7 + $gp + $ra + $s8 = 9 total + 1x8 bytes padding |
| 104 | */ |
| 105 | .macro SETUP_REFS_ONLY_CALLEE_SAVE_FRAME |
| 106 | daddiu $sp, $sp, -80 |
| 107 | .cfi_adjust_cfa_offset 80 |
| 108 | |
| 109 | // Ugly compile-time check, but we only have the preprocessor. |
| 110 | #if (FRAME_SIZE_REFS_ONLY_CALLEE_SAVE != 80) |
| 111 | #error "REFS_ONLY_CALLEE_SAVE_FRAME(MIPS64) size not as expected." |
| 112 | #endif |
| 113 | |
| 114 | sd $ra, 72($sp) |
| 115 | .cfi_rel_offset 31, 72 |
| 116 | sd $s8, 64($sp) |
| 117 | .cfi_rel_offset 30, 64 |
Goran Jakovljevic | 0456881 | 2015-04-23 15:27:23 +0200 | [diff] [blame] | 118 | sd $t8, 56($sp) # t8 holds caller's gp, now save it to the stack. |
| 119 | .cfi_rel_offset 28, 56 # Value from gp is pushed, so set the cfi offset accordingly. |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 120 | sd $s7, 48($sp) |
| 121 | .cfi_rel_offset 23, 48 |
| 122 | sd $s6, 40($sp) |
| 123 | .cfi_rel_offset 22, 40 |
| 124 | sd $s5, 32($sp) |
| 125 | .cfi_rel_offset 21, 32 |
| 126 | sd $s4, 24($sp) |
| 127 | .cfi_rel_offset 20, 24 |
| 128 | sd $s3, 16($sp) |
| 129 | .cfi_rel_offset 19, 16 |
| 130 | sd $s2, 8($sp) |
| 131 | .cfi_rel_offset 18, 8 |
| 132 | # load appropriate callee-save-method |
| 133 | ld $v0, %got(_ZN3art7Runtime9instance_E)($gp) |
| 134 | ld $v0, 0($v0) |
| 135 | THIS_LOAD_REQUIRES_READ_BARRIER |
Mathieu Chartier | bb87e0f | 2015-04-03 11:21:55 -0700 | [diff] [blame] | 136 | lwu $v0, RUNTIME_REFS_ONLY_CALLEE_SAVE_FRAME_OFFSET($v0) |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 137 | sw $v0, 0($sp) # Place Method* at bottom of stack. |
| 138 | sd $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF) # Place sp in Thread::Current()->top_quick_frame. |
| 139 | .endm |
| 140 | |
| 141 | .macro RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME |
| 142 | ld $ra, 72($sp) |
| 143 | .cfi_restore 31 |
| 144 | ld $s8, 64($sp) |
| 145 | .cfi_restore 30 |
Goran Jakovljevic | 0456881 | 2015-04-23 15:27:23 +0200 | [diff] [blame] | 146 | ld $t8, 56($sp) # Restore gp back to it's temp storage. |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 147 | .cfi_restore 28 |
| 148 | ld $s7, 48($sp) |
| 149 | .cfi_restore 23 |
| 150 | ld $s6, 40($sp) |
| 151 | .cfi_restore 22 |
| 152 | ld $s5, 32($sp) |
| 153 | .cfi_restore 21 |
| 154 | ld $s4, 24($sp) |
| 155 | .cfi_restore 20 |
| 156 | ld $s3, 16($sp) |
| 157 | .cfi_restore 19 |
| 158 | ld $s2, 8($sp) |
| 159 | .cfi_restore 18 |
| 160 | daddiu $sp, $sp, 80 |
| 161 | .cfi_adjust_cfa_offset -80 |
Goran Jakovljevic | 0456881 | 2015-04-23 15:27:23 +0200 | [diff] [blame] | 162 | .cpreturn |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 163 | .endm |
| 164 | |
| 165 | .macro RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME_AND_RETURN |
| 166 | ld $ra, 72($sp) |
| 167 | .cfi_restore 31 |
| 168 | ld $s8, 64($sp) |
| 169 | .cfi_restore 30 |
Goran Jakovljevic | 0456881 | 2015-04-23 15:27:23 +0200 | [diff] [blame] | 170 | ld $t8, 56($sp) # Restore gp back to it's temp storage. |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 171 | .cfi_restore 28 |
| 172 | ld $s7, 48($sp) |
| 173 | .cfi_restore 23 |
| 174 | ld $s6, 40($sp) |
| 175 | .cfi_restore 22 |
| 176 | ld $s5, 32($sp) |
| 177 | .cfi_restore 21 |
| 178 | ld $s4, 24($sp) |
| 179 | .cfi_restore 20 |
| 180 | ld $s3, 16($sp) |
| 181 | .cfi_restore 19 |
| 182 | ld $s2, 8($sp) |
| 183 | .cfi_restore 18 |
Goran Jakovljevic | 0456881 | 2015-04-23 15:27:23 +0200 | [diff] [blame] | 184 | .cpreturn |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 185 | jalr $zero, $ra |
| 186 | daddiu $sp, $sp, 80 |
| 187 | .cfi_adjust_cfa_offset -80 |
| 188 | .endm |
| 189 | |
| 190 | // This assumes the top part of these stack frame types are identical. |
| 191 | #define REFS_AND_ARGS_MINUS_REFS_SIZE (FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE - FRAME_SIZE_REFS_ONLY_CALLEE_SAVE) |
| 192 | |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 193 | .macro SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME_INTERNAL |
| 194 | daddiu $sp, $sp, -208 |
| 195 | .cfi_adjust_cfa_offset 208 |
| 196 | |
| 197 | // Ugly compile-time check, but we only have the preprocessor. |
| 198 | #if (FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE != 208) |
| 199 | #error "REFS_AND_ARGS_CALLEE_SAVE_FRAME(MIPS64) size not as expected." |
| 200 | #endif |
| 201 | |
| 202 | sd $ra, 200($sp) # = kQuickCalleeSaveFrame_RefAndArgs_LrOffset |
| 203 | .cfi_rel_offset 31, 200 |
| 204 | sd $s8, 192($sp) |
| 205 | .cfi_rel_offset 30, 192 |
Goran Jakovljevic | 0456881 | 2015-04-23 15:27:23 +0200 | [diff] [blame] | 206 | sd $t8, 184($sp) # t8 holds caller's gp, now save it to the stack. |
| 207 | .cfi_rel_offset 28, 184 # Value from gp is pushed, so set the cfi offset accordingly. |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 208 | sd $s7, 176($sp) |
| 209 | .cfi_rel_offset 23, 176 |
| 210 | sd $s6, 168($sp) |
| 211 | .cfi_rel_offset 22, 168 |
| 212 | sd $s5, 160($sp) |
| 213 | .cfi_rel_offset 21, 160 |
| 214 | sd $s4, 152($sp) |
| 215 | .cfi_rel_offset 20, 152 |
| 216 | sd $s3, 144($sp) |
| 217 | .cfi_rel_offset 19, 144 |
| 218 | sd $s2, 136($sp) |
| 219 | .cfi_rel_offset 18, 136 |
| 220 | |
| 221 | sd $a7, 128($sp) |
| 222 | .cfi_rel_offset 11, 128 |
| 223 | sd $a6, 120($sp) |
| 224 | .cfi_rel_offset 10, 120 |
| 225 | sd $a5, 112($sp) |
| 226 | .cfi_rel_offset 9, 112 |
| 227 | sd $a4, 104($sp) |
| 228 | .cfi_rel_offset 8, 104 |
| 229 | sd $a3, 96($sp) |
| 230 | .cfi_rel_offset 7, 96 |
| 231 | sd $a2, 88($sp) |
| 232 | .cfi_rel_offset 6, 88 |
| 233 | sd $a1, 80($sp) # = kQuickCalleeSaveFrame_RefAndArgs_Gpr1Offset |
| 234 | .cfi_rel_offset 5, 80 |
| 235 | |
| 236 | s.d $f19, 72($sp) |
| 237 | s.d $f18, 64($sp) |
| 238 | s.d $f17, 56($sp) |
| 239 | s.d $f16, 48($sp) |
| 240 | s.d $f15, 40($sp) |
| 241 | s.d $f14, 32($sp) |
| 242 | s.d $f13, 24($sp) # = kQuickCalleeSaveFrame_RefAndArgs_Fpr1Offset |
| 243 | s.d $f12, 16($sp) # This isn't necessary to store. |
Douglas Leung | 8223b80 | 2015-04-28 17:22:29 -0700 | [diff] [blame] | 244 | # 1x8 bytes padding + Method* |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 245 | .endm |
| 246 | |
Douglas Leung | 8223b80 | 2015-04-28 17:22:29 -0700 | [diff] [blame] | 247 | /* |
| 248 | * Macro that sets up the callee save frame to conform with |
| 249 | * Runtime::CreateCalleeSaveMethod(kRefsAndArgs). Restoration assumes |
| 250 | * non-moving GC. |
| 251 | * callee-save: padding + $f12-$f19 + $a1-$a7 + $s2-$s7 + $gp + $ra + $s8 = 24 total + 1 words padding + Method* |
| 252 | */ |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 253 | .macro SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME |
| 254 | SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME_INTERNAL |
| 255 | # load appropriate callee-save-method |
| 256 | ld $v0, %got(_ZN3art7Runtime9instance_E)($gp) |
| 257 | ld $v0, 0($v0) |
| 258 | THIS_LOAD_REQUIRES_READ_BARRIER |
Mathieu Chartier | bb87e0f | 2015-04-03 11:21:55 -0700 | [diff] [blame] | 259 | lwu $v0, RUNTIME_REFS_AND_ARGS_CALLEE_SAVE_FRAME_OFFSET($v0) |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 260 | sw $v0, 0($sp) # Place Method* at bottom of stack. |
| 261 | sd $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF) # Place sp in Thread::Current()->top_quick_frame. |
| 262 | .endm |
| 263 | |
Douglas Leung | 8223b80 | 2015-04-28 17:22:29 -0700 | [diff] [blame] | 264 | .macro SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME_WITH_METHOD_IN_A0 |
| 265 | SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME_INTERNAL |
| 266 | sw $a0, 0($sp) # Place Method* at bottom of stack. |
| 267 | sd $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF) # Place sp in Thread::Current()->top_quick_frame. |
| 268 | .endm |
| 269 | |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 270 | .macro RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME |
| 271 | ld $ra, 200($sp) |
| 272 | .cfi_restore 31 |
| 273 | ld $s8, 192($sp) |
| 274 | .cfi_restore 30 |
Goran Jakovljevic | 0456881 | 2015-04-23 15:27:23 +0200 | [diff] [blame] | 275 | ld $t8, 184($sp) # Restore gp back to it's temp storage. |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 276 | .cfi_restore 28 |
| 277 | ld $s7, 176($sp) |
| 278 | .cfi_restore 23 |
| 279 | ld $s6, 168($sp) |
| 280 | .cfi_restore 22 |
| 281 | ld $s5, 160($sp) |
| 282 | .cfi_restore 21 |
| 283 | ld $s4, 152($sp) |
| 284 | .cfi_restore 20 |
| 285 | ld $s3, 144($sp) |
| 286 | .cfi_restore 19 |
| 287 | ld $s2, 136($sp) |
| 288 | .cfi_restore 18 |
| 289 | |
| 290 | ld $a7, 128($sp) |
| 291 | .cfi_restore 11 |
| 292 | ld $a6, 120($sp) |
| 293 | .cfi_restore 10 |
| 294 | ld $a5, 112($sp) |
| 295 | .cfi_restore 9 |
| 296 | ld $a4, 104($sp) |
| 297 | .cfi_restore 8 |
| 298 | ld $a3, 96($sp) |
| 299 | .cfi_restore 7 |
| 300 | ld $a2, 88($sp) |
| 301 | .cfi_restore 6 |
| 302 | ld $a1, 80($sp) |
| 303 | .cfi_restore 5 |
| 304 | |
| 305 | l.d $f19, 72($sp) |
| 306 | l.d $f18, 64($sp) |
| 307 | l.d $f17, 56($sp) |
| 308 | l.d $f16, 48($sp) |
| 309 | l.d $f15, 40($sp) |
| 310 | l.d $f14, 32($sp) |
| 311 | l.d $f13, 24($sp) |
| 312 | l.d $f12, 16($sp) |
| 313 | |
Goran Jakovljevic | 0456881 | 2015-04-23 15:27:23 +0200 | [diff] [blame] | 314 | .cpreturn |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 315 | daddiu $sp, $sp, 208 |
| 316 | .cfi_adjust_cfa_offset -208 |
| 317 | .endm |
| 318 | |
| 319 | /* |
| 320 | * Macro that set calls through to artDeliverPendingExceptionFromCode, |
| 321 | * where the pending |
| 322 | * exception is Thread::Current()->exception_ |
| 323 | */ |
| 324 | .macro DELIVER_PENDING_EXCEPTION |
Goran Jakovljevic | 0456881 | 2015-04-23 15:27:23 +0200 | [diff] [blame] | 325 | SETUP_GP |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 326 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME # save callee saves for throw |
| 327 | dla $t9, artDeliverPendingExceptionFromCode |
| 328 | jalr $zero, $t9 # artDeliverPendingExceptionFromCode(Thread*) |
| 329 | move $a0, rSELF # pass Thread::Current |
| 330 | .endm |
| 331 | |
| 332 | .macro RETURN_IF_NO_EXCEPTION |
| 333 | ld $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ |
| 334 | RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME |
| 335 | bne $t0, $zero, 1f # success if no exception is pending |
| 336 | nop |
| 337 | jalr $zero, $ra |
| 338 | nop |
| 339 | 1: |
| 340 | DELIVER_PENDING_EXCEPTION |
| 341 | .endm |
| 342 | |
| 343 | .macro RETURN_IF_ZERO |
| 344 | RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME |
| 345 | bne $v0, $zero, 1f # success? |
| 346 | nop |
| 347 | jalr $zero, $ra # return on success |
| 348 | nop |
| 349 | 1: |
| 350 | DELIVER_PENDING_EXCEPTION |
| 351 | .endm |
| 352 | |
| 353 | .macro RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER |
| 354 | RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME |
| 355 | beq $v0, $zero, 1f # success? |
| 356 | nop |
| 357 | jalr $zero, $ra # return on success |
| 358 | nop |
| 359 | 1: |
| 360 | DELIVER_PENDING_EXCEPTION |
| 361 | .endm |
| 362 | |
| 363 | /* |
| 364 | * On entry $a0 is uint32_t* gprs_ and $a1 is uint32_t* fprs_ |
| 365 | * FIXME: just guessing about the shape of the jmpbuf. Where will pc be? |
| 366 | */ |
Goran Jakovljevic | 0456881 | 2015-04-23 15:27:23 +0200 | [diff] [blame] | 367 | ENTRY_NO_GP art_quick_do_long_jump |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 368 | l.d $f0, 0($a1) |
| 369 | l.d $f1, 8($a1) |
| 370 | l.d $f2, 16($a1) |
| 371 | l.d $f3, 24($a1) |
| 372 | l.d $f4, 32($a1) |
| 373 | l.d $f5, 40($a1) |
| 374 | l.d $f6, 48($a1) |
| 375 | l.d $f7, 56($a1) |
| 376 | l.d $f8, 64($a1) |
| 377 | l.d $f9, 72($a1) |
| 378 | l.d $f10, 80($a1) |
| 379 | l.d $f11, 88($a1) |
| 380 | l.d $f12, 96($a1) |
| 381 | l.d $f13, 104($a1) |
| 382 | l.d $f14, 112($a1) |
| 383 | l.d $f15, 120($a1) |
| 384 | l.d $f16, 128($a1) |
| 385 | l.d $f17, 136($a1) |
| 386 | l.d $f18, 144($a1) |
| 387 | l.d $f19, 152($a1) |
| 388 | l.d $f20, 160($a1) |
| 389 | l.d $f21, 168($a1) |
| 390 | l.d $f22, 176($a1) |
| 391 | l.d $f23, 184($a1) |
| 392 | l.d $f24, 192($a1) |
| 393 | l.d $f25, 200($a1) |
| 394 | l.d $f26, 208($a1) |
| 395 | l.d $f27, 216($a1) |
| 396 | l.d $f28, 224($a1) |
| 397 | l.d $f29, 232($a1) |
| 398 | l.d $f30, 240($a1) |
| 399 | l.d $f31, 248($a1) |
| 400 | .set push |
| 401 | .set nomacro |
| 402 | .set noat |
| 403 | # no need to load zero |
| 404 | ld $at, 8($a0) |
| 405 | .set pop |
| 406 | ld $v0, 16($a0) |
| 407 | ld $v1, 24($a0) |
| 408 | # a0 has to be loaded last |
| 409 | ld $a1, 40($a0) |
| 410 | ld $a2, 48($a0) |
| 411 | ld $a3, 56($a0) |
| 412 | ld $a4, 64($a0) |
| 413 | ld $a5, 72($a0) |
| 414 | ld $a6, 80($a0) |
| 415 | ld $a7, 88($a0) |
| 416 | ld $t0, 96($a0) |
| 417 | ld $t1, 104($a0) |
| 418 | ld $t2, 112($a0) |
| 419 | ld $t3, 120($a0) |
| 420 | ld $s0, 128($a0) |
| 421 | ld $s1, 136($a0) |
| 422 | ld $s2, 144($a0) |
| 423 | ld $s3, 152($a0) |
| 424 | ld $s4, 160($a0) |
| 425 | ld $s5, 168($a0) |
| 426 | ld $s6, 176($a0) |
| 427 | ld $s7, 184($a0) |
| 428 | ld $t8, 192($a0) |
| 429 | ld $t9, 200($a0) |
| 430 | # no need to load k0, k1 |
| 431 | ld $gp, 224($a0) |
| 432 | ld $sp, 232($a0) |
| 433 | ld $s8, 240($a0) |
| 434 | ld $ra, 248($a0) |
| 435 | ld $a0, 32($a0) |
| 436 | move $v0, $zero # clear result registers v0 and v1 |
| 437 | jalr $zero, $ra # do long jump |
| 438 | move $v1, $zero |
| 439 | END art_quick_do_long_jump |
| 440 | |
Maja Gagic | 6ea651f | 2015-02-24 16:55:04 +0100 | [diff] [blame] | 441 | /* |
| 442 | * Called by managed code, saves most registers (forms basis of long jump |
| 443 | * context) and passes the bottom of the stack. |
| 444 | * artDeliverExceptionFromCode will place the callee save Method* at |
| 445 | * the bottom of the thread. On entry v0 holds Throwable* |
| 446 | */ |
| 447 | ENTRY art_quick_deliver_exception |
| 448 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
| 449 | dla $t9, artDeliverExceptionFromCode |
| 450 | jalr $zero, $t9 # artDeliverExceptionFromCode(Throwable*, Thread*) |
| 451 | move $a1, rSELF # pass Thread::Current |
| 452 | END art_quick_deliver_exception |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 453 | |
Maja Gagic | 6ea651f | 2015-02-24 16:55:04 +0100 | [diff] [blame] | 454 | /* |
| 455 | * Called by managed code to create and deliver a NullPointerException |
| 456 | */ |
| 457 | .extern artThrowNullPointerExceptionFromCode |
| 458 | ENTRY art_quick_throw_null_pointer_exception |
| 459 | .Lart_quick_throw_null_pointer_exception_gp_set: |
| 460 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
| 461 | dla $t9, artThrowNullPointerExceptionFromCode |
| 462 | jalr $zero, $t9 # artThrowNullPointerExceptionFromCode(Thread*) |
| 463 | move $a0, rSELF # pass Thread::Current |
| 464 | END art_quick_throw_null_pointer_exception |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 465 | |
Maja Gagic | 6ea651f | 2015-02-24 16:55:04 +0100 | [diff] [blame] | 466 | /* |
| 467 | * Called by managed code to create and deliver an ArithmeticException |
| 468 | */ |
| 469 | .extern artThrowDivZeroFromCode |
| 470 | ENTRY art_quick_throw_div_zero |
| 471 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
| 472 | dla $t9, artThrowDivZeroFromCode |
| 473 | jalr $zero, $t9 # artThrowDivZeroFromCode(Thread*) |
| 474 | move $a0, rSELF # pass Thread::Current |
| 475 | END art_quick_throw_div_zero |
| 476 | |
| 477 | /* |
| 478 | * Called by managed code to create and deliver an |
| 479 | * ArrayIndexOutOfBoundsException |
| 480 | */ |
| 481 | .extern artThrowArrayBoundsFromCode |
| 482 | ENTRY art_quick_throw_array_bounds |
| 483 | .Lart_quick_throw_array_bounds_gp_set: |
| 484 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
| 485 | dla $t9, artThrowArrayBoundsFromCode |
| 486 | jalr $zero, $t9 # artThrowArrayBoundsFromCode(index, limit, Thread*) |
| 487 | move $a2, rSELF # pass Thread::Current |
| 488 | END art_quick_throw_array_bounds |
| 489 | |
| 490 | /* |
| 491 | * Called by managed code to create and deliver a StackOverflowError. |
| 492 | */ |
| 493 | .extern artThrowStackOverflowFromCode |
| 494 | ENTRY art_quick_throw_stack_overflow |
| 495 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
| 496 | dla $t9, artThrowStackOverflowFromCode |
| 497 | jalr $zero, $t9 # artThrowStackOverflowFromCode(Thread*) |
| 498 | move $a0, rSELF # pass Thread::Current |
| 499 | END art_quick_throw_stack_overflow |
| 500 | |
| 501 | /* |
| 502 | * Called by managed code to create and deliver a NoSuchMethodError. |
| 503 | */ |
| 504 | .extern artThrowNoSuchMethodFromCode |
| 505 | ENTRY art_quick_throw_no_such_method |
| 506 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
| 507 | dla $t9, artThrowNoSuchMethodFromCode |
| 508 | jalr $zero, $t9 # artThrowNoSuchMethodFromCode(method_idx, Thread*) |
| 509 | move $a1, rSELF # pass Thread::Current |
| 510 | END art_quick_throw_no_such_method |
| 511 | |
| 512 | /* |
| 513 | * All generated callsites for interface invokes and invocation slow paths will load arguments |
| 514 | * as usual - except instead of loading arg0/$a0 with the target Method*, arg0/$a0 will contain |
| 515 | * the method_idx. This wrapper will save arg1-arg3, load the caller's Method*, align the |
| 516 | * stack and call the appropriate C helper. |
| 517 | * NOTE: "this" is first visable argument of the target, and so can be found in arg1/$a1. |
| 518 | * |
| 519 | * The helper will attempt to locate the target and return a 128-bit result in $v0/$v1 consisting |
| 520 | * of the target Method* in $v0 and method->code_ in $v1. |
| 521 | * |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 522 | * If unsuccessful, the helper will return null/null. There will be a pending exception in the |
Maja Gagic | 6ea651f | 2015-02-24 16:55:04 +0100 | [diff] [blame] | 523 | * thread and we branch to another stub to deliver it. |
| 524 | * |
| 525 | * On success this wrapper will restore arguments and *jump* to the target, leaving the ra |
| 526 | * pointing back to the original caller. |
| 527 | */ |
| 528 | .macro INVOKE_TRAMPOLINE c_name, cxx_name |
| 529 | .extern \cxx_name |
| 530 | ENTRY \c_name |
| 531 | SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME # save callee saves in case allocation triggers GC |
| 532 | lwu $a2, FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE($sp) # pass caller Method* |
| 533 | move $a3, rSELF # pass Thread::Current |
| 534 | jal \cxx_name # (method_idx, this, caller, Thread*, $sp) |
| 535 | move $a4, $sp # pass $sp |
| 536 | move $a0, $v0 # save target Method* |
| 537 | move $t9, $v1 # save $v0->code_ |
| 538 | RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME |
| 539 | beq $v0, $zero, 1f |
| 540 | nop |
| 541 | jalr $zero, $t9 |
| 542 | nop |
| 543 | 1: |
| 544 | DELIVER_PENDING_EXCEPTION |
| 545 | END \c_name |
| 546 | .endm |
| 547 | |
| 548 | INVOKE_TRAMPOLINE art_quick_invoke_interface_trampoline, artInvokeInterfaceTrampoline |
| 549 | INVOKE_TRAMPOLINE art_quick_invoke_interface_trampoline_with_access_check, artInvokeInterfaceTrampolineWithAccessCheck |
| 550 | |
| 551 | INVOKE_TRAMPOLINE art_quick_invoke_static_trampoline_with_access_check, artInvokeStaticTrampolineWithAccessCheck |
| 552 | INVOKE_TRAMPOLINE art_quick_invoke_direct_trampoline_with_access_check, artInvokeDirectTrampolineWithAccessCheck |
| 553 | INVOKE_TRAMPOLINE art_quick_invoke_super_trampoline_with_access_check, artInvokeSuperTrampolineWithAccessCheck |
| 554 | INVOKE_TRAMPOLINE art_quick_invoke_virtual_trampoline_with_access_check, artInvokeVirtualTrampolineWithAccessCheck |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 555 | |
| 556 | # On entry: |
| 557 | # t0 = shorty |
| 558 | # t1 = ptr to arg_array |
| 559 | # t2 = number of argument bytes remain |
| 560 | # v0 = ptr to stack frame where to copy arg_array |
| 561 | # This macro modifies t3, t9 and v0 |
| 562 | .macro LOOP_OVER_SHORTY_LOADING_REG gpu, fpu, label |
| 563 | lbu $t3, 0($t0) # get argument type from shorty |
| 564 | beqz $t3, \label |
| 565 | daddiu $t0, 1 |
| 566 | li $t9, 68 # put char 'D' into t9 |
| 567 | beq $t9, $t3, 1f # branch if result type char == 'D' |
| 568 | li $t9, 70 # put char 'F' into t9 |
| 569 | beq $t9, $t3, 2f # branch if result type char == 'F' |
| 570 | li $t9, 74 # put char 'J' into t9 |
| 571 | beq $t9, $t3, 3f # branch if result type char == 'J' |
| 572 | nop |
Maja Gagic | 6ea651f | 2015-02-24 16:55:04 +0100 | [diff] [blame] | 573 | lw $\gpu, 0($t1) |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 574 | sw $\gpu, 0($v0) |
| 575 | daddiu $v0, 4 |
| 576 | daddiu $t1, 4 |
| 577 | b 4f |
| 578 | daddiu $t2, -4 # delay slot |
| 579 | |
| 580 | 1: # found double |
| 581 | lwu $t3, 0($t1) |
| 582 | mtc1 $t3, $\fpu |
| 583 | sw $t3, 0($v0) |
| 584 | lwu $t3, 4($t1) |
| 585 | mthc1 $t3, $\fpu |
| 586 | sw $t3, 4($v0) |
| 587 | daddiu $v0, 8 |
| 588 | daddiu $t1, 8 |
| 589 | b 4f |
| 590 | daddiu $t2, -8 # delay slot |
| 591 | |
| 592 | 2: # found float |
| 593 | lwu $t3, 0($t1) |
| 594 | mtc1 $t3, $\fpu |
| 595 | sw $t3, 0($v0) |
| 596 | daddiu $v0, 4 |
| 597 | daddiu $t1, 4 |
| 598 | b 4f |
| 599 | daddiu $t2, -4 # delay slot |
| 600 | |
| 601 | 3: # found long (8 bytes) |
| 602 | lwu $t3, 0($t1) |
| 603 | sw $t3, 0($v0) |
| 604 | lwu $t9, 4($t1) |
| 605 | sw $t9, 4($v0) |
| 606 | dsll $t9, $t9, 32 |
| 607 | or $\gpu, $t9, $t3 |
| 608 | daddiu $v0, 8 |
| 609 | daddiu $t1, 8 |
| 610 | daddiu $t2, -8 |
| 611 | 4: |
| 612 | .endm |
| 613 | |
| 614 | /* |
| 615 | * Invocation stub for quick code. |
| 616 | * On entry: |
| 617 | * a0 = method pointer |
| 618 | * a1 = argument array that must at least contain the this ptr. |
| 619 | * a2 = size of argument array in bytes |
| 620 | * a3 = (managed) thread pointer |
| 621 | * a4 = JValue* result |
| 622 | * a5 = shorty |
| 623 | */ |
Goran Jakovljevic | 0456881 | 2015-04-23 15:27:23 +0200 | [diff] [blame] | 624 | ENTRY_NO_GP art_quick_invoke_stub |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 625 | # push a4, a5, s0(rSUSPEND), s1(rSELF), s8, ra onto the stack |
| 626 | daddiu $sp, $sp, -48 |
| 627 | .cfi_adjust_cfa_offset 48 |
| 628 | sd $ra, 40($sp) |
| 629 | .cfi_rel_offset 31, 40 |
| 630 | sd $s8, 32($sp) |
| 631 | .cfi_rel_offset 30, 32 |
| 632 | sd $s1, 24($sp) |
| 633 | .cfi_rel_offset 17, 24 |
| 634 | sd $s0, 16($sp) |
| 635 | .cfi_rel_offset 16, 16 |
| 636 | sd $a5, 8($sp) |
| 637 | .cfi_rel_offset 9, 8 |
| 638 | sd $a4, 0($sp) |
| 639 | .cfi_rel_offset 8, 0 |
| 640 | |
| 641 | daddiu $s0, $zero, SUSPEND_CHECK_INTERVAL # reset rSUSPEND to SUSPEND_CHECK_INTERVAL |
| 642 | move $s1, $a3 # move managed thread pointer into s1 (rSELF) |
| 643 | move $s8, $sp # save sp in s8 (fp) |
| 644 | |
| 645 | daddiu $t3, $a2, 20 # add 4 for method* and 16 for stack alignment |
| 646 | dsrl $t3, $t3, 4 # shift the frame size right 4 |
| 647 | dsll $t3, $t3, 4 # shift the frame size left 4 to align to 16 bytes |
| 648 | dsubu $sp, $sp, $t3 # reserve stack space for argument array |
| 649 | |
| 650 | daddiu $t0, $a5, 1 # t0 = shorty[1] (skip 1 for return type) |
| 651 | daddiu $t1, $a1, 4 # t1 = ptr to arg_array[4] (skip this ptr) |
| 652 | daddiu $t2, $a2, -4 # t2 = number of argument bytes remain (skip this ptr) |
| 653 | daddiu $v0, $sp, 8 # v0 points to where to copy arg_array |
| 654 | LOOP_OVER_SHORTY_LOADING_REG a2, f14, call_fn |
| 655 | LOOP_OVER_SHORTY_LOADING_REG a3, f15, call_fn |
| 656 | LOOP_OVER_SHORTY_LOADING_REG a4, f16, call_fn |
| 657 | LOOP_OVER_SHORTY_LOADING_REG a5, f17, call_fn |
| 658 | LOOP_OVER_SHORTY_LOADING_REG a6, f18, call_fn |
| 659 | LOOP_OVER_SHORTY_LOADING_REG a7, f19, call_fn |
| 660 | |
| 661 | # copy arguments onto stack (t2 should be multiples of 4) |
| 662 | ble $t2, $zero, call_fn # t2 = number of argument bytes remain |
| 663 | 1: |
| 664 | lw $t3, 0($t1) # load from argument array |
| 665 | daddiu $t1, $t1, 4 |
| 666 | sw $t3, 0($v0) # save to stack |
| 667 | daddiu $t2, -4 |
| 668 | bgt $t2, $zero, 1b # t2 = number of argument bytes remain |
| 669 | daddiu $v0, $v0, 4 |
| 670 | |
| 671 | call_fn: |
| 672 | # call method (a0 and a1 have been untouched) |
| 673 | lwu $a1, 0($a1) # make a1 = this ptr |
| 674 | sw $a1, 4($sp) # copy this ptr (skip 4 bytes for method*) |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 675 | sw $zero, 0($sp) # store null for method* at bottom of frame |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 676 | ld $t9, MIRROR_ART_METHOD_QUICK_CODE_OFFSET_64($a0) # get pointer to the code |
| 677 | jalr $t9 # call the method |
| 678 | nop |
| 679 | move $sp, $s8 # restore sp |
| 680 | |
| 681 | # pop a4, a5, s1(rSELF), s8, ra off of the stack |
| 682 | ld $a4, 0($sp) |
| 683 | .cfi_restore 8 |
| 684 | ld $a5, 8($sp) |
| 685 | .cfi_restore 9 |
| 686 | ld $s0, 16($sp) |
| 687 | .cfi_restore 16 |
| 688 | ld $s1, 24($sp) |
| 689 | .cfi_restore 17 |
| 690 | ld $s8, 32($sp) |
| 691 | .cfi_restore 30 |
| 692 | ld $ra, 40($sp) |
| 693 | .cfi_restore 31 |
| 694 | daddiu $sp, $sp, 48 |
| 695 | .cfi_adjust_cfa_offset -48 |
| 696 | |
| 697 | # a4 = JValue* result |
| 698 | # a5 = shorty string |
| 699 | lbu $t1, 0($a5) # get result type from shorty |
| 700 | li $t2, 68 # put char 'D' into t2 |
| 701 | beq $t1, $t2, 1f # branch if result type char == 'D' |
| 702 | li $t3, 70 # put char 'F' into t3 |
| 703 | beq $t1, $t3, 1f # branch if result type char == 'F' |
| 704 | sw $v0, 0($a4) # store the result |
| 705 | dsrl $v1, $v0, 32 |
| 706 | jalr $zero, $ra |
| 707 | sw $v1, 4($a4) # store the other half of the result |
| 708 | 1: |
| 709 | mfc1 $v0, $f0 |
| 710 | mfhc1 $v1, $f0 |
| 711 | sw $v0, 0($a4) # store the result |
| 712 | jalr $zero, $ra |
| 713 | sw $v1, 4($a4) # store the other half of the result |
| 714 | END art_quick_invoke_stub |
| 715 | |
| 716 | /* |
| 717 | * Invocation static stub for quick code. |
| 718 | * On entry: |
| 719 | * a0 = method pointer |
| 720 | * a1 = argument array that must at least contain the this ptr. |
| 721 | * a2 = size of argument array in bytes |
| 722 | * a3 = (managed) thread pointer |
| 723 | * a4 = JValue* result |
| 724 | * a5 = shorty |
| 725 | */ |
Goran Jakovljevic | 0456881 | 2015-04-23 15:27:23 +0200 | [diff] [blame] | 726 | ENTRY_NO_GP art_quick_invoke_static_stub |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 727 | |
| 728 | # push a4, a5, s0(rSUSPEND), s1(rSELF), s8, ra, onto the stack |
| 729 | daddiu $sp, $sp, -48 |
| 730 | .cfi_adjust_cfa_offset 48 |
| 731 | sd $ra, 40($sp) |
| 732 | .cfi_rel_offset 31, 40 |
| 733 | sd $s8, 32($sp) |
| 734 | .cfi_rel_offset 30, 32 |
| 735 | sd $s1, 24($sp) |
| 736 | .cfi_rel_offset 17, 24 |
| 737 | sd $s0, 16($sp) |
| 738 | .cfi_rel_offset 16, 16 |
| 739 | sd $a5, 8($sp) |
| 740 | .cfi_rel_offset 9, 8 |
| 741 | sd $a4, 0($sp) |
| 742 | .cfi_rel_offset 8, 0 |
| 743 | |
| 744 | daddiu $s0, $zero, SUSPEND_CHECK_INTERVAL # reset rSUSPEND to SUSPEND_CHECK_INTERVAL |
| 745 | move $s1, $a3 # move managed thread pointer into s1 (rSELF) |
| 746 | move $s8, $sp # save sp in s8 (fp) |
| 747 | |
| 748 | daddiu $t3, $a2, 20 # add 4 for method* and 16 for stack alignment |
| 749 | dsrl $t3, $t3, 4 # shift the frame size right 4 |
| 750 | dsll $t3, $t3, 4 # shift the frame size left 4 to align to 16 bytes |
| 751 | dsubu $sp, $sp, $t3 # reserve stack space for argument array |
| 752 | |
| 753 | daddiu $t0, $a5, 1 # t0 = shorty[1] (skip 1 for return type) |
| 754 | move $t1, $a1 # t1 = arg_array |
| 755 | move $t2, $a2 # t2 = number of argument bytes remain |
| 756 | daddiu $v0, $sp, 4 # v0 points to where to copy arg_array |
| 757 | LOOP_OVER_SHORTY_LOADING_REG a1, f13, call_sfn |
| 758 | LOOP_OVER_SHORTY_LOADING_REG a2, f14, call_sfn |
| 759 | LOOP_OVER_SHORTY_LOADING_REG a3, f15, call_sfn |
| 760 | LOOP_OVER_SHORTY_LOADING_REG a4, f16, call_sfn |
| 761 | LOOP_OVER_SHORTY_LOADING_REG a5, f17, call_sfn |
| 762 | LOOP_OVER_SHORTY_LOADING_REG a6, f18, call_sfn |
| 763 | LOOP_OVER_SHORTY_LOADING_REG a7, f19, call_sfn |
| 764 | |
| 765 | # copy arguments onto stack (t2 should be multiples of 4) |
| 766 | ble $t2, $zero, call_sfn # t2 = number of argument bytes remain |
| 767 | 1: |
| 768 | lw $t3, 0($t1) # load from argument array |
| 769 | daddiu $t1, $t1, 4 |
| 770 | sw $t3, 0($v0) # save to stack |
| 771 | daddiu $t2, -4 |
| 772 | bgt $t2, $zero, 1b # t2 = number of argument bytes remain |
| 773 | daddiu $v0, $v0, 4 |
| 774 | |
| 775 | call_sfn: |
| 776 | # call method (a0 has been untouched) |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 777 | sw $zero, 0($sp) # store null for method* at bottom of frame |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 778 | ld $t9, MIRROR_ART_METHOD_QUICK_CODE_OFFSET_64($a0) # get pointer to the code |
| 779 | jalr $t9 # call the method |
| 780 | nop |
| 781 | move $sp, $s8 # restore sp |
| 782 | |
| 783 | # pop a4, a5, s0(rSUSPEND), s1(rSELF), s8, ra off of the stack |
| 784 | ld $a4, 0($sp) |
| 785 | .cfi_restore 8 |
| 786 | ld $a5, 8($sp) |
| 787 | .cfi_restore 9 |
| 788 | ld $s0, 16($sp) |
| 789 | .cfi_restore 16 |
| 790 | ld $s1, 24($sp) |
| 791 | .cfi_restore 17 |
| 792 | ld $s8, 32($sp) |
| 793 | .cfi_restore 30 |
| 794 | ld $ra, 40($sp) |
| 795 | .cfi_restore 31 |
| 796 | daddiu $sp, $sp, 48 |
| 797 | .cfi_adjust_cfa_offset -48 |
| 798 | |
| 799 | # a4 = JValue* result |
| 800 | # a5 = shorty string |
| 801 | lbu $t1, 0($a5) # get result type from shorty |
| 802 | li $t2, 68 # put char 'D' into t2 |
| 803 | beq $t1, $t2, 1f # branch if result type char == 'D' |
| 804 | li $t3, 70 # put char 'F' into t3 |
| 805 | beq $t1, $t3, 1f # branch if result type char == 'F' |
| 806 | sw $v0, 0($a4) # store the result |
| 807 | dsrl $v1, $v0, 32 |
| 808 | jalr $zero, $ra |
| 809 | sw $v1, 4($a4) # store the other half of the result |
| 810 | 1: |
| 811 | mfc1 $v0, $f0 |
| 812 | mfhc1 $v1, $f0 |
| 813 | sw $v0, 0($a4) # store the result |
| 814 | jalr $zero, $ra |
| 815 | sw $v1, 4($a4) # store the other half of the result |
| 816 | END art_quick_invoke_static_stub |
| 817 | |
Maja Gagic | 6ea651f | 2015-02-24 16:55:04 +0100 | [diff] [blame] | 818 | /* |
| 819 | * Entry from managed code that calls artHandleFillArrayDataFromCode and |
| 820 | * delivers exception on failure. |
| 821 | */ |
| 822 | .extern artHandleFillArrayDataFromCode |
| 823 | ENTRY art_quick_handle_fill_data |
| 824 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case exception allocation triggers GC |
| 825 | lwu $a2, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method* |
| 826 | jal artHandleFillArrayDataFromCode # (payload offset, Array*, method, Thread*) |
| 827 | move $a3, rSELF # pass Thread::Current |
| 828 | RETURN_IF_ZERO |
| 829 | END art_quick_handle_fill_data |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 830 | |
Maja Gagic | 6ea651f | 2015-02-24 16:55:04 +0100 | [diff] [blame] | 831 | /* |
| 832 | * Entry from managed code that calls artLockObjectFromCode, may block for GC. |
| 833 | */ |
| 834 | .extern artLockObjectFromCode |
| 835 | ENTRY art_quick_lock_object |
| 836 | beq $a0, $zero, .Lart_quick_throw_null_pointer_exception_gp_set |
| 837 | nop |
| 838 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case we block |
| 839 | jal artLockObjectFromCode # (Object* obj, Thread*) |
| 840 | move $a1, rSELF # pass Thread::Current |
| 841 | RETURN_IF_ZERO |
| 842 | END art_quick_lock_object |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 843 | |
Maja Gagic | 6ea651f | 2015-02-24 16:55:04 +0100 | [diff] [blame] | 844 | /* |
| 845 | * Entry from managed code that calls artUnlockObjectFromCode and delivers exception on failure. |
| 846 | */ |
| 847 | .extern artUnlockObjectFromCode |
| 848 | ENTRY art_quick_unlock_object |
| 849 | beq $a0, $zero, .Lart_quick_throw_null_pointer_exception_gp_set |
| 850 | nop |
| 851 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case exception allocation triggers GC |
| 852 | jal artUnlockObjectFromCode # (Object* obj, Thread*) |
| 853 | move $a1, rSELF # pass Thread::Current |
| 854 | RETURN_IF_ZERO |
| 855 | END art_quick_unlock_object |
| 856 | |
| 857 | /* |
| 858 | * Entry from managed code that calls artCheckCastFromCode and delivers exception on failure. |
| 859 | */ |
| 860 | .extern artThrowClassCastException |
| 861 | ENTRY art_quick_check_cast |
| 862 | daddiu $sp, $sp, -32 |
| 863 | .cfi_adjust_cfa_offset 32 |
| 864 | sd $ra, 24($sp) |
| 865 | .cfi_rel_offset 31, 24 |
| 866 | sd $t9, 16($sp) |
| 867 | sd $a1, 8($sp) |
| 868 | sd $a0, 0($sp) |
| 869 | jal artIsAssignableFromCode |
Goran Jakovljevic | 0456881 | 2015-04-23 15:27:23 +0200 | [diff] [blame] | 870 | .cpreturn # Restore gp from t8 in branch delay slot. |
| 871 | # t8 may be clobbered in artIsAssignableFromCode. |
Maja Gagic | 6ea651f | 2015-02-24 16:55:04 +0100 | [diff] [blame] | 872 | beq $v0, $zero, .Lthrow_class_cast_exception |
| 873 | ld $ra, 24($sp) |
| 874 | jalr $zero, $ra |
| 875 | daddiu $sp, $sp, 32 |
| 876 | .cfi_adjust_cfa_offset -32 |
| 877 | .Lthrow_class_cast_exception: |
| 878 | ld $t9, 16($sp) |
| 879 | ld $a1, 8($sp) |
| 880 | ld $a0, 0($sp) |
| 881 | daddiu $sp, $sp, 32 |
| 882 | .cfi_adjust_cfa_offset -32 |
Goran Jakovljevic | 0456881 | 2015-04-23 15:27:23 +0200 | [diff] [blame] | 883 | SETUP_GP |
Maja Gagic | 6ea651f | 2015-02-24 16:55:04 +0100 | [diff] [blame] | 884 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
| 885 | dla $t9, artThrowClassCastException |
| 886 | jalr $zero, $t9 # artThrowClassCastException (Class*, Class*, Thread*) |
| 887 | move $a2, rSELF # pass Thread::Current |
| 888 | END art_quick_check_cast |
| 889 | |
| 890 | /* |
| 891 | * Entry from managed code for array put operations of objects where the value being stored |
| 892 | * needs to be checked for compatibility. |
| 893 | * a0 = array, a1 = index, a2 = value |
| 894 | */ |
| 895 | ENTRY art_quick_aput_obj_with_null_and_bound_check |
| 896 | bne $a0, $zero, .Lart_quick_aput_obj_with_bound_check_gp_set |
| 897 | nop |
| 898 | b .Lart_quick_throw_null_pointer_exception_gp_set |
| 899 | nop |
| 900 | END art_quick_aput_obj_with_null_and_bound_check |
| 901 | |
| 902 | ENTRY art_quick_aput_obj_with_bound_check |
| 903 | lwu $t0, MIRROR_ARRAY_LENGTH_OFFSET($a0) |
| 904 | sltu $t1, $a1, $t0 |
| 905 | bne $t1, $zero, .Lart_quick_aput_obj_gp_set |
| 906 | nop |
| 907 | move $a0, $a1 |
| 908 | b .Lart_quick_throw_array_bounds_gp_set |
| 909 | move $a1, $t0 |
| 910 | END art_quick_aput_obj_with_bound_check |
| 911 | |
| 912 | ENTRY art_quick_aput_obj |
| 913 | beq $a2, $zero, .Ldo_aput_null |
| 914 | nop |
| 915 | lwu $t0, MIRROR_OBJECT_CLASS_OFFSET($a0) |
| 916 | lwu $t1, MIRROR_OBJECT_CLASS_OFFSET($a2) |
| 917 | lwu $t0, MIRROR_CLASS_COMPONENT_TYPE_OFFSET($t0) |
| 918 | bne $t1, $t0, .Lcheck_assignability # value's type == array's component type - trivial assignability |
| 919 | nop |
| 920 | .Ldo_aput: |
| 921 | dsll $a1, $a1, 2 |
| 922 | daddu $t0, $a0, $a1 |
| 923 | sw $a2, MIRROR_OBJECT_ARRAY_DATA_OFFSET($t0) |
| 924 | ld $t0, THREAD_CARD_TABLE_OFFSET(rSELF) |
| 925 | dsrl $t1, $a0, 7 |
| 926 | daddu $t1, $t1, $t0 |
| 927 | sb $t0, ($t1) |
| 928 | jalr $zero, $ra |
Goran Jakovljevic | 0456881 | 2015-04-23 15:27:23 +0200 | [diff] [blame] | 929 | .cpreturn # Restore gp from t8 in branch delay slot. |
Maja Gagic | 6ea651f | 2015-02-24 16:55:04 +0100 | [diff] [blame] | 930 | .Ldo_aput_null: |
| 931 | dsll $a1, $a1, 2 |
| 932 | daddu $t0, $a0, $a1 |
| 933 | sw $a2, MIRROR_OBJECT_ARRAY_DATA_OFFSET($t0) |
| 934 | jalr $zero, $ra |
Goran Jakovljevic | 0456881 | 2015-04-23 15:27:23 +0200 | [diff] [blame] | 935 | .cpreturn # Restore gp from t8 in branch delay slot. |
Maja Gagic | 6ea651f | 2015-02-24 16:55:04 +0100 | [diff] [blame] | 936 | .Lcheck_assignability: |
| 937 | daddiu $sp, $sp, -64 |
| 938 | .cfi_adjust_cfa_offset 64 |
| 939 | sd $ra, 56($sp) |
| 940 | .cfi_rel_offset 31, 56 |
| 941 | sd $t9, 24($sp) |
| 942 | sd $a2, 16($sp) |
| 943 | sd $a1, 8($sp) |
| 944 | sd $a0, 0($sp) |
| 945 | move $a1, $t1 |
| 946 | move $a0, $t0 |
| 947 | jal artIsAssignableFromCode # (Class*, Class*) |
Goran Jakovljevic | 0456881 | 2015-04-23 15:27:23 +0200 | [diff] [blame] | 948 | .cpreturn # Restore gp from t8 in branch delay slot. |
| 949 | # t8 may be clobbered in artIsAssignableFromCode. |
Maja Gagic | 6ea651f | 2015-02-24 16:55:04 +0100 | [diff] [blame] | 950 | ld $ra, 56($sp) |
| 951 | ld $t9, 24($sp) |
| 952 | ld $a2, 16($sp) |
| 953 | ld $a1, 8($sp) |
| 954 | ld $a0, 0($sp) |
| 955 | daddiu $sp, $sp, 64 |
| 956 | .cfi_adjust_cfa_offset -64 |
Goran Jakovljevic | 0456881 | 2015-04-23 15:27:23 +0200 | [diff] [blame] | 957 | SETUP_GP |
Maja Gagic | 6ea651f | 2015-02-24 16:55:04 +0100 | [diff] [blame] | 958 | bne $v0, $zero, .Ldo_aput |
| 959 | nop |
| 960 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
| 961 | move $a1, $a2 |
| 962 | dla $t9, artThrowArrayStoreException |
| 963 | jalr $zero, $t9 # artThrowArrayStoreException(Class*, Class*, Thread*) |
| 964 | move $a2, rSELF # pass Thread::Current |
| 965 | END art_quick_aput_obj |
| 966 | |
| 967 | /* |
Maja Gagic | 6ea651f | 2015-02-24 16:55:04 +0100 | [diff] [blame] | 968 | * Called by managed code to resolve a static field and load a boolean primitive value. |
| 969 | */ |
| 970 | .extern artGetBooleanStaticFromCode |
| 971 | ENTRY art_quick_get_boolean_static |
| 972 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 973 | lwu $a1, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method* |
| 974 | jal artGetBooleanStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) |
| 975 | move $a2, rSELF # pass Thread::Current |
| 976 | RETURN_IF_NO_EXCEPTION |
| 977 | END art_quick_get_boolean_static |
| 978 | |
| 979 | /* |
| 980 | * Called by managed code to resolve a static field and load a byte primitive value. |
| 981 | */ |
| 982 | .extern artGetByteStaticFromCode |
| 983 | ENTRY art_quick_get_byte_static |
| 984 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 985 | lwu $a1, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method* |
| 986 | jal artGetByteStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) |
| 987 | move $a2, rSELF # pass Thread::Current |
| 988 | RETURN_IF_NO_EXCEPTION |
| 989 | END art_quick_get_byte_static |
| 990 | |
| 991 | /* |
| 992 | * Called by managed code to resolve a static field and load a char primitive value. |
| 993 | */ |
| 994 | .extern artGetCharStaticFromCode |
| 995 | ENTRY art_quick_get_char_static |
| 996 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 997 | lwu $a1, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method* |
| 998 | jal artGetCharStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) |
| 999 | move $a2, rSELF # pass Thread::Current |
| 1000 | RETURN_IF_NO_EXCEPTION |
| 1001 | END art_quick_get_char_static |
| 1002 | |
| 1003 | /* |
| 1004 | * Called by managed code to resolve a static field and load a short primitive value. |
| 1005 | */ |
| 1006 | .extern artGetShortStaticFromCode |
| 1007 | ENTRY art_quick_get_short_static |
| 1008 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 1009 | lwu $a1, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method* |
| 1010 | jal artGetShortStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) |
| 1011 | move $a2, rSELF # pass Thread::Current |
| 1012 | RETURN_IF_NO_EXCEPTION |
| 1013 | END art_quick_get_short_static |
| 1014 | |
| 1015 | /* |
| 1016 | * Called by managed code to resolve a static field and load a 32-bit primitive value. |
| 1017 | */ |
| 1018 | .extern artGet32StaticFromCode |
| 1019 | ENTRY art_quick_get32_static |
| 1020 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 1021 | lwu $a1, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method* |
| 1022 | jal artGet32StaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) |
| 1023 | move $a2, rSELF # pass Thread::Current |
| 1024 | RETURN_IF_NO_EXCEPTION |
| 1025 | END art_quick_get32_static |
| 1026 | |
| 1027 | /* |
| 1028 | * Called by managed code to resolve a static field and load a 64-bit primitive value. |
| 1029 | */ |
| 1030 | .extern artGet64StaticFromCode |
| 1031 | ENTRY art_quick_get64_static |
| 1032 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 1033 | lwu $a1, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method* |
| 1034 | jal artGet64StaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) |
| 1035 | move $a2, rSELF # pass Thread::Current |
| 1036 | RETURN_IF_NO_EXCEPTION |
| 1037 | END art_quick_get64_static |
| 1038 | |
| 1039 | /* |
| 1040 | * Called by managed code to resolve a static field and load an object reference. |
| 1041 | */ |
| 1042 | .extern artGetObjStaticFromCode |
| 1043 | ENTRY art_quick_get_obj_static |
| 1044 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 1045 | lwu $a1, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method* |
| 1046 | jal artGetObjStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) |
| 1047 | move $a2, rSELF # pass Thread::Current |
| 1048 | RETURN_IF_NO_EXCEPTION |
| 1049 | END art_quick_get_obj_static |
| 1050 | |
| 1051 | /* |
| 1052 | * Called by managed code to resolve an instance field and load a boolean primitive value. |
| 1053 | */ |
| 1054 | .extern artGetBooleanInstanceFromCode |
| 1055 | ENTRY art_quick_get_boolean_instance |
| 1056 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 1057 | lwu $a2, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method* |
| 1058 | jal artGetBooleanInstanceFromCode # (field_idx, Object*, referrer, Thread*) |
| 1059 | move $a3, rSELF # pass Thread::Current |
| 1060 | RETURN_IF_NO_EXCEPTION |
| 1061 | END art_quick_get_boolean_instance |
| 1062 | |
| 1063 | /* |
| 1064 | * Called by managed code to resolve an instance field and load a byte primitive value. |
| 1065 | */ |
| 1066 | .extern artGetByteInstanceFromCode |
| 1067 | ENTRY art_quick_get_byte_instance |
| 1068 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 1069 | lwu $a2, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method* |
| 1070 | jal artGetByteInstanceFromCode # (field_idx, Object*, referrer, Thread*) |
| 1071 | move $a3, rSELF # pass Thread::Current |
| 1072 | RETURN_IF_NO_EXCEPTION |
| 1073 | END art_quick_get_byte_instance |
| 1074 | |
| 1075 | /* |
| 1076 | * Called by managed code to resolve an instance field and load a char primitive value. |
| 1077 | */ |
| 1078 | .extern artGetCharInstanceFromCode |
| 1079 | ENTRY art_quick_get_char_instance |
| 1080 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 1081 | lwu $a2, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method* |
| 1082 | jal artGetCharInstanceFromCode # (field_idx, Object*, referrer, Thread*) |
| 1083 | move $a3, rSELF # pass Thread::Current |
| 1084 | RETURN_IF_NO_EXCEPTION |
| 1085 | END art_quick_get_char_instance |
| 1086 | |
| 1087 | /* |
| 1088 | * Called by managed code to resolve an instance field and load a short primitive value. |
| 1089 | */ |
| 1090 | .extern artGetShortInstanceFromCode |
| 1091 | ENTRY art_quick_get_short_instance |
| 1092 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 1093 | lwu $a2, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method* |
| 1094 | jal artGetShortInstanceFromCode # (field_idx, Object*, referrer, Thread*) |
| 1095 | move $a3, rSELF # pass Thread::Current |
| 1096 | RETURN_IF_NO_EXCEPTION |
| 1097 | END art_quick_get_short_instance |
| 1098 | |
| 1099 | /* |
| 1100 | * Called by managed code to resolve an instance field and load a 32-bit primitive value. |
| 1101 | */ |
| 1102 | .extern artGet32InstanceFromCode |
| 1103 | ENTRY art_quick_get32_instance |
| 1104 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 1105 | lwu $a2, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method* |
| 1106 | jal artGet32InstanceFromCode # (field_idx, Object*, referrer, Thread*) |
| 1107 | move $a3, rSELF # pass Thread::Current |
| 1108 | RETURN_IF_NO_EXCEPTION |
| 1109 | END art_quick_get32_instance |
| 1110 | |
| 1111 | /* |
| 1112 | * Called by managed code to resolve an instance field and load a 64-bit primitive value. |
| 1113 | */ |
| 1114 | .extern artGet64InstanceFromCode |
| 1115 | ENTRY art_quick_get64_instance |
| 1116 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 1117 | lwu $a2, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method* |
| 1118 | jal artGet64InstanceFromCode # (field_idx, Object*, referrer, Thread*) |
| 1119 | move $a3, rSELF # pass Thread::Current |
| 1120 | RETURN_IF_NO_EXCEPTION |
| 1121 | END art_quick_get64_instance |
| 1122 | |
| 1123 | /* |
| 1124 | * Called by managed code to resolve an instance field and load an object reference. |
| 1125 | */ |
| 1126 | .extern artGetObjInstanceFromCode |
| 1127 | ENTRY art_quick_get_obj_instance |
| 1128 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 1129 | lwu $a2, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method* |
| 1130 | jal artGetObjInstanceFromCode # (field_idx, Object*, referrer, Thread*) |
| 1131 | move $a3, rSELF # pass Thread::Current |
| 1132 | RETURN_IF_NO_EXCEPTION |
| 1133 | END art_quick_get_obj_instance |
| 1134 | |
| 1135 | /* |
| 1136 | * Called by managed code to resolve a static field and store a 8-bit primitive value. |
| 1137 | */ |
| 1138 | .extern artSet8StaticFromCode |
| 1139 | ENTRY art_quick_set8_static |
| 1140 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 1141 | lwu $a2, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method* |
| 1142 | jal artSet8StaticFromCode # (field_idx, new_val, referrer, Thread*) |
| 1143 | move $a3, rSELF # pass Thread::Current |
| 1144 | RETURN_IF_ZERO |
| 1145 | END art_quick_set8_static |
| 1146 | |
| 1147 | /* |
| 1148 | * Called by managed code to resolve a static field and store a 16-bit primitive value. |
| 1149 | */ |
| 1150 | .extern artSet16StaticFromCode |
| 1151 | ENTRY art_quick_set16_static |
| 1152 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 1153 | lwu $a2, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method* |
| 1154 | jal artSet16StaticFromCode # (field_idx, new_val, referrer, Thread*) |
| 1155 | move $a3, rSELF # pass Thread::Current |
| 1156 | RETURN_IF_ZERO |
| 1157 | END art_quick_set16_static |
| 1158 | |
| 1159 | /* |
| 1160 | * Called by managed code to resolve a static field and store a 32-bit primitive value. |
| 1161 | */ |
| 1162 | .extern artSet32StaticFromCode |
| 1163 | ENTRY art_quick_set32_static |
| 1164 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 1165 | lwu $a2, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method* |
| 1166 | jal artSet32StaticFromCode # (field_idx, new_val, referrer, Thread*) |
| 1167 | move $a3, rSELF # pass Thread::Current |
| 1168 | RETURN_IF_ZERO |
| 1169 | END art_quick_set32_static |
| 1170 | |
| 1171 | /* |
| 1172 | * Called by managed code to resolve a static field and store a 64-bit primitive value. |
| 1173 | */ |
| 1174 | .extern artSet64StaticFromCode |
| 1175 | ENTRY art_quick_set64_static |
| 1176 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 1177 | move $a2, $a1 # pass new_val |
| 1178 | lwu $a1, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method* |
| 1179 | jal artSet64StaticFromCode # (field_idx, referrer, new_val, Thread*) |
| 1180 | move $a3, rSELF # pass Thread::Current |
| 1181 | RETURN_IF_ZERO |
| 1182 | END art_quick_set64_static |
| 1183 | |
| 1184 | /* |
| 1185 | * Called by managed code to resolve a static field and store an object reference. |
| 1186 | */ |
| 1187 | .extern artSetObjStaticFromCode |
| 1188 | ENTRY art_quick_set_obj_static |
| 1189 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 1190 | lwu $a2, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method* |
| 1191 | jal artSetObjStaticFromCode # (field_idx, new_val, referrer, Thread*) |
| 1192 | move $a3, rSELF # pass Thread::Current |
| 1193 | RETURN_IF_ZERO |
| 1194 | END art_quick_set_obj_static |
| 1195 | |
| 1196 | /* |
| 1197 | * Called by managed code to resolve an instance field and store a 8-bit primitive value. |
| 1198 | */ |
| 1199 | .extern artSet8InstanceFromCode |
| 1200 | ENTRY art_quick_set8_instance |
| 1201 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 1202 | lwu $a3, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method* |
| 1203 | jal artSet8InstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*) |
| 1204 | move $a4, rSELF # pass Thread::Current |
| 1205 | RETURN_IF_ZERO |
| 1206 | END art_quick_set8_instance |
| 1207 | |
| 1208 | /* |
| 1209 | * Called by managed code to resolve an instance field and store a 16-bit primitive value. |
| 1210 | */ |
| 1211 | .extern artSet16InstanceFromCode |
| 1212 | ENTRY art_quick_set16_instance |
| 1213 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 1214 | lwu $a3, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method* |
| 1215 | jal artSet16InstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*) |
| 1216 | move $a4, rSELF # pass Thread::Current |
| 1217 | RETURN_IF_ZERO |
| 1218 | END art_quick_set16_instance |
| 1219 | |
| 1220 | /* |
| 1221 | * Called by managed code to resolve an instance field and store a 32-bit primitive value. |
| 1222 | */ |
| 1223 | .extern artSet32InstanceFromCode |
| 1224 | ENTRY art_quick_set32_instance |
| 1225 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 1226 | lwu $a3, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method* |
| 1227 | jal artSet32InstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*) |
| 1228 | move $a4, rSELF # pass Thread::Current |
| 1229 | RETURN_IF_ZERO |
| 1230 | END art_quick_set32_instance |
| 1231 | |
| 1232 | /* |
| 1233 | * Called by managed code to resolve an instance field and store a 64-bit primitive value. |
| 1234 | */ |
| 1235 | .extern artSet64InstanceFromCode |
| 1236 | ENTRY art_quick_set64_instance |
| 1237 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 1238 | lwu $a3, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method* |
| 1239 | jal artSet64InstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*) |
| 1240 | move $a4, rSELF # pass Thread::Current |
| 1241 | RETURN_IF_ZERO |
| 1242 | END art_quick_set64_instance |
| 1243 | |
| 1244 | /* |
| 1245 | * Called by managed code to resolve an instance field and store an object reference. |
| 1246 | */ |
| 1247 | .extern artSetObjInstanceFromCode |
| 1248 | ENTRY art_quick_set_obj_instance |
| 1249 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 1250 | lwu $a3, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method* |
| 1251 | jal artSetObjInstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*) |
| 1252 | move $a4, rSELF # pass Thread::Current |
| 1253 | RETURN_IF_ZERO |
| 1254 | END art_quick_set_obj_instance |
| 1255 | |
Vladimir Marko | 5ea536a | 2015-04-20 20:11:30 +0100 | [diff] [blame] | 1256 | // Macro to facilitate adding new allocation entrypoints. |
| 1257 | .macro ONE_ARG_DOWNCALL name, entrypoint, return |
| 1258 | .extern \entrypoint |
| 1259 | ENTRY \name |
Maja Gagic | 6ea651f | 2015-02-24 16:55:04 +0100 | [diff] [blame] | 1260 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
Vladimir Marko | 5ea536a | 2015-04-20 20:11:30 +0100 | [diff] [blame] | 1261 | jal \entrypoint |
| 1262 | move $a1, rSELF # pass Thread::Current |
| 1263 | \return |
| 1264 | END \name |
| 1265 | .endm |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 1266 | |
| 1267 | // Macro to facilitate adding new allocation entrypoints. |
| 1268 | .macro TWO_ARG_DOWNCALL name, entrypoint, return |
Maja Gagic | 6ea651f | 2015-02-24 16:55:04 +0100 | [diff] [blame] | 1269 | .extern \entrypoint |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 1270 | ENTRY \name |
Maja Gagic | 6ea651f | 2015-02-24 16:55:04 +0100 | [diff] [blame] | 1271 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 1272 | jal \entrypoint |
| 1273 | move $a2, rSELF # pass Thread::Current |
| 1274 | \return |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 1275 | END \name |
| 1276 | .endm |
| 1277 | |
| 1278 | .macro THREE_ARG_DOWNCALL name, entrypoint, return |
Maja Gagic | 6ea651f | 2015-02-24 16:55:04 +0100 | [diff] [blame] | 1279 | .extern \entrypoint |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 1280 | ENTRY \name |
Maja Gagic | 6ea651f | 2015-02-24 16:55:04 +0100 | [diff] [blame] | 1281 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 1282 | jal \entrypoint |
| 1283 | move $a3, rSELF # pass Thread::Current |
| 1284 | \return |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 1285 | END \name |
| 1286 | .endm |
| 1287 | |
Vladimir Marko | e85e123 | 2015-04-28 14:14:58 +0100 | [diff] [blame] | 1288 | .macro FOUR_ARG_DOWNCALL name, entrypoint, return |
| 1289 | .extern \entrypoint |
| 1290 | ENTRY \name |
| 1291 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 1292 | jal \entrypoint |
| 1293 | move $a4, rSELF # pass Thread::Current |
| 1294 | \return |
| 1295 | END \name |
| 1296 | .endm |
| 1297 | |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 1298 | // Generate the allocation entrypoints for each allocator. |
| 1299 | GENERATE_ALL_ALLOC_ENTRYPOINTS |
| 1300 | |
Maja Gagic | 6ea651f | 2015-02-24 16:55:04 +0100 | [diff] [blame] | 1301 | /* |
Vladimir Marko | 5ea536a | 2015-04-20 20:11:30 +0100 | [diff] [blame] | 1302 | * Entry from managed code to resolve a string, this stub will allocate a String and deliver an |
| 1303 | * exception on error. On success the String is returned. A0 holds the string index. The fast |
| 1304 | * path check for hit in strings cache has already been performed. |
| 1305 | */ |
| 1306 | ONE_ARG_DOWNCALL art_quick_resolve_string, artResolveStringFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER |
| 1307 | |
| 1308 | /* |
| 1309 | * Entry from managed code when uninitialized static storage, this stub will run the class |
| 1310 | * initializer and deliver the exception on error. On success the static storage base is |
| 1311 | * returned. |
| 1312 | */ |
| 1313 | ONE_ARG_DOWNCALL art_quick_initialize_static_storage, artInitializeStaticStorageFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER |
| 1314 | |
| 1315 | /* |
| 1316 | * Entry from managed code when dex cache misses for a type_idx. |
| 1317 | */ |
| 1318 | ONE_ARG_DOWNCALL art_quick_initialize_type, artInitializeTypeFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER |
| 1319 | |
| 1320 | /* |
| 1321 | * Entry from managed code when type_idx needs to be checked for access and dex cache may also |
| 1322 | * miss. |
| 1323 | */ |
| 1324 | ONE_ARG_DOWNCALL art_quick_initialize_type_and_verify_access, artInitializeTypeAndVerifyAccessFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER |
| 1325 | |
| 1326 | /* |
Maja Gagic | 6ea651f | 2015-02-24 16:55:04 +0100 | [diff] [blame] | 1327 | * Called by managed code when the value in rSUSPEND has been decremented to 0. |
| 1328 | */ |
| 1329 | .extern artTestSuspendFromCode |
| 1330 | ENTRY art_quick_test_suspend |
| 1331 | lh $a0, THREAD_FLAGS_OFFSET(rSELF) |
| 1332 | bne $a0, $zero, 1f |
| 1333 | daddiu rSUSPEND, $zero, SUSPEND_CHECK_INTERVAL # reset rSUSPEND to SUSPEND_CHECK_INTERVAL |
| 1334 | jalr $zero, $ra |
Goran Jakovljevic | 0456881 | 2015-04-23 15:27:23 +0200 | [diff] [blame] | 1335 | .cpreturn # Restore gp from t8 in branch delay slot. |
Maja Gagic | 6ea651f | 2015-02-24 16:55:04 +0100 | [diff] [blame] | 1336 | 1: |
| 1337 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves for stack crawl |
| 1338 | jal artTestSuspendFromCode # (Thread*) |
| 1339 | move $a0, rSELF |
| 1340 | RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME_AND_RETURN |
| 1341 | END art_quick_test_suspend |
Douglas Leung | 6461d19 | 2015-01-30 18:13:58 -0800 | [diff] [blame] | 1342 | |
| 1343 | /* |
| 1344 | * Called by managed code that is attempting to call a method on a proxy class. On entry |
| 1345 | * r0 holds the proxy method; r1, r2 and r3 may contain arguments. |
| 1346 | */ |
| 1347 | .extern artQuickProxyInvokeHandler |
| 1348 | ENTRY art_quick_proxy_invoke_handler |
Douglas Leung | 8223b80 | 2015-04-28 17:22:29 -0700 | [diff] [blame] | 1349 | SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME_WITH_METHOD_IN_A0 |
Douglas Leung | 6461d19 | 2015-01-30 18:13:58 -0800 | [diff] [blame] | 1350 | move $a2, rSELF # pass Thread::Current |
| 1351 | jal artQuickProxyInvokeHandler # (Method* proxy method, receiver, Thread*, SP) |
| 1352 | move $a3, $sp # pass $sp |
| 1353 | ld $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ |
| 1354 | daddiu $sp, $sp, REFS_AND_ARGS_MINUS_REFS_SIZE # skip a0-a7 and f12-f19 |
| 1355 | RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME |
| 1356 | bne $t0, $zero, 1f |
| 1357 | dmtc1 $v0, $f0 # place return value to FP return value |
| 1358 | jalr $zero, $ra |
| 1359 | dmtc1 $v1, $f1 # place return value to FP return value |
| 1360 | 1: |
| 1361 | DELIVER_PENDING_EXCEPTION |
| 1362 | END art_quick_proxy_invoke_handler |
| 1363 | |
Maja Gagic | 6ea651f | 2015-02-24 16:55:04 +0100 | [diff] [blame] | 1364 | /* |
| 1365 | * Called to resolve an imt conflict. t0 is a hidden argument that holds the target method's |
| 1366 | * dex method index. |
| 1367 | */ |
| 1368 | ENTRY art_quick_imt_conflict_trampoline |
| 1369 | lwu $a0, 0($sp) # load caller Method* |
| 1370 | lwu $a0, MIRROR_ART_METHOD_DEX_CACHE_METHODS_OFFSET($a0) # load dex_cache_resolved_methods |
| 1371 | dsll $t0, 2 # convert target method offset to bytes |
| 1372 | daddu $a0, $t0 # get address of target method |
| 1373 | dla $t9, art_quick_invoke_interface_trampoline |
Goran Jakovljevic | 0456881 | 2015-04-23 15:27:23 +0200 | [diff] [blame] | 1374 | .cpreturn |
Maja Gagic | 6ea651f | 2015-02-24 16:55:04 +0100 | [diff] [blame] | 1375 | jalr $zero, $t9 |
| 1376 | lwu $a0, MIRROR_OBJECT_ARRAY_DATA_OFFSET($a0) # load the target method |
| 1377 | END art_quick_imt_conflict_trampoline |
Andreas Gampe | cc7c39d | 2015-01-30 17:04:45 -0800 | [diff] [blame] | 1378 | |
| 1379 | .extern artQuickResolutionTrampoline |
| 1380 | ENTRY art_quick_resolution_trampoline |
| 1381 | SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME |
| 1382 | move $a2, rSELF # pass Thread::Current |
| 1383 | jal artQuickResolutionTrampoline # (Method* called, receiver, Thread*, SP) |
| 1384 | move $a3, $sp # pass $sp |
| 1385 | beq $v0, $zero, 1f |
| 1386 | lwu $a0, 0($sp) # load resolved method in $a0 |
| 1387 | # artQuickResolutionTrampoline puts resolved method in *SP |
| 1388 | RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME |
| 1389 | move $t9, $v0 # code pointer must be in $t9 to generate the global pointer |
| 1390 | jalr $zero, $t9 # tail call to method |
| 1391 | nop |
| 1392 | 1: |
| 1393 | RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME |
| 1394 | DELIVER_PENDING_EXCEPTION |
| 1395 | END art_quick_resolution_trampoline |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 1396 | |
| 1397 | .extern artQuickGenericJniTrampoline |
| 1398 | .extern artQuickGenericJniEndTrampoline |
| 1399 | ENTRY art_quick_generic_jni_trampoline |
Douglas Leung | 8223b80 | 2015-04-28 17:22:29 -0700 | [diff] [blame] | 1400 | SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME_WITH_METHOD_IN_A0 |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 1401 | move $s8, $sp # save $sp |
| 1402 | |
| 1403 | # prepare for call to artQuickGenericJniTrampoline(Thread*, SP) |
| 1404 | move $a0, rSELF # pass Thread::Current |
| 1405 | move $a1, $sp # pass $sp |
| 1406 | jal artQuickGenericJniTrampoline # (Thread*, SP) |
| 1407 | daddiu $sp, $sp, -5120 # reserve space on the stack |
| 1408 | |
| 1409 | # The C call will have registered the complete save-frame on success. |
| 1410 | # The result of the call is: |
| 1411 | # v0: ptr to native code, 0 on error. |
| 1412 | # v1: ptr to the bottom of the used area of the alloca, can restore stack till here. |
| 1413 | beq $v0, $zero, 1f # check entry error |
| 1414 | move $t9, $v0 # save the code ptr |
| 1415 | move $sp, $v1 # release part of the alloca |
| 1416 | |
| 1417 | # Load parameters from stack into registers |
| 1418 | ld $a0, 0($sp) |
| 1419 | ld $a1, 8($sp) |
| 1420 | ld $a2, 16($sp) |
| 1421 | ld $a3, 24($sp) |
| 1422 | ld $a4, 32($sp) |
| 1423 | ld $a5, 40($sp) |
| 1424 | ld $a6, 48($sp) |
| 1425 | ld $a7, 56($sp) |
| 1426 | # Load FPRs the same as GPRs. Look at BuildNativeCallFrameStateMachine. |
| 1427 | l.d $f12, 0($sp) |
| 1428 | l.d $f13, 8($sp) |
| 1429 | l.d $f14, 16($sp) |
| 1430 | l.d $f15, 24($sp) |
| 1431 | l.d $f16, 32($sp) |
| 1432 | l.d $f17, 40($sp) |
| 1433 | l.d $f18, 48($sp) |
| 1434 | l.d $f19, 56($sp) |
| 1435 | jalr $t9 # native call |
| 1436 | daddiu $sp, $sp, 64 |
| 1437 | |
| 1438 | # result sign extension is handled in C code |
| 1439 | # prepare for call to artQuickGenericJniEndTrampoline(Thread*, result, result_f) |
| 1440 | move $a0, rSELF # pass Thread::Current |
| 1441 | move $a1, $v0 |
| 1442 | jal artQuickGenericJniEndTrampoline |
| 1443 | dmfc1 $a2, $f0 |
| 1444 | |
| 1445 | ld $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ |
Nicolas Geoffray | 126d659 | 2015-03-03 14:28:35 +0000 | [diff] [blame] | 1446 | bne $t0, $zero, 1f # check for pending exceptions |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 1447 | move $sp, $s8 # tear down the alloca |
| 1448 | |
| 1449 | # tear dpown the callee-save frame |
| 1450 | RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME |
| 1451 | |
| 1452 | jalr $zero, $ra |
| 1453 | dmtc1 $v0, $f0 # place return value to FP return value |
| 1454 | |
| 1455 | 1: |
Nicolas Geoffray | 126d659 | 2015-03-03 14:28:35 +0000 | [diff] [blame] | 1456 | ld $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF) |
| 1457 | # This will create a new save-all frame, required by the runtime. |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 1458 | DELIVER_PENDING_EXCEPTION |
| 1459 | END art_quick_generic_jni_trampoline |
| 1460 | |
| 1461 | .extern artQuickToInterpreterBridge |
| 1462 | ENTRY art_quick_to_interpreter_bridge |
| 1463 | SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME |
| 1464 | move $a1, rSELF # pass Thread::Current |
| 1465 | jal artQuickToInterpreterBridge # (Method* method, Thread*, SP) |
| 1466 | move $a2, $sp # pass $sp |
| 1467 | ld $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ |
| 1468 | daddiu $sp, $sp, REFS_AND_ARGS_MINUS_REFS_SIZE # skip a0-a7 and f12-f19 |
| 1469 | RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME |
| 1470 | bne $t0, $zero, 1f |
| 1471 | dmtc1 $v0, $f0 # place return value to FP return value |
| 1472 | jalr $zero, $ra |
| 1473 | dmtc1 $v1, $f1 # place return value to FP return value |
| 1474 | 1: |
| 1475 | DELIVER_PENDING_EXCEPTION |
| 1476 | END art_quick_to_interpreter_bridge |
| 1477 | |
| 1478 | /* |
| 1479 | * Routine that intercepts method calls and returns. |
| 1480 | */ |
| 1481 | .extern artInstrumentationMethodEntryFromCode |
| 1482 | .extern artInstrumentationMethodExitFromCode |
| 1483 | ENTRY art_quick_instrumentation_entry |
| 1484 | SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME |
| 1485 | daddiu $sp, $sp, -16 # space for saving arg0 |
| 1486 | .cfi_adjust_cfa_offset 16 |
| 1487 | sd $a0, 0($sp) # save arg0 |
| 1488 | move $a3, $ra # pass $ra |
| 1489 | jal artInstrumentationMethodEntryFromCode # (Method*, Object*, Thread*, RA) |
| 1490 | move $a2, rSELF # pass Thread::Current |
| 1491 | move $t9, $v0 # $t9 holds reference to code |
| 1492 | ld $a0, 0($sp) # restore arg0 |
| 1493 | daddiu $sp, $sp, 16 # remove args |
| 1494 | .cfi_adjust_cfa_offset -16 |
| 1495 | RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME |
| 1496 | jalr $t9 # call method |
| 1497 | nop |
| 1498 | END art_quick_instrumentation_entry |
| 1499 | /* intentional fallthrough */ |
| 1500 | .global art_quick_instrumentation_exit |
| 1501 | art_quick_instrumentation_exit: |
| 1502 | .cfi_startproc |
Goran Jakovljevic | 0456881 | 2015-04-23 15:27:23 +0200 | [diff] [blame] | 1503 | SETUP_GP |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 1504 | move $ra, $zero # link register is to here, so clobber with 0 for later checks |
| 1505 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME |
| 1506 | move $t0, $sp # remember bottom of caller's frame |
| 1507 | daddiu $sp, $sp, -16 # save return values and set up args |
| 1508 | .cfi_adjust_cfa_offset 16 |
| 1509 | sd $v0, 0($sp) |
| 1510 | .cfi_rel_offset 2, 0 |
| 1511 | s.d $f0, 8($sp) |
| 1512 | mov.d $f15, $f0 # pass fpr result |
| 1513 | move $a2, $v0 # pass gpr result |
| 1514 | move $a1, $t0 # pass $sp |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 1515 | move $a0, rSELF # pass Thread::Current |
Goran Jakovljevic | 0456881 | 2015-04-23 15:27:23 +0200 | [diff] [blame] | 1516 | jal artInstrumentationMethodExitFromCode # (Thread*, SP, gpr_res, fpr_res) |
| 1517 | .cpreturn # Restore gp from t8 in branch delay slot. gp is not used anymore, |
| 1518 | # and t8 may be clobbered in artInstrumentationMethodExitFromCode. |
| 1519 | |
Douglas Leung | f96e8bd | 2015-03-27 15:38:30 -0700 | [diff] [blame] | 1520 | move $t9, $v0 # set aside returned link register |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 1521 | move $ra, $v1 # set link register for deoptimization |
| 1522 | ld $v0, 0($sp) # restore return values |
| 1523 | l.d $f0, 8($sp) |
Douglas Leung | f96e8bd | 2015-03-27 15:38:30 -0700 | [diff] [blame] | 1524 | jalr $zero, $t9 # return |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 1525 | daddiu $sp, $sp, 16+FRAME_SIZE_REFS_ONLY_CALLEE_SAVE # 16 bytes of saved values + ref_only callee save frame |
| 1526 | .cfi_adjust_cfa_offset -(16+FRAME_SIZE_REFS_ONLY_CALLEE_SAVE) |
| 1527 | END art_quick_instrumentation_exit |
| 1528 | |
Maja Gagic | 6ea651f | 2015-02-24 16:55:04 +0100 | [diff] [blame] | 1529 | /* |
| 1530 | * Instrumentation has requested that we deoptimize into the interpreter. The deoptimization |
| 1531 | * will long jump to the upcall with a special exception of -1. |
| 1532 | */ |
| 1533 | .extern artDeoptimize |
| 1534 | .extern artEnterInterpreterFromDeoptimize |
| 1535 | ENTRY art_quick_deoptimize |
| 1536 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
| 1537 | jal artDeoptimize # artDeoptimize(Thread*, SP) |
| 1538 | # Returns caller method's frame size. |
| 1539 | move $a0, rSELF # pass Thread::current |
| 1540 | END art_quick_deoptimize |
| 1541 | |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 1542 | UNIMPLEMENTED art_quick_indexof |
| 1543 | UNIMPLEMENTED art_quick_string_compareto |