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