| 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 | |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 17 | #include "asm_support.h" |
| 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 | |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 27 | /* Cache alignment for function entry */ |
| 28 | .macro ALIGN_FUNCTION_ENTRY |
| 29 | .balign 16 |
| 30 | .endm |
| 31 | |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 32 | /* Generates $gp for function calls */ |
| 33 | .macro GENERATE_GLOBAL_POINTER |
| 34 | .cpload $t9 |
| 35 | .endm |
| 36 | |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 37 | /* |
| 38 | * Macro that sets up the callee save frame to conform with |
| 39 | * Runtime::CreateCalleeSaveMethod(kSaveAll) |
| jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 40 | * callee-save: $s0-$s8 + $ra, 10 total + 4 words |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 41 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 42 | .macro SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
| jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 43 | addiu $sp, $sp, -64 |
| 44 | sw $ra, 60($sp) |
| 45 | sw $s8, 56($sp) |
| 46 | sw $s7, 52($sp) |
| 47 | sw $s6, 48($sp) |
| 48 | sw $s5, 44($sp) |
| 49 | sw $s4, 40($sp) |
| 50 | sw $s3, 36($sp) |
| 51 | sw $s2, 32($sp) |
| 52 | sw $s1, 28($sp) |
| 53 | sw $s0, 24($sp) |
| 54 | # 2 words for alignment, 4 open words for args $a0-$a3, bottom will hold Method* |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 55 | .endm |
| 56 | |
| 57 | /* |
| 58 | * Macro that sets up the callee save frame to conform with |
| 59 | * Runtime::CreateCalleeSaveMethod(kRefsOnly). Restoration assumes non-moving GC. |
| 60 | * Does not include rSUSPEND or rSELF |
| jeffhao | fc6a30e | 2012-10-18 18:24:15 -0700 | [diff] [blame] | 61 | * callee-save: $s2-$s8 + $ra, 8 total + 4 words + extra args + gp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 62 | */ |
| 63 | .macro SETUP_REF_ONLY_CALLEE_SAVE_FRAME |
| jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 64 | addiu $sp, $sp, -64 |
| 65 | sw $ra, 60($sp) |
| 66 | sw $s8, 56($sp) |
| 67 | sw $s7, 52($sp) |
| 68 | sw $s6, 48($sp) |
| 69 | sw $s5, 44($sp) |
| 70 | sw $s4, 40($sp) |
| 71 | sw $s3, 36($sp) |
| 72 | sw $s2, 32($sp) |
| jeffhao | fc6a30e | 2012-10-18 18:24:15 -0700 | [diff] [blame] | 73 | sw $gp, 28($sp) |
| 74 | # 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] | 75 | .endm |
| 76 | |
| 77 | .macro RESTORE_REF_ONLY_CALLEE_SAVE_FRAME |
| jeffhao | fc6a30e | 2012-10-18 18:24:15 -0700 | [diff] [blame] | 78 | lw $gp, 28($sp) |
| jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 79 | lw $ra, 60($sp) |
| 80 | addiu $sp, $sp, 64 |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 81 | .endm |
| 82 | |
| 83 | .macro RESTORE_REF_ONLY_CALLEE_SAVE_FRAME_AND_RETURN |
| jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 84 | lw $ra, 60($sp) |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 85 | jr $ra |
| jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 86 | addiu $sp, $sp, 64 |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 87 | .endm |
| 88 | |
| 89 | /* |
| 90 | * Macro that sets up the callee save frame to conform with |
| 91 | * Runtime::CreateCalleeSaveMethod(kRefsAndArgs). Restoration assumes non-moving GC. |
| jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 92 | * $a1-$a3, $s2-$s8, $ra, 11 total + Method* |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 93 | */ |
| 94 | .macro SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME |
| jeffhao | 0703060 | 2012-09-26 14:33:14 -0700 | [diff] [blame] | 95 | addiu $sp, $sp, -48 |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 96 | sw $ra, 44($sp) |
| 97 | sw $s8, 40($sp) |
| 98 | sw $s7, 36($sp) |
| 99 | sw $s6, 32($sp) |
| 100 | sw $s5, 28($sp) |
| 101 | sw $s4, 24($sp) |
| 102 | sw $s3, 20($sp) |
| 103 | sw $s2, 16($sp) |
| 104 | sw $a3, 12($sp) |
| 105 | sw $a2, 8($sp) |
| 106 | sw $a1, 4($sp) |
| jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 107 | # bottom will hold Method* |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 108 | .endm |
| 109 | |
| 110 | .macro RESTORE_REF_AND_ARGS_CALLEE_SAVE_FRAME |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 111 | lw $ra, 44($sp) # restore $ra |
| 112 | lw $a1, 4($sp) # restore non-callee save $a1 |
| 113 | lw $a2, 8($sp) # restore non-callee save $a2 |
| 114 | lw $a3, 12($sp) # restore non-callee save $a3 |
| 115 | addiu $sp, $sp, 48 # strip frame |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 116 | .endm |
| 117 | |
| 118 | /* |
| 119 | * Macro that set calls through to artDeliverPendingExceptionFromCode, where the pending |
| 120 | * exception is Thread::Current()->exception_ |
| 121 | */ |
| 122 | .macro DELIVER_PENDING_EXCEPTION |
| jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 123 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME # save callee saves for throw |
| 124 | move $a0, rSELF # pass Thread::Current |
| 125 | la $t9, artDeliverPendingExceptionFromCode |
| 126 | jr $t9 # artDeliverPendingExceptionFromCode(Thread*, $sp) |
| 127 | move $a1, $sp # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 128 | .endm |
| 129 | |
| 130 | .macro RETURN_IF_NO_EXCEPTION |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 131 | lw $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 132 | RESTORE_REF_ONLY_CALLEE_SAVE_FRAME |
| jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 133 | bnez $t0, 1f # success if no exception is pending |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 134 | nop |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 135 | jr $ra |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 136 | nop |
| 137 | 1: |
| 138 | DELIVER_PENDING_EXCEPTION |
| 139 | .endm |
| 140 | |
| 141 | .macro RETURN_IF_ZERO |
| 142 | RESTORE_REF_ONLY_CALLEE_SAVE_FRAME |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 143 | bnez $v0, 1f # success? |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 144 | nop |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 145 | jr $ra # return on success |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 146 | nop |
| 147 | 1: |
| 148 | DELIVER_PENDING_EXCEPTION |
| 149 | .endm |
| 150 | |
| 151 | .macro RETURN_IF_NONZERO |
| 152 | RESTORE_REF_ONLY_CALLEE_SAVE_FRAME |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 153 | beqz $v0, 1f # success? |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 154 | nop |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 155 | jr $ra # return on success |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 156 | nop |
| 157 | 1: |
| 158 | DELIVER_PENDING_EXCEPTION |
| 159 | .endm |
| 160 | |
| 161 | .global art_update_debugger |
| 162 | .extern artUpdateDebuggerFromCode |
| 163 | /* |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 164 | * On entry, $a0 and $a1 must be preserved, $a2 is dex PC |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 165 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 166 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 167 | art_update_debugger: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 168 | GENERATE_GLOBAL_POINTER |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 169 | move $a3, $a0 # stash away $a0 so that it's saved as if it were an argument |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 170 | SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 171 | move $a0, $a2 # arg0 is dex PC |
| 172 | move $a1, rSELF # arg1 is Thread* |
| 173 | move $a2, $sp # arg2 is $sp |
| 174 | jal artUpdateDebuggerFromCode # artUpdateDebuggerFromCode(int32_t, Thread*, Method**) |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 175 | nop |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 176 | RESTORE_REF_AND_ARGS_CALLEE_SAVE_FRAME |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 177 | jr $ra |
| 178 | move $a0, $a3 # restore original $a0 |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 179 | |
| 180 | .global art_do_long_jump |
| 181 | /* |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 182 | * On entry $a0 is uint32_t* gprs_ and $a1 is uint32_t* fprs_ |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 183 | * FIXME: just guessing about the shape of the jmpbuf. Where will pc be? |
| 184 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 185 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 186 | art_do_long_jump: |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 187 | l.s $f0, 0($a1) |
| 188 | l.s $f1, 4($a1) |
| 189 | l.s $f2, 8($a1) |
| 190 | l.s $f3, 12($a1) |
| 191 | l.s $f4, 16($a1) |
| 192 | l.s $f5, 20($a1) |
| 193 | l.s $f6, 24($a1) |
| 194 | l.s $f7, 28($a1) |
| 195 | l.s $f8, 32($a1) |
| 196 | l.s $f9, 36($a1) |
| 197 | l.s $f10, 40($a1) |
| 198 | l.s $f11, 44($a1) |
| 199 | l.s $f12, 48($a1) |
| 200 | l.s $f13, 52($a1) |
| 201 | l.s $f14, 56($a1) |
| 202 | l.s $f15, 60($a1) |
| 203 | l.s $f16, 64($a1) |
| 204 | l.s $f17, 68($a1) |
| 205 | l.s $f18, 72($a1) |
| 206 | l.s $f19, 76($a1) |
| 207 | l.s $f20, 80($a1) |
| 208 | l.s $f21, 84($a1) |
| 209 | l.s $f22, 88($a1) |
| 210 | l.s $f23, 92($a1) |
| 211 | l.s $f24, 96($a1) |
| 212 | l.s $f25, 100($a1) |
| 213 | l.s $f26, 104($a1) |
| 214 | l.s $f27, 108($a1) |
| 215 | l.s $f28, 112($a1) |
| 216 | l.s $f29, 116($a1) |
| 217 | l.s $f30, 120($a1) |
| 218 | l.s $f31, 124($a1) |
| 219 | lw $at, 4($a0) |
| 220 | lw $v0, 8($a0) |
| 221 | lw $v1, 12($a0) |
| 222 | lw $a1, 20($a0) |
| 223 | lw $a2, 24($a0) |
| 224 | lw $a3, 28($a0) |
| 225 | lw $t0, 32($a0) |
| 226 | lw $t1, 36($a0) |
| 227 | lw $t2, 40($a0) |
| 228 | lw $t3, 44($a0) |
| 229 | lw $t4, 48($a0) |
| 230 | lw $t5, 52($a0) |
| 231 | lw $t6, 56($a0) |
| 232 | lw $t7, 60($a0) |
| 233 | lw $s0, 64($a0) |
| 234 | lw $s1, 68($a0) |
| 235 | lw $s2, 72($a0) |
| 236 | lw $s3, 76($a0) |
| 237 | lw $s4, 80($a0) |
| 238 | lw $s5, 84($a0) |
| 239 | lw $s6, 88($a0) |
| 240 | lw $s7, 92($a0) |
| 241 | lw $t8, 96($a0) |
| 242 | lw $t9, 100($a0) |
| 243 | lw $k0, 104($a0) |
| 244 | lw $k1, 108($a0) |
| 245 | lw $gp, 112($a0) |
| 246 | lw $sp, 116($a0) |
| 247 | lw $fp, 120($a0) |
| 248 | lw $ra, 124($a0) |
| 249 | lw $a0, 16($a0) |
| 250 | move $v0, $zero # clear result registers r0 and r1 |
| 251 | jr $ra # do long jump |
| 252 | move $v1, $zero |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 253 | |
| 254 | .global art_deliver_exception_from_code |
| 255 | /* |
| 256 | * Called by managed code, saves most registers (forms basis of long jump context) and passes |
| 257 | * the bottom of the stack. artDeliverExceptionFromCode will place the callee save Method* at |
| 258 | * the bottom of the thread. On entry r0 holds Throwable* |
| 259 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 260 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 261 | art_deliver_exception_from_code: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 262 | GENERATE_GLOBAL_POINTER |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 263 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
| jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 264 | move $a1, rSELF # pass Thread::Current |
| 265 | la $t9, artDeliverExceptionFromCode |
| 266 | jr $t9 # artDeliverExceptionFromCode(Throwable*, Thread*, $sp) |
| 267 | move $a2, $sp # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 268 | |
| 269 | .global art_throw_null_pointer_exception_from_code |
| 270 | .extern artThrowNullPointerExceptionFromCode |
| 271 | /* |
| 272 | * Called by managed code to create and deliver a NullPointerException |
| 273 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 274 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 275 | art_throw_null_pointer_exception_from_code: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 276 | GENERATE_GLOBAL_POINTER |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 277 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
| jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 278 | move $a0, rSELF # pass Thread::Current |
| 279 | la $t9, artThrowNullPointerExceptionFromCode |
| 280 | jr $t9 # artThrowNullPointerExceptionFromCode(Thread*, $sp) |
| 281 | move $a1, $sp # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 282 | |
| 283 | .global art_throw_div_zero_from_code |
| 284 | .extern artThrowDivZeroFromCode |
| 285 | /* |
| 286 | * Called by managed code to create and deliver an ArithmeticException |
| 287 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 288 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 289 | art_throw_div_zero_from_code: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 290 | GENERATE_GLOBAL_POINTER |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 291 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 292 | move $a0, rSELF # pass Thread::Current |
| jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 293 | la $t9, artThrowDivZeroFromCode |
| 294 | jr $t9 # artThrowDivZeroFromCode(Thread*, $sp) |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 295 | move $a1, $sp # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 296 | |
| 297 | .global art_throw_array_bounds_from_code |
| 298 | .extern artThrowArrayBoundsFromCode |
| 299 | /* |
| 300 | * Called by managed code to create and deliver an ArrayIndexOutOfBoundsException |
| 301 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 302 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 303 | art_throw_array_bounds_from_code: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 304 | GENERATE_GLOBAL_POINTER |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 305 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
| jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 306 | move $a2, rSELF # pass Thread::Current |
| 307 | la $t9, artThrowArrayBoundsFromCode |
| 308 | jr $t9 # artThrowArrayBoundsFromCode(index, limit, Thread*, $sp) |
| 309 | move $a3, $sp # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 310 | |
| 311 | .global art_throw_stack_overflow_from_code |
| 312 | .extern artThrowStackOverflowFromCode |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 313 | /* |
| 314 | * Called by managed code to create and deliver a StackOverflowError. |
| 315 | */ |
| 316 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 317 | art_throw_stack_overflow_from_code: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 318 | GENERATE_GLOBAL_POINTER |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 319 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
| jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 320 | move $a0, rSELF # pass Thread::Current |
| 321 | la $t9, artThrowStackOverflowFromCode |
| 322 | jr $t9 # artThrowStackOverflowFromCode(Thread*, $sp) |
| 323 | move $a1, $sp # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 324 | |
| 325 | .global art_throw_no_such_method_from_code |
| 326 | .extern artThrowNoSuchMethodFromCode |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 327 | /* |
| 328 | * Called by managed code to create and deliver a NoSuchMethodError. |
| 329 | */ |
| 330 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 331 | art_throw_no_such_method_from_code: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 332 | GENERATE_GLOBAL_POINTER |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 333 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
| jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 334 | move $a1, rSELF # pass Thread::Current |
| 335 | la $t9, artThrowNoSuchMethodFromCode |
| 336 | jr $t9 # artThrowNoSuchMethodFromCode(method_idx, Thread*, $sp) |
| 337 | move $a2, $sp # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 338 | |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 339 | /* |
| 340 | * All generated callsites for interface invokes and invocation slow paths will load arguments |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 341 | * 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] | 342 | * the method_idx. This wrapper will save arg1-arg3, load the caller's Method*, align the |
| 343 | * stack and call the appropriate C helper. |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 344 | * 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] | 345 | * |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 346 | * The helper will attempt to locate the target and return a 64-bit result in $v0/$v1 consisting |
| 347 | * of the target Method* in $v0 and method->code_ in $v1. |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 348 | * |
| jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 349 | * 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] | 350 | * thread and we branch to another stub to deliver it. |
| 351 | * |
| 352 | * On success this wrapper will restore arguments and *jump* to the target, leaving the lr |
| 353 | * pointing back to the original caller. |
| 354 | */ |
| 355 | .macro INVOKE_TRAMPOLINE c_name, cxx_name |
| 356 | .global \c_name |
| 357 | .extern \cxx_name |
| 358 | \c_name: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 359 | GENERATE_GLOBAL_POINTER |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 360 | SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME # save callee saves in case allocation triggers GC |
| 361 | lw $a2, 48($sp) # pass caller Method* |
| jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 362 | move $t0, $sp # save $sp |
| 363 | addiu $sp, $sp, -16 # make space for extra args |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 364 | move $a3, rSELF # pass Thread::Current |
| jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 365 | sw $gp, 12($sp) # save $gp |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 366 | jal \cxx_name # (method_idx, this, caller, Thread*, $sp) |
| jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 367 | sw $t0, 16($sp) # pass $sp |
| jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 368 | lw $gp, 12($sp) # restore $gp |
| jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 369 | addiu $sp, $sp, 16 # release out args |
| 370 | move $a0, $v0 # save target Method* |
| jeffhao | 30a3317 | 2012-10-22 18:16:22 -0700 | [diff] [blame] | 371 | move $t9, $v1 # save $v0->code_ |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 372 | RESTORE_REF_AND_ARGS_CALLEE_SAVE_FRAME |
| jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 373 | beqz $v0, 1f |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 374 | nop |
| jeffhao | 30a3317 | 2012-10-22 18:16:22 -0700 | [diff] [blame] | 375 | jr $t9 |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 376 | nop |
| 377 | 1: |
| 378 | DELIVER_PENDING_EXCEPTION |
| 379 | .endm |
| 380 | |
| 381 | INVOKE_TRAMPOLINE art_invoke_interface_trampoline, artInvokeInterfaceTrampoline |
| 382 | INVOKE_TRAMPOLINE art_invoke_interface_trampoline_with_access_check, artInvokeInterfaceTrampolineWithAccessCheck |
| 383 | |
| 384 | INVOKE_TRAMPOLINE art_invoke_static_trampoline_with_access_check, artInvokeStaticTrampolineWithAccessCheck |
| 385 | INVOKE_TRAMPOLINE art_invoke_direct_trampoline_with_access_check, artInvokeDirectTrampolineWithAccessCheck |
| 386 | INVOKE_TRAMPOLINE art_invoke_super_trampoline_with_access_check, artInvokeSuperTrampolineWithAccessCheck |
| 387 | INVOKE_TRAMPOLINE art_invoke_virtual_trampoline_with_access_check, artInvokeVirtualTrampolineWithAccessCheck |
| 388 | |
| 389 | .global art_work_around_app_jni_bugs |
| 390 | .extern artWorkAroundAppJniBugs |
| 391 | /* |
| 392 | * Entry point of native methods when JNI bug compatibility is enabled. |
| 393 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 394 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 395 | art_work_around_app_jni_bugs: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 396 | GENERATE_GLOBAL_POINTER |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 397 | # save registers that may contain arguments and LR that will be crushed by a call |
| 398 | addiu $sp, $sp, -32 |
| jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 399 | sw $ra, 28($sp) |
| 400 | sw $a3, 24($sp) |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 401 | sw $a2, 20($sp) |
| jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 402 | sw $a1, 16($sp) |
| 403 | sw $a0, 12($sp) |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 404 | move $a0, rSELF # pass Thread::Current |
| 405 | jal artWorkAroundAppJniBugs # (Thread*, $sp) |
| 406 | move $a1, $sp # pass $sp |
| jeffhao | 30a3317 | 2012-10-22 18:16:22 -0700 | [diff] [blame] | 407 | move $t9, $v0 # save target address |
| jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 408 | lw $a0, 12($sp) |
| 409 | lw $a1, 16($sp) |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 410 | lw $a2, 20($sp) |
| jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 411 | lw $a3, 24($sp) |
| 412 | lw $ra, 28($sp) |
| jeffhao | 30a3317 | 2012-10-22 18:16:22 -0700 | [diff] [blame] | 413 | jr $t9 # tail call into JNI routine |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 414 | addiu $sp, $sp, 32 |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 415 | |
| 416 | .global art_handle_fill_data_from_code |
| 417 | .extern artHandleFillArrayDataFromCode |
| 418 | /* |
| 419 | * Entry from managed code that calls artHandleFillArrayDataFromCode and delivers exception on |
| 420 | * failure. |
| 421 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 422 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 423 | art_handle_fill_data_from_code: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 424 | GENERATE_GLOBAL_POINTER |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 425 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case exception allocation triggers GC |
| 426 | move $a2, rSELF # pass Thread::Current |
| 427 | jal artHandleFillArrayDataFromCode # (Array*, const DexFile::Payload*, Thread*, $sp) |
| 428 | move $a3, $sp # pass $sp |
| jeffhao | fc6a30e | 2012-10-18 18:24:15 -0700 | [diff] [blame] | 429 | RETURN_IF_ZERO |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 430 | |
| 431 | .global art_lock_object_from_code |
| 432 | .extern artLockObjectFromCode |
| 433 | /* |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 434 | * Entry from managed code that calls artLockObjectFromCode, may block for GC. |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 435 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 436 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 437 | art_lock_object_from_code: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 438 | GENERATE_GLOBAL_POINTER |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 439 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case we block |
| 440 | move $a1, rSELF # pass Thread::Current |
| 441 | jal artLockObjectFromCode # (Object* obj, Thread*, $sp) |
| 442 | move $a2, $sp # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 443 | RESTORE_REF_ONLY_CALLEE_SAVE_FRAME_AND_RETURN |
| 444 | |
| 445 | .global art_unlock_object_from_code |
| 446 | .extern artUnlockObjectFromCode |
| 447 | /* |
| 448 | * Entry from managed code that calls artUnlockObjectFromCode and delivers exception on failure. |
| 449 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 450 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 451 | art_unlock_object_from_code: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 452 | GENERATE_GLOBAL_POINTER |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 453 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case exception allocation triggers GC |
| 454 | move $a1, rSELF # pass Thread::Current |
| 455 | jal artUnlockObjectFromCode # (Object* obj, Thread*, $sp) |
| 456 | move $a2, $sp # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 457 | RETURN_IF_ZERO |
| 458 | |
| 459 | .global art_check_cast_from_code |
| 460 | .extern artCheckCastFromCode |
| 461 | /* |
| 462 | * Entry from managed code that calls artCheckCastFromCode and delivers exception on failure. |
| 463 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 464 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 465 | art_check_cast_from_code: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 466 | GENERATE_GLOBAL_POINTER |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 467 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case exception allocation triggers GC |
| 468 | move $a2, rSELF # pass Thread::Current |
| 469 | jal artCheckCastFromCode # (Class* a, Class* b, Thread*, $sp) |
| 470 | move $a3, $sp # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 471 | RETURN_IF_ZERO |
| 472 | |
| 473 | .global art_can_put_array_element_from_code |
| 474 | .extern artCanPutArrayElementFromCode |
| 475 | /* |
| 476 | * Entry from managed code that calls artCanPutArrayElementFromCode and delivers exception on |
| 477 | * failure. |
| 478 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 479 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 480 | art_can_put_array_element_from_code: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 481 | GENERATE_GLOBAL_POINTER |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 482 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case exception allocation triggers GC |
| 483 | move $a2, rSELF # pass Thread::Current |
| 484 | jal artCanPutArrayElementFromCode # (Object* element, Class* array_class, Thread*, $sp) |
| 485 | move $a3, $sp # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 486 | RETURN_IF_ZERO |
| 487 | |
| 488 | .global art_initialize_static_storage_from_code |
| 489 | .extern artInitializeStaticStorageFromCode |
| 490 | /* |
| 491 | * Entry from managed code when uninitialized static storage, this stub will run the class |
| 492 | * initializer and deliver the exception on error. On success the static storage base is |
| 493 | * returned. |
| 494 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 495 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 496 | art_initialize_static_storage_from_code: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 497 | GENERATE_GLOBAL_POINTER |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 498 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 499 | move $a2, rSELF # pass Thread::Current |
| 500 | # artInitializeStaticStorageFromCode(uint32_t type_idx, Method* referrer, Thread*, $sp) |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 501 | jal artInitializeStaticStorageFromCode |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 502 | move $a3, $sp # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 503 | RETURN_IF_NONZERO |
| 504 | |
| 505 | .global art_initialize_type_from_code |
| 506 | .extern artInitializeTypeFromCode |
| 507 | /* |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 508 | * Entry from managed code when dex cache misses for a type_idx. |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 509 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 510 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 511 | art_initialize_type_from_code: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 512 | GENERATE_GLOBAL_POINTER |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 513 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 514 | move $a2, rSELF # pass Thread::Current |
| 515 | # artInitializeTypeFromCode(uint32_t type_idx, Method* referrer, Thread*, $sp) |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 516 | jal artInitializeTypeFromCode |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 517 | move $a3, $sp # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 518 | RETURN_IF_NONZERO |
| 519 | |
| 520 | .global art_initialize_type_and_verify_access_from_code |
| 521 | .extern artInitializeTypeAndVerifyAccessFromCode |
| 522 | /* |
| 523 | * 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] | 524 | * miss. |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 525 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 526 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 527 | art_initialize_type_and_verify_access_from_code: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 528 | GENERATE_GLOBAL_POINTER |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 529 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 530 | move $a2, rSELF # pass Thread::Current |
| 531 | # artInitializeTypeFromCode(uint32_t type_idx, Method* referrer, Thread*, $sp) |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 532 | jal artInitializeTypeAndVerifyAccessFromCode |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 533 | move $a3, $sp # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 534 | RETURN_IF_NONZERO |
| 535 | |
| 536 | .global art_get32_static_from_code |
| 537 | .extern artGet32StaticFromCode |
| 538 | /* |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 539 | * 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] | 540 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 541 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 542 | art_get32_static_from_code: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 543 | GENERATE_GLOBAL_POINTER |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 544 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 545 | lw $a1, 64($sp) # pass referrer's Method* |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 546 | move $a2, rSELF # pass Thread::Current |
| jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 547 | jal artGet32StaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*, $sp) |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 548 | move $a3, $sp # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 549 | RETURN_IF_NO_EXCEPTION |
| 550 | |
| 551 | .global art_get64_static_from_code |
| 552 | .extern artGet64StaticFromCode |
| 553 | /* |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 554 | * 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] | 555 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 556 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 557 | art_get64_static_from_code: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 558 | GENERATE_GLOBAL_POINTER |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 559 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 560 | lw $a1, 64($sp) # pass referrer's Method* |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 561 | move $a2, rSELF # pass Thread::Current |
| jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 562 | jal artGet64StaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*, $sp) |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 563 | move $a3, $sp # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 564 | RETURN_IF_NO_EXCEPTION |
| 565 | |
| 566 | .global art_get_obj_static_from_code |
| 567 | .extern artGetObjStaticFromCode |
| 568 | /* |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 569 | * 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] | 570 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 571 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 572 | art_get_obj_static_from_code: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 573 | GENERATE_GLOBAL_POINTER |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 574 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 575 | lw $a1, 64($sp) # pass referrer's Method* |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 576 | move $a2, rSELF # pass Thread::Current |
| jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 577 | jal artGetObjStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*, $sp) |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 578 | move $a3, $sp # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 579 | RETURN_IF_NO_EXCEPTION |
| 580 | |
| 581 | .global art_get32_instance_from_code |
| 582 | .extern artGet32InstanceFromCode |
| 583 | /* |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 584 | * 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] | 585 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 586 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 587 | art_get32_instance_from_code: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 588 | GENERATE_GLOBAL_POINTER |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 589 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 590 | lw $a2, 64($sp) # pass referrer's Method* |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 591 | move $a3, rSELF # pass Thread::Current |
| jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 592 | jal artGet32InstanceFromCode # (field_idx, Object*, referrer, Thread*, $sp) |
| jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 593 | sw $sp, 16($sp) # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 594 | RETURN_IF_NO_EXCEPTION |
| 595 | |
| 596 | .global art_get64_instance_from_code |
| 597 | .extern artGet64InstanceFromCode |
| 598 | /* |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 599 | * 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] | 600 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 601 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 602 | art_get64_instance_from_code: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 603 | GENERATE_GLOBAL_POINTER |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 604 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 605 | lw $a2, 64($sp) # pass referrer's Method* |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 606 | move $a3, rSELF # pass Thread::Current |
| jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 607 | jal artGet64InstanceFromCode # (field_idx, Object*, referrer, Thread*, $sp) |
| jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 608 | sw $sp, 16($sp) # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 609 | RETURN_IF_NO_EXCEPTION |
| 610 | |
| 611 | .global art_get_obj_instance_from_code |
| 612 | .extern artGetObjInstanceFromCode |
| 613 | /* |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 614 | * 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] | 615 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 616 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 617 | art_get_obj_instance_from_code: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 618 | GENERATE_GLOBAL_POINTER |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 619 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 620 | lw $a2, 64($sp) # pass referrer's Method* |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 621 | move $a3, rSELF # pass Thread::Current |
| jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 622 | jal artGetObjInstanceFromCode # (field_idx, Object*, referrer, Thread*, $sp) |
| jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 623 | sw $sp, 16($sp) # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 624 | RETURN_IF_NO_EXCEPTION |
| 625 | |
| 626 | .global art_set32_static_from_code |
| 627 | .extern artSet32StaticFromCode |
| 628 | /* |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 629 | * 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] | 630 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 631 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 632 | art_set32_static_from_code: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 633 | GENERATE_GLOBAL_POINTER |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 634 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 635 | lw $a2, 64($sp) # pass referrer's Method* |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 636 | move $a3, rSELF # pass Thread::Current |
| jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 637 | jal artSet32StaticFromCode # (field_idx, new_val, referrer, Thread*, $sp) |
| jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 638 | sw $sp, 16($sp) # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 639 | RETURN_IF_ZERO |
| 640 | |
| 641 | .global art_set64_static_from_code |
| 642 | .extern artSet32StaticFromCode |
| 643 | /* |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 644 | * 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] | 645 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 646 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 647 | art_set64_static_from_code: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 648 | GENERATE_GLOBAL_POINTER |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 649 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 650 | lw $a1, 64($sp) # pass referrer's Method* |
| jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 651 | sw rSELF, 16($sp) # pass Thread::Current |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 652 | jal artSet64StaticFromCode # (field_idx, referrer, new_val, Thread*, $sp) |
| jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 653 | sw $sp, 20($sp) # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 654 | RETURN_IF_ZERO |
| 655 | |
| 656 | .global art_set_obj_static_from_code |
| 657 | .extern artSetObjStaticFromCode |
| 658 | /* |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 659 | * 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] | 660 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 661 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 662 | art_set_obj_static_from_code: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 663 | GENERATE_GLOBAL_POINTER |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 664 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 665 | lw $a2, 64($sp) # pass referrer's Method* |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 666 | move $a3, rSELF # pass Thread::Current |
| jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 667 | jal artSetObjStaticFromCode # (field_idx, new_val, referrer, Thread*, $sp) |
| jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 668 | sw $sp, 16($sp) # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 669 | RETURN_IF_ZERO |
| 670 | |
| 671 | .global art_set32_instance_from_code |
| 672 | .extern artSet32InstanceFromCode |
| 673 | /* |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 674 | * 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] | 675 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 676 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 677 | art_set32_instance_from_code: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 678 | GENERATE_GLOBAL_POINTER |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 679 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 680 | lw $a3, 64($sp) # pass referrer's Method* |
| jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 681 | sw rSELF, 16($sp) # pass Thread::Current |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 682 | jal artSet32InstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*, $sp) |
| jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 683 | sw $sp, 20($sp) # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 684 | RETURN_IF_ZERO |
| 685 | |
| 686 | .global art_set64_instance_from_code |
| 687 | .extern artSet32InstanceFromCode |
| 688 | /* |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 689 | * 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] | 690 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 691 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 692 | art_set64_instance_from_code: |
| 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 | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 695 | sw rSELF, 16($sp) # pass Thread::Current |
| 696 | jal artSet64InstanceFromCode # (field_idx, Object*, new_val, Thread*, $sp) |
| jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 697 | sw $sp, 20($sp) # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 698 | RETURN_IF_ZERO |
| 699 | |
| 700 | .global art_set_obj_instance_from_code |
| 701 | .extern artSetObjInstanceFromCode |
| 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 an object reference. |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 704 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 705 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 706 | art_set_obj_instance_from_code: |
| 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 |
| 711 | jal artSetObjInstanceFromCode # (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 |
| 714 | |
| 715 | .global art_resolve_string_from_code |
| 716 | .extern artResolveStringFromCode |
| 717 | /* |
| 718 | * Entry from managed code to resolve a string, this stub will allocate a String and deliver an |
| 719 | * exception on error. On success the String is returned. R0 holds the referring method, |
| 720 | * R1 holds the string index. The fast path check for hit in strings cache has already been |
| 721 | * performed. |
| 722 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 723 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 724 | art_resolve_string_from_code: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 725 | GENERATE_GLOBAL_POINTER |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 726 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 727 | move $a2, rSELF # pass Thread::Current |
| 728 | # artResolveStringFromCode(Method* referrer, uint32_t string_idx, Thread*, $sp) |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 729 | jal artResolveStringFromCode |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 730 | move $a3, $sp # pass $sp |
| jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 731 | RETURN_IF_NONZERO |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 732 | |
| 733 | .global art_alloc_object_from_code |
| 734 | .extern artAllocObjectFromCode |
| 735 | /* |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 736 | * Called by managed code to allocate an object. |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 737 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 738 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 739 | art_alloc_object_from_code: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 740 | GENERATE_GLOBAL_POINTER |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 741 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 742 | move $a2, rSELF # pass Thread::Current |
| 743 | jal artAllocObjectFromCode # (uint32_t type_idx, Method* method, Thread*, $sp) |
| 744 | move $a3, $sp # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 745 | RETURN_IF_NONZERO |
| 746 | |
| 747 | .global art_alloc_object_from_code_with_access_check |
| 748 | .extern artAllocObjectFromCodeWithAccessCheck |
| 749 | /* |
| 750 | * 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] | 751 | * access to the created type. |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 752 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 753 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 754 | art_alloc_object_from_code_with_access_check: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 755 | GENERATE_GLOBAL_POINTER |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 756 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 757 | move $a2, rSELF # pass Thread::Current |
| 758 | jal artAllocObjectFromCodeWithAccessCheck # (uint32_t type_idx, Method* method, Thread*, $sp) |
| 759 | move $a3, $sp # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 760 | RETURN_IF_NONZERO |
| 761 | |
| 762 | .global art_alloc_array_from_code |
| 763 | .extern artAllocArrayFromCode |
| 764 | /* |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 765 | * Called by managed code to allocate an array. |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 766 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 767 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 768 | art_alloc_array_from_code: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 769 | GENERATE_GLOBAL_POINTER |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 770 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 771 | move $a3, rSELF # pass Thread::Current |
| 772 | # artAllocArrayFromCode(uint32_t type_idx, Method* method, int32_t component_count, Thread*, $sp) |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 773 | jal artAllocArrayFromCode |
| jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 774 | sw $sp, 16($sp) # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 775 | RETURN_IF_NONZERO |
| 776 | |
| 777 | .global art_alloc_array_from_code_with_access_check |
| 778 | .extern artAllocArrayFromCodeWithAccessCheck |
| 779 | /* |
| 780 | * 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] | 781 | * access to the created type. |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 782 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 783 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 784 | art_alloc_array_from_code_with_access_check: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 785 | GENERATE_GLOBAL_POINTER |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 786 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 787 | move $a3, rSELF # pass Thread::Current |
| 788 | # artAllocArrayFromCodeWithAccessCheck(type_idx, method, component_count, Thread*, $sp) |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 789 | jal artAllocArrayFromCodeWithAccessCheck |
| jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 790 | sw $sp, 16($sp) # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 791 | RETURN_IF_NONZERO |
| 792 | |
| 793 | .global art_check_and_alloc_array_from_code |
| 794 | .extern artCheckAndAllocArrayFromCode |
| 795 | /* |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 796 | * 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] | 797 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 798 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 799 | art_check_and_alloc_array_from_code: |
| 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 |
| 802 | move $a3, rSELF # pass Thread::Current |
| 803 | # artCheckAndAllocArrayFromCode(uint32_t type_idx, Method* method, int32_t count, Thread* , $sp) |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 804 | jal artCheckAndAllocArrayFromCode |
| jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 805 | sw $sp, 16($sp) # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 806 | RETURN_IF_NONZERO |
| 807 | |
| 808 | .global art_check_and_alloc_array_from_code_with_access_check |
| 809 | .extern artCheckAndAllocArrayFromCodeWithAccessCheck |
| 810 | /* |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 811 | * 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] | 812 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 813 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 814 | art_check_and_alloc_array_from_code_with_access_check: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 815 | GENERATE_GLOBAL_POINTER |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 816 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 817 | move $a3, rSELF # pass Thread::Current |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 818 | # artCheckAndAllocArrayFromCodeWithAccessCheck(type_idx, method, count, Thread* , $sp) |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 819 | jal artCheckAndAllocArrayFromCodeWithAccessCheck |
| jeffhao | 4eb68ed | 2012-10-17 16:41:07 -0700 | [diff] [blame] | 820 | sw $sp, 16($sp) # pass $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 821 | RETURN_IF_NONZERO |
| 822 | |
| 823 | .global art_test_suspend |
| 824 | .extern artTestSuspendFromCode |
| 825 | /* |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 826 | * 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] | 827 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 828 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 829 | art_test_suspend: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 830 | GENERATE_GLOBAL_POINTER |
| Ian Rogers | 474b6da | 2012-09-25 00:20:38 -0700 | [diff] [blame] | 831 | lh $a0, THREAD_FLAGS_OFFSET(rSELF) |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 832 | bnez $a0, 1f |
| 833 | addi rSUSPEND, $zero, SUSPEND_CHECK_INTERVAL # reset rSUSPEND to SUSPEND_CHECK_INTERVAL |
| 834 | jr $ra |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 835 | nop |
| 836 | 1: |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 837 | move $a0, rSELF |
| 838 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME # save callee saves for stack crawl |
| 839 | jal artTestSuspendFromCode # (Thread*, $sp) |
| 840 | move $a1, $sp |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 841 | RESTORE_REF_ONLY_CALLEE_SAVE_FRAME_AND_RETURN |
| 842 | |
| 843 | .global art_proxy_invoke_handler |
| 844 | .extern artProxyInvokeHandler |
| 845 | /* |
| 846 | * 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] | 847 | * r0 holds the proxy method; r1, r2 and r3 may contain arguments. |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 848 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 849 | ALIGN_FUNCTION_ENTRY |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 850 | art_proxy_invoke_handler: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 851 | GENERATE_GLOBAL_POINTER |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 852 | SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 853 | sw $a0, 0($sp) # place proxy method at bottom of frame |
| 854 | move $a2, rSELF # pass Thread::Current |
| Ian Rogers | 7db619b | 2013-01-16 18:35:48 -0800 | [diff] [blame^] | 855 | jal artProxyInvokeHandler # (Method* proxy method, receiver, Thread*, SP) |
| Ian Rogers | af6e67a | 2013-01-16 08:38:37 -0800 | [diff] [blame] | 856 | move $a3, $sp # pass $sp |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 857 | lw $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 858 | lw $ra, 44($sp) # restore $ra |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 859 | bnez $t0, 1f |
| 860 | addiu $sp, $sp, 48 # pop frame |
| 861 | jr $ra |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 862 | nop |
| 863 | 1: |
| 864 | DELIVER_PENDING_EXCEPTION |
| 865 | |
| Ian Rogers | 7db619b | 2013-01-16 18:35:48 -0800 | [diff] [blame^] | 866 | .global art_interpreter_entry |
| 867 | .extern artInterpreterEntry |
| 868 | ALIGN_FUNCTION_ENTRY |
| 869 | art_interpreter_entry: |
| 870 | GENERATE_GLOBAL_POINTER |
| 871 | SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME |
| 872 | sw $a0, 0($sp) # place proxy method at bottom of frame |
| 873 | move $a1, rSELF # pass Thread::Current |
| 874 | jal artInterpreterEntry # (Method* method, Thread*, SP) |
| 875 | move $a2, $sp # pass $sp |
| 876 | lw $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ |
| 877 | lw $ra, 44($sp) # restore $ra |
| 878 | bnez $t0, 1f |
| 879 | addiu $sp, $sp, 48 # pop frame |
| 880 | jr $ra |
| 881 | nop |
| 882 | 1: |
| 883 | DELIVER_PENDING_EXCEPTION |
| 884 | |
| jeffhao | 725a957 | 2012-11-13 18:20:12 -0800 | [diff] [blame] | 885 | .global art_instrumentation_entry_from_code |
| 886 | .global art_instrumentation_exit_from_code |
| 887 | .extern artInstrumentationMethodEntryFromCode |
| 888 | .extern artInstrumentationMethodExitFromCode |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 889 | /* |
| jeffhao | 725a957 | 2012-11-13 18:20:12 -0800 | [diff] [blame] | 890 | * Routine that intercepts method calls and returns. |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 891 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 892 | ALIGN_FUNCTION_ENTRY |
| jeffhao | 725a957 | 2012-11-13 18:20:12 -0800 | [diff] [blame] | 893 | art_instrumentation_entry_from_code: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 894 | GENERATE_GLOBAL_POINTER |
| 895 | move $t0, $sp # remember bottom of caller's frame |
| 896 | addiu $sp, $sp, -16 # save arguments (4 words) |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 897 | sw $a0, 0($sp) |
| 898 | sw $a1, 4($sp) |
| 899 | sw $a2, 8($sp) |
| 900 | sw $a3, 12($sp) |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 901 | move $a3, $ra # pass $ra |
| 902 | move $a2, $t0 # pass $sp |
| 903 | jal artInstrumentationMethodEntryFromCode # (Method*, Thread*, SP, LR) |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 904 | move $a1, rSELF # pass Thread::Current |
| jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 905 | move $t9, $v0 # $t9 holds reference to code |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 906 | lw $a0, 0($sp) |
| 907 | lw $a1, 4($sp) |
| 908 | lw $a2, 8($sp) |
| 909 | lw $a3, 12($sp) |
| jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 910 | jalr $t9 # call method |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 911 | addiu $sp, $sp, 16 |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 912 | /* intentional fallthrough */ |
| jeffhao | 725a957 | 2012-11-13 18:20:12 -0800 | [diff] [blame] | 913 | art_instrumentation_exit_from_code: |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 914 | addiu $t9, $ra, 4 # put current address into $t9 to rebuild $gp |
| 915 | GENERATE_GLOBAL_POINTER |
| 916 | move $t0, $sp # remember bottom of caller's frame |
| 917 | addiu $sp, $sp, -16 # save return values |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 918 | sw $v0, 0($sp) |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 919 | sw $v1, 4($sp) |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 920 | move $a1, $t0 # pass $sp |
| 921 | jal artInstrumentationMethodExitFromCode # (Thread*, SP) |
| 922 | move $a0, rSELF # pass Thread::Current |
| 923 | move $t0, $v0 # set aside returned link register |
| 924 | move $ra, $v1 # set link register for deoptimization |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 925 | lw $v0, 0($sp) |
| 926 | lw $v1, 4($sp) |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 927 | jr $t0 # return |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 928 | addiu $sp, $sp, 16 |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 929 | |
| jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 930 | .global art_deoptimize |
| 931 | .extern artDeoptimize |
| 932 | .extern artEnterInterpreterFromDeoptimize |
| 933 | /* |
| 934 | * The thread's enter interpreter flag is set and so we should transition to the interpreter |
| 935 | * rather than allow execution to continue in the frame below. There may be live results in |
| 936 | * registers depending on how complete the operation is when we safepoint - for example, a |
| 937 | * set operation may have completed while a get operation needs writing back into the vregs. |
| 938 | */ |
| 939 | ALIGN_FUNCTION_ENTRY |
| 940 | art_deoptimize: |
| 941 | GENERATE_GLOBAL_POINTER |
| 942 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME |
| 943 | move $a0, $v0 # pass first half of return value |
| 944 | move $a1, $v1 # pass second half of return value |
| 945 | move $a2, rSELF # pass Thread::current |
| 946 | jal artDeoptimize # artDeoptimize(return value, Thread*, SP) |
| 947 | # Returns caller method's frame size. |
| 948 | move $a3, $sp # pass $sp |
| 949 | RESTORE_REF_ONLY_CALLEE_SAVE_FRAME |
| 950 | beqz $v0, 1f # Return if caller was upcall. |
| 951 | add $t9, $sp, $v0 # $t9 == bottom of caller's frame. |
| 952 | lw $ra, -4($t9) # Restore $ra. |
| 953 | move $sp, $t9 # Remove frame. |
| 954 | SETUP_REF_ONLY_CALLEE_SAVE_FRAME |
| 955 | jal artEnterInterpreterFromDeoptimize # Enter interpreter, callee-save ends stack fragment. |
| 956 | nop |
| 957 | RESTORE_REF_ONLY_CALLEE_SAVE_FRAME |
| 958 | 1: |
| 959 | jr $ra # Return to caller. |
| 960 | nop |
| 961 | |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 962 | .global art_shl_long |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 963 | /* |
| 964 | * Long integer shift. This is different from the generic 32/64-bit |
| 965 | * binary operations because vAA/vBB are 64-bit but vCC (the shift |
| 966 | * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low |
| 967 | * 6 bits. |
| 968 | * On entry: |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 969 | * $a0: low word |
| 970 | * $a1: high word |
| 971 | * $a2: shift count |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 972 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 973 | ALIGN_FUNCTION_ENTRY |
| 974 | art_shl_long: |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 975 | /* shl-long vAA, vBB, vCC */ |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 976 | sll $v0, $a0, $a2 # rlo<- alo << (shift&31) |
| 977 | not $v1, $a2 # rhi<- 31-shift (shift is 5b) |
| 978 | srl $a0, 1 |
| 979 | srl $a0, $v1 # alo<- alo >> (32-(shift&31)) |
| 980 | sll $v1, $a1, $a2 # rhi<- ahi << (shift&31) |
| 981 | or $v1, $a0 # rhi<- rhi | alo |
| 982 | andi $a2, 0x20 # shift< shift & 0x20 |
| 983 | movn $v1, $v0, $a2 # rhi<- rlo (if shift&0x20) |
| 984 | jr $ra |
| jeffhao | fc6a30e | 2012-10-18 18:24:15 -0700 | [diff] [blame] | 985 | movn $v0, $zero, $a2 # rlo<- 0 (if shift&0x20) |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 986 | |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 987 | .global art_shr_long |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 988 | /* |
| 989 | * Long integer shift. This is different from the generic 32/64-bit |
| 990 | * binary operations because vAA/vBB are 64-bit but vCC (the shift |
| 991 | * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low |
| 992 | * 6 bits. |
| 993 | * On entry: |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 994 | * $a0: low word |
| 995 | * $a1: high word |
| 996 | * $a2: shift count |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 997 | */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 998 | ALIGN_FUNCTION_ENTRY |
| 999 | art_shr_long: |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1000 | sra $v1, $a1, $a2 # rhi<- ahi >> (shift&31) |
| 1001 | srl $v0, $a0, $a2 # rlo<- alo >> (shift&31) |
| 1002 | sra $a3, $a1, 31 # $a3<- sign(ah) |
| 1003 | not $a0, $a2 # alo<- 31-shift (shift is 5b) |
| 1004 | sll $a1, 1 |
| 1005 | sll $a1, $a0 # ahi<- ahi << (32-(shift&31)) |
| 1006 | or $v0, $a1 # rlo<- rlo | ahi |
| 1007 | andi $a2, 0x20 # shift & 0x20 |
| 1008 | movn $v0, $v1, $a2 # rlo<- rhi (if shift&0x20) |
| 1009 | jr $ra |
| 1010 | movn $v1, $a3, $a2 # rhi<- sign(ahi) (if shift&0x20) |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1011 | |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1012 | .global art_ushr_long |
| buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1013 | /* |
| 1014 | * Long integer shift. This is different from the generic 32/64-bit |
| 1015 | * binary operations because vAA/vBB are 64-bit but vCC (the shift |
| 1016 | * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low |
| 1017 | * 6 bits. |
| 1018 | * On entry: |
| 1019 | * r0: low word |
| 1020 | * r1: high word |
| 1021 | * r2: shift count |
| 1022 | */ |
| 1023 | /* ushr-long vAA, vBB, vCC */ |
| Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 1024 | ALIGN_FUNCTION_ENTRY |
| 1025 | art_ushr_long: |
| jeffhao | fc6a30e | 2012-10-18 18:24:15 -0700 | [diff] [blame] | 1026 | srl $v1, $a1, $a2 # rhi<- ahi >> (shift&31) |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1027 | srl $v0, $a0, $a2 # rlo<- alo >> (shift&31) |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1028 | not $a0, $a2 # alo<- 31-shift (shift is 5b) |
| 1029 | sll $a1, 1 |
| 1030 | sll $a1, $a0 # ahi<- ahi << (32-(shift&31)) |
| 1031 | or $v0, $a1 # rlo<- rlo | ahi |
| 1032 | andi $a2, 0x20 # shift & 0x20 |
| 1033 | movn $v0, $v1, $a2 # rlo<- rhi (if shift&0x20) |
| 1034 | jr $ra |
| jeffhao | fc6a30e | 2012-10-18 18:24:15 -0700 | [diff] [blame] | 1035 | movn $v1, $zero, $a2 # rhi<- 0 (if shift&0x20) |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1036 | |
| 1037 | .global art_indexof |
| 1038 | ALIGN_FUNCTION_ENTRY |
| 1039 | art_indexof: |
| 1040 | jr $ra |
| jeffhao | 0703060 | 2012-09-26 14:33:14 -0700 | [diff] [blame] | 1041 | nop |
| jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1042 | |
| 1043 | .global art_string_compareto |
| 1044 | ALIGN_FUNCTION_ENTRY |
| 1045 | art_string_compareto: |
| 1046 | jr $ra |
| jeffhao | 0703060 | 2012-09-26 14:33:14 -0700 | [diff] [blame] | 1047 | nop |