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 | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 286 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 287 | move $a0, rSELF # pass Thread::Current |
| 288 | la $t9, artThrowNullPointerExceptionFromCode |
| 289 | jr $t9 # artThrowNullPointerExceptionFromCode(Thread*, $sp) |
| 290 | move $a1, $sp # pass $sp |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 291 | END art_quick_throw_null_pointer_exception |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 292 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 293 | /* |
| 294 | * Called by managed code to create and deliver an ArithmeticException |
| 295 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 296 | .extern artThrowDivZeroFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 297 | ENTRY art_quick_throw_div_zero |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 298 | GENERATE_GLOBAL_POINTER |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 299 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 300 | move $a0, rSELF # pass Thread::Current |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 301 | la $t9, artThrowDivZeroFromCode |
| 302 | jr $t9 # artThrowDivZeroFromCode(Thread*, $sp) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 303 | move $a1, $sp # pass $sp |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 304 | END art_quick_throw_div_zero |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 305 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 306 | /* |
| 307 | * Called by managed code to create and deliver an ArrayIndexOutOfBoundsException |
| 308 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 309 | .extern artThrowArrayBoundsFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 310 | ENTRY art_quick_throw_array_bounds |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 311 | GENERATE_GLOBAL_POINTER |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 312 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 313 | move $a2, rSELF # pass Thread::Current |
| 314 | la $t9, artThrowArrayBoundsFromCode |
| 315 | jr $t9 # artThrowArrayBoundsFromCode(index, limit, Thread*, $sp) |
| 316 | move $a3, $sp # pass $sp |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 317 | END art_quick_throw_array_bounds |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 318 | |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 319 | /* |
| 320 | * Called by managed code to create and deliver a StackOverflowError. |
| 321 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 322 | .extern artThrowStackOverflowFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 323 | ENTRY art_quick_throw_stack_overflow |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 324 | GENERATE_GLOBAL_POINTER |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 325 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 326 | move $a0, rSELF # pass Thread::Current |
| 327 | la $t9, artThrowStackOverflowFromCode |
| 328 | jr $t9 # artThrowStackOverflowFromCode(Thread*, $sp) |
| 329 | move $a1, $sp # pass $sp |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 330 | END art_quick_throw_stack_overflow |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 331 | |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 332 | /* |
| 333 | * Called by managed code to create and deliver a NoSuchMethodError. |
| 334 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 335 | .extern artThrowNoSuchMethodFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 336 | ENTRY art_quick_throw_no_such_method |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 337 | GENERATE_GLOBAL_POINTER |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 338 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 339 | move $a1, rSELF # pass Thread::Current |
| 340 | la $t9, artThrowNoSuchMethodFromCode |
| 341 | jr $t9 # artThrowNoSuchMethodFromCode(method_idx, Thread*, $sp) |
| 342 | move $a2, $sp # pass $sp |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 343 | END art_quick_throw_no_such_method |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 344 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 345 | /* |
| 346 | * All generated callsites for interface invokes and invocation slow paths will load arguments |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 347 | * 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] | 348 | * the method_idx. This wrapper will save arg1-arg3, load the caller's Method*, align the |
| 349 | * stack and call the appropriate C helper. |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 350 | * 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] | 351 | * |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 352 | * The helper will attempt to locate the target and return a 64-bit result in $v0/$v1 consisting |
| 353 | * of the target Method* in $v0 and method->code_ in $v1. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 354 | * |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 355 | * 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] | 356 | * thread and we branch to another stub to deliver it. |
| 357 | * |
| 358 | * On success this wrapper will restore arguments and *jump* to the target, leaving the lr |
| 359 | * pointing back to the original caller. |
| 360 | */ |
| 361 | .macro INVOKE_TRAMPOLINE c_name, cxx_name |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 362 | .extern \cxx_name |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 363 | ENTRY \c_name |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 364 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 365 | 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] | 366 | lw $a2, 64($sp) # pass caller Method* |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 367 | move $t0, $sp # save $sp |
Jeff Hao | 58df327 | 2013-04-22 15:28:53 -0700 | [diff] [blame] | 368 | addiu $sp, $sp, -32 # make space for extra args |
| 369 | .cfi_adjust_cfa_offset 32 |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 370 | move $a3, rSELF # pass Thread::Current |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 371 | .cfi_rel_offset 28, 12 |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 372 | jal \cxx_name # (method_idx, this, caller, Thread*, $sp) |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 373 | sw $t0, 16($sp) # pass $sp |
Jeff Hao | 58df327 | 2013-04-22 15:28:53 -0700 | [diff] [blame] | 374 | addiu $sp, $sp, 32 # release out args |
| 375 | .cfi_adjust_cfa_offset -32 |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 376 | move $a0, $v0 # save target Method* |
jeffhao | 30a3317 | 2012-10-22 18:16:22 -0700 | [diff] [blame] | 377 | move $t9, $v1 # save $v0->code_ |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 378 | RESTORE_REF_AND_ARGS_CALLEE_SAVE_FRAME |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 379 | beqz $v0, 1f |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 380 | nop |
jeffhao | 30a3317 | 2012-10-22 18:16:22 -0700 | [diff] [blame] | 381 | jr $t9 |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 382 | nop |
| 383 | 1: |
| 384 | DELIVER_PENDING_EXCEPTION |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 385 | END \c_name |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 386 | .endm |
| 387 | |
Logan Chien | 8dbb708 | 2013-01-25 20:31:17 +0800 | [diff] [blame] | 388 | INVOKE_TRAMPOLINE art_quick_invoke_interface_trampoline, artInvokeInterfaceTrampoline |
| 389 | INVOKE_TRAMPOLINE art_quick_invoke_interface_trampoline_with_access_check, artInvokeInterfaceTrampolineWithAccessCheck |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 390 | |
Logan Chien | 8dbb708 | 2013-01-25 20:31:17 +0800 | [diff] [blame] | 391 | INVOKE_TRAMPOLINE art_quick_invoke_static_trampoline_with_access_check, artInvokeStaticTrampolineWithAccessCheck |
| 392 | INVOKE_TRAMPOLINE art_quick_invoke_direct_trampoline_with_access_check, artInvokeDirectTrampolineWithAccessCheck |
| 393 | INVOKE_TRAMPOLINE art_quick_invoke_super_trampoline_with_access_check, artInvokeSuperTrampolineWithAccessCheck |
| 394 | INVOKE_TRAMPOLINE art_quick_invoke_virtual_trampoline_with_access_check, artInvokeVirtualTrampolineWithAccessCheck |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 395 | |
Jeff Hao | 79fe539 | 2013-04-24 18:41:58 -0700 | [diff] [blame] | 396 | /* |
Jeff Hao | 6474d19 | 2013-03-26 14:08:09 -0700 | [diff] [blame] | 397 | * Common invocation stub for portable and quick. |
Jeff Hao | 5d91730 | 2013-02-27 17:57:33 -0800 | [diff] [blame] | 398 | * On entry: |
| 399 | * a0 = method pointer |
| 400 | * a1 = argument array or NULL for no argument methods |
| 401 | * a2 = size of argument array in bytes |
| 402 | * a3 = (managed) thread pointer |
Jeff Hao | 6474d19 | 2013-03-26 14:08:09 -0700 | [diff] [blame] | 403 | * [sp + 16] = JValue* result |
| 404 | * [sp + 20] = result type char |
Jeff Hao | 5d91730 | 2013-02-27 17:57:33 -0800 | [diff] [blame] | 405 | */ |
Jeff Hao | 79fe539 | 2013-04-24 18:41:58 -0700 | [diff] [blame] | 406 | .type art_portable_invoke_stub, %function |
| 407 | .global art_portable_invoke_stub |
Jeff Hao | 6474d19 | 2013-03-26 14:08:09 -0700 | [diff] [blame] | 408 | art_portable_invoke_stub: |
Jeff Hao | 5d91730 | 2013-02-27 17:57:33 -0800 | [diff] [blame] | 409 | ENTRY art_quick_invoke_stub |
| 410 | GENERATE_GLOBAL_POINTER |
| 411 | sw $a0, 0($sp) # save out a0 |
| 412 | addiu $sp, $sp, -16 # spill s0, s1, fp, ra |
| 413 | .cfi_adjust_cfa_offset 16 |
| 414 | sw $ra, 12($sp) |
| 415 | .cfi_rel_offset 31, 12 |
| 416 | sw $fp, 8($sp) |
| 417 | .cfi_rel_offset 30, 8 |
| 418 | sw $s1, 4($sp) |
| 419 | .cfi_rel_offset 17, 4 |
| 420 | sw $s0, 0($sp) |
| 421 | .cfi_rel_offset 16, 0 |
| 422 | move $fp, $sp # save sp in fp |
| 423 | .cfi_def_cfa_register 30 |
| 424 | move $s1, $a3 # move managed thread pointer into s1 |
| 425 | addiu $s0, $zero, SUSPEND_CHECK_INTERVAL # reset s0 to suspend check interval |
| 426 | addiu $t0, $a2, 16 # create space for method pointer in frame |
| 427 | srl $t0, $t0, 3 # shift the frame size right 3 |
| 428 | sll $t0, $t0, 3 # shift the frame size left 3 to align to 16 bytes |
| 429 | subu $sp, $sp, $t0 # reserve stack space for argument array |
| 430 | addiu $a0, $sp, 4 # pass stack pointer + method ptr as dest for memcpy |
| 431 | jal memcpy # (dest, src, bytes) |
| 432 | addiu $sp, $sp, -16 # make space for argument slots for memcpy |
| 433 | addiu $sp, $sp, 16 # restore stack after memcpy |
| 434 | lw $a0, 16($fp) # restore method* |
| 435 | lw $a1, 4($sp) # copy arg value for a1 |
| 436 | lw $a2, 8($sp) # copy arg value for a2 |
| 437 | lw $a3, 12($sp) # copy arg value for a3 |
| 438 | lw $t9, METHOD_CODE_OFFSET($a0) # get pointer to the code |
| 439 | jalr $t9 # call the method |
| 440 | sw $zero, 0($sp) # store NULL for method* at bottom of frame |
| 441 | move $sp, $fp # restore the stack |
| 442 | lw $s0, 0($sp) |
| 443 | lw $s1, 4($sp) |
| 444 | lw $fp, 8($sp) |
| 445 | lw $ra, 12($sp) |
| 446 | addiu $sp, $sp, 16 |
| 447 | .cfi_adjust_cfa_offset -16 |
| 448 | lw $t0, 16($sp) # get result pointer |
Jeff Hao | 6474d19 | 2013-03-26 14:08:09 -0700 | [diff] [blame] | 449 | lw $t1, 20($sp) # get result type char |
| 450 | li $t2, 68 # put char 'D' into t2 |
| 451 | beq $t1, $t2, 1f # branch if result type char == 'D' |
| 452 | li $t3, 70 # put char 'F' into t3 |
| 453 | beq $t1, $t3, 1f # branch if result type char == 'F' |
Jeff Hao | 5d91730 | 2013-02-27 17:57:33 -0800 | [diff] [blame] | 454 | sw $v0, 0($t0) # store the result |
Jeff Hao | 6474d19 | 2013-03-26 14:08:09 -0700 | [diff] [blame] | 455 | jr $ra |
Jeff Hao | 5d91730 | 2013-02-27 17:57:33 -0800 | [diff] [blame] | 456 | sw $v1, 4($t0) # store the other half of the result |
Jeff Hao | 6474d19 | 2013-03-26 14:08:09 -0700 | [diff] [blame] | 457 | 1: |
Jeff Hao | 19ca8cf | 2013-03-15 18:16:51 -0700 | [diff] [blame] | 458 | s.s $f0, 0($t0) # store floating point result |
Jeff Hao | 5d91730 | 2013-02-27 17:57:33 -0800 | [diff] [blame] | 459 | jr $ra |
Jeff Hao | 19ca8cf | 2013-03-15 18:16:51 -0700 | [diff] [blame] | 460 | s.s $f1, 4($t0) # store other half of floating point result |
Jeff Hao | 5d91730 | 2013-02-27 17:57:33 -0800 | [diff] [blame] | 461 | END art_quick_invoke_stub |
Jeff Hao | 6474d19 | 2013-03-26 14:08:09 -0700 | [diff] [blame] | 462 | .size art_portable_invoke_stub, .-art_portable_invoke_stub |
Jeff Hao | 5d91730 | 2013-02-27 17:57:33 -0800 | [diff] [blame] | 463 | |
| 464 | /* |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 465 | * Entry from managed code that calls artHandleFillArrayDataFromCode and delivers exception on |
| 466 | * failure. |
| 467 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 468 | .extern artHandleFillArrayDataFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 469 | ENTRY art_quick_handle_fill_data |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 470 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 471 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case exception allocation triggers GC |
| 472 | move $a2, rSELF # pass Thread::Current |
| 473 | jal artHandleFillArrayDataFromCode # (Array*, const DexFile::Payload*, Thread*, $sp) |
| 474 | move $a3, $sp # pass $sp |
jeffhao | fc6a30e | 2012-10-18 18:24:15 -0700 | [diff] [blame] | 475 | RETURN_IF_ZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 476 | END art_quick_handle_fill_data |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 477 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 478 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 479 | * Entry from managed code that calls artLockObjectFromCode, may block for GC. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 480 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 481 | .extern artLockObjectFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 482 | ENTRY art_quick_lock_object |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 483 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 484 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case we block |
| 485 | move $a1, rSELF # pass Thread::Current |
| 486 | jal artLockObjectFromCode # (Object* obj, Thread*, $sp) |
| 487 | move $a2, $sp # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 488 | RESTORE_REF_ONLY_CALLEE_SAVE_FRAME_AND_RETURN |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 489 | END art_quick_lock_object |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 490 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 491 | /* |
| 492 | * Entry from managed code that calls artUnlockObjectFromCode and delivers exception on failure. |
| 493 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 494 | .extern artUnlockObjectFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 495 | ENTRY art_quick_unlock_object |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 496 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 497 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case exception allocation triggers GC |
| 498 | move $a1, rSELF # pass Thread::Current |
| 499 | jal artUnlockObjectFromCode # (Object* obj, Thread*, $sp) |
| 500 | move $a2, $sp # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 501 | RETURN_IF_ZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 502 | END art_quick_unlock_object |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 503 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 504 | /* |
| 505 | * Entry from managed code that calls artCheckCastFromCode and delivers exception on failure. |
| 506 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 507 | .extern artCheckCastFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 508 | ENTRY art_quick_check_cast |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 509 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 510 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case exception allocation triggers GC |
| 511 | move $a2, rSELF # pass Thread::Current |
| 512 | jal artCheckCastFromCode # (Class* a, Class* b, Thread*, $sp) |
| 513 | move $a3, $sp # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 514 | RETURN_IF_ZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 515 | END art_quick_check_cast |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 516 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 517 | /* |
| 518 | * Entry from managed code that calls artCanPutArrayElementFromCode and delivers exception on |
| 519 | * failure. |
| 520 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 521 | .extern artCanPutArrayElementFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 522 | ENTRY art_quick_can_put_array_element |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 523 | GENERATE_GLOBAL_POINTER |
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 $a2, rSELF # pass Thread::Current |
| 526 | jal artCanPutArrayElementFromCode # (Object* element, Class* array_class, Thread*, $sp) |
| 527 | move $a3, $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_can_put_array_element |
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 when uninitialized static storage, this stub will run the class |
| 533 | * initializer and deliver the exception on error. On success the static storage base is |
| 534 | * returned. |
| 535 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 536 | .extern artInitializeStaticStorageFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 537 | ENTRY art_quick_initialize_static_storage |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 538 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 539 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 540 | move $a2, rSELF # pass Thread::Current |
| 541 | # artInitializeStaticStorageFromCode(uint32_t type_idx, Method* referrer, Thread*, $sp) |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 542 | jal artInitializeStaticStorageFromCode |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 543 | move $a3, $sp # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 544 | RETURN_IF_NONZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 545 | END art_quick_initialize_static_storage |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 546 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 547 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 548 | * Entry from managed code when dex cache misses for a type_idx. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 549 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 550 | .extern artInitializeTypeFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 551 | ENTRY art_quick_initialize_type |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 552 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 553 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 554 | move $a2, rSELF # pass Thread::Current |
| 555 | # artInitializeTypeFromCode(uint32_t type_idx, Method* referrer, Thread*, $sp) |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 556 | jal artInitializeTypeFromCode |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 557 | move $a3, $sp # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 558 | RETURN_IF_NONZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 559 | END art_quick_initialize_type |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 560 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 561 | /* |
| 562 | * 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] | 563 | * miss. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 564 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 565 | .extern artInitializeTypeAndVerifyAccessFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 566 | ENTRY art_quick_initialize_type_and_verify_access |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 567 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 568 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 569 | move $a2, rSELF # pass Thread::Current |
| 570 | # artInitializeTypeFromCode(uint32_t type_idx, Method* referrer, Thread*, $sp) |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 571 | jal artInitializeTypeAndVerifyAccessFromCode |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 572 | move $a3, $sp # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 573 | RETURN_IF_NONZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 574 | END art_quick_initialize_type_and_verify_access |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 575 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 576 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 577 | * 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] | 578 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 579 | .extern artGet32StaticFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 580 | ENTRY art_quick_get32_static |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 581 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 582 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 583 | lw $a1, 64($sp) # pass referrer's Method* |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 584 | move $a2, rSELF # pass Thread::Current |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 585 | jal artGet32StaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*, $sp) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 586 | move $a3, $sp # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 587 | RETURN_IF_NO_EXCEPTION |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 588 | END art_quick_get32_static |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 589 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 590 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 591 | * 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] | 592 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 593 | .extern artGet64StaticFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 594 | ENTRY art_quick_get64_static |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 595 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 596 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 597 | lw $a1, 64($sp) # pass referrer's Method* |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 598 | move $a2, rSELF # pass Thread::Current |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 599 | jal artGet64StaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*, $sp) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 600 | move $a3, $sp # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 601 | RETURN_IF_NO_EXCEPTION |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 602 | END art_quick_get64_static |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 603 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 604 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 605 | * 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] | 606 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 607 | .extern artGetObjStaticFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 608 | ENTRY art_quick_get_obj_static |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 609 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 610 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 611 | lw $a1, 64($sp) # pass referrer's Method* |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 612 | move $a2, rSELF # pass Thread::Current |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 613 | jal artGetObjStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*, $sp) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 614 | move $a3, $sp # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 615 | RETURN_IF_NO_EXCEPTION |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 616 | END art_quick_get_obj_static |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 617 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 618 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 619 | * 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] | 620 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 621 | .extern artGet32InstanceFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 622 | ENTRY art_quick_get32_instance |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 623 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 624 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 625 | lw $a2, 64($sp) # pass referrer's Method* |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 626 | move $a3, rSELF # pass Thread::Current |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 627 | jal artGet32InstanceFromCode # (field_idx, Object*, referrer, Thread*, $sp) |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 628 | sw $sp, 16($sp) # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 629 | RETURN_IF_NO_EXCEPTION |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 630 | END art_quick_get32_instance |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 631 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 632 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 633 | * 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] | 634 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 635 | .extern artGet64InstanceFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 636 | ENTRY art_quick_get64_instance |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 637 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 638 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 639 | lw $a2, 64($sp) # pass referrer's Method* |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 640 | move $a3, rSELF # pass Thread::Current |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 641 | jal artGet64InstanceFromCode # (field_idx, Object*, referrer, Thread*, $sp) |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 642 | sw $sp, 16($sp) # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 643 | RETURN_IF_NO_EXCEPTION |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 644 | END art_quick_get64_instance |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 645 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 646 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 647 | * 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] | 648 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 649 | .extern artGetObjInstanceFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 650 | ENTRY art_quick_get_obj_instance |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 651 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 652 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 653 | lw $a2, 64($sp) # pass referrer's Method* |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 654 | move $a3, rSELF # pass Thread::Current |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 655 | jal artGetObjInstanceFromCode # (field_idx, Object*, referrer, Thread*, $sp) |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 656 | sw $sp, 16($sp) # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 657 | RETURN_IF_NO_EXCEPTION |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 658 | END art_quick_get_obj_instance |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 659 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 660 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 661 | * 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] | 662 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 663 | .extern artSet32StaticFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 664 | ENTRY art_quick_set32_static |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 665 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 666 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 667 | lw $a2, 64($sp) # pass referrer's Method* |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 668 | move $a3, rSELF # pass Thread::Current |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 669 | jal artSet32StaticFromCode # (field_idx, new_val, referrer, Thread*, $sp) |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 670 | sw $sp, 16($sp) # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 671 | RETURN_IF_ZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 672 | END art_quick_set32_static |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 673 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 674 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 675 | * 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] | 676 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 677 | .extern artSet32StaticFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 678 | ENTRY art_quick_set64_static |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 679 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 680 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 681 | lw $a1, 64($sp) # pass referrer's Method* |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 682 | sw rSELF, 16($sp) # pass Thread::Current |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 683 | jal artSet64StaticFromCode # (field_idx, referrer, new_val, Thread*, $sp) |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 684 | sw $sp, 20($sp) # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 685 | RETURN_IF_ZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 686 | END art_quick_set64_static |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 687 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 688 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 689 | * 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] | 690 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 691 | .extern artSetObjStaticFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 692 | ENTRY art_quick_set_obj_static |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 693 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 694 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 695 | lw $a2, 64($sp) # pass referrer's Method* |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 696 | move $a3, rSELF # pass Thread::Current |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 697 | jal artSetObjStaticFromCode # (field_idx, new_val, referrer, Thread*, $sp) |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 698 | sw $sp, 16($sp) # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 699 | RETURN_IF_ZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 700 | END art_quick_set_obj_static |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 701 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 702 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 703 | * 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] | 704 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 705 | .extern artSet32InstanceFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 706 | ENTRY art_quick_set32_instance |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 707 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 708 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 709 | lw $a3, 64($sp) # pass referrer's Method* |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 710 | sw rSELF, 16($sp) # pass Thread::Current |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 711 | jal artSet32InstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*, $sp) |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 712 | sw $sp, 20($sp) # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 713 | RETURN_IF_ZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 714 | END art_quick_set32_instance |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 715 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 716 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 717 | * 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] | 718 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 719 | .extern artSet32InstanceFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 720 | ENTRY art_quick_set64_instance |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 721 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 722 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 723 | sw rSELF, 16($sp) # pass Thread::Current |
| 724 | jal artSet64InstanceFromCode # (field_idx, Object*, new_val, Thread*, $sp) |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 725 | sw $sp, 20($sp) # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 726 | RETURN_IF_ZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 727 | END art_quick_set64_instance |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 728 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 729 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 730 | * 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] | 731 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 732 | .extern artSetObjInstanceFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 733 | ENTRY art_quick_set_obj_instance |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 734 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 735 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 736 | lw $a3, 64($sp) # pass referrer's Method* |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 737 | sw rSELF, 16($sp) # pass Thread::Current |
| 738 | jal artSetObjInstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*, $sp) |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 739 | sw $sp, 20($sp) # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 740 | RETURN_IF_ZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 741 | END art_quick_set_obj_instance |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 742 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 743 | /* |
| 744 | * Entry from managed code to resolve a string, this stub will allocate a String and deliver an |
| 745 | * exception on error. On success the String is returned. R0 holds the referring method, |
| 746 | * R1 holds the string index. The fast path check for hit in strings cache has already been |
| 747 | * performed. |
| 748 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 749 | .extern artResolveStringFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 750 | ENTRY art_quick_resolve_string |
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 |
| 753 | move $a2, rSELF # pass Thread::Current |
| 754 | # artResolveStringFromCode(Method* referrer, uint32_t string_idx, Thread*, $sp) |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 755 | jal artResolveStringFromCode |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 756 | move $a3, $sp # pass $sp |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 757 | RETURN_IF_NONZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 758 | END art_quick_resolve_string |
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 allocate an object. |
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 artAllocObjectFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 764 | ENTRY art_quick_alloc_object |
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 |
| 767 | move $a2, rSELF # pass Thread::Current |
| 768 | jal artAllocObjectFromCode # (uint32_t type_idx, Method* method, Thread*, $sp) |
| 769 | move $a3, $sp # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 770 | RETURN_IF_NONZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 771 | END art_quick_alloc_object |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 772 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 773 | /* |
| 774 | * 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] | 775 | * access to the created type. |
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 artAllocObjectFromCodeWithAccessCheck |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 778 | ENTRY art_quick_alloc_object_with_access_check |
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 |
| 781 | move $a2, rSELF # pass Thread::Current |
| 782 | jal artAllocObjectFromCodeWithAccessCheck # (uint32_t type_idx, Method* method, Thread*, $sp) |
| 783 | move $a3, $sp # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 784 | RETURN_IF_NONZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 785 | END art_quick_alloc_object_with_access_check |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 786 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 787 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 788 | * Called by managed code to allocate an array. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 789 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 790 | .extern artAllocArrayFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 791 | ENTRY art_quick_alloc_array |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 792 | GENERATE_GLOBAL_POINTER |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 793 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 794 | move $a3, rSELF # pass Thread::Current |
| 795 | # artAllocArrayFromCode(uint32_t type_idx, Method* method, int32_t component_count, Thread*, $sp) |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 796 | jal artAllocArrayFromCode |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 797 | sw $sp, 16($sp) # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 798 | RETURN_IF_NONZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 799 | END art_quick_alloc_array |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 800 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 801 | /* |
| 802 | * 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] | 803 | * access to the created type. |
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 artAllocArrayFromCodeWithAccessCheck |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 806 | ENTRY art_quick_alloc_array_with_access_check |
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 |
| 809 | move $a3, rSELF # pass Thread::Current |
| 810 | # artAllocArrayFromCodeWithAccessCheck(type_idx, method, component_count, Thread*, $sp) |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 811 | jal artAllocArrayFromCodeWithAccessCheck |
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_NONZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 814 | END art_quick_alloc_array_with_access_check |
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 allocate an array in a special case for FILLED_NEW_ARRAY. |
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 artCheckAndAllocArrayFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 820 | ENTRY art_quick_check_and_alloc_array |
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 |
| 823 | move $a3, rSELF # pass Thread::Current |
| 824 | # artCheckAndAllocArrayFromCode(uint32_t type_idx, Method* method, int32_t count, Thread* , $sp) |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 825 | jal artCheckAndAllocArrayFromCode |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 826 | sw $sp, 16($sp) # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 827 | RETURN_IF_NONZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 828 | END art_quick_check_and_alloc_array |
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 allocate an array in a special case for FILLED_NEW_ARRAY. |
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 artCheckAndAllocArrayFromCodeWithAccessCheck |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 834 | ENTRY art_quick_check_and_alloc_array_with_access_check |
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 | move $a3, rSELF # pass Thread::Current |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 838 | # artCheckAndAllocArrayFromCodeWithAccessCheck(type_idx, method, count, Thread* , $sp) |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 839 | jal artCheckAndAllocArrayFromCodeWithAccessCheck |
jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 840 | sw $sp, 16($sp) # pass $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 841 | RETURN_IF_NONZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 842 | END art_quick_check_and_alloc_array_with_access_check |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 843 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 844 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 845 | * 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] | 846 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 847 | .extern artTestSuspendFromCode |
| 848 | ENTRY art_quick_test_suspend |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 849 | GENERATE_GLOBAL_POINTER |
Ian Rogers | 474b6da | 2012-09-25 00:20:38 -0700 | [diff] [blame] | 850 | lh $a0, THREAD_FLAGS_OFFSET(rSELF) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 851 | bnez $a0, 1f |
| 852 | addi rSUSPEND, $zero, SUSPEND_CHECK_INTERVAL # reset rSUSPEND to SUSPEND_CHECK_INTERVAL |
| 853 | jr $ra |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 854 | nop |
| 855 | 1: |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 856 | move $a0, rSELF |
| 857 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves for stack crawl |
| 858 | jal artTestSuspendFromCode # (Thread*, $sp) |
| 859 | move $a1, $sp |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 860 | RESTORE_REF_ONLY_CALLEE_SAVE_FRAME_AND_RETURN |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 861 | END art_quick_test_suspend |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 862 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 863 | /* |
| 864 | * 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] | 865 | * r0 holds the proxy method; r1, r2 and r3 may contain arguments. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 866 | */ |
Jeff Hao | 5fa60c3 | 2013-04-04 17:57:01 -0700 | [diff] [blame] | 867 | .extern artQuickProxyInvokeHandler |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 868 | ENTRY art_quick_proxy_invoke_handler |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 869 | GENERATE_GLOBAL_POINTER |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 870 | SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 871 | sw $a0, 0($sp) # place proxy method at bottom of frame |
| 872 | move $a2, rSELF # pass Thread::Current |
Jeff Hao | 5fa60c3 | 2013-04-04 17:57:01 -0700 | [diff] [blame] | 873 | jal artQuickProxyInvokeHandler # (Method* proxy method, receiver, Thread*, SP) |
Ian Rogers | af6e67a | 2013-01-16 08:38:37 -0800 | [diff] [blame] | 874 | move $a3, $sp # pass $sp |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 875 | lw $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ |
Jeff Hao | 1f3bc2f | 2013-04-30 15:17:19 -0700 | [diff] [blame] | 876 | lw $gp, 52($sp) # restore $gp |
| 877 | lw $ra, 60($sp) # restore $ra |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 878 | bnez $t0, 1f |
Jeff Hao | 1f3bc2f | 2013-04-30 15:17:19 -0700 | [diff] [blame] | 879 | addiu $sp, $sp, 64 # pop frame |
| 880 | .cfi_adjust_cfa_offset -64 |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 881 | jr $ra |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 882 | nop |
| 883 | 1: |
| 884 | DELIVER_PENDING_EXCEPTION |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 885 | END art_quick_proxy_invoke_handler |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 886 | |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 887 | .extern artQuickResolutionTrampoline |
| 888 | ENTRY art_quick_resolution_trampoline |
Ian Rogers | 7db619b | 2013-01-16 18:35:48 -0800 | [diff] [blame] | 889 | GENERATE_GLOBAL_POINTER |
| 890 | SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 891 | move $a2, rSELF # pass Thread::Current |
| 892 | jal artQuickProxyInvokeHandler # (Method* called, receiver, Thread*, SP) |
| 893 | move $a3, $sp # pass $sp |
| 894 | lw $gp, 52($sp) # restore $gp |
| 895 | lw $ra, 60($sp) # restore $ra |
| 896 | beqz $v0, 1f |
| 897 | lw $a0, 0($sp) # load resolved method to $a0 |
| 898 | lw $a1, 4($sp) # restore non-callee save $a1 |
| 899 | lw $a2, 8($sp) # restore non-callee save $a2 |
| 900 | lw $a3, 12($sp) # restore non-callee save $a3 |
| 901 | jr $v0 # tail call to method |
| 902 | 1: |
| 903 | addiu $sp, $sp, 64 # pop frame |
| 904 | .cfi_adjust_cfa_offset -64 |
| 905 | DELIVER_PENDING_EXCEPTION |
| 906 | END art_quick_resolution_trampoline |
| 907 | |
| 908 | .extern artQuickToInterpreterBridge |
| 909 | ENTRY art_quick_to_interpreter_bridge |
| 910 | GENERATE_GLOBAL_POINTER |
| 911 | SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME |
Ian Rogers | 7db619b | 2013-01-16 18:35:48 -0800 | [diff] [blame] | 912 | move $a1, rSELF # pass Thread::Current |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 913 | jal artQuickToInterpreterBridge # (Method* method, Thread*, SP) |
Ian Rogers | 7db619b | 2013-01-16 18:35:48 -0800 | [diff] [blame] | 914 | move $a2, $sp # pass $sp |
| 915 | lw $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ |
Jeff Hao | 1f3bc2f | 2013-04-30 15:17:19 -0700 | [diff] [blame] | 916 | lw $gp, 52($sp) # restore $gp |
| 917 | lw $ra, 60($sp) # restore $ra |
Ian Rogers | 7db619b | 2013-01-16 18:35:48 -0800 | [diff] [blame] | 918 | bnez $t0, 1f |
Jeff Hao | 1f3bc2f | 2013-04-30 15:17:19 -0700 | [diff] [blame] | 919 | addiu $sp, $sp, 64 # pop frame |
| 920 | .cfi_adjust_cfa_offset -64 |
Ian Rogers | 7db619b | 2013-01-16 18:35:48 -0800 | [diff] [blame] | 921 | jr $ra |
| 922 | nop |
| 923 | 1: |
| 924 | DELIVER_PENDING_EXCEPTION |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 925 | END art_quick_to_interpreter_bridge |
Ian Rogers | 7db619b | 2013-01-16 18:35:48 -0800 | [diff] [blame] | 926 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 927 | /* |
jeffhao | 725a957 | 2012-11-13 18:20:12 -0800 | [diff] [blame] | 928 | * Routine that intercepts method calls and returns. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 929 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 930 | .extern artInstrumentationMethodEntryFromCode |
| 931 | .extern artInstrumentationMethodExitFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 932 | ENTRY art_quick_instrumentation_entry |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 933 | GENERATE_GLOBAL_POINTER |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 934 | SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 935 | move $t0, $sp # remember bottom of caller's frame |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 936 | addiu $sp, $sp, -32 # space for args, pad (3 words), arguments (5 words) |
| 937 | .cfi_adjust_cfa_offset 32 |
| 938 | sw $a0, 28($sp) # save arg0 |
| 939 | sw $ra, 16($sp) # pass $ra |
| 940 | move $a3, $t0 # pass $sp |
| 941 | jal artInstrumentationMethodEntryFromCode # (Method*, Object*, Thread*, SP, LR) |
| 942 | move $a2, rSELF # pass Thread::Current |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 943 | move $t9, $v0 # $t9 holds reference to code |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 944 | lw $a0, 28($sp) # restore arg0 |
| 945 | addiu $sp, $sp, 32 # remove args |
| 946 | .cfi_adjust_cfa_offset -32 |
| 947 | RESTORE_REF_AND_ARGS_CALLEE_SAVE_FRAME |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 948 | jalr $t9 # call method |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 949 | nop |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 950 | END art_quick_instrumentation_entry |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 951 | /* intentional fallthrough */ |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 952 | .global art_quick_instrumentation_exit |
| 953 | art_quick_instrumentation_exit: |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 954 | .cfi_startproc |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 955 | addiu $t9, $ra, 4 # put current address into $t9 to rebuild $gp |
| 956 | GENERATE_GLOBAL_POINTER |
| 957 | move $t0, $sp # remember bottom of caller's frame |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 958 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME |
| 959 | addiu $sp, $sp, -48 # save return values and set up args |
| 960 | .cfi_adjust_cfa_offset 48 |
| 961 | sw $v0, 32($sp) |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 962 | .cfi_rel_offset 2, 0 |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 963 | sw $v1, 36($sp) |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 964 | .cfi_rel_offset 3, 4 |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 965 | s.s $f0, 40($sp) |
| 966 | s.s $f1, 44($sp) |
| 967 | s.s $f0, 16($sp) # pass fpr result |
| 968 | s.s $f1, 20($sp) |
| 969 | move $a2, $v0 # pass gpr result |
| 970 | move $a3, $v1 |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 971 | move $a1, $t0 # pass $sp |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 972 | jal artInstrumentationMethodExitFromCode # (Thread*, SP, gpr_res, fpr_res) |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 973 | move $a0, rSELF # pass Thread::Current |
| 974 | move $t0, $v0 # set aside returned link register |
| 975 | move $ra, $v1 # set link register for deoptimization |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 976 | lw $v0, 32($sp) # restore return values |
| 977 | lw $v1, 36($sp) |
| 978 | l.s $f0, 40($sp) |
| 979 | l.s $f1, 44($sp) |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 980 | jr $t0 # return |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 981 | addiu $sp, $sp, 112 # 48 bytes of args + 64 bytes of callee save frame |
| 982 | .cfi_adjust_cfa_offset -112 |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame^] | 983 | END art_quick_instrumentation_exit |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 984 | |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 985 | /* |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 986 | * Instrumentation has requested that we deoptimize into the interpreter. The deoptimization |
| 987 | * will long jump to the upcall with a special exception of -1. |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 988 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 989 | .extern artDeoptimize |
| 990 | .extern artEnterInterpreterFromDeoptimize |
| 991 | ENTRY art_quick_deoptimize |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 992 | GENERATE_GLOBAL_POINTER |
Jeff Hao | 14dd5a8 | 2013-04-11 10:23:36 -0700 | [diff] [blame] | 993 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 994 | move $a0, rSELF # pass Thread::current |
| 995 | jal artDeoptimize # artDeoptimize(Thread*, SP) |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 996 | # Returns caller method's frame size. |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 997 | move $a1, $sp # pass $sp |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 998 | END art_quick_deoptimize |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 999 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1000 | /* |
| 1001 | * Long integer shift. This is different from the generic 32/64-bit |
| 1002 | * binary operations because vAA/vBB are 64-bit but vCC (the shift |
| 1003 | * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low |
| 1004 | * 6 bits. |
| 1005 | * On entry: |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1006 | * $a0: low word |
| 1007 | * $a1: high word |
| 1008 | * $a2: shift count |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1009 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1010 | ENTRY art_quick_shl_long |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1011 | /* shl-long vAA, vBB, vCC */ |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1012 | sll $v0, $a0, $a2 # rlo<- alo << (shift&31) |
| 1013 | not $v1, $a2 # rhi<- 31-shift (shift is 5b) |
| 1014 | srl $a0, 1 |
| 1015 | srl $a0, $v1 # alo<- alo >> (32-(shift&31)) |
| 1016 | sll $v1, $a1, $a2 # rhi<- ahi << (shift&31) |
| 1017 | or $v1, $a0 # rhi<- rhi | alo |
| 1018 | andi $a2, 0x20 # shift< shift & 0x20 |
| 1019 | movn $v1, $v0, $a2 # rhi<- rlo (if shift&0x20) |
| 1020 | jr $ra |
jeffhao | fc6a30e | 2012-10-18 18:24:15 -0700 | [diff] [blame] | 1021 | movn $v0, $zero, $a2 # rlo<- 0 (if shift&0x20) |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1022 | END art_quick_shl_long |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1023 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1024 | /* |
| 1025 | * Long integer shift. This is different from the generic 32/64-bit |
| 1026 | * binary operations because vAA/vBB are 64-bit but vCC (the shift |
| 1027 | * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low |
| 1028 | * 6 bits. |
| 1029 | * On entry: |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1030 | * $a0: low word |
| 1031 | * $a1: high word |
| 1032 | * $a2: shift count |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1033 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1034 | .global art_quick_shr_long |
| 1035 | ENTRY art_quick_shr_long |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1036 | sra $v1, $a1, $a2 # rhi<- ahi >> (shift&31) |
| 1037 | srl $v0, $a0, $a2 # rlo<- alo >> (shift&31) |
| 1038 | sra $a3, $a1, 31 # $a3<- sign(ah) |
| 1039 | not $a0, $a2 # alo<- 31-shift (shift is 5b) |
| 1040 | sll $a1, 1 |
| 1041 | sll $a1, $a0 # ahi<- ahi << (32-(shift&31)) |
| 1042 | or $v0, $a1 # rlo<- rlo | ahi |
| 1043 | andi $a2, 0x20 # shift & 0x20 |
| 1044 | movn $v0, $v1, $a2 # rlo<- rhi (if shift&0x20) |
| 1045 | jr $ra |
| 1046 | movn $v1, $a3, $a2 # rhi<- sign(ahi) (if shift&0x20) |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1047 | END art_quick_shr_long |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1048 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1049 | /* |
| 1050 | * Long integer shift. This is different from the generic 32/64-bit |
| 1051 | * binary operations because vAA/vBB are 64-bit but vCC (the shift |
| 1052 | * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low |
| 1053 | * 6 bits. |
| 1054 | * On entry: |
| 1055 | * r0: low word |
| 1056 | * r1: high word |
| 1057 | * r2: shift count |
| 1058 | */ |
| 1059 | /* ushr-long vAA, vBB, vCC */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1060 | .global art_quick_ushr_long |
| 1061 | ENTRY art_quick_ushr_long |
jeffhao | fc6a30e | 2012-10-18 18:24:15 -0700 | [diff] [blame] | 1062 | srl $v1, $a1, $a2 # rhi<- ahi >> (shift&31) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1063 | srl $v0, $a0, $a2 # rlo<- alo >> (shift&31) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1064 | not $a0, $a2 # alo<- 31-shift (shift is 5b) |
| 1065 | sll $a1, 1 |
| 1066 | sll $a1, $a0 # ahi<- ahi << (32-(shift&31)) |
| 1067 | or $v0, $a1 # rlo<- rlo | ahi |
| 1068 | andi $a2, 0x20 # shift & 0x20 |
| 1069 | movn $v0, $v1, $a2 # rlo<- rhi (if shift&0x20) |
| 1070 | jr $ra |
jeffhao | fc6a30e | 2012-10-18 18:24:15 -0700 | [diff] [blame] | 1071 | movn $v1, $zero, $a2 # rhi<- 0 (if shift&0x20) |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1072 | END art_quick_ushr_long |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1073 | |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1074 | ENTRY art_quick_indexof |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1075 | jr $ra |
jeffhao | 0703060 | 2012-09-26 14:33:14 -0700 | [diff] [blame] | 1076 | nop |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1077 | END art_quick_indexof |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1078 | |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1079 | ENTRY art_quick_string_compareto |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1080 | jr $ra |
jeffhao | 0703060 | 2012-09-26 14:33:14 -0700 | [diff] [blame] | 1081 | nop |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1082 | END art_quick_string_compareto |