Elliott Hughes | 0f3c553 | 2012-03-30 14:51:51 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 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 | |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 17 | #include "asm_support_mips.S" |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 18 | |
jeffhao | 0703060 | 2012-09-26 14:33:14 -0700 | [diff] [blame] | 19 | .set noreorder |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 20 | .balign 4 |
| 21 | |
| 22 | /* Deliver the given exception */ |
| 23 | .extern artDeliverExceptionFromCode |
| 24 | /* Deliver an exception pending on a thread */ |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 25 | .extern artDeliverPendingExceptionFromCode |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 26 | |
| 27 | /* |
| 28 | * Macro that sets up the callee save frame to conform with |
| 29 | * Runtime::CreateCalleeSaveMethod(kSaveAll) |
Jeff Hao | 1f3bc2f | 2013-04-30 15:17:19 -0700 | [diff] [blame] | 30 | * callee-save: $s0-$s8 + $gp + $ra, 11 total + 1 word padding + 4 open words for args |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 31 | */ |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 32 | .macro SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 33 | addiu $sp, $sp, -64 |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 34 | .cfi_adjust_cfa_offset 64 |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 35 | sw $ra, 60($sp) |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 36 | .cfi_rel_offset 31, 60 |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 37 | sw $s8, 56($sp) |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 38 | .cfi_rel_offset 30, 56 |
Jeff Hao | 1f3bc2f | 2013-04-30 15:17:19 -0700 | [diff] [blame] | 39 | sw $gp, 52($sp) |
| 40 | .cfi_rel_offset 28, 52 |
| 41 | sw $s7, 48($sp) |
| 42 | .cfi_rel_offset 23, 48 |
| 43 | sw $s6, 44($sp) |
| 44 | .cfi_rel_offset 22, 44 |
| 45 | sw $s5, 40($sp) |
| 46 | .cfi_rel_offset 21, 40 |
| 47 | sw $s4, 36($sp) |
| 48 | .cfi_rel_offset 20, 36 |
| 49 | sw $s3, 32($sp) |
| 50 | .cfi_rel_offset 19, 32 |
| 51 | sw $s2, 28($sp) |
| 52 | .cfi_rel_offset 18, 28 |
| 53 | sw $s1, 24($sp) |
| 54 | .cfi_rel_offset 17, 24 |
| 55 | sw $s0, 20($sp) |
| 56 | .cfi_rel_offset 16, 20 |
| 57 | # 1 word for alignment, 4 open words for args $a0-$a3, bottom will hold Method* |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 58 | .endm |
| 59 | |
| 60 | /* |
| 61 | * Macro that sets up the callee save frame to conform with |
| 62 | * Runtime::CreateCalleeSaveMethod(kRefsOnly). Restoration assumes non-moving GC. |
| 63 | * Does not include rSUSPEND or rSELF |
Jeff Hao | 1f3bc2f | 2013-04-30 15:17:19 -0700 | [diff] [blame] | 64 | * callee-save: $s2-$s8 + $gp + $ra, 9 total + 3 words padding + 4 open words for args |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 65 | */ |
| 66 | .macro SETUP_REF_ONLY_CALLEE_SAVE_FRAME |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 67 | addiu $sp, $sp, -64 |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 68 | .cfi_adjust_cfa_offset 64 |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 69 | sw $ra, 60($sp) |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 70 | .cfi_rel_offset 31, 60 |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 71 | sw $s8, 56($sp) |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 72 | .cfi_rel_offset 30, 56 |
Jeff Hao | 1f3bc2f | 2013-04-30 15:17:19 -0700 | [diff] [blame] | 73 | sw $gp, 52($sp) |
| 74 | .cfi_rel_offset 28, 52 |
| 75 | sw $s7, 48($sp) |
| 76 | .cfi_rel_offset 23, 48 |
| 77 | sw $s6, 44($sp) |
| 78 | .cfi_rel_offset 22, 44 |
| 79 | sw $s5, 40($sp) |
| 80 | .cfi_rel_offset 21, 40 |
| 81 | sw $s4, 36($sp) |
| 82 | .cfi_rel_offset 20, 36 |
| 83 | sw $s3, 32($sp) |
| 84 | .cfi_rel_offset 19, 32 |
| 85 | sw $s2, 28($sp) |
| 86 | .cfi_rel_offset 18, 28 |
jeffhao | fc6a30e | 2012-10-18 18:24:15 -0700 | [diff] [blame] | 87 | # 3 words for alignment and extra args, 4 open words for args $a0-$a3, bottom will hold Method* |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 88 | .endm |
| 89 | |
| 90 | .macro RESTORE_REF_ONLY_CALLEE_SAVE_FRAME |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 91 | lw $ra, 60($sp) |
Mathieu Chartier | 2a6c7b7 | 2013-10-16 11:16:33 -0700 | [diff] [blame^] | 92 | lw $s8, 56($sp) |
| 93 | lw $gp, 52($sp) |
| 94 | lw $s7, 48($sp) |
| 95 | lw $s6, 44($sp) |
| 96 | lw $s5, 40($sp) |
| 97 | lw $s4, 36($sp) |
| 98 | lw $s3, 32($sp) |
| 99 | lw $s2, 28($sp) |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 100 | addiu $sp, $sp, 64 |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 101 | .cfi_adjust_cfa_offset -64 |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 102 | .endm |
| 103 | |
| 104 | .macro RESTORE_REF_ONLY_CALLEE_SAVE_FRAME_AND_RETURN |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 105 | lw $ra, 60($sp) |
Mathieu Chartier | 2a6c7b7 | 2013-10-16 11:16:33 -0700 | [diff] [blame^] | 106 | lw $s8, 56($sp) |
| 107 | lw $gp, 52($sp) |
| 108 | lw $s7, 48($sp) |
| 109 | lw $s6, 44($sp) |
| 110 | lw $s5, 40($sp) |
| 111 | lw $s4, 36($sp) |
| 112 | lw $s3, 32($sp) |
| 113 | lw $s2, 28($sp) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 114 | jr $ra |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 115 | addiu $sp, $sp, 64 |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 116 | .cfi_adjust_cfa_offset -64 |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 117 | .endm |
| 118 | |
| 119 | /* |
| 120 | * Macro that sets up the callee save frame to conform with |
| 121 | * Runtime::CreateCalleeSaveMethod(kRefsAndArgs). Restoration assumes non-moving GC. |
Jeff Hao | 1f3bc2f | 2013-04-30 15:17:19 -0700 | [diff] [blame] | 122 | * callee-save: $a1-$a3, $s2-$s8 + $gp + $ra, 12 total + 3 words padding + method* |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 123 | */ |
| 124 | .macro SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME |
Jeff Hao | 1f3bc2f | 2013-04-30 15:17:19 -0700 | [diff] [blame] | 125 | addiu $sp, $sp, -64 |
| 126 | .cfi_adjust_cfa_offset 64 |
| 127 | sw $ra, 60($sp) |
| 128 | .cfi_rel_offset 31, 60 |
| 129 | sw $s8, 56($sp) |
| 130 | .cfi_rel_offset 30, 56 |
| 131 | sw $gp, 52($sp) |
| 132 | .cfi_rel_offset 28, 52 |
| 133 | sw $s7, 48($sp) |
| 134 | .cfi_rel_offset 23, 48 |
| 135 | sw $s6, 44($sp) |
| 136 | .cfi_rel_offset 22, 44 |
| 137 | sw $s5, 40($sp) |
| 138 | .cfi_rel_offset 21, 40 |
| 139 | sw $s4, 36($sp) |
| 140 | .cfi_rel_offset 20, 36 |
| 141 | sw $s3, 32($sp) |
| 142 | .cfi_rel_offset 19, 32 |
| 143 | sw $s2, 28($sp) |
| 144 | .cfi_rel_offset 18, 28 |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 145 | sw $a3, 12($sp) |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 146 | .cfi_rel_offset 7, 12 |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 147 | sw $a2, 8($sp) |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 148 | .cfi_rel_offset 6, 8 |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 149 | sw $a1, 4($sp) |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 150 | .cfi_rel_offset 5, 4 |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 151 | # bottom will hold Method* |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 152 | .endm |
| 153 | |
| 154 | .macro RESTORE_REF_AND_ARGS_CALLEE_SAVE_FRAME |
Mathieu Chartier | 2a6c7b7 | 2013-10-16 11:16:33 -0700 | [diff] [blame^] | 155 | lw $ra, 60($sp) |
| 156 | lw $s8, 56($sp) |
| 157 | lw $gp, 52($sp) |
| 158 | lw $s7, 48($sp) |
| 159 | lw $s6, 44($sp) |
| 160 | lw $s5, 40($sp) |
| 161 | lw $s4, 36($sp) |
| 162 | lw $s3, 32($sp) |
| 163 | lw $s2, 28($sp) |
| 164 | lw $a3, 12($sp) |
| 165 | lw $a2, 8($sp) |
| 166 | lw $a1, 4($sp) |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 167 | addiu $sp, $sp, 64 # pop frame |
Jeff Hao | 1f3bc2f | 2013-04-30 15:17:19 -0700 | [diff] [blame] | 168 | .cfi_adjust_cfa_offset -64 |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 169 | .endm |
| 170 | |
| 171 | /* |
| 172 | * Macro that set calls through to artDeliverPendingExceptionFromCode, where the pending |
| 173 | * exception is Thread::Current()->exception_ |
| 174 | */ |
| 175 | .macro DELIVER_PENDING_EXCEPTION |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 176 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME # save callee saves for throw |
| 177 | move $a0, rSELF # pass Thread::Current |
| 178 | la $t9, artDeliverPendingExceptionFromCode |
| 179 | jr $t9 # artDeliverPendingExceptionFromCode(Thread*, $sp) |
| 180 | move $a1, $sp # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 181 | .endm |
| 182 | |
| 183 | .macro RETURN_IF_NO_EXCEPTION |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 184 | lw $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 185 | RESTORE_REF_ONLY_CALLEE_SAVE_FRAME |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 186 | bnez $t0, 1f # success if no exception is pending |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 187 | nop |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 188 | jr $ra |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 189 | nop |
| 190 | 1: |
| 191 | DELIVER_PENDING_EXCEPTION |
| 192 | .endm |
| 193 | |
| 194 | .macro RETURN_IF_ZERO |
| 195 | RESTORE_REF_ONLY_CALLEE_SAVE_FRAME |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 196 | bnez $v0, 1f # success? |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 197 | nop |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 198 | jr $ra # return on success |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 199 | nop |
| 200 | 1: |
| 201 | DELIVER_PENDING_EXCEPTION |
| 202 | .endm |
| 203 | |
| 204 | .macro RETURN_IF_NONZERO |
| 205 | RESTORE_REF_ONLY_CALLEE_SAVE_FRAME |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 206 | beqz $v0, 1f # success? |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 207 | nop |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 208 | jr $ra # return on success |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 209 | nop |
| 210 | 1: |
| 211 | DELIVER_PENDING_EXCEPTION |
| 212 | .endm |
| 213 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 214 | /* |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 215 | * On entry $a0 is uint32_t* gprs_ and $a1 is uint32_t* fprs_ |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 216 | * FIXME: just guessing about the shape of the jmpbuf. Where will pc be? |
| 217 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 218 | ENTRY art_quick_do_long_jump |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 219 | l.s $f0, 0($a1) |
| 220 | l.s $f1, 4($a1) |
| 221 | l.s $f2, 8($a1) |
| 222 | l.s $f3, 12($a1) |
| 223 | l.s $f4, 16($a1) |
| 224 | l.s $f5, 20($a1) |
| 225 | l.s $f6, 24($a1) |
| 226 | l.s $f7, 28($a1) |
| 227 | l.s $f8, 32($a1) |
| 228 | l.s $f9, 36($a1) |
| 229 | l.s $f10, 40($a1) |
| 230 | l.s $f11, 44($a1) |
| 231 | l.s $f12, 48($a1) |
| 232 | l.s $f13, 52($a1) |
| 233 | l.s $f14, 56($a1) |
| 234 | l.s $f15, 60($a1) |
| 235 | l.s $f16, 64($a1) |
| 236 | l.s $f17, 68($a1) |
| 237 | l.s $f18, 72($a1) |
| 238 | l.s $f19, 76($a1) |
| 239 | l.s $f20, 80($a1) |
| 240 | l.s $f21, 84($a1) |
| 241 | l.s $f22, 88($a1) |
| 242 | l.s $f23, 92($a1) |
| 243 | l.s $f24, 96($a1) |
| 244 | l.s $f25, 100($a1) |
| 245 | l.s $f26, 104($a1) |
| 246 | l.s $f27, 108($a1) |
| 247 | l.s $f28, 112($a1) |
| 248 | l.s $f29, 116($a1) |
| 249 | l.s $f30, 120($a1) |
| 250 | l.s $f31, 124($a1) |
| 251 | lw $at, 4($a0) |
| 252 | lw $v0, 8($a0) |
| 253 | lw $v1, 12($a0) |
| 254 | lw $a1, 20($a0) |
| 255 | lw $a2, 24($a0) |
| 256 | lw $a3, 28($a0) |
| 257 | lw $t0, 32($a0) |
| 258 | lw $t1, 36($a0) |
| 259 | lw $t2, 40($a0) |
| 260 | lw $t3, 44($a0) |
| 261 | lw $t4, 48($a0) |
| 262 | lw $t5, 52($a0) |
| 263 | lw $t6, 56($a0) |
| 264 | lw $t7, 60($a0) |
| 265 | lw $s0, 64($a0) |
| 266 | lw $s1, 68($a0) |
| 267 | lw $s2, 72($a0) |
| 268 | lw $s3, 76($a0) |
| 269 | lw $s4, 80($a0) |
| 270 | lw $s5, 84($a0) |
| 271 | lw $s6, 88($a0) |
| 272 | lw $s7, 92($a0) |
| 273 | lw $t8, 96($a0) |
| 274 | lw $t9, 100($a0) |
| 275 | lw $k0, 104($a0) |
| 276 | lw $k1, 108($a0) |
| 277 | lw $gp, 112($a0) |
| 278 | lw $sp, 116($a0) |
| 279 | lw $fp, 120($a0) |
| 280 | lw $ra, 124($a0) |
| 281 | lw $a0, 16($a0) |
| 282 | move $v0, $zero # clear result registers r0 and r1 |
| 283 | jr $ra # do long jump |
| 284 | move $v1, $zero |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 285 | END art_quick_do_long_jump |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 286 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 287 | /* |
| 288 | * Called by managed code, saves most registers (forms basis of long jump context) and passes |
| 289 | * the bottom of the stack. artDeliverExceptionFromCode will place the callee save Method* at |
| 290 | * the bottom of the thread. On entry r0 holds Throwable* |
| 291 | */ |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 292 | ENTRY art_quick_deliver_exception |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 293 | GENERATE_GLOBAL_POINTER |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 294 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 295 | move $a1, rSELF # pass Thread::Current |
| 296 | la $t9, artDeliverExceptionFromCode |
| 297 | jr $t9 # artDeliverExceptionFromCode(Throwable*, Thread*, $sp) |
| 298 | move $a2, $sp # pass $sp |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 299 | END art_quick_deliver_exception |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 300 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 301 | /* |
| 302 | * Called by managed code to create and deliver a NullPointerException |
| 303 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 304 | .extern artThrowNullPointerExceptionFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 305 | ENTRY art_quick_throw_null_pointer_exception |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 306 | GENERATE_GLOBAL_POINTER |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 307 | art_quick_throw_null_pointer_exception_gp_set: |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 308 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 309 | move $a0, rSELF # pass Thread::Current |
| 310 | la $t9, artThrowNullPointerExceptionFromCode |
| 311 | jr $t9 # artThrowNullPointerExceptionFromCode(Thread*, $sp) |
| 312 | move $a1, $sp # pass $sp |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 313 | END art_quick_throw_null_pointer_exception |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 314 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 315 | /* |
| 316 | * Called by managed code to create and deliver an ArithmeticException |
| 317 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 318 | .extern artThrowDivZeroFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 319 | ENTRY art_quick_throw_div_zero |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 320 | GENERATE_GLOBAL_POINTER |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 321 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 322 | move $a0, rSELF # pass Thread::Current |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 323 | la $t9, artThrowDivZeroFromCode |
| 324 | jr $t9 # artThrowDivZeroFromCode(Thread*, $sp) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 325 | move $a1, $sp # pass $sp |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 326 | END art_quick_throw_div_zero |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 327 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 328 | /* |
| 329 | * Called by managed code to create and deliver an ArrayIndexOutOfBoundsException |
| 330 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 331 | .extern artThrowArrayBoundsFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 332 | ENTRY art_quick_throw_array_bounds |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 333 | GENERATE_GLOBAL_POINTER |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 334 | art_quick_throw_array_bounds_gp_set: |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 335 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 336 | move $a2, rSELF # pass Thread::Current |
| 337 | la $t9, artThrowArrayBoundsFromCode |
| 338 | jr $t9 # artThrowArrayBoundsFromCode(index, limit, Thread*, $sp) |
| 339 | move $a3, $sp # pass $sp |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 340 | END art_quick_throw_array_bounds |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 341 | |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 342 | /* |
| 343 | * Called by managed code to create and deliver a StackOverflowError. |
| 344 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 345 | .extern artThrowStackOverflowFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 346 | ENTRY art_quick_throw_stack_overflow |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 347 | GENERATE_GLOBAL_POINTER |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 348 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 349 | move $a0, rSELF # pass Thread::Current |
| 350 | la $t9, artThrowStackOverflowFromCode |
| 351 | jr $t9 # artThrowStackOverflowFromCode(Thread*, $sp) |
| 352 | move $a1, $sp # pass $sp |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 353 | END art_quick_throw_stack_overflow |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 354 | |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 355 | /* |
| 356 | * Called by managed code to create and deliver a NoSuchMethodError. |
| 357 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 358 | .extern artThrowNoSuchMethodFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 359 | ENTRY art_quick_throw_no_such_method |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 360 | GENERATE_GLOBAL_POINTER |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 361 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 362 | move $a1, rSELF # pass Thread::Current |
| 363 | la $t9, artThrowNoSuchMethodFromCode |
| 364 | jr $t9 # artThrowNoSuchMethodFromCode(method_idx, Thread*, $sp) |
| 365 | move $a2, $sp # pass $sp |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 366 | END art_quick_throw_no_such_method |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 367 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 368 | /* |
| 369 | * All generated callsites for interface invokes and invocation slow paths will load arguments |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 370 | * as usual - except instead of loading arg0/$a0 with the target Method*, arg0/$a0 will contain |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 371 | * the method_idx. This wrapper will save arg1-arg3, load the caller's Method*, align the |
| 372 | * stack and call the appropriate C helper. |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 373 | * NOTE: "this" is first visable argument of the target, and so can be found in arg1/$a1. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 374 | * |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 375 | * The helper will attempt to locate the target and return a 64-bit result in $v0/$v1 consisting |
| 376 | * of the target Method* in $v0 and method->code_ in $v1. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 377 | * |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 378 | * If unsuccessful, the helper will return NULL/NULL. There will be a pending exception in the |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 379 | * thread and we branch to another stub to deliver it. |
| 380 | * |
| 381 | * On success this wrapper will restore arguments and *jump* to the target, leaving the lr |
| 382 | * pointing back to the original caller. |
| 383 | */ |
| 384 | .macro INVOKE_TRAMPOLINE c_name, cxx_name |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 385 | .extern \cxx_name |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 386 | ENTRY \c_name |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 387 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 388 | SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME # save callee saves in case allocation triggers GC |
Jeff Hao | 1f3bc2f | 2013-04-30 15:17:19 -0700 | [diff] [blame] | 389 | lw $a2, 64($sp) # pass caller Method* |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 390 | move $t0, $sp # save $sp |
Jeff Hao | 58df327 | 2013-04-22 15:28:53 -0700 | [diff] [blame] | 391 | addiu $sp, $sp, -32 # make space for extra args |
| 392 | .cfi_adjust_cfa_offset 32 |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 393 | move $a3, rSELF # pass Thread::Current |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 394 | .cfi_rel_offset 28, 12 |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 395 | jal \cxx_name # (method_idx, this, caller, Thread*, $sp) |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 396 | sw $t0, 16($sp) # pass $sp |
Jeff Hao | 58df327 | 2013-04-22 15:28:53 -0700 | [diff] [blame] | 397 | addiu $sp, $sp, 32 # release out args |
| 398 | .cfi_adjust_cfa_offset -32 |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 399 | move $a0, $v0 # save target Method* |
jeffhao | 30a3317 | 2012-10-22 18:16:22 -0700 | [diff] [blame] | 400 | move $t9, $v1 # save $v0->code_ |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 401 | RESTORE_REF_AND_ARGS_CALLEE_SAVE_FRAME |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 402 | beqz $v0, 1f |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 403 | nop |
jeffhao | 30a3317 | 2012-10-22 18:16:22 -0700 | [diff] [blame] | 404 | jr $t9 |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 405 | nop |
| 406 | 1: |
| 407 | DELIVER_PENDING_EXCEPTION |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 408 | END \c_name |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 409 | .endm |
| 410 | |
Logan Chien | 8dbb708 | 2013-01-25 20:31:17 +0800 | [diff] [blame] | 411 | INVOKE_TRAMPOLINE art_quick_invoke_interface_trampoline, artInvokeInterfaceTrampoline |
| 412 | INVOKE_TRAMPOLINE art_quick_invoke_interface_trampoline_with_access_check, artInvokeInterfaceTrampolineWithAccessCheck |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 413 | |
Logan Chien | 8dbb708 | 2013-01-25 20:31:17 +0800 | [diff] [blame] | 414 | INVOKE_TRAMPOLINE art_quick_invoke_static_trampoline_with_access_check, artInvokeStaticTrampolineWithAccessCheck |
| 415 | INVOKE_TRAMPOLINE art_quick_invoke_direct_trampoline_with_access_check, artInvokeDirectTrampolineWithAccessCheck |
| 416 | INVOKE_TRAMPOLINE art_quick_invoke_super_trampoline_with_access_check, artInvokeSuperTrampolineWithAccessCheck |
| 417 | INVOKE_TRAMPOLINE art_quick_invoke_virtual_trampoline_with_access_check, artInvokeVirtualTrampolineWithAccessCheck |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 418 | |
Jeff Hao | 79fe539 | 2013-04-24 18:41:58 -0700 | [diff] [blame] | 419 | /* |
Jeff Hao | 6474d19 | 2013-03-26 14:08:09 -0700 | [diff] [blame] | 420 | * Common invocation stub for portable and quick. |
Jeff Hao | 5d91730 | 2013-02-27 17:57:33 -0800 | [diff] [blame] | 421 | * On entry: |
| 422 | * a0 = method pointer |
| 423 | * a1 = argument array or NULL for no argument methods |
| 424 | * a2 = size of argument array in bytes |
| 425 | * a3 = (managed) thread pointer |
Jeff Hao | 6474d19 | 2013-03-26 14:08:09 -0700 | [diff] [blame] | 426 | * [sp + 16] = JValue* result |
| 427 | * [sp + 20] = result type char |
Jeff Hao | 5d91730 | 2013-02-27 17:57:33 -0800 | [diff] [blame] | 428 | */ |
Jeff Hao | 79fe539 | 2013-04-24 18:41:58 -0700 | [diff] [blame] | 429 | .type art_portable_invoke_stub, %function |
| 430 | .global art_portable_invoke_stub |
Jeff Hao | 6474d19 | 2013-03-26 14:08:09 -0700 | [diff] [blame] | 431 | art_portable_invoke_stub: |
Jeff Hao | 5d91730 | 2013-02-27 17:57:33 -0800 | [diff] [blame] | 432 | ENTRY art_quick_invoke_stub |
| 433 | GENERATE_GLOBAL_POINTER |
| 434 | sw $a0, 0($sp) # save out a0 |
| 435 | addiu $sp, $sp, -16 # spill s0, s1, fp, ra |
| 436 | .cfi_adjust_cfa_offset 16 |
| 437 | sw $ra, 12($sp) |
| 438 | .cfi_rel_offset 31, 12 |
| 439 | sw $fp, 8($sp) |
| 440 | .cfi_rel_offset 30, 8 |
| 441 | sw $s1, 4($sp) |
| 442 | .cfi_rel_offset 17, 4 |
| 443 | sw $s0, 0($sp) |
| 444 | .cfi_rel_offset 16, 0 |
| 445 | move $fp, $sp # save sp in fp |
| 446 | .cfi_def_cfa_register 30 |
| 447 | move $s1, $a3 # move managed thread pointer into s1 |
| 448 | addiu $s0, $zero, SUSPEND_CHECK_INTERVAL # reset s0 to suspend check interval |
| 449 | addiu $t0, $a2, 16 # create space for method pointer in frame |
| 450 | srl $t0, $t0, 3 # shift the frame size right 3 |
| 451 | sll $t0, $t0, 3 # shift the frame size left 3 to align to 16 bytes |
| 452 | subu $sp, $sp, $t0 # reserve stack space for argument array |
| 453 | addiu $a0, $sp, 4 # pass stack pointer + method ptr as dest for memcpy |
| 454 | jal memcpy # (dest, src, bytes) |
| 455 | addiu $sp, $sp, -16 # make space for argument slots for memcpy |
| 456 | addiu $sp, $sp, 16 # restore stack after memcpy |
| 457 | lw $a0, 16($fp) # restore method* |
| 458 | lw $a1, 4($sp) # copy arg value for a1 |
| 459 | lw $a2, 8($sp) # copy arg value for a2 |
| 460 | lw $a3, 12($sp) # copy arg value for a3 |
| 461 | lw $t9, METHOD_CODE_OFFSET($a0) # get pointer to the code |
| 462 | jalr $t9 # call the method |
| 463 | sw $zero, 0($sp) # store NULL for method* at bottom of frame |
| 464 | move $sp, $fp # restore the stack |
| 465 | lw $s0, 0($sp) |
| 466 | lw $s1, 4($sp) |
| 467 | lw $fp, 8($sp) |
| 468 | lw $ra, 12($sp) |
| 469 | addiu $sp, $sp, 16 |
| 470 | .cfi_adjust_cfa_offset -16 |
| 471 | lw $t0, 16($sp) # get result pointer |
Jeff Hao | 6474d19 | 2013-03-26 14:08:09 -0700 | [diff] [blame] | 472 | lw $t1, 20($sp) # get result type char |
| 473 | li $t2, 68 # put char 'D' into t2 |
| 474 | beq $t1, $t2, 1f # branch if result type char == 'D' |
| 475 | li $t3, 70 # put char 'F' into t3 |
| 476 | beq $t1, $t3, 1f # branch if result type char == 'F' |
Jeff Hao | 5d91730 | 2013-02-27 17:57:33 -0800 | [diff] [blame] | 477 | sw $v0, 0($t0) # store the result |
Jeff Hao | 6474d19 | 2013-03-26 14:08:09 -0700 | [diff] [blame] | 478 | jr $ra |
Jeff Hao | 5d91730 | 2013-02-27 17:57:33 -0800 | [diff] [blame] | 479 | sw $v1, 4($t0) # store the other half of the result |
Jeff Hao | 6474d19 | 2013-03-26 14:08:09 -0700 | [diff] [blame] | 480 | 1: |
Jeff Hao | 19ca8cf | 2013-03-15 18:16:51 -0700 | [diff] [blame] | 481 | s.s $f0, 0($t0) # store floating point result |
Jeff Hao | 5d91730 | 2013-02-27 17:57:33 -0800 | [diff] [blame] | 482 | jr $ra |
Jeff Hao | 19ca8cf | 2013-03-15 18:16:51 -0700 | [diff] [blame] | 483 | s.s $f1, 4($t0) # store other half of floating point result |
Jeff Hao | 5d91730 | 2013-02-27 17:57:33 -0800 | [diff] [blame] | 484 | END art_quick_invoke_stub |
Jeff Hao | 6474d19 | 2013-03-26 14:08:09 -0700 | [diff] [blame] | 485 | .size art_portable_invoke_stub, .-art_portable_invoke_stub |
Jeff Hao | 5d91730 | 2013-02-27 17:57:33 -0800 | [diff] [blame] | 486 | |
| 487 | /* |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 488 | * Entry from managed code that calls artHandleFillArrayDataFromCode and delivers exception on |
| 489 | * failure. |
| 490 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 491 | .extern artHandleFillArrayDataFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 492 | ENTRY art_quick_handle_fill_data |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 493 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 494 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case exception allocation triggers GC |
| 495 | move $a2, rSELF # pass Thread::Current |
| 496 | jal artHandleFillArrayDataFromCode # (Array*, const DexFile::Payload*, Thread*, $sp) |
| 497 | move $a3, $sp # pass $sp |
jeffhao | fc6a30e | 2012-10-18 18:24:15 -0700 | [diff] [blame] | 498 | RETURN_IF_ZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 499 | END art_quick_handle_fill_data |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 500 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 501 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 502 | * Entry from managed code that calls artLockObjectFromCode, may block for GC. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 503 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 504 | .extern artLockObjectFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 505 | ENTRY art_quick_lock_object |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 506 | GENERATE_GLOBAL_POINTER |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 507 | beqz $a0, art_quick_throw_null_pointer_exception_gp_set |
| 508 | nop |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 509 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case we block |
| 510 | move $a1, rSELF # pass Thread::Current |
| 511 | jal artLockObjectFromCode # (Object* obj, Thread*, $sp) |
| 512 | move $a2, $sp # pass $sp |
Ian Rogers | 6bcd163 | 2013-10-08 18:50:47 -0700 | [diff] [blame] | 513 | RETURN_IF_ZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 514 | END art_quick_lock_object |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 515 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 516 | /* |
| 517 | * Entry from managed code that calls artUnlockObjectFromCode and delivers exception on failure. |
| 518 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 519 | .extern artUnlockObjectFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 520 | ENTRY art_quick_unlock_object |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 521 | GENERATE_GLOBAL_POINTER |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 522 | beqz $a0, art_quick_throw_null_pointer_exception_gp_set |
| 523 | nop |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 524 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case exception allocation triggers GC |
| 525 | move $a1, rSELF # pass Thread::Current |
| 526 | jal artUnlockObjectFromCode # (Object* obj, Thread*, $sp) |
| 527 | move $a2, $sp # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 528 | RETURN_IF_ZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 529 | END art_quick_unlock_object |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 530 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 531 | /* |
| 532 | * Entry from managed code that calls artCheckCastFromCode and delivers exception on failure. |
| 533 | */ |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 534 | .extern artThrowClassCastException |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 535 | ENTRY art_quick_check_cast |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 536 | GENERATE_GLOBAL_POINTER |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 537 | addiu $sp, $sp, -16 |
| 538 | .cfi_adjust_cfa_offset 16 |
| 539 | sw $ra, 12($sp) |
| 540 | .cfi_rel_offset 31, 12 |
| 541 | sw $t9, 8($sp) |
| 542 | sw $a1, 4($sp) |
| 543 | sw $a0, 0($sp) |
| 544 | jal artIsAssignableFromCode |
| 545 | nop |
| 546 | beqz $v0, throw_class_cast_exception |
| 547 | lw $ra, 12($sp) |
| 548 | jr $ra |
| 549 | addiu $sp, $sp, 16 |
| 550 | .cfi_adjust_cfa_offset -16 |
| 551 | throw_class_cast_exception: |
| 552 | lw $t9, 8($sp) |
| 553 | lw $a1, 4($sp) |
| 554 | lw $a0, 0($sp) |
| 555 | addiu $sp, $sp, 16 |
| 556 | .cfi_adjust_cfa_offset -16 |
| 557 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
| 558 | move $a2, rSELF # pass Thread::Current |
| 559 | la $t9, artThrowClassCastException |
| 560 | jr $t9 # artThrowClassCastException (Class*, Class*, Thread*, SP) |
| 561 | move $a3, $sp # pass $sp |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 562 | END art_quick_check_cast |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 563 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 564 | /* |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 565 | * Entry from managed code for array put operations of objects where the value being stored |
| 566 | * needs to be checked for compatibility. |
| 567 | * a0 = array, a1 = index, a2 = value |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 568 | */ |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 569 | ENTRY art_quick_aput_obj_with_null_and_bound_check |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 570 | GENERATE_GLOBAL_POINTER |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 571 | bnez $a0, art_quick_aput_obj_with_bound_check_gp_set |
| 572 | nop |
| 573 | b art_quick_throw_null_pointer_exception_gp_set |
| 574 | nop |
| 575 | END art_quick_aput_obj_with_null_and_bound_check |
| 576 | |
| 577 | ENTRY art_quick_aput_obj_with_bound_check |
| 578 | GENERATE_GLOBAL_POINTER |
| 579 | art_quick_aput_obj_with_bound_check_gp_set: |
| 580 | lw $t0, ARRAY_LENGTH_OFFSET($a0) |
| 581 | sltu $t1, $a1, $t0 |
| 582 | bnez $t1, art_quick_aput_obj_gp_set |
| 583 | nop |
| 584 | move $a0, $a1 |
| 585 | b art_quick_throw_array_bounds_gp_set |
| 586 | move $a1, $t0 |
| 587 | END art_quick_aput_obj_with_bound_check |
| 588 | |
| 589 | ENTRY art_quick_aput_obj |
| 590 | GENERATE_GLOBAL_POINTER |
| 591 | art_quick_aput_obj_gp_set: |
| 592 | beqz $a2, do_aput_null |
| 593 | nop |
| 594 | lw $t0, CLASS_OFFSET($a0) |
| 595 | lw $t1, CLASS_OFFSET($a2) |
| 596 | lw $t0, CLASS_COMPONENT_TYPE_OFFSET($t0) |
| 597 | bne $t1, $t0, check_assignability # value's type == array's component type - trivial assignability |
| 598 | nop |
| 599 | do_aput: |
| 600 | sll $a1, $a1, 2 |
| 601 | add $t0, $a0, $a1 |
| 602 | sw $a2, OBJECT_ARRAY_DATA_OFFSET($t0) |
| 603 | lw $t0, THREAD_CARD_TABLE_OFFSET(rSELF) |
| 604 | srl $t1, $a0, 7 |
| 605 | add $t1, $t1, $t0 |
| 606 | sb $t0, ($t1) |
| 607 | jr $ra |
| 608 | nop |
| 609 | do_aput_null: |
| 610 | sll $a1, $a1, 2 |
| 611 | add $t0, $a0, $a1 |
| 612 | sw $a2, OBJECT_ARRAY_DATA_OFFSET($t0) |
| 613 | jr $ra |
| 614 | nop |
| 615 | check_assignability: |
| 616 | addiu $sp, $sp, -32 |
| 617 | .cfi_adjust_cfa_offset 32 |
| 618 | sw $ra, 28($sp) |
| 619 | .cfi_rel_offset 31, 28 |
| 620 | sw $t9, 12($sp) |
| 621 | sw $a2, 8($sp) |
| 622 | sw $a1, 4($sp) |
| 623 | sw $a0, 0($sp) |
| 624 | move $a1, $t1 |
| 625 | move $a0, $t0 |
| 626 | jal artIsAssignableFromCode # (Class*, Class*) |
| 627 | nop |
| 628 | lw $ra, 28($sp) |
| 629 | lw $t9, 12($sp) |
| 630 | lw $a2, 8($sp) |
| 631 | lw $a1, 4($sp) |
| 632 | lw $a0, 0($sp) |
| 633 | add $sp, 32 |
| 634 | .cfi_adjust_cfa_offset -32 |
| 635 | bnez $v0, do_aput |
| 636 | nop |
| 637 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
| 638 | move $a1, $a2 |
| 639 | move $a2, rSELF # pass Thread::Current |
| 640 | la $t9, artThrowArrayStoreException |
| 641 | jr $t9 # artThrowArrayStoreException(Class*, Class*, Thread*, SP) |
| 642 | move $a3, $sp # pass $sp |
| 643 | END art_quick_aput_obj |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 644 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 645 | /* |
| 646 | * Entry from managed code when uninitialized static storage, this stub will run the class |
| 647 | * initializer and deliver the exception on error. On success the static storage base is |
| 648 | * returned. |
| 649 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 650 | .extern artInitializeStaticStorageFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 651 | ENTRY art_quick_initialize_static_storage |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 652 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 653 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 654 | move $a2, rSELF # pass Thread::Current |
| 655 | # artInitializeStaticStorageFromCode(uint32_t type_idx, Method* referrer, Thread*, $sp) |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 656 | jal artInitializeStaticStorageFromCode |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 657 | move $a3, $sp # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 658 | RETURN_IF_NONZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 659 | END art_quick_initialize_static_storage |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 660 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 661 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 662 | * Entry from managed code when dex cache misses for a type_idx. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 663 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 664 | .extern artInitializeTypeFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 665 | ENTRY art_quick_initialize_type |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 666 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 667 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 668 | move $a2, rSELF # pass Thread::Current |
| 669 | # artInitializeTypeFromCode(uint32_t type_idx, Method* referrer, Thread*, $sp) |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 670 | jal artInitializeTypeFromCode |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 671 | move $a3, $sp # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 672 | RETURN_IF_NONZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 673 | END art_quick_initialize_type |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 674 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 675 | /* |
| 676 | * Entry from managed code when type_idx needs to be checked for access and dex cache may also |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 677 | * miss. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 678 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 679 | .extern artInitializeTypeAndVerifyAccessFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 680 | ENTRY art_quick_initialize_type_and_verify_access |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 681 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 682 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 683 | move $a2, rSELF # pass Thread::Current |
| 684 | # artInitializeTypeFromCode(uint32_t type_idx, Method* referrer, Thread*, $sp) |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 685 | jal artInitializeTypeAndVerifyAccessFromCode |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 686 | move $a3, $sp # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 687 | RETURN_IF_NONZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 688 | END art_quick_initialize_type_and_verify_access |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 689 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 690 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 691 | * Called by managed code to resolve a static field and load a 32-bit primitive value. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 692 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 693 | .extern artGet32StaticFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 694 | ENTRY art_quick_get32_static |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 695 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 696 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 697 | lw $a1, 64($sp) # pass referrer's Method* |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 698 | move $a2, rSELF # pass Thread::Current |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 699 | jal artGet32StaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*, $sp) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 700 | move $a3, $sp # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 701 | RETURN_IF_NO_EXCEPTION |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 702 | END art_quick_get32_static |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 703 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 704 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 705 | * Called by managed code to resolve a static field and load a 64-bit primitive value. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 706 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 707 | .extern artGet64StaticFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 708 | ENTRY art_quick_get64_static |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 709 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 710 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 711 | lw $a1, 64($sp) # pass referrer's Method* |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 712 | move $a2, rSELF # pass Thread::Current |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 713 | jal artGet64StaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*, $sp) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 714 | move $a3, $sp # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 715 | RETURN_IF_NO_EXCEPTION |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 716 | END art_quick_get64_static |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 717 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 718 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 719 | * Called by managed code to resolve a static field and load an object reference. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 720 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 721 | .extern artGetObjStaticFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 722 | ENTRY art_quick_get_obj_static |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 723 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 724 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 725 | lw $a1, 64($sp) # pass referrer's Method* |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 726 | move $a2, rSELF # pass Thread::Current |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 727 | jal artGetObjStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*, $sp) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 728 | move $a3, $sp # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 729 | RETURN_IF_NO_EXCEPTION |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 730 | END art_quick_get_obj_static |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 731 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 732 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 733 | * Called by managed code to resolve an instance field and load a 32-bit primitive value. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 734 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 735 | .extern artGet32InstanceFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 736 | ENTRY art_quick_get32_instance |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 737 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 738 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 739 | lw $a2, 64($sp) # pass referrer's Method* |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 740 | move $a3, rSELF # pass Thread::Current |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 741 | jal artGet32InstanceFromCode # (field_idx, Object*, referrer, Thread*, $sp) |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 742 | sw $sp, 16($sp) # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 743 | RETURN_IF_NO_EXCEPTION |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 744 | END art_quick_get32_instance |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 745 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 746 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 747 | * Called by managed code to resolve an instance field and load a 64-bit primitive value. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 748 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 749 | .extern artGet64InstanceFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 750 | ENTRY art_quick_get64_instance |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 751 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 752 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 753 | lw $a2, 64($sp) # pass referrer's Method* |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 754 | move $a3, rSELF # pass Thread::Current |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 755 | jal artGet64InstanceFromCode # (field_idx, Object*, referrer, Thread*, $sp) |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 756 | sw $sp, 16($sp) # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 757 | RETURN_IF_NO_EXCEPTION |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 758 | END art_quick_get64_instance |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 759 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 760 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 761 | * Called by managed code to resolve an instance field and load an object reference. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 762 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 763 | .extern artGetObjInstanceFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 764 | ENTRY art_quick_get_obj_instance |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 765 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 766 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 767 | lw $a2, 64($sp) # pass referrer's Method* |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 768 | move $a3, rSELF # pass Thread::Current |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 769 | jal artGetObjInstanceFromCode # (field_idx, Object*, referrer, Thread*, $sp) |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 770 | sw $sp, 16($sp) # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 771 | RETURN_IF_NO_EXCEPTION |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 772 | END art_quick_get_obj_instance |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 773 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 774 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 775 | * Called by managed code to resolve a static field and store a 32-bit primitive value. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 776 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 777 | .extern artSet32StaticFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 778 | ENTRY art_quick_set32_static |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 779 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 780 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 781 | lw $a2, 64($sp) # pass referrer's Method* |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 782 | move $a3, rSELF # pass Thread::Current |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 783 | jal artSet32StaticFromCode # (field_idx, new_val, referrer, Thread*, $sp) |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 784 | sw $sp, 16($sp) # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 785 | RETURN_IF_ZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 786 | END art_quick_set32_static |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 787 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 788 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 789 | * Called by managed code to resolve a static field and store a 64-bit primitive value. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 790 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 791 | .extern artSet32StaticFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 792 | ENTRY art_quick_set64_static |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 793 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 794 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 795 | lw $a1, 64($sp) # pass referrer's Method* |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 796 | sw rSELF, 16($sp) # pass Thread::Current |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 797 | jal artSet64StaticFromCode # (field_idx, referrer, new_val, Thread*, $sp) |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 798 | sw $sp, 20($sp) # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 799 | RETURN_IF_ZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 800 | END art_quick_set64_static |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 801 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 802 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 803 | * Called by managed code to resolve a static field and store an object reference. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 804 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 805 | .extern artSetObjStaticFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 806 | ENTRY art_quick_set_obj_static |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 807 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 808 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 809 | lw $a2, 64($sp) # pass referrer's Method* |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 810 | move $a3, rSELF # pass Thread::Current |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 811 | jal artSetObjStaticFromCode # (field_idx, new_val, referrer, Thread*, $sp) |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 812 | sw $sp, 16($sp) # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 813 | RETURN_IF_ZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 814 | END art_quick_set_obj_static |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 815 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 816 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 817 | * Called by managed code to resolve an instance field and store a 32-bit primitive value. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 818 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 819 | .extern artSet32InstanceFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 820 | ENTRY art_quick_set32_instance |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 821 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 822 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 823 | lw $a3, 64($sp) # pass referrer's Method* |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 824 | sw rSELF, 16($sp) # pass Thread::Current |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 825 | jal artSet32InstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*, $sp) |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 826 | sw $sp, 20($sp) # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 827 | RETURN_IF_ZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 828 | END art_quick_set32_instance |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 829 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 830 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 831 | * Called by managed code to resolve an instance field and store a 64-bit primitive value. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 832 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 833 | .extern artSet32InstanceFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 834 | ENTRY art_quick_set64_instance |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 835 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 836 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 837 | sw rSELF, 16($sp) # pass Thread::Current |
| 838 | jal artSet64InstanceFromCode # (field_idx, Object*, new_val, Thread*, $sp) |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 839 | sw $sp, 20($sp) # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 840 | RETURN_IF_ZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 841 | END art_quick_set64_instance |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 842 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 843 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 844 | * Called by managed code to resolve an instance field and store an object reference. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 845 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 846 | .extern artSetObjInstanceFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 847 | ENTRY art_quick_set_obj_instance |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 848 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 849 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 850 | lw $a3, 64($sp) # pass referrer's Method* |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 851 | sw rSELF, 16($sp) # pass Thread::Current |
| 852 | jal artSetObjInstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*, $sp) |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 853 | sw $sp, 20($sp) # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 854 | RETURN_IF_ZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 855 | END art_quick_set_obj_instance |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 856 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 857 | /* |
| 858 | * Entry from managed code to resolve a string, this stub will allocate a String and deliver an |
| 859 | * exception on error. On success the String is returned. R0 holds the referring method, |
| 860 | * R1 holds the string index. The fast path check for hit in strings cache has already been |
| 861 | * performed. |
| 862 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 863 | .extern artResolveStringFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 864 | ENTRY art_quick_resolve_string |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 865 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 866 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 867 | move $a2, rSELF # pass Thread::Current |
| 868 | # artResolveStringFromCode(Method* referrer, uint32_t string_idx, Thread*, $sp) |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 869 | jal artResolveStringFromCode |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 870 | move $a3, $sp # pass $sp |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 871 | RETURN_IF_NONZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 872 | END art_quick_resolve_string |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 873 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 874 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 875 | * Called by managed code to allocate an object. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 876 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 877 | .extern artAllocObjectFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 878 | ENTRY art_quick_alloc_object |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 879 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 880 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 881 | move $a2, rSELF # pass Thread::Current |
| 882 | jal artAllocObjectFromCode # (uint32_t type_idx, Method* method, Thread*, $sp) |
| 883 | move $a3, $sp # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 884 | RETURN_IF_NONZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 885 | END art_quick_alloc_object |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 886 | |
Hiroshi Yamauchi | 3b4c189 | 2013-09-12 21:33:12 -0700 | [diff] [blame] | 887 | .extern artAllocObjectFromCodeInstrumented |
| 888 | ENTRY art_quick_alloc_object_instrumented |
| 889 | GENERATE_GLOBAL_POINTER |
| 890 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 891 | move $a2, rSELF # pass Thread::Current |
| 892 | jal artAllocObjectFromCodeInstrumented # (uint32_t type_idx, Method* method, Thread*, $sp) |
| 893 | move $a3, $sp # pass $sp |
| 894 | RETURN_IF_NONZERO |
| 895 | END art_quick_alloc_object_instrumented |
| 896 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 897 | /* |
| 898 | * Called by managed code to allocate an object when the caller doesn't know whether it has |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 899 | * access to the created type. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 900 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 901 | .extern artAllocObjectFromCodeWithAccessCheck |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 902 | ENTRY art_quick_alloc_object_with_access_check |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 903 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 904 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 905 | move $a2, rSELF # pass Thread::Current |
| 906 | jal artAllocObjectFromCodeWithAccessCheck # (uint32_t type_idx, Method* method, Thread*, $sp) |
| 907 | move $a3, $sp # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 908 | RETURN_IF_NONZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 909 | END art_quick_alloc_object_with_access_check |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 910 | |
Hiroshi Yamauchi | 3b4c189 | 2013-09-12 21:33:12 -0700 | [diff] [blame] | 911 | .extern artAllocObjectFromCodeWithAccessCheckInstrumented |
| 912 | ENTRY art_quick_alloc_object_with_access_check_instrumented |
| 913 | GENERATE_GLOBAL_POINTER |
| 914 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 915 | move $a2, rSELF # pass Thread::Current |
| 916 | jal artAllocObjectFromCodeWithAccessCheckInstrumented # (uint32_t type_idx, Method* method, Thread*, $sp) |
| 917 | move $a3, $sp # pass $sp |
| 918 | RETURN_IF_NONZERO |
| 919 | END art_quick_alloc_object_with_access_check_instrumented |
| 920 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 921 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 922 | * Called by managed code to allocate an array. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 923 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 924 | .extern artAllocArrayFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 925 | ENTRY art_quick_alloc_array |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 926 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 927 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 928 | move $a3, rSELF # pass Thread::Current |
| 929 | # artAllocArrayFromCode(uint32_t type_idx, Method* method, int32_t component_count, Thread*, $sp) |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 930 | jal artAllocArrayFromCode |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 931 | sw $sp, 16($sp) # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 932 | RETURN_IF_NONZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 933 | END art_quick_alloc_array |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 934 | |
Hiroshi Yamauchi | 3b4c189 | 2013-09-12 21:33:12 -0700 | [diff] [blame] | 935 | .extern artAllocArrayFromCodeInstrumented |
| 936 | ENTRY art_quick_alloc_array_instrumented |
| 937 | GENERATE_GLOBAL_POINTER |
| 938 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 939 | move $a3, rSELF # pass Thread::Current |
| 940 | # artAllocArrayFromCodeInstrumented(uint32_t type_idx, Method* method, int32_t component_count, Thread*, $sp) |
| 941 | jal artAllocArrayFromCodeInstrumented |
| 942 | sw $sp, 16($sp) # pass $sp |
| 943 | RETURN_IF_NONZERO |
| 944 | END art_quick_alloc_array_instrumented |
| 945 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 946 | /* |
| 947 | * Called by managed code to allocate an array when the caller doesn't know whether it has |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 948 | * access to the created type. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 949 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 950 | .extern artAllocArrayFromCodeWithAccessCheck |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 951 | ENTRY art_quick_alloc_array_with_access_check |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 952 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 953 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 954 | move $a3, rSELF # pass Thread::Current |
| 955 | # artAllocArrayFromCodeWithAccessCheck(type_idx, method, component_count, Thread*, $sp) |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 956 | jal artAllocArrayFromCodeWithAccessCheck |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 957 | sw $sp, 16($sp) # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 958 | RETURN_IF_NONZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 959 | END art_quick_alloc_array_with_access_check |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 960 | |
Hiroshi Yamauchi | 3b4c189 | 2013-09-12 21:33:12 -0700 | [diff] [blame] | 961 | .extern artAllocArrayFromCodeWithAccessCheckInstrumented |
| 962 | ENTRY art_quick_alloc_array_with_access_check_instrumented |
| 963 | GENERATE_GLOBAL_POINTER |
| 964 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 965 | move $a3, rSELF # pass Thread::Current |
| 966 | # artAllocArrayFromCodeWithAccessCheckInstrumented(type_idx, method, component_count, Thread*, $sp) |
| 967 | jal artAllocArrayFromCodeWithAccessCheckInstrumented |
| 968 | sw $sp, 16($sp) # pass $sp |
| 969 | RETURN_IF_NONZERO |
| 970 | END art_quick_alloc_array_with_access_check_instrumented |
| 971 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 972 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 973 | * Called by managed code to allocate an array in a special case for FILLED_NEW_ARRAY. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 974 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 975 | .extern artCheckAndAllocArrayFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 976 | ENTRY art_quick_check_and_alloc_array |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 977 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 978 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 979 | move $a3, rSELF # pass Thread::Current |
| 980 | # artCheckAndAllocArrayFromCode(uint32_t type_idx, Method* method, int32_t count, Thread* , $sp) |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 981 | jal artCheckAndAllocArrayFromCode |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 982 | sw $sp, 16($sp) # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 983 | RETURN_IF_NONZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 984 | END art_quick_check_and_alloc_array |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 985 | |
Hiroshi Yamauchi | 3b4c189 | 2013-09-12 21:33:12 -0700 | [diff] [blame] | 986 | .extern artCheckAndAllocArrayFromCodeInstrumented |
| 987 | ENTRY art_quick_check_and_alloc_array_instrumented |
| 988 | GENERATE_GLOBAL_POINTER |
| 989 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 990 | move $a3, rSELF # pass Thread::Current |
| 991 | # artCheckAndAllocArrayFromCodeInstrumented(uint32_t type_idx, Method* method, int32_t count, Thread* , $sp) |
| 992 | jal artCheckAndAllocArrayFromCodeInstrumented |
| 993 | sw $sp, 16($sp) # pass $sp |
| 994 | RETURN_IF_NONZERO |
| 995 | END art_quick_check_and_alloc_array_instrumented |
| 996 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 997 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 998 | * Called by managed code to allocate an array in a special case for FILLED_NEW_ARRAY. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 999 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1000 | .extern artCheckAndAllocArrayFromCodeWithAccessCheck |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1001 | ENTRY art_quick_check_and_alloc_array_with_access_check |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 1002 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1003 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 1004 | move $a3, rSELF # pass Thread::Current |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1005 | # artCheckAndAllocArrayFromCodeWithAccessCheck(type_idx, method, count, Thread* , $sp) |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1006 | jal artCheckAndAllocArrayFromCodeWithAccessCheck |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 1007 | sw $sp, 16($sp) # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1008 | RETURN_IF_NONZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1009 | END art_quick_check_and_alloc_array_with_access_check |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1010 | |
Hiroshi Yamauchi | 3b4c189 | 2013-09-12 21:33:12 -0700 | [diff] [blame] | 1011 | .extern artCheckAndAllocArrayFromCodeWithAccessCheckInstrumented |
| 1012 | ENTRY art_quick_check_and_alloc_array_with_access_check_instrumented |
| 1013 | GENERATE_GLOBAL_POINTER |
| 1014 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 1015 | move $a3, rSELF # pass Thread::Current |
| 1016 | # artCheckAndAllocArrayFromCodeWithAccessCheckInstrumented(type_idx, method, count, Thread* , $sp) |
| 1017 | jal artCheckAndAllocArrayFromCodeWithAccessCheckInstrumented |
| 1018 | sw $sp, 16($sp) # pass $sp |
| 1019 | RETURN_IF_NONZERO |
| 1020 | END art_quick_check_and_alloc_array_with_access_check_instrumented |
| 1021 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1022 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 1023 | * Called by managed code when the value in rSUSPEND has been decremented to 0. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1024 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1025 | .extern artTestSuspendFromCode |
| 1026 | ENTRY art_quick_test_suspend |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 1027 | GENERATE_GLOBAL_POINTER |
Ian Rogers | 474b6da | 2012-09-25 00:20:38 -0700 | [diff] [blame] | 1028 | lh $a0, THREAD_FLAGS_OFFSET(rSELF) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1029 | bnez $a0, 1f |
| 1030 | addi rSUSPEND, $zero, SUSPEND_CHECK_INTERVAL # reset rSUSPEND to SUSPEND_CHECK_INTERVAL |
| 1031 | jr $ra |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1032 | nop |
| 1033 | 1: |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1034 | move $a0, rSELF |
| 1035 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves for stack crawl |
| 1036 | jal artTestSuspendFromCode # (Thread*, $sp) |
| 1037 | move $a1, $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1038 | RESTORE_REF_ONLY_CALLEE_SAVE_FRAME_AND_RETURN |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1039 | END art_quick_test_suspend |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1040 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1041 | /* |
| 1042 | * Called by managed code that is attempting to call a method on a proxy class. On entry |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 1043 | * r0 holds the proxy method; r1, r2 and r3 may contain arguments. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1044 | */ |
Jeff Hao | 5fa60c3 | 2013-04-04 17:57:01 -0700 | [diff] [blame] | 1045 | .extern artQuickProxyInvokeHandler |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1046 | ENTRY art_quick_proxy_invoke_handler |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 1047 | GENERATE_GLOBAL_POINTER |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1048 | SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1049 | sw $a0, 0($sp) # place proxy method at bottom of frame |
| 1050 | move $a2, rSELF # pass Thread::Current |
Jeff Hao | 5fa60c3 | 2013-04-04 17:57:01 -0700 | [diff] [blame] | 1051 | jal artQuickProxyInvokeHandler # (Method* proxy method, receiver, Thread*, SP) |
Ian Rogers | af6e67a | 2013-01-16 08:38:37 -0800 | [diff] [blame] | 1052 | move $a3, $sp # pass $sp |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1053 | lw $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ |
Jeff Hao | 1f3bc2f | 2013-04-30 15:17:19 -0700 | [diff] [blame] | 1054 | lw $gp, 52($sp) # restore $gp |
| 1055 | lw $ra, 60($sp) # restore $ra |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1056 | bnez $t0, 1f |
Jeff Hao | 1f3bc2f | 2013-04-30 15:17:19 -0700 | [diff] [blame] | 1057 | addiu $sp, $sp, 64 # pop frame |
| 1058 | .cfi_adjust_cfa_offset -64 |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1059 | jr $ra |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1060 | nop |
| 1061 | 1: |
| 1062 | DELIVER_PENDING_EXCEPTION |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1063 | END art_quick_proxy_invoke_handler |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1064 | |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1065 | .extern artQuickResolutionTrampoline |
| 1066 | ENTRY art_quick_resolution_trampoline |
Ian Rogers | 7db619b | 2013-01-16 18:35:48 -0800 | [diff] [blame] | 1067 | GENERATE_GLOBAL_POINTER |
| 1068 | SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1069 | move $a2, rSELF # pass Thread::Current |
Ian Rogers | 65d1b22 | 2013-09-27 10:59:41 -0700 | [diff] [blame] | 1070 | jal artQuickResolutionTrampoline # (Method* called, receiver, Thread*, SP) |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1071 | move $a3, $sp # pass $sp |
| 1072 | lw $gp, 52($sp) # restore $gp |
| 1073 | lw $ra, 60($sp) # restore $ra |
| 1074 | beqz $v0, 1f |
| 1075 | lw $a0, 0($sp) # load resolved method to $a0 |
| 1076 | lw $a1, 4($sp) # restore non-callee save $a1 |
| 1077 | lw $a2, 8($sp) # restore non-callee save $a2 |
| 1078 | lw $a3, 12($sp) # restore non-callee save $a3 |
Ian Rogers | 65d1b22 | 2013-09-27 10:59:41 -0700 | [diff] [blame] | 1079 | move $t9, $v0 # code pointer must be in $t9 to generate the global pointer |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1080 | jr $v0 # tail call to method |
| 1081 | 1: |
| 1082 | addiu $sp, $sp, 64 # pop frame |
| 1083 | .cfi_adjust_cfa_offset -64 |
| 1084 | DELIVER_PENDING_EXCEPTION |
| 1085 | END art_quick_resolution_trampoline |
| 1086 | |
| 1087 | .extern artQuickToInterpreterBridge |
| 1088 | ENTRY art_quick_to_interpreter_bridge |
| 1089 | GENERATE_GLOBAL_POINTER |
| 1090 | SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME |
Ian Rogers | 7db619b | 2013-01-16 18:35:48 -0800 | [diff] [blame] | 1091 | move $a1, rSELF # pass Thread::Current |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1092 | jal artQuickToInterpreterBridge # (Method* method, Thread*, SP) |
Ian Rogers | 7db619b | 2013-01-16 18:35:48 -0800 | [diff] [blame] | 1093 | move $a2, $sp # pass $sp |
| 1094 | lw $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ |
Jeff Hao | 1f3bc2f | 2013-04-30 15:17:19 -0700 | [diff] [blame] | 1095 | lw $gp, 52($sp) # restore $gp |
| 1096 | lw $ra, 60($sp) # restore $ra |
Ian Rogers | 7db619b | 2013-01-16 18:35:48 -0800 | [diff] [blame] | 1097 | bnez $t0, 1f |
Jeff Hao | 1f3bc2f | 2013-04-30 15:17:19 -0700 | [diff] [blame] | 1098 | addiu $sp, $sp, 64 # pop frame |
| 1099 | .cfi_adjust_cfa_offset -64 |
Ian Rogers | 7db619b | 2013-01-16 18:35:48 -0800 | [diff] [blame] | 1100 | jr $ra |
| 1101 | nop |
| 1102 | 1: |
| 1103 | DELIVER_PENDING_EXCEPTION |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1104 | END art_quick_to_interpreter_bridge |
Ian Rogers | 7db619b | 2013-01-16 18:35:48 -0800 | [diff] [blame] | 1105 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1106 | /* |
jeffhao | 725a957 | 2012-11-13 18:20:12 -0800 | [diff] [blame] | 1107 | * Routine that intercepts method calls and returns. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1108 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1109 | .extern artInstrumentationMethodEntryFromCode |
| 1110 | .extern artInstrumentationMethodExitFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1111 | ENTRY art_quick_instrumentation_entry |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 1112 | GENERATE_GLOBAL_POINTER |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 1113 | SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 1114 | move $t0, $sp # remember bottom of caller's frame |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 1115 | addiu $sp, $sp, -32 # space for args, pad (3 words), arguments (5 words) |
| 1116 | .cfi_adjust_cfa_offset 32 |
| 1117 | sw $a0, 28($sp) # save arg0 |
| 1118 | sw $ra, 16($sp) # pass $ra |
| 1119 | move $a3, $t0 # pass $sp |
| 1120 | jal artInstrumentationMethodEntryFromCode # (Method*, Object*, Thread*, SP, LR) |
| 1121 | move $a2, rSELF # pass Thread::Current |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 1122 | move $t9, $v0 # $t9 holds reference to code |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 1123 | lw $a0, 28($sp) # restore arg0 |
| 1124 | addiu $sp, $sp, 32 # remove args |
| 1125 | .cfi_adjust_cfa_offset -32 |
| 1126 | RESTORE_REF_AND_ARGS_CALLEE_SAVE_FRAME |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 1127 | jalr $t9 # call method |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 1128 | nop |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1129 | END art_quick_instrumentation_entry |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1130 | /* intentional fallthrough */ |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1131 | .global art_quick_instrumentation_exit |
| 1132 | art_quick_instrumentation_exit: |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1133 | .cfi_startproc |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 1134 | addiu $t9, $ra, 4 # put current address into $t9 to rebuild $gp |
| 1135 | GENERATE_GLOBAL_POINTER |
| 1136 | move $t0, $sp # remember bottom of caller's frame |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 1137 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME |
| 1138 | addiu $sp, $sp, -48 # save return values and set up args |
| 1139 | .cfi_adjust_cfa_offset 48 |
| 1140 | sw $v0, 32($sp) |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1141 | .cfi_rel_offset 2, 0 |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 1142 | sw $v1, 36($sp) |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1143 | .cfi_rel_offset 3, 4 |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 1144 | s.s $f0, 40($sp) |
| 1145 | s.s $f1, 44($sp) |
| 1146 | s.s $f0, 16($sp) # pass fpr result |
| 1147 | s.s $f1, 20($sp) |
| 1148 | move $a2, $v0 # pass gpr result |
| 1149 | move $a3, $v1 |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 1150 | move $a1, $t0 # pass $sp |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 1151 | jal artInstrumentationMethodExitFromCode # (Thread*, SP, gpr_res, fpr_res) |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 1152 | move $a0, rSELF # pass Thread::Current |
| 1153 | move $t0, $v0 # set aside returned link register |
| 1154 | move $ra, $v1 # set link register for deoptimization |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 1155 | lw $v0, 32($sp) # restore return values |
| 1156 | lw $v1, 36($sp) |
| 1157 | l.s $f0, 40($sp) |
| 1158 | l.s $f1, 44($sp) |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 1159 | jr $t0 # return |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 1160 | addiu $sp, $sp, 112 # 48 bytes of args + 64 bytes of callee save frame |
| 1161 | .cfi_adjust_cfa_offset -112 |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1162 | END art_quick_instrumentation_exit |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1163 | |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 1164 | /* |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 1165 | * Instrumentation has requested that we deoptimize into the interpreter. The deoptimization |
| 1166 | * will long jump to the upcall with a special exception of -1. |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 1167 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1168 | .extern artDeoptimize |
| 1169 | .extern artEnterInterpreterFromDeoptimize |
| 1170 | ENTRY art_quick_deoptimize |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 1171 | GENERATE_GLOBAL_POINTER |
Jeff Hao | 14dd5a8 | 2013-04-11 10:23:36 -0700 | [diff] [blame] | 1172 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 1173 | move $a0, rSELF # pass Thread::current |
| 1174 | jal artDeoptimize # artDeoptimize(Thread*, SP) |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 1175 | # Returns caller method's frame size. |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 1176 | move $a1, $sp # pass $sp |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1177 | END art_quick_deoptimize |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 1178 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1179 | /* |
| 1180 | * Long integer shift. This is different from the generic 32/64-bit |
| 1181 | * binary operations because vAA/vBB are 64-bit but vCC (the shift |
| 1182 | * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low |
| 1183 | * 6 bits. |
| 1184 | * On entry: |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1185 | * $a0: low word |
| 1186 | * $a1: high word |
| 1187 | * $a2: shift count |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1188 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1189 | ENTRY art_quick_shl_long |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1190 | /* shl-long vAA, vBB, vCC */ |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1191 | sll $v0, $a0, $a2 # rlo<- alo << (shift&31) |
| 1192 | not $v1, $a2 # rhi<- 31-shift (shift is 5b) |
| 1193 | srl $a0, 1 |
| 1194 | srl $a0, $v1 # alo<- alo >> (32-(shift&31)) |
| 1195 | sll $v1, $a1, $a2 # rhi<- ahi << (shift&31) |
| 1196 | or $v1, $a0 # rhi<- rhi | alo |
| 1197 | andi $a2, 0x20 # shift< shift & 0x20 |
| 1198 | movn $v1, $v0, $a2 # rhi<- rlo (if shift&0x20) |
| 1199 | jr $ra |
jeffhao | fc6a30e | 2012-10-18 18:24:15 -0700 | [diff] [blame] | 1200 | movn $v0, $zero, $a2 # rlo<- 0 (if shift&0x20) |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1201 | END art_quick_shl_long |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1202 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1203 | /* |
| 1204 | * Long integer shift. This is different from the generic 32/64-bit |
| 1205 | * binary operations because vAA/vBB are 64-bit but vCC (the shift |
| 1206 | * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low |
| 1207 | * 6 bits. |
| 1208 | * On entry: |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1209 | * $a0: low word |
| 1210 | * $a1: high word |
| 1211 | * $a2: shift count |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1212 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1213 | .global art_quick_shr_long |
| 1214 | ENTRY art_quick_shr_long |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1215 | sra $v1, $a1, $a2 # rhi<- ahi >> (shift&31) |
| 1216 | srl $v0, $a0, $a2 # rlo<- alo >> (shift&31) |
| 1217 | sra $a3, $a1, 31 # $a3<- sign(ah) |
| 1218 | not $a0, $a2 # alo<- 31-shift (shift is 5b) |
| 1219 | sll $a1, 1 |
| 1220 | sll $a1, $a0 # ahi<- ahi << (32-(shift&31)) |
| 1221 | or $v0, $a1 # rlo<- rlo | ahi |
| 1222 | andi $a2, 0x20 # shift & 0x20 |
| 1223 | movn $v0, $v1, $a2 # rlo<- rhi (if shift&0x20) |
| 1224 | jr $ra |
| 1225 | movn $v1, $a3, $a2 # rhi<- sign(ahi) (if shift&0x20) |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1226 | END art_quick_shr_long |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1227 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1228 | /* |
| 1229 | * Long integer shift. This is different from the generic 32/64-bit |
| 1230 | * binary operations because vAA/vBB are 64-bit but vCC (the shift |
| 1231 | * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low |
| 1232 | * 6 bits. |
| 1233 | * On entry: |
| 1234 | * r0: low word |
| 1235 | * r1: high word |
| 1236 | * r2: shift count |
| 1237 | */ |
| 1238 | /* ushr-long vAA, vBB, vCC */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1239 | .global art_quick_ushr_long |
| 1240 | ENTRY art_quick_ushr_long |
jeffhao | fc6a30e | 2012-10-18 18:24:15 -0700 | [diff] [blame] | 1241 | srl $v1, $a1, $a2 # rhi<- ahi >> (shift&31) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1242 | srl $v0, $a0, $a2 # rlo<- alo >> (shift&31) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1243 | not $a0, $a2 # alo<- 31-shift (shift is 5b) |
| 1244 | sll $a1, 1 |
| 1245 | sll $a1, $a0 # ahi<- ahi << (32-(shift&31)) |
| 1246 | or $v0, $a1 # rlo<- rlo | ahi |
| 1247 | andi $a2, 0x20 # shift & 0x20 |
| 1248 | movn $v0, $v1, $a2 # rlo<- rhi (if shift&0x20) |
| 1249 | jr $ra |
jeffhao | fc6a30e | 2012-10-18 18:24:15 -0700 | [diff] [blame] | 1250 | movn $v1, $zero, $a2 # rhi<- 0 (if shift&0x20) |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1251 | END art_quick_ushr_long |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1252 | |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1253 | ENTRY art_quick_indexof |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1254 | jr $ra |
jeffhao | 0703060 | 2012-09-26 14:33:14 -0700 | [diff] [blame] | 1255 | nop |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1256 | END art_quick_indexof |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1257 | |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1258 | ENTRY art_quick_string_compareto |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1259 | jr $ra |
jeffhao | 0703060 | 2012-09-26 14:33:14 -0700 | [diff] [blame] | 1260 | nop |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1261 | END art_quick_string_compareto |