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