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 |
Andreas Gampe | a4e0e67 | 2015-05-27 18:31:42 -0700 | [diff] [blame] | 40 | addiu $sp, $sp, -96 |
| 41 | .cfi_adjust_cfa_offset 96 |
Andreas Gampe | 5c1e435 | 2014-04-21 19:28:24 -0700 | [diff] [blame] | 42 | |
| 43 | // Ugly compile-time check, but we only have the preprocessor. |
Andreas Gampe | a4e0e67 | 2015-05-27 18:31:42 -0700 | [diff] [blame] | 44 | #if (FRAME_SIZE_SAVE_ALL_CALLEE_SAVE != 96) |
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 | |
Andreas Gampe | a4e0e67 | 2015-05-27 18:31:42 -0700 | [diff] [blame] | 48 | sw $ra, 92($sp) |
| 49 | .cfi_rel_offset 31, 92 |
| 50 | sw $s8, 88($sp) |
| 51 | .cfi_rel_offset 30, 88 |
| 52 | sw $gp, 84($sp) |
| 53 | .cfi_rel_offset 28, 84 |
| 54 | sw $s7, 80($sp) |
| 55 | .cfi_rel_offset 23, 80 |
| 56 | sw $s6, 76($sp) |
| 57 | .cfi_rel_offset 22, 76 |
| 58 | sw $s5, 72($sp) |
| 59 | .cfi_rel_offset 21, 72 |
| 60 | sw $s4, 68($sp) |
| 61 | .cfi_rel_offset 20, 68 |
| 62 | sw $s3, 64($sp) |
| 63 | .cfi_rel_offset 19, 64 |
| 64 | sw $s2, 60($sp) |
| 65 | .cfi_rel_offset 18, 60 |
| 66 | sw $s1, 56($sp) |
| 67 | .cfi_rel_offset 17, 56 |
| 68 | sw $s0, 52($sp) |
| 69 | .cfi_rel_offset 16, 52 |
| 70 | |
| 71 | SDu $f30, $f31, 44, $sp, $t1 |
| 72 | SDu $f28, $f29, 36, $sp, $t1 |
| 73 | SDu $f26, $f27, 28, $sp, $t1 |
| 74 | SDu $f24, $f25, 20, $sp, $t1 |
| 75 | SDu $f22, $f23, 12, $sp, $t1 |
| 76 | SDu $f20, $f21, 4, $sp, $t1 |
| 77 | |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 78 | # 1 word for holding Method* |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 79 | |
Douglas Leung | 4af77b7 | 2014-10-22 16:32:28 -0700 | [diff] [blame] | 80 | lw $t0, %got(_ZN3art7Runtime9instance_E)($gp) |
| 81 | lw $t0, 0($t0) |
Douglas Leung | 4af77b7 | 2014-10-22 16:32:28 -0700 | [diff] [blame] | 82 | lw $t0, RUNTIME_SAVE_ALL_CALLEE_SAVE_FRAME_OFFSET($t0) |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 83 | sw $t0, 0($sp) # Place Method* at bottom of stack. |
| 84 | 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] | 85 | addiu $sp, $sp, -ARG_SLOT_SIZE # reserve argument slots on the stack |
| 86 | .cfi_adjust_cfa_offset ARG_SLOT_SIZE |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 87 | .endm |
| 88 | |
| 89 | /* |
| 90 | * Macro that sets up the callee save frame to conform with |
| 91 | * Runtime::CreateCalleeSaveMethod(kRefsOnly). Restoration assumes non-moving GC. |
| 92 | * Does not include rSUSPEND or rSELF |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 93 | * callee-save: $s2-$s8 + $gp + $ra, 9 total + 2 words padding + 1 word to hold Method* |
| 94 | * Clobbers $t0 and $sp |
| 95 | * Allocates ARG_SLOT_SIZE bytes at the bottom of the stack for arg slots. |
| 96 | * 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] | 97 | */ |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 98 | .macro SETUP_REFS_ONLY_CALLEE_SAVE_FRAME |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 99 | addiu $sp, $sp, -48 |
| 100 | .cfi_adjust_cfa_offset 48 |
Andreas Gampe | 5c1e435 | 2014-04-21 19:28:24 -0700 | [diff] [blame] | 101 | |
| 102 | // Ugly compile-time check, but we only have the preprocessor. |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 103 | #if (FRAME_SIZE_REFS_ONLY_CALLEE_SAVE != 48) |
Andreas Gampe | 5c1e435 | 2014-04-21 19:28:24 -0700 | [diff] [blame] | 104 | #error "REFS_ONLY_CALLEE_SAVE_FRAME(MIPS) size not as expected." |
| 105 | #endif |
| 106 | |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 107 | sw $ra, 44($sp) |
| 108 | .cfi_rel_offset 31, 44 |
| 109 | sw $s8, 40($sp) |
| 110 | .cfi_rel_offset 30, 40 |
| 111 | sw $gp, 36($sp) |
| 112 | .cfi_rel_offset 28, 36 |
| 113 | sw $s7, 32($sp) |
| 114 | .cfi_rel_offset 23, 32 |
| 115 | sw $s6, 28($sp) |
| 116 | .cfi_rel_offset 22, 28 |
| 117 | sw $s5, 24($sp) |
| 118 | .cfi_rel_offset 21, 24 |
| 119 | sw $s4, 20($sp) |
| 120 | .cfi_rel_offset 20, 20 |
| 121 | sw $s3, 16($sp) |
| 122 | .cfi_rel_offset 19, 16 |
| 123 | sw $s2, 12($sp) |
| 124 | .cfi_rel_offset 18, 12 |
| 125 | # 2 words for alignment and bottom word will hold Method* |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 126 | |
Douglas Leung | 4af77b7 | 2014-10-22 16:32:28 -0700 | [diff] [blame] | 127 | lw $t0, %got(_ZN3art7Runtime9instance_E)($gp) |
| 128 | lw $t0, 0($t0) |
Douglas Leung | 4af77b7 | 2014-10-22 16:32:28 -0700 | [diff] [blame] | 129 | lw $t0, RUNTIME_REFS_ONLY_CALLEE_SAVE_FRAME_OFFSET($t0) |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 130 | sw $t0, 0($sp) # Place Method* at bottom of stack. |
| 131 | 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] | 132 | addiu $sp, $sp, -ARG_SLOT_SIZE # reserve argument slots on the stack |
| 133 | .cfi_adjust_cfa_offset ARG_SLOT_SIZE |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 134 | .endm |
| 135 | |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 136 | .macro RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 137 | addiu $sp, $sp, ARG_SLOT_SIZE # remove argument slots on the stack |
| 138 | .cfi_adjust_cfa_offset -ARG_SLOT_SIZE |
| 139 | lw $ra, 44($sp) |
Dave Allison | bbb32c2 | 2013-11-05 18:25:18 -0800 | [diff] [blame] | 140 | .cfi_restore 31 |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 141 | lw $s8, 40($sp) |
Dave Allison | bbb32c2 | 2013-11-05 18:25:18 -0800 | [diff] [blame] | 142 | .cfi_restore 30 |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 143 | lw $gp, 36($sp) |
Dave Allison | bbb32c2 | 2013-11-05 18:25:18 -0800 | [diff] [blame] | 144 | .cfi_restore 28 |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 145 | lw $s7, 32($sp) |
Dave Allison | bbb32c2 | 2013-11-05 18:25:18 -0800 | [diff] [blame] | 146 | .cfi_restore 23 |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 147 | lw $s6, 28($sp) |
Dave Allison | bbb32c2 | 2013-11-05 18:25:18 -0800 | [diff] [blame] | 148 | .cfi_restore 22 |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 149 | lw $s5, 24($sp) |
Dave Allison | bbb32c2 | 2013-11-05 18:25:18 -0800 | [diff] [blame] | 150 | .cfi_restore 21 |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 151 | lw $s4, 20($sp) |
Dave Allison | bbb32c2 | 2013-11-05 18:25:18 -0800 | [diff] [blame] | 152 | .cfi_restore 20 |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 153 | lw $s3, 16($sp) |
Dave Allison | bbb32c2 | 2013-11-05 18:25:18 -0800 | [diff] [blame] | 154 | .cfi_restore 19 |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 155 | lw $s2, 12($sp) |
Dave Allison | bbb32c2 | 2013-11-05 18:25:18 -0800 | [diff] [blame] | 156 | .cfi_restore 18 |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 157 | addiu $sp, $sp, 48 |
| 158 | .cfi_adjust_cfa_offset -48 |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 159 | .endm |
| 160 | |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 161 | .macro RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME_AND_RETURN |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 162 | RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME |
Andreas Gampe | 8d36591 | 2015-01-13 11:32:32 -0800 | [diff] [blame] | 163 | jalr $zero, $ra |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 164 | nop |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 165 | .endm |
| 166 | |
| 167 | /* |
| 168 | * Macro that sets up the callee save frame to conform with |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 169 | * Runtime::CreateCalleeSaveMethod(kRefsAndArgs). |
Jeff Hao | 1f3bc2f | 2013-04-30 15:17:19 -0700 | [diff] [blame] | 170 | * 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] | 171 | */ |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 172 | .macro SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME_REGISTERS_ONLY |
Goran Jakovljevic | ff73498 | 2015-08-24 12:58:55 +0000 | [diff] [blame] | 173 | addiu $sp, $sp, -80 |
| 174 | .cfi_adjust_cfa_offset 80 |
Andreas Gampe | 5c1e435 | 2014-04-21 19:28:24 -0700 | [diff] [blame] | 175 | |
| 176 | // Ugly compile-time check, but we only have the preprocessor. |
Goran Jakovljevic | ff73498 | 2015-08-24 12:58:55 +0000 | [diff] [blame] | 177 | #if (FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE != 80) |
Andreas Gampe | 5c1e435 | 2014-04-21 19:28:24 -0700 | [diff] [blame] | 178 | #error "REFS_AND_ARGS_CALLEE_SAVE_FRAME(MIPS) size not as expected." |
| 179 | #endif |
| 180 | |
Goran Jakovljevic | ff73498 | 2015-08-24 12:58:55 +0000 | [diff] [blame] | 181 | sw $ra, 76($sp) |
| 182 | .cfi_rel_offset 31, 76 |
| 183 | sw $s8, 72($sp) |
| 184 | .cfi_rel_offset 30, 72 |
| 185 | sw $gp, 68($sp) |
| 186 | .cfi_rel_offset 28, 68 |
| 187 | sw $s7, 64($sp) |
| 188 | .cfi_rel_offset 23, 64 |
| 189 | sw $s6, 60($sp) |
| 190 | .cfi_rel_offset 22, 60 |
| 191 | sw $s5, 56($sp) |
| 192 | .cfi_rel_offset 21, 56 |
| 193 | sw $s4, 52($sp) |
| 194 | .cfi_rel_offset 20, 52 |
| 195 | sw $s3, 48($sp) |
| 196 | .cfi_rel_offset 19, 48 |
| 197 | sw $s2, 44($sp) |
| 198 | .cfi_rel_offset 18, 44 |
| 199 | sw $a3, 40($sp) |
| 200 | .cfi_rel_offset 7, 40 |
| 201 | sw $a2, 36($sp) |
| 202 | .cfi_rel_offset 6, 36 |
| 203 | sw $a1, 32($sp) |
| 204 | .cfi_rel_offset 5, 32 |
| 205 | SDu $f14, $f15, 24, $sp, $t0 |
| 206 | SDu $f12, $f13, 16, $sp, $t0 |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 207 | # bottom will hold Method* |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 208 | .endm |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 209 | |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 210 | /* |
| 211 | * Macro that sets up the callee save frame to conform with |
| 212 | * Runtime::CreateCalleeSaveMethod(kRefsAndArgs). Restoration assumes non-moving GC. |
Goran Jakovljevic | ff73498 | 2015-08-24 12:58:55 +0000 | [diff] [blame] | 213 | * callee-save: $a1-$a3, $f12-$f15, $s2-$s8 + $gp + $ra, 12 total + 3 words padding + method* |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 214 | * Clobbers $t0 and $sp |
| 215 | * Allocates ARG_SLOT_SIZE bytes at the bottom of the stack for arg slots. |
| 216 | * Reserves FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE + ARG_SLOT_SIZE bytes on the stack |
| 217 | */ |
| 218 | .macro SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME |
| 219 | SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME_REGISTERS_ONLY |
Douglas Leung | 4af77b7 | 2014-10-22 16:32:28 -0700 | [diff] [blame] | 220 | lw $t0, %got(_ZN3art7Runtime9instance_E)($gp) |
| 221 | lw $t0, 0($t0) |
Douglas Leung | 4af77b7 | 2014-10-22 16:32:28 -0700 | [diff] [blame] | 222 | lw $t0, RUNTIME_REFS_AND_ARGS_CALLEE_SAVE_FRAME_OFFSET($t0) |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 223 | sw $t0, 0($sp) # Place Method* at bottom of stack. |
| 224 | 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] | 225 | addiu $sp, $sp, -ARG_SLOT_SIZE # reserve argument slots on the stack |
| 226 | .cfi_adjust_cfa_offset ARG_SLOT_SIZE |
| 227 | .endm |
| 228 | |
| 229 | /* |
| 230 | * Macro that sets up the callee save frame to conform with |
| 231 | * Runtime::CreateCalleeSaveMethod(kRefsAndArgs). Restoration assumes non-moving GC. |
Goran Jakovljevic | ff73498 | 2015-08-24 12:58:55 +0000 | [diff] [blame] | 232 | * callee-save: $a1-$a3, $f12-$f15, $s2-$s8 + $gp + $ra, 12 total + 3 words padding + method* |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 233 | * Clobbers $sp |
| 234 | * Use $a0 as the Method* and loads it into bottom of stack. |
| 235 | * Allocates ARG_SLOT_SIZE bytes at the bottom of the stack for arg slots. |
| 236 | * Reserves FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE + ARG_SLOT_SIZE bytes on the stack |
| 237 | */ |
| 238 | .macro SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME_WITH_METHOD_IN_A0 |
| 239 | SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME_REGISTERS_ONLY |
| 240 | sw $a0, 0($sp) # Place Method* at bottom of stack. |
| 241 | sw $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF) # Place sp in Thread::Current()->top_quick_frame. |
| 242 | addiu $sp, $sp, -ARG_SLOT_SIZE # reserve argument slots on the stack |
| 243 | .cfi_adjust_cfa_offset ARG_SLOT_SIZE |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 244 | .endm |
| 245 | |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 246 | .macro RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 247 | addiu $sp, $sp, ARG_SLOT_SIZE # remove argument slots on the stack |
| 248 | .cfi_adjust_cfa_offset -ARG_SLOT_SIZE |
Goran Jakovljevic | ff73498 | 2015-08-24 12:58:55 +0000 | [diff] [blame] | 249 | lw $ra, 76($sp) |
Dave Allison | bbb32c2 | 2013-11-05 18:25:18 -0800 | [diff] [blame] | 250 | .cfi_restore 31 |
Goran Jakovljevic | ff73498 | 2015-08-24 12:58:55 +0000 | [diff] [blame] | 251 | lw $s8, 72($sp) |
Dave Allison | bbb32c2 | 2013-11-05 18:25:18 -0800 | [diff] [blame] | 252 | .cfi_restore 30 |
Goran Jakovljevic | ff73498 | 2015-08-24 12:58:55 +0000 | [diff] [blame] | 253 | lw $gp, 68($sp) |
Dave Allison | bbb32c2 | 2013-11-05 18:25:18 -0800 | [diff] [blame] | 254 | .cfi_restore 28 |
Goran Jakovljevic | ff73498 | 2015-08-24 12:58:55 +0000 | [diff] [blame] | 255 | lw $s7, 64($sp) |
Dave Allison | bbb32c2 | 2013-11-05 18:25:18 -0800 | [diff] [blame] | 256 | .cfi_restore 23 |
Goran Jakovljevic | ff73498 | 2015-08-24 12:58:55 +0000 | [diff] [blame] | 257 | lw $s6, 60($sp) |
Dave Allison | bbb32c2 | 2013-11-05 18:25:18 -0800 | [diff] [blame] | 258 | .cfi_restore 22 |
Goran Jakovljevic | ff73498 | 2015-08-24 12:58:55 +0000 | [diff] [blame] | 259 | lw $s5, 56($sp) |
Dave Allison | bbb32c2 | 2013-11-05 18:25:18 -0800 | [diff] [blame] | 260 | .cfi_restore 21 |
Goran Jakovljevic | ff73498 | 2015-08-24 12:58:55 +0000 | [diff] [blame] | 261 | lw $s4, 52($sp) |
Dave Allison | bbb32c2 | 2013-11-05 18:25:18 -0800 | [diff] [blame] | 262 | .cfi_restore 20 |
Goran Jakovljevic | ff73498 | 2015-08-24 12:58:55 +0000 | [diff] [blame] | 263 | lw $s3, 48($sp) |
Dave Allison | bbb32c2 | 2013-11-05 18:25:18 -0800 | [diff] [blame] | 264 | .cfi_restore 19 |
Goran Jakovljevic | ff73498 | 2015-08-24 12:58:55 +0000 | [diff] [blame] | 265 | lw $s2, 44($sp) |
Dave Allison | bbb32c2 | 2013-11-05 18:25:18 -0800 | [diff] [blame] | 266 | .cfi_restore 18 |
Goran Jakovljevic | ff73498 | 2015-08-24 12:58:55 +0000 | [diff] [blame] | 267 | lw $a3, 40($sp) |
Dave Allison | bbb32c2 | 2013-11-05 18:25:18 -0800 | [diff] [blame] | 268 | .cfi_restore 7 |
Goran Jakovljevic | ff73498 | 2015-08-24 12:58:55 +0000 | [diff] [blame] | 269 | lw $a2, 36($sp) |
Dave Allison | bbb32c2 | 2013-11-05 18:25:18 -0800 | [diff] [blame] | 270 | .cfi_restore 6 |
Goran Jakovljevic | ff73498 | 2015-08-24 12:58:55 +0000 | [diff] [blame] | 271 | lw $a1, 32($sp) |
Dave Allison | bbb32c2 | 2013-11-05 18:25:18 -0800 | [diff] [blame] | 272 | .cfi_restore 5 |
Goran Jakovljevic | ff73498 | 2015-08-24 12:58:55 +0000 | [diff] [blame] | 273 | LDu $f14, $f15, 24, $sp, $t1 |
| 274 | LDu $f12, $f13, 16, $sp, $t1 |
| 275 | addiu $sp, $sp, 80 # pop frame |
| 276 | .cfi_adjust_cfa_offset -80 |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 277 | .endm |
| 278 | |
| 279 | /* |
| 280 | * Macro that set calls through to artDeliverPendingExceptionFromCode, where the pending |
| 281 | * exception is Thread::Current()->exception_ |
| 282 | */ |
| 283 | .macro DELIVER_PENDING_EXCEPTION |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 284 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME # save callee saves for throw |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 285 | la $t9, artDeliverPendingExceptionFromCode |
Andreas Gampe | 8d36591 | 2015-01-13 11:32:32 -0800 | [diff] [blame] | 286 | jalr $zero, $t9 # artDeliverPendingExceptionFromCode(Thread*) |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 287 | move $a0, rSELF # pass Thread::Current |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 288 | .endm |
| 289 | |
| 290 | .macro RETURN_IF_NO_EXCEPTION |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 291 | lw $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 292 | RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 293 | bnez $t0, 1f # success if no exception is pending |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 294 | nop |
Andreas Gampe | 8d36591 | 2015-01-13 11:32:32 -0800 | [diff] [blame] | 295 | jalr $zero, $ra |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 296 | nop |
| 297 | 1: |
| 298 | DELIVER_PENDING_EXCEPTION |
| 299 | .endm |
| 300 | |
| 301 | .macro RETURN_IF_ZERO |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 302 | RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 303 | bnez $v0, 1f # success? |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 304 | nop |
Andreas Gampe | 8d36591 | 2015-01-13 11:32:32 -0800 | [diff] [blame] | 305 | jalr $zero, $ra # return on success |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 306 | nop |
| 307 | 1: |
| 308 | DELIVER_PENDING_EXCEPTION |
| 309 | .endm |
| 310 | |
Andreas Gampe | 1cc7dba | 2014-12-17 18:43:01 -0800 | [diff] [blame] | 311 | .macro RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 312 | RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 313 | beqz $v0, 1f # success? |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 314 | nop |
Andreas Gampe | 8d36591 | 2015-01-13 11:32:32 -0800 | [diff] [blame] | 315 | jalr $zero, $ra # return on success |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 316 | nop |
| 317 | 1: |
| 318 | DELIVER_PENDING_EXCEPTION |
| 319 | .endm |
| 320 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 321 | /* |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 322 | * On entry $a0 is uint32_t* gprs_ and $a1 is uint32_t* fprs_ |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 323 | * FIXME: just guessing about the shape of the jmpbuf. Where will pc be? |
| 324 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 325 | ENTRY art_quick_do_long_jump |
Duane Sand | e34652f | 2014-11-04 11:09:36 -0800 | [diff] [blame] | 326 | LDu $f0, $f1, 0*8, $a1, $t1 |
| 327 | LDu $f2, $f3, 1*8, $a1, $t1 |
| 328 | LDu $f4, $f5, 2*8, $a1, $t1 |
| 329 | LDu $f6, $f7, 3*8, $a1, $t1 |
| 330 | LDu $f8, $f9, 4*8, $a1, $t1 |
| 331 | LDu $f10, $f11, 5*8, $a1, $t1 |
| 332 | LDu $f12, $f13, 6*8, $a1, $t1 |
| 333 | LDu $f14, $f15, 7*8, $a1, $t1 |
| 334 | LDu $f16, $f17, 8*8, $a1, $t1 |
| 335 | LDu $f18, $f19, 9*8, $a1, $t1 |
| 336 | LDu $f20, $f21, 10*8, $a1, $t1 |
| 337 | LDu $f22, $f23, 11*8, $a1, $t1 |
| 338 | LDu $f24, $f25, 12*8, $a1, $t1 |
| 339 | LDu $f26, $f27, 13*8, $a1, $t1 |
| 340 | LDu $f28, $f29, 14*8, $a1, $t1 |
| 341 | LDu $f30, $f31, 15*8, $a1, $t1 |
| 342 | |
Chris Dearman | 748dd95 | 2014-05-23 10:47:01 -0700 | [diff] [blame] | 343 | .set push |
| 344 | .set nomacro |
| 345 | .set noat |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 346 | lw $at, 4($a0) |
Chris Dearman | 748dd95 | 2014-05-23 10:47:01 -0700 | [diff] [blame] | 347 | .set pop |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 348 | lw $v0, 8($a0) |
| 349 | lw $v1, 12($a0) |
| 350 | lw $a1, 20($a0) |
| 351 | lw $a2, 24($a0) |
| 352 | lw $a3, 28($a0) |
| 353 | lw $t0, 32($a0) |
| 354 | lw $t1, 36($a0) |
| 355 | lw $t2, 40($a0) |
| 356 | lw $t3, 44($a0) |
| 357 | lw $t4, 48($a0) |
| 358 | lw $t5, 52($a0) |
| 359 | lw $t6, 56($a0) |
| 360 | lw $t7, 60($a0) |
| 361 | lw $s0, 64($a0) |
| 362 | lw $s1, 68($a0) |
| 363 | lw $s2, 72($a0) |
| 364 | lw $s3, 76($a0) |
| 365 | lw $s4, 80($a0) |
| 366 | lw $s5, 84($a0) |
| 367 | lw $s6, 88($a0) |
| 368 | lw $s7, 92($a0) |
| 369 | lw $t8, 96($a0) |
| 370 | lw $t9, 100($a0) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 371 | lw $gp, 112($a0) |
| 372 | lw $sp, 116($a0) |
| 373 | lw $fp, 120($a0) |
| 374 | lw $ra, 124($a0) |
| 375 | lw $a0, 16($a0) |
| 376 | move $v0, $zero # clear result registers r0 and r1 |
Goran Jakovljevic | 7596996 | 2015-10-27 12:29:07 +0100 | [diff] [blame] | 377 | jalr $zero, $t9 # do long jump |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 378 | move $v1, $zero |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 379 | END art_quick_do_long_jump |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 380 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 381 | /* |
| 382 | * Called by managed code, saves most registers (forms basis of long jump context) and passes |
| 383 | * the bottom of the stack. artDeliverExceptionFromCode will place the callee save Method* at |
Lazar Trsic | 84bc06e | 2015-06-10 16:05:46 +0200 | [diff] [blame] | 384 | * the bottom of the thread. On entry a0 holds Throwable* |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 385 | */ |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 386 | ENTRY art_quick_deliver_exception |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 387 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 388 | la $t9, artDeliverExceptionFromCode |
Andreas Gampe | 8d36591 | 2015-01-13 11:32:32 -0800 | [diff] [blame] | 389 | jalr $zero, $t9 # artDeliverExceptionFromCode(Throwable*, Thread*) |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 390 | move $a1, rSELF # pass Thread::Current |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 391 | END art_quick_deliver_exception |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 392 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 393 | /* |
| 394 | * Called by managed code to create and deliver a NullPointerException |
| 395 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 396 | .extern artThrowNullPointerExceptionFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 397 | ENTRY art_quick_throw_null_pointer_exception |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 398 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 399 | la $t9, artThrowNullPointerExceptionFromCode |
Andreas Gampe | 8d36591 | 2015-01-13 11:32:32 -0800 | [diff] [blame] | 400 | jalr $zero, $t9 # artThrowNullPointerExceptionFromCode(Thread*) |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 401 | move $a0, rSELF # pass Thread::Current |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 402 | END art_quick_throw_null_pointer_exception |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 403 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 404 | /* |
| 405 | * Called by managed code to create and deliver an ArithmeticException |
| 406 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 407 | .extern artThrowDivZeroFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 408 | ENTRY art_quick_throw_div_zero |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 409 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 410 | la $t9, artThrowDivZeroFromCode |
Andreas Gampe | 8d36591 | 2015-01-13 11:32:32 -0800 | [diff] [blame] | 411 | jalr $zero, $t9 # artThrowDivZeroFromCode(Thread*) |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 412 | move $a0, rSELF # pass Thread::Current |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 413 | END art_quick_throw_div_zero |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 414 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 415 | /* |
| 416 | * Called by managed code to create and deliver an ArrayIndexOutOfBoundsException |
| 417 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 418 | .extern artThrowArrayBoundsFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 419 | ENTRY art_quick_throw_array_bounds |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 420 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 421 | la $t9, artThrowArrayBoundsFromCode |
Andreas Gampe | 8d36591 | 2015-01-13 11:32:32 -0800 | [diff] [blame] | 422 | jalr $zero, $t9 # artThrowArrayBoundsFromCode(index, limit, Thread*) |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 423 | move $a2, rSELF # pass Thread::Current |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 424 | END art_quick_throw_array_bounds |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 425 | |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 426 | /* |
| 427 | * Called by managed code to create and deliver a StackOverflowError. |
| 428 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 429 | .extern artThrowStackOverflowFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 430 | ENTRY art_quick_throw_stack_overflow |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 431 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 432 | la $t9, artThrowStackOverflowFromCode |
Andreas Gampe | 8d36591 | 2015-01-13 11:32:32 -0800 | [diff] [blame] | 433 | jalr $zero, $t9 # artThrowStackOverflowFromCode(Thread*) |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 434 | move $a0, rSELF # pass Thread::Current |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 435 | END art_quick_throw_stack_overflow |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 436 | |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 437 | /* |
| 438 | * Called by managed code to create and deliver a NoSuchMethodError. |
| 439 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 440 | .extern artThrowNoSuchMethodFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 441 | ENTRY art_quick_throw_no_such_method |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 442 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 443 | la $t9, artThrowNoSuchMethodFromCode |
Andreas Gampe | 8d36591 | 2015-01-13 11:32:32 -0800 | [diff] [blame] | 444 | jalr $zero, $t9 # artThrowNoSuchMethodFromCode(method_idx, Thread*) |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 445 | move $a1, rSELF # pass Thread::Current |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 446 | END art_quick_throw_no_such_method |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 447 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 448 | /* |
| 449 | * All generated callsites for interface invokes and invocation slow paths will load arguments |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 450 | * 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] | 451 | * 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] | 452 | * 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] | 453 | * |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 454 | * The helper will attempt to locate the target and return a 64-bit result in $v0/$v1 consisting |
| 455 | * of the target Method* in $v0 and method->code_ in $v1. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 456 | * |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 457 | * 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] | 458 | * thread and we branch to another stub to deliver it. |
| 459 | * |
| 460 | * On success this wrapper will restore arguments and *jump* to the target, leaving the lr |
| 461 | * pointing back to the original caller. |
| 462 | */ |
Andreas Gampe | 3031c8d | 2015-07-13 20:11:06 -0700 | [diff] [blame] | 463 | .macro INVOKE_TRAMPOLINE_BODY cxx_name |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 464 | .extern \cxx_name |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 465 | 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] | 466 | move $a2, rSELF # pass Thread::Current |
| 467 | jal \cxx_name # (method_idx, this, Thread*, $sp) |
| 468 | addiu $a3, $sp, ARG_SLOT_SIZE # pass $sp (remove arg slots) |
| 469 | move $a0, $v0 # save target Method* |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 470 | RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 471 | beqz $v0, 1f |
Nicolas Geoffray | 7ea6a17 | 2015-05-19 18:58:54 +0100 | [diff] [blame] | 472 | move $t9, $v1 # save $v0->code_ |
Andreas Gampe | 8d36591 | 2015-01-13 11:32:32 -0800 | [diff] [blame] | 473 | jalr $zero, $t9 |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 474 | nop |
| 475 | 1: |
| 476 | DELIVER_PENDING_EXCEPTION |
Andreas Gampe | 3031c8d | 2015-07-13 20:11:06 -0700 | [diff] [blame] | 477 | .endm |
| 478 | .macro INVOKE_TRAMPOLINE c_name, cxx_name |
| 479 | ENTRY \c_name |
| 480 | INVOKE_TRAMPOLINE_BODY \cxx_name |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 481 | END \c_name |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 482 | .endm |
| 483 | |
Logan Chien | 8dbb708 | 2013-01-25 20:31:17 +0800 | [diff] [blame] | 484 | INVOKE_TRAMPOLINE art_quick_invoke_interface_trampoline_with_access_check, artInvokeInterfaceTrampolineWithAccessCheck |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 485 | |
Logan Chien | 8dbb708 | 2013-01-25 20:31:17 +0800 | [diff] [blame] | 486 | INVOKE_TRAMPOLINE art_quick_invoke_static_trampoline_with_access_check, artInvokeStaticTrampolineWithAccessCheck |
| 487 | INVOKE_TRAMPOLINE art_quick_invoke_direct_trampoline_with_access_check, artInvokeDirectTrampolineWithAccessCheck |
| 488 | INVOKE_TRAMPOLINE art_quick_invoke_super_trampoline_with_access_check, artInvokeSuperTrampolineWithAccessCheck |
| 489 | INVOKE_TRAMPOLINE art_quick_invoke_virtual_trampoline_with_access_check, artInvokeVirtualTrampolineWithAccessCheck |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 490 | |
Goran Jakovljevic | ff73498 | 2015-08-24 12:58:55 +0000 | [diff] [blame] | 491 | .macro LOAD_WORD_TO_REG reg, next_arg, index, label |
| 492 | lw $\reg, -4($\next_arg) # next_arg points to argument after the current one (offset is 4) |
| 493 | b \label |
| 494 | addiu $\index, 1 |
| 495 | .endm |
| 496 | |
| 497 | .macro LOAD_LONG_TO_REG reg1, reg2, next_arg, index, label |
| 498 | lw $\reg1, -8($\next_arg) # next_arg points to argument after the current one (offset is 8) |
| 499 | lw $\reg2, -4($\next_arg) |
| 500 | b \label |
| 501 | li $\index, 4 # long can be loaded only to a2_a3 pair so index will be always 4 |
| 502 | .endm |
| 503 | |
| 504 | .macro LOAD_FLOAT_TO_REG reg, next_arg, index, label |
| 505 | lwc1 $\reg, -4($\next_arg) # next_arg points to argument after the current one (offset is 4) |
| 506 | b \label |
| 507 | addiu $\index, 1 |
| 508 | .endm |
| 509 | |
| 510 | .macro LOAD_DOUBLE_TO_REG reg1, reg2, next_arg, index, tmp, label |
| 511 | LDu $\reg1, $\reg2, -8, $\next_arg, $\tmp # next_arg points to argument after the current one |
| 512 | # (offset is 8) |
| 513 | b \label |
| 514 | addiu $\index, 1 |
| 515 | .endm |
| 516 | |
Jeff Hao | 79fe539 | 2013-04-24 18:41:58 -0700 | [diff] [blame] | 517 | /* |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 518 | * Invocation stub for quick code. |
Jeff Hao | 5d91730 | 2013-02-27 17:57:33 -0800 | [diff] [blame] | 519 | * On entry: |
| 520 | * a0 = method pointer |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 521 | * a1 = argument array or null for no argument methods |
Jeff Hao | 5d91730 | 2013-02-27 17:57:33 -0800 | [diff] [blame] | 522 | * a2 = size of argument array in bytes |
| 523 | * a3 = (managed) thread pointer |
Jeff Hao | 6474d19 | 2013-03-26 14:08:09 -0700 | [diff] [blame] | 524 | * [sp + 16] = JValue* result |
Ian Rogers | 0177e53 | 2014-02-11 16:30:46 -0800 | [diff] [blame] | 525 | * [sp + 20] = shorty |
Jeff Hao | 5d91730 | 2013-02-27 17:57:33 -0800 | [diff] [blame] | 526 | */ |
| 527 | ENTRY art_quick_invoke_stub |
Jeff Hao | 5d91730 | 2013-02-27 17:57:33 -0800 | [diff] [blame] | 528 | sw $a0, 0($sp) # save out a0 |
| 529 | addiu $sp, $sp, -16 # spill s0, s1, fp, ra |
| 530 | .cfi_adjust_cfa_offset 16 |
| 531 | sw $ra, 12($sp) |
| 532 | .cfi_rel_offset 31, 12 |
| 533 | sw $fp, 8($sp) |
| 534 | .cfi_rel_offset 30, 8 |
| 535 | sw $s1, 4($sp) |
| 536 | .cfi_rel_offset 17, 4 |
| 537 | sw $s0, 0($sp) |
| 538 | .cfi_rel_offset 16, 0 |
| 539 | move $fp, $sp # save sp in fp |
| 540 | .cfi_def_cfa_register 30 |
| 541 | move $s1, $a3 # move managed thread pointer into s1 |
| 542 | addiu $s0, $zero, SUSPEND_CHECK_INTERVAL # reset s0 to suspend check interval |
Goran Jakovljevic | ff73498 | 2015-08-24 12:58:55 +0000 | [diff] [blame] | 543 | addiu $t0, $a2, 4 # create space for ArtMethod* in frame. |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 544 | subu $t0, $sp, $t0 # reserve & align *stack* to 16 bytes: |
Goran Jakovljevic | ff73498 | 2015-08-24 12:58:55 +0000 | [diff] [blame] | 545 | srl $t0, $t0, 4 # native calling convention only aligns to 8B, |
| 546 | sll $sp, $t0, 4 # so we have to ensure ART 16B alignment ourselves. |
| 547 | addiu $a0, $sp, 4 # pass stack pointer + ArtMethod* as dest for memcpy |
Jeff Hao | 5d91730 | 2013-02-27 17:57:33 -0800 | [diff] [blame] | 548 | jal memcpy # (dest, src, bytes) |
| 549 | addiu $sp, $sp, -16 # make space for argument slots for memcpy |
| 550 | addiu $sp, $sp, 16 # restore stack after memcpy |
Goran Jakovljevic | ff73498 | 2015-08-24 12:58:55 +0000 | [diff] [blame] | 551 | lw $a0, 16($fp) # restore ArtMethod* |
| 552 | lw $a1, 4($sp) # a1 = this* |
| 553 | addiu $t0, $sp, 8 # t0 = pointer to the current argument (skip ArtMethod* and this*) |
| 554 | li $t3, 2 # t3 = gpr_index = 2 (skip A0 and A1) |
| 555 | move $t4, $zero # t4 = fp_index = 0 |
| 556 | lw $t1, 20+16($fp) # get shorty (20 is offset from the $sp on entry + 16 as the $fp is |
| 557 | # 16 bytes below the $sp on entry) |
| 558 | addiu $t1, 1 # t1 = shorty + 1 (skip 1 for return type) |
| 559 | loop: |
| 560 | lbu $t2, 0($t1) # t2 = shorty[i] |
| 561 | beqz $t2, loopEnd # finish getting args when shorty[i] == '\0' |
| 562 | addiu $t1, 1 |
| 563 | |
| 564 | li $t9, 'J' # put char 'J' into t9 |
| 565 | beq $t9, $t2, isLong # branch if result type char == 'J' |
| 566 | li $t9, 'D' # put char 'D' into t9 |
| 567 | beq $t9, $t2, isDouble # branch if result type char == 'D' |
| 568 | li $t9, 'F' # put char 'F' into t9 |
| 569 | beq $t9, $t2, isSingle # branch if result type char == 'F' |
| 570 | addiu $t0, 4 # next_arg = curr_arg + 4 (in branch delay slot, |
| 571 | # for both, int and single) |
| 572 | |
| 573 | li $t5, 2 # skip a0 and a1 (ArtMethod* and this*) |
| 574 | bne $t5, $t3, 1f # if (gpr_index == 2) |
| 575 | addiu $t5, 1 |
| 576 | LOAD_WORD_TO_REG a2, t0, t3, loop # a2 = current argument, gpr_index++ |
| 577 | 1: bne $t5, $t3, loop # else if (gpr_index == 3) |
| 578 | nop |
| 579 | LOAD_WORD_TO_REG a3, t0, t3, loop # a3 = current argument, gpr_index++ |
| 580 | |
| 581 | isLong: |
| 582 | addiu $t0, 8 # next_arg = curr_arg + 8 |
| 583 | slti $t5, $t3, 3 |
| 584 | beqz $t5, 2f # if (gpr_index < 3) |
| 585 | nop |
| 586 | LOAD_LONG_TO_REG a2, a3, t0, t3, loop # a2_a3 = curr_arg, gpr_index = 4 |
| 587 | 2: b loop # else |
| 588 | li $t3, 4 # gpr_index = 4 |
| 589 | |
| 590 | isDouble: |
| 591 | addiu $t0, 8 # next_arg = curr_arg + 8 |
| 592 | li $t5, 0 |
| 593 | bne $t5, $t4, 3f # if (fp_index == 0) |
| 594 | addiu $t5, 1 |
| 595 | LOAD_DOUBLE_TO_REG f12, f13, t0, t4, t9, loop # f12_f13 = curr_arg, fp_index++ |
| 596 | 3: bne $t5, $t4, loop # else if (fp_index == 1) |
| 597 | nop |
| 598 | LOAD_DOUBLE_TO_REG f14, f15, t0, t4, t9, loop # f14_f15 = curr_arg, fp_index++ |
| 599 | |
| 600 | isSingle: |
| 601 | li $t5, 0 |
| 602 | bne $t5, $t4, 4f # if (fp_index == 0) |
| 603 | addiu $t5, 1 |
| 604 | LOAD_FLOAT_TO_REG f12, t0, t4, loop # f12 = curr_arg, fp_index++ |
| 605 | 4: bne $t5, $t4, loop # else if (fp_index == 1) |
| 606 | nop |
| 607 | LOAD_FLOAT_TO_REG f14, t0, t4, loop # f14 = curr_arg, fp_index++ |
| 608 | |
| 609 | loopEnd: |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 610 | lw $t9, ART_METHOD_QUICK_CODE_OFFSET_32($a0) # get pointer to the code |
Jeff Hao | 5d91730 | 2013-02-27 17:57:33 -0800 | [diff] [blame] | 611 | jalr $t9 # call the method |
Goran Jakovljevic | ff73498 | 2015-08-24 12:58:55 +0000 | [diff] [blame] | 612 | sw $zero, 0($sp) # store null for ArtMethod* at bottom of frame |
Jeff Hao | 5d91730 | 2013-02-27 17:57:33 -0800 | [diff] [blame] | 613 | move $sp, $fp # restore the stack |
| 614 | lw $s0, 0($sp) |
Dave Allison | bbb32c2 | 2013-11-05 18:25:18 -0800 | [diff] [blame] | 615 | .cfi_restore 16 |
Jeff Hao | 5d91730 | 2013-02-27 17:57:33 -0800 | [diff] [blame] | 616 | lw $s1, 4($sp) |
Dave Allison | bbb32c2 | 2013-11-05 18:25:18 -0800 | [diff] [blame] | 617 | .cfi_restore 17 |
Jeff Hao | 5d91730 | 2013-02-27 17:57:33 -0800 | [diff] [blame] | 618 | lw $fp, 8($sp) |
Dave Allison | bbb32c2 | 2013-11-05 18:25:18 -0800 | [diff] [blame] | 619 | .cfi_restore 30 |
Jeff Hao | 5d91730 | 2013-02-27 17:57:33 -0800 | [diff] [blame] | 620 | lw $ra, 12($sp) |
Dave Allison | bbb32c2 | 2013-11-05 18:25:18 -0800 | [diff] [blame] | 621 | .cfi_restore 31 |
Jeff Hao | 5d91730 | 2013-02-27 17:57:33 -0800 | [diff] [blame] | 622 | addiu $sp, $sp, 16 |
| 623 | .cfi_adjust_cfa_offset -16 |
| 624 | lw $t0, 16($sp) # get result pointer |
Ian Rogers | 0177e53 | 2014-02-11 16:30:46 -0800 | [diff] [blame] | 625 | lw $t1, 20($sp) # get shorty |
| 626 | lb $t1, 0($t1) # get result type char |
Goran Jakovljevic | ff73498 | 2015-08-24 12:58:55 +0000 | [diff] [blame] | 627 | li $t2, 'D' # put char 'D' into t2 |
| 628 | beq $t1, $t2, 5f # branch if result type char == 'D' |
| 629 | li $t3, 'F' # put char 'F' into t3 |
| 630 | beq $t1, $t3, 5f # branch if result type char == 'F' |
Jeff Hao | 5d91730 | 2013-02-27 17:57:33 -0800 | [diff] [blame] | 631 | sw $v0, 0($t0) # store the result |
Andreas Gampe | 8d36591 | 2015-01-13 11:32:32 -0800 | [diff] [blame] | 632 | jalr $zero, $ra |
Jeff Hao | 5d91730 | 2013-02-27 17:57:33 -0800 | [diff] [blame] | 633 | sw $v1, 4($t0) # store the other half of the result |
Goran Jakovljevic | ff73498 | 2015-08-24 12:58:55 +0000 | [diff] [blame] | 634 | 5: |
Duane Sand | e34652f | 2014-11-04 11:09:36 -0800 | [diff] [blame] | 635 | SDu $f0, $f1, 0, $t0, $t1 # store floating point result |
Andreas Gampe | 8d36591 | 2015-01-13 11:32:32 -0800 | [diff] [blame] | 636 | jalr $zero, $ra |
Duane Sand | e34652f | 2014-11-04 11:09:36 -0800 | [diff] [blame] | 637 | nop |
Jeff Hao | 5d91730 | 2013-02-27 17:57:33 -0800 | [diff] [blame] | 638 | END art_quick_invoke_stub |
| 639 | |
| 640 | /* |
Goran Jakovljevic | ff73498 | 2015-08-24 12:58:55 +0000 | [diff] [blame] | 641 | * Invocation static stub for quick code. |
| 642 | * On entry: |
| 643 | * a0 = method pointer |
| 644 | * a1 = argument array or null for no argument methods |
| 645 | * a2 = size of argument array in bytes |
| 646 | * a3 = (managed) thread pointer |
| 647 | * [sp + 16] = JValue* result |
| 648 | * [sp + 20] = shorty |
| 649 | */ |
| 650 | ENTRY art_quick_invoke_static_stub |
| 651 | sw $a0, 0($sp) # save out a0 |
| 652 | addiu $sp, $sp, -16 # spill s0, s1, fp, ra |
| 653 | .cfi_adjust_cfa_offset 16 |
| 654 | sw $ra, 12($sp) |
| 655 | .cfi_rel_offset 31, 12 |
| 656 | sw $fp, 8($sp) |
| 657 | .cfi_rel_offset 30, 8 |
| 658 | sw $s1, 4($sp) |
| 659 | .cfi_rel_offset 17, 4 |
| 660 | sw $s0, 0($sp) |
| 661 | .cfi_rel_offset 16, 0 |
| 662 | move $fp, $sp # save sp in fp |
| 663 | .cfi_def_cfa_register 30 |
| 664 | move $s1, $a3 # move managed thread pointer into s1 |
| 665 | addiu $s0, $zero, SUSPEND_CHECK_INTERVAL # reset s0 to suspend check interval |
| 666 | addiu $t0, $a2, 4 # create space for ArtMethod* in frame. |
| 667 | subu $t0, $sp, $t0 # reserve & align *stack* to 16 bytes: |
| 668 | srl $t0, $t0, 4 # native calling convention only aligns to 8B, |
| 669 | sll $sp, $t0, 4 # so we have to ensure ART 16B alignment ourselves. |
| 670 | addiu $a0, $sp, 4 # pass stack pointer + ArtMethod* as dest for memcpy |
| 671 | jal memcpy # (dest, src, bytes) |
| 672 | addiu $sp, $sp, -16 # make space for argument slots for memcpy |
| 673 | addiu $sp, $sp, 16 # restore stack after memcpy |
| 674 | lw $a0, 16($fp) # restore ArtMethod* |
| 675 | addiu $t0, $sp, 4 # t0 = pointer to the current argument (skip ArtMethod*) |
| 676 | li $t3, 1 # t3 = gpr_index = 1 (skip A0) |
| 677 | move $t4, $zero # t4 = fp_index = 0 |
| 678 | lw $t1, 20+16($fp) # get shorty (20 is offset from the $sp on entry + 16 as the $fp is |
| 679 | # 16 bytes below the $sp on entry) |
| 680 | addiu $t1, 1 # t1 = shorty + 1 (skip 1 for return type) |
| 681 | loopS: |
| 682 | lbu $t2, 0($t1) # t2 = shorty[i] |
| 683 | beqz $t2, loopEndS # finish getting args when shorty[i] == '\0' |
| 684 | addiu $t1, 1 |
| 685 | |
| 686 | li $t9, 'J' # put char 'J' into t9 |
| 687 | beq $t9, $t2, isLongS # branch if result type char == 'J' |
| 688 | li $t9, 'D' # put char 'D' into t9 |
| 689 | beq $t9, $t2, isDoubleS # branch if result type char == 'D' |
| 690 | li $t9, 'F' # put char 'F' into t9 |
| 691 | beq $t9, $t2, isSingleS # branch if result type char == 'F' |
| 692 | addiu $t0, 4 # next_arg = curr_arg + 4 (in branch delay slot, |
| 693 | # for both, int and single) |
| 694 | |
| 695 | li $t5, 1 # skip a0 (ArtMethod*) |
| 696 | bne $t5, $t3, 1f # if (gpr_index == 1) |
| 697 | addiu $t5, 1 |
| 698 | LOAD_WORD_TO_REG a1, t0, t3, loopS # a1 = current argument, gpr_index++ |
| 699 | 1: bne $t5, $t3, 2f # else if (gpr_index == 2) |
| 700 | addiu $t5, 1 |
| 701 | LOAD_WORD_TO_REG a2, t0, t3, loopS # a2 = current argument, gpr_index++ |
| 702 | 2: bne $t5, $t3, loopS # else if (gpr_index == 3) |
| 703 | nop |
| 704 | LOAD_WORD_TO_REG a3, t0, t3, loopS # a3 = current argument, gpr_index++ |
| 705 | |
| 706 | isLongS: |
| 707 | addiu $t0, 8 # next_arg = curr_arg + 8 |
| 708 | slti $t5, $t3, 3 |
| 709 | beqz $t5, 3f # if (gpr_index < 3) |
| 710 | nop |
| 711 | LOAD_LONG_TO_REG a2, a3, t0, t3, loopS # a2_a3 = curr_arg, gpr_index = 4 |
| 712 | 3: b loopS # else |
| 713 | li $t3, 4 # gpr_index = 4 |
| 714 | |
| 715 | isDoubleS: |
| 716 | addiu $t0, 8 # next_arg = curr_arg + 8 |
| 717 | li $t5, 0 |
| 718 | bne $t5, $t4, 4f # if (fp_index == 0) |
| 719 | addiu $t5, 1 |
| 720 | LOAD_DOUBLE_TO_REG f12, f13, t0, t4, t9, loopS # f12_f13 = curr_arg, fp_index++ |
| 721 | 4: bne $t5, $t4, loopS # else if (fp_index == 1) |
| 722 | nop |
| 723 | LOAD_DOUBLE_TO_REG f14, f15, t0, t4, t9, loopS # f14_f15 = curr_arg, fp_index++ |
| 724 | |
| 725 | isSingleS: |
| 726 | li $t5, 0 |
| 727 | bne $t5, $t4, 5f # if (fp_index == 0) |
| 728 | addiu $t5, 1 |
| 729 | LOAD_FLOAT_TO_REG f12, t0, t4, loopS # f12 = curr_arg, fp_index++ |
| 730 | 5: bne $t5, $t4, loopS # else if (fp_index == 1) |
| 731 | nop |
| 732 | LOAD_FLOAT_TO_REG f14, t0, t4, loopS # f14 = curr_arg, fp_index++ |
| 733 | |
| 734 | loopEndS: |
| 735 | lw $t9, ART_METHOD_QUICK_CODE_OFFSET_32($a0) # get pointer to the code |
| 736 | jalr $t9 # call the method |
| 737 | sw $zero, 0($sp) # store null for ArtMethod* at bottom of frame |
| 738 | move $sp, $fp # restore the stack |
| 739 | lw $s0, 0($sp) |
| 740 | .cfi_restore 16 |
| 741 | lw $s1, 4($sp) |
| 742 | .cfi_restore 17 |
| 743 | lw $fp, 8($sp) |
| 744 | .cfi_restore 30 |
| 745 | lw $ra, 12($sp) |
| 746 | .cfi_restore 31 |
| 747 | addiu $sp, $sp, 16 |
| 748 | .cfi_adjust_cfa_offset -16 |
| 749 | lw $t0, 16($sp) # get result pointer |
| 750 | lw $t1, 20($sp) # get shorty |
| 751 | lb $t1, 0($t1) # get result type char |
| 752 | li $t2, 'D' # put char 'D' into t2 |
| 753 | beq $t1, $t2, 6f # branch if result type char == 'D' |
| 754 | li $t3, 'F' # put char 'F' into t3 |
| 755 | beq $t1, $t3, 6f # branch if result type char == 'F' |
| 756 | sw $v0, 0($t0) # store the result |
| 757 | jalr $zero, $ra |
| 758 | sw $v1, 4($t0) # store the other half of the result |
| 759 | 6: |
| 760 | SDu $f0, $f1, 0, $t0, $t1 # store floating point result |
| 761 | jalr $zero, $ra |
| 762 | nop |
| 763 | END art_quick_invoke_static_stub |
| 764 | |
| 765 | /* |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 766 | * Entry from managed code that calls artHandleFillArrayDataFromCode and delivers exception on |
| 767 | * failure. |
| 768 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 769 | .extern artHandleFillArrayDataFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 770 | ENTRY art_quick_handle_fill_data |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 771 | lw $a2, 0($sp) # pass referrer's Method* |
| 772 | 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] | 773 | jal artHandleFillArrayDataFromCode # (payload offset, Array*, method, Thread*) |
Ian Rogers | 832336b | 2014-10-08 15:35:22 -0700 | [diff] [blame] | 774 | move $a3, rSELF # pass Thread::Current |
jeffhao | fc6a30e | 2012-10-18 18:24:15 -0700 | [diff] [blame] | 775 | RETURN_IF_ZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 776 | END art_quick_handle_fill_data |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 777 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 778 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 779 | * Entry from managed code that calls artLockObjectFromCode, may block for GC. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 780 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 781 | .extern artLockObjectFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 782 | ENTRY art_quick_lock_object |
Ian Rogers | 86bcdc2 | 2014-02-21 22:06:38 -0800 | [diff] [blame] | 783 | beqz $a0, .Lart_quick_throw_null_pointer_exception_gp_set |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 784 | nop |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 785 | 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] | 786 | jal artLockObjectFromCode # (Object* obj, Thread*) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 787 | move $a1, rSELF # pass Thread::Current |
Ian Rogers | 6bcd163 | 2013-10-08 18:50:47 -0700 | [diff] [blame] | 788 | RETURN_IF_ZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 789 | END art_quick_lock_object |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 790 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 791 | /* |
| 792 | * Entry from managed code that calls artUnlockObjectFromCode and delivers exception on failure. |
| 793 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 794 | .extern artUnlockObjectFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 795 | ENTRY art_quick_unlock_object |
Ian Rogers | 86bcdc2 | 2014-02-21 22:06:38 -0800 | [diff] [blame] | 796 | beqz $a0, .Lart_quick_throw_null_pointer_exception_gp_set |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 797 | nop |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 798 | 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] | 799 | jal artUnlockObjectFromCode # (Object* obj, Thread*) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 800 | move $a1, rSELF # pass Thread::Current |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 801 | RETURN_IF_ZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 802 | END art_quick_unlock_object |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 803 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 804 | /* |
| 805 | * Entry from managed code that calls artCheckCastFromCode and delivers exception on failure. |
| 806 | */ |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 807 | .extern artThrowClassCastException |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 808 | ENTRY art_quick_check_cast |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 809 | addiu $sp, $sp, -16 |
| 810 | .cfi_adjust_cfa_offset 16 |
| 811 | sw $ra, 12($sp) |
| 812 | .cfi_rel_offset 31, 12 |
| 813 | sw $t9, 8($sp) |
| 814 | sw $a1, 4($sp) |
| 815 | sw $a0, 0($sp) |
| 816 | jal artIsAssignableFromCode |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 817 | addiu $sp, $sp, -16 # reserve argument slots on the stack |
| 818 | addiu $sp, $sp, 16 |
Ian Rogers | 86bcdc2 | 2014-02-21 22:06:38 -0800 | [diff] [blame] | 819 | beqz $v0, .Lthrow_class_cast_exception |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 820 | lw $ra, 12($sp) |
Andreas Gampe | 8d36591 | 2015-01-13 11:32:32 -0800 | [diff] [blame] | 821 | jalr $zero, $ra |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 822 | addiu $sp, $sp, 16 |
| 823 | .cfi_adjust_cfa_offset -16 |
Ian Rogers | 86bcdc2 | 2014-02-21 22:06:38 -0800 | [diff] [blame] | 824 | .Lthrow_class_cast_exception: |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 825 | lw $t9, 8($sp) |
| 826 | lw $a1, 4($sp) |
| 827 | lw $a0, 0($sp) |
| 828 | addiu $sp, $sp, 16 |
| 829 | .cfi_adjust_cfa_offset -16 |
| 830 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 831 | la $t9, artThrowClassCastException |
Andreas Gampe | 8d36591 | 2015-01-13 11:32:32 -0800 | [diff] [blame] | 832 | jalr $zero, $t9 # artThrowClassCastException (Class*, Class*, Thread*) |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 833 | move $a2, rSELF # pass Thread::Current |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 834 | END art_quick_check_cast |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 835 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 836 | /* |
Man Cao | 1aee900 | 2015-07-14 22:31:42 -0700 | [diff] [blame] | 837 | * Restore rReg's value from offset($sp) if rReg is not the same as rExclude. |
| 838 | * nReg is the register number for rReg. |
| 839 | */ |
| 840 | .macro POP_REG_NE rReg, nReg, offset, rExclude |
| 841 | .ifnc \rReg, \rExclude |
| 842 | lw \rReg, \offset($sp) # restore rReg |
| 843 | .cfi_restore \nReg |
| 844 | .endif |
| 845 | .endm |
| 846 | |
| 847 | /* |
| 848 | * Macro to insert read barrier, only used in art_quick_aput_obj. |
| 849 | * rObj and rDest are registers, offset is a defined literal such as MIRROR_OBJECT_CLASS_OFFSET. |
| 850 | * TODO: When read barrier has a fast path, add heap unpoisoning support for the fast path. |
| 851 | */ |
| 852 | .macro READ_BARRIER rDest, rObj, offset |
| 853 | #ifdef USE_READ_BARRIER |
| 854 | # saved registers used in art_quick_aput_obj: a0-a2, t0-t1, t9, ra. 8 words for 16B alignment. |
| 855 | addiu $sp, $sp, -32 |
| 856 | .cfi_adjust_cfa_offset 32 |
| 857 | sw $ra, 28($sp) |
| 858 | .cfi_rel_offset 31, 28 |
| 859 | sw $t9, 24($sp) |
| 860 | .cfi_rel_offset 25, 24 |
| 861 | sw $t1, 20($sp) |
| 862 | .cfi_rel_offset 9, 20 |
| 863 | sw $t0, 16($sp) |
| 864 | .cfi_rel_offset 8, 16 |
| 865 | sw $a2, 8($sp) # padding slot at offset 12 (padding can be any slot in the 32B) |
| 866 | .cfi_rel_offset 6, 8 |
| 867 | sw $a1, 4($sp) |
| 868 | .cfi_rel_offset 5, 4 |
| 869 | sw $a0, 0($sp) |
| 870 | .cfi_rel_offset 4, 0 |
| 871 | |
Man Cao | 6306921 | 2015-08-21 15:51:39 -0700 | [diff] [blame] | 872 | # move $a0, \rRef # pass ref in a0 (no-op for now since parameter ref is unused) |
Man Cao | 1aee900 | 2015-07-14 22:31:42 -0700 | [diff] [blame] | 873 | .ifnc \rObj, $a1 |
| 874 | move $a1, \rObj # pass rObj |
| 875 | .endif |
| 876 | addiu $a2, $zero, \offset # pass offset |
| 877 | jal artReadBarrierSlow # artReadBarrierSlow(ref, rObj, offset) |
| 878 | addiu $sp, $sp, -16 # Use branch delay slot to reserve argument slots on the stack |
| 879 | # before the call to artReadBarrierSlow. |
| 880 | addiu $sp, $sp, 16 # restore stack after call to artReadBarrierSlow |
| 881 | # No need to unpoison return value in v0, artReadBarrierSlow() would do the unpoisoning. |
| 882 | move \rDest, $v0 # save return value in rDest |
| 883 | # (rDest cannot be v0 in art_quick_aput_obj) |
| 884 | |
| 885 | lw $a0, 0($sp) # restore registers except rDest |
| 886 | # (rDest can only be t0 or t1 in art_quick_aput_obj) |
| 887 | .cfi_restore 4 |
| 888 | lw $a1, 4($sp) |
| 889 | .cfi_restore 5 |
| 890 | lw $a2, 8($sp) |
| 891 | .cfi_restore 6 |
| 892 | POP_REG_NE $t0, 8, 16, \rDest |
| 893 | POP_REG_NE $t1, 9, 20, \rDest |
| 894 | lw $t9, 24($sp) |
| 895 | .cfi_restore 25 |
| 896 | lw $ra, 28($sp) # restore $ra |
| 897 | .cfi_restore 31 |
| 898 | addiu $sp, $sp, 32 |
| 899 | .cfi_adjust_cfa_offset -32 |
| 900 | #else |
| 901 | lw \rDest, \offset(\rObj) |
| 902 | UNPOISON_HEAP_REF \rDest |
| 903 | #endif // USE_READ_BARRIER |
| 904 | .endm |
| 905 | |
| 906 | /* |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 907 | * Entry from managed code for array put operations of objects where the value being stored |
| 908 | * needs to be checked for compatibility. |
| 909 | * a0 = array, a1 = index, a2 = value |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 910 | */ |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 911 | ENTRY art_quick_aput_obj_with_null_and_bound_check |
Ian Rogers | 86bcdc2 | 2014-02-21 22:06:38 -0800 | [diff] [blame] | 912 | bnez $a0, .Lart_quick_aput_obj_with_bound_check_gp_set |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 913 | nop |
Ian Rogers | 86bcdc2 | 2014-02-21 22:06:38 -0800 | [diff] [blame] | 914 | b .Lart_quick_throw_null_pointer_exception_gp_set |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 915 | nop |
| 916 | END art_quick_aput_obj_with_null_and_bound_check |
| 917 | |
| 918 | ENTRY art_quick_aput_obj_with_bound_check |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 919 | lw $t0, MIRROR_ARRAY_LENGTH_OFFSET($a0) |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 920 | sltu $t1, $a1, $t0 |
Ian Rogers | 86bcdc2 | 2014-02-21 22:06:38 -0800 | [diff] [blame] | 921 | bnez $t1, .Lart_quick_aput_obj_gp_set |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 922 | nop |
| 923 | move $a0, $a1 |
Ian Rogers | 86bcdc2 | 2014-02-21 22:06:38 -0800 | [diff] [blame] | 924 | b .Lart_quick_throw_array_bounds_gp_set |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 925 | move $a1, $t0 |
| 926 | END art_quick_aput_obj_with_bound_check |
| 927 | |
Man Cao | 1aee900 | 2015-07-14 22:31:42 -0700 | [diff] [blame] | 928 | #ifdef USE_READ_BARRIER |
| 929 | .extern artReadBarrierSlow |
| 930 | #endif |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 931 | ENTRY art_quick_aput_obj |
Ian Rogers | 86bcdc2 | 2014-02-21 22:06:38 -0800 | [diff] [blame] | 932 | beqz $a2, .Ldo_aput_null |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 933 | nop |
Man Cao | 1aee900 | 2015-07-14 22:31:42 -0700 | [diff] [blame] | 934 | READ_BARRIER $t0, $a0, MIRROR_OBJECT_CLASS_OFFSET |
| 935 | READ_BARRIER $t1, $a2, MIRROR_OBJECT_CLASS_OFFSET |
| 936 | READ_BARRIER $t0, $t0, MIRROR_CLASS_COMPONENT_TYPE_OFFSET |
Ian Rogers | 86bcdc2 | 2014-02-21 22:06:38 -0800 | [diff] [blame] | 937 | 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] | 938 | nop |
Ian Rogers | 86bcdc2 | 2014-02-21 22:06:38 -0800 | [diff] [blame] | 939 | .Ldo_aput: |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 940 | sll $a1, $a1, 2 |
| 941 | add $t0, $a0, $a1 |
Hiroshi Yamauchi | bfa5eb6 | 2015-05-29 15:04:41 -0700 | [diff] [blame] | 942 | POISON_HEAP_REF $a2 |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 943 | sw $a2, MIRROR_OBJECT_ARRAY_DATA_OFFSET($t0) |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 944 | lw $t0, THREAD_CARD_TABLE_OFFSET(rSELF) |
| 945 | srl $t1, $a0, 7 |
| 946 | add $t1, $t1, $t0 |
| 947 | sb $t0, ($t1) |
Andreas Gampe | 8d36591 | 2015-01-13 11:32:32 -0800 | [diff] [blame] | 948 | jalr $zero, $ra |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 949 | nop |
Ian Rogers | 86bcdc2 | 2014-02-21 22:06:38 -0800 | [diff] [blame] | 950 | .Ldo_aput_null: |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 951 | sll $a1, $a1, 2 |
| 952 | add $t0, $a0, $a1 |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 953 | sw $a2, MIRROR_OBJECT_ARRAY_DATA_OFFSET($t0) |
Andreas Gampe | 8d36591 | 2015-01-13 11:32:32 -0800 | [diff] [blame] | 954 | jalr $zero, $ra |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 955 | nop |
Ian Rogers | 86bcdc2 | 2014-02-21 22:06:38 -0800 | [diff] [blame] | 956 | .Lcheck_assignability: |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 957 | addiu $sp, $sp, -32 |
| 958 | .cfi_adjust_cfa_offset 32 |
| 959 | sw $ra, 28($sp) |
| 960 | .cfi_rel_offset 31, 28 |
| 961 | sw $t9, 12($sp) |
| 962 | sw $a2, 8($sp) |
| 963 | sw $a1, 4($sp) |
| 964 | sw $a0, 0($sp) |
| 965 | move $a1, $t1 |
| 966 | move $a0, $t0 |
| 967 | jal artIsAssignableFromCode # (Class*, Class*) |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 968 | addiu $sp, $sp, -16 # reserve argument slots on the stack |
| 969 | addiu $sp, $sp, 16 |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 970 | lw $ra, 28($sp) |
| 971 | lw $t9, 12($sp) |
| 972 | lw $a2, 8($sp) |
| 973 | lw $a1, 4($sp) |
| 974 | lw $a0, 0($sp) |
Duane Sand | e34652f | 2014-11-04 11:09:36 -0800 | [diff] [blame] | 975 | addiu $sp, 32 |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 976 | .cfi_adjust_cfa_offset -32 |
Ian Rogers | 86bcdc2 | 2014-02-21 22:06:38 -0800 | [diff] [blame] | 977 | bnez $v0, .Ldo_aput |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 978 | nop |
| 979 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
| 980 | move $a1, $a2 |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 981 | la $t9, artThrowArrayStoreException |
Andreas Gampe | 8d36591 | 2015-01-13 11:32:32 -0800 | [diff] [blame] | 982 | jalr $zero, $t9 # artThrowArrayStoreException(Class*, Class*, Thread*) |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 983 | move $a2, rSELF # pass Thread::Current |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 984 | END art_quick_aput_obj |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 985 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 986 | /* |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 987 | * Called by managed code to resolve a static field and load a boolean primitive value. |
| 988 | */ |
| 989 | .extern artGetBooleanStaticFromCode |
| 990 | ENTRY art_quick_get_boolean_static |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 991 | lw $a1, 0($sp) # pass referrer's Method* |
| 992 | 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] | 993 | jal artGetBooleanStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 994 | move $a2, rSELF # pass Thread::Current |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 995 | RETURN_IF_NO_EXCEPTION |
| 996 | END art_quick_get_boolean_static |
| 997 | /* |
| 998 | * Called by managed code to resolve a static field and load a byte primitive value. |
| 999 | */ |
| 1000 | .extern artGetByteStaticFromCode |
| 1001 | ENTRY art_quick_get_byte_static |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1002 | lw $a1, 0($sp) # pass referrer's Method* |
| 1003 | 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] | 1004 | jal artGetByteStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1005 | move $a2, rSELF # pass Thread::Current |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1006 | RETURN_IF_NO_EXCEPTION |
| 1007 | END art_quick_get_byte_static |
| 1008 | |
| 1009 | /* |
| 1010 | * Called by managed code to resolve a static field and load a char primitive value. |
| 1011 | */ |
| 1012 | .extern artGetCharStaticFromCode |
| 1013 | ENTRY art_quick_get_char_static |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1014 | lw $a1, 0($sp) # pass referrer's Method* |
| 1015 | 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] | 1016 | jal artGetCharStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1017 | move $a2, rSELF # pass Thread::Current |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1018 | RETURN_IF_NO_EXCEPTION |
| 1019 | END art_quick_get_char_static |
| 1020 | /* |
| 1021 | * Called by managed code to resolve a static field and load a short primitive value. |
| 1022 | */ |
| 1023 | .extern artGetShortStaticFromCode |
| 1024 | ENTRY art_quick_get_short_static |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1025 | lw $a1, 0($sp) # pass referrer's Method* |
| 1026 | 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] | 1027 | jal artGetShortStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1028 | move $a2, rSELF # pass Thread::Current |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1029 | RETURN_IF_NO_EXCEPTION |
| 1030 | END art_quick_get_short_static |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1031 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1032 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 1033 | * 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] | 1034 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1035 | .extern artGet32StaticFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1036 | ENTRY art_quick_get32_static |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1037 | lw $a1, 0($sp) # pass referrer's Method* |
| 1038 | 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] | 1039 | jal artGet32StaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1040 | move $a2, rSELF # pass Thread::Current |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1041 | RETURN_IF_NO_EXCEPTION |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1042 | END art_quick_get32_static |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1043 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1044 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 1045 | * 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] | 1046 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1047 | .extern artGet64StaticFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1048 | ENTRY art_quick_get64_static |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1049 | lw $a1, 0($sp) # pass referrer's Method* |
| 1050 | 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] | 1051 | jal artGet64StaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1052 | move $a2, rSELF # pass Thread::Current |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1053 | RETURN_IF_NO_EXCEPTION |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1054 | END art_quick_get64_static |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1055 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1056 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 1057 | * 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] | 1058 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1059 | .extern artGetObjStaticFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1060 | ENTRY art_quick_get_obj_static |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1061 | lw $a1, 0($sp) # pass referrer's Method* |
| 1062 | 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] | 1063 | jal artGetObjStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1064 | move $a2, rSELF # pass Thread::Current |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1065 | RETURN_IF_NO_EXCEPTION |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1066 | END art_quick_get_obj_static |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1067 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1068 | /* |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1069 | * Called by managed code to resolve an instance field and load a boolean primitive value. |
| 1070 | */ |
| 1071 | .extern artGetBooleanInstanceFromCode |
| 1072 | ENTRY art_quick_get_boolean_instance |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1073 | lw $a2, 0($sp) # pass referrer's Method* |
| 1074 | 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] | 1075 | jal artGetBooleanInstanceFromCode # (field_idx, Object*, referrer, Thread*) |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1076 | move $a3, rSELF # pass Thread::Current |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1077 | RETURN_IF_NO_EXCEPTION |
| 1078 | END art_quick_get_boolean_instance |
| 1079 | /* |
| 1080 | * Called by managed code to resolve an instance field and load a byte primitive value. |
| 1081 | */ |
| 1082 | .extern artGetByteInstanceFromCode |
| 1083 | ENTRY art_quick_get_byte_instance |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1084 | lw $a2, 0($sp) # pass referrer's Method* |
| 1085 | 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] | 1086 | jal artGetByteInstanceFromCode # (field_idx, Object*, referrer, Thread*) |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1087 | move $a3, rSELF # pass Thread::Current |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1088 | RETURN_IF_NO_EXCEPTION |
| 1089 | END art_quick_get_byte_instance |
| 1090 | |
| 1091 | /* |
| 1092 | * Called by managed code to resolve an instance field and load a char primitive value. |
| 1093 | */ |
| 1094 | .extern artGetCharInstanceFromCode |
| 1095 | ENTRY art_quick_get_char_instance |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1096 | lw $a2, 0($sp) # pass referrer's Method* |
| 1097 | 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] | 1098 | jal artGetCharInstanceFromCode # (field_idx, Object*, referrer, Thread*) |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1099 | move $a3, rSELF # pass Thread::Current |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1100 | RETURN_IF_NO_EXCEPTION |
| 1101 | END art_quick_get_char_instance |
| 1102 | /* |
| 1103 | * Called by managed code to resolve an instance field and load a short primitive value. |
| 1104 | */ |
| 1105 | .extern artGetShortInstanceFromCode |
| 1106 | ENTRY art_quick_get_short_instance |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1107 | lw $a2, 0($sp) # pass referrer's Method* |
| 1108 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 1109 | jal artGetShortInstanceFromCode # (field_idx, Object*, referrer, Thread*) |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1110 | move $a3, rSELF # pass Thread::Current |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1111 | RETURN_IF_NO_EXCEPTION |
| 1112 | END art_quick_get_short_instance |
| 1113 | |
| 1114 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 1115 | * 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] | 1116 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1117 | .extern artGet32InstanceFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1118 | ENTRY art_quick_get32_instance |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1119 | lw $a2, 0($sp) # pass referrer's Method* |
| 1120 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 1121 | jal artGet32InstanceFromCode # (field_idx, Object*, referrer, Thread*) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1122 | move $a3, rSELF # pass Thread::Current |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1123 | RETURN_IF_NO_EXCEPTION |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1124 | END art_quick_get32_instance |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1125 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1126 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 1127 | * 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] | 1128 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1129 | .extern artGet64InstanceFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1130 | ENTRY art_quick_get64_instance |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1131 | lw $a2, 0($sp) # pass referrer's Method* |
| 1132 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 1133 | jal artGet64InstanceFromCode # (field_idx, Object*, referrer, Thread*) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1134 | move $a3, rSELF # pass Thread::Current |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1135 | RETURN_IF_NO_EXCEPTION |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1136 | END art_quick_get64_instance |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1137 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1138 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 1139 | * 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] | 1140 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1141 | .extern artGetObjInstanceFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1142 | ENTRY art_quick_get_obj_instance |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1143 | lw $a2, 0($sp) # pass referrer's Method* |
| 1144 | 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] | 1145 | jal artGetObjInstanceFromCode # (field_idx, Object*, referrer, Thread*) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1146 | move $a3, rSELF # pass Thread::Current |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1147 | RETURN_IF_NO_EXCEPTION |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1148 | END art_quick_get_obj_instance |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1149 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1150 | /* |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1151 | * Called by managed code to resolve a static field and store a 8-bit primitive value. |
| 1152 | */ |
| 1153 | .extern artSet8StaticFromCode |
| 1154 | ENTRY art_quick_set8_static |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1155 | lw $a2, 0($sp) # pass referrer's Method* |
| 1156 | 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] | 1157 | jal artSet8StaticFromCode # (field_idx, new_val, referrer, Thread*) |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1158 | move $a3, rSELF # pass Thread::Current |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1159 | RETURN_IF_ZERO |
| 1160 | END art_quick_set8_static |
| 1161 | |
| 1162 | /* |
| 1163 | * Called by managed code to resolve a static field and store a 16-bit primitive value. |
| 1164 | */ |
| 1165 | .extern artSet16StaticFromCode |
| 1166 | ENTRY art_quick_set16_static |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1167 | lw $a2, 0($sp) # pass referrer's Method* |
| 1168 | 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] | 1169 | jal artSet16StaticFromCode # (field_idx, new_val, referrer, Thread*, $sp) |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 1170 | move $a3, rSELF # pass Thread::Current |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1171 | RETURN_IF_ZERO |
| 1172 | END art_quick_set16_static |
| 1173 | |
| 1174 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 1175 | * 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] | 1176 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1177 | .extern artSet32StaticFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1178 | ENTRY art_quick_set32_static |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1179 | lw $a2, 0($sp) # pass referrer's Method* |
| 1180 | 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] | 1181 | jal artSet32StaticFromCode # (field_idx, new_val, referrer, Thread*) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1182 | move $a3, rSELF # pass Thread::Current |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1183 | RETURN_IF_ZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1184 | END art_quick_set32_static |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1185 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1186 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 1187 | * 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] | 1188 | */ |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1189 | .extern artSet64StaticFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1190 | ENTRY art_quick_set64_static |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1191 | lw $a1, 0($sp) # pass referrer's Method* |
Andreas Gampe | 8d36591 | 2015-01-13 11:32:32 -0800 | [diff] [blame] | 1192 | # 64 bit new_val is in a2:a3 pair |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1193 | 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] | 1194 | jal artSet64StaticFromCode # (field_idx, referrer, new_val, Thread*) |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 1195 | sw rSELF, 16($sp) # pass Thread::Current |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1196 | RETURN_IF_ZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1197 | END art_quick_set64_static |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1198 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1199 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 1200 | * 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] | 1201 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1202 | .extern artSetObjStaticFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1203 | ENTRY art_quick_set_obj_static |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1204 | lw $a2, 0($sp) # pass referrer's Method* |
| 1205 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1206 | move $a3, rSELF # pass Thread::Current |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1207 | jal artSetObjStaticFromCode # (field_idx, new_val, referrer, Thread*) |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1208 | RETURN_IF_ZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1209 | END art_quick_set_obj_static |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1210 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1211 | /* |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1212 | * Called by managed code to resolve an instance field and store a 8-bit primitive value. |
| 1213 | */ |
| 1214 | .extern artSet8InstanceFromCode |
| 1215 | ENTRY art_quick_set8_instance |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1216 | lw $a3, 0($sp) # pass referrer's Method* |
| 1217 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 1218 | jal artSet8InstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*) |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1219 | sw rSELF, 16($sp) # pass Thread::Current |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1220 | RETURN_IF_ZERO |
| 1221 | END art_quick_set8_instance |
| 1222 | |
| 1223 | /* |
| 1224 | * Called by managed code to resolve an instance field and store a 16-bit primitive value. |
| 1225 | */ |
| 1226 | .extern artSet16InstanceFromCode |
| 1227 | ENTRY art_quick_set16_instance |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1228 | lw $a3, 0($sp) # pass referrer's Method* |
| 1229 | 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] | 1230 | jal artSet16InstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*) |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1231 | sw rSELF, 16($sp) # pass Thread::Current |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1232 | RETURN_IF_ZERO |
| 1233 | END art_quick_set16_instance |
| 1234 | |
| 1235 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 1236 | * 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] | 1237 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1238 | .extern artSet32InstanceFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1239 | ENTRY art_quick_set32_instance |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1240 | lw $a3, 0($sp) # pass referrer's Method* |
| 1241 | 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] | 1242 | jal artSet32InstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*) |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 1243 | sw rSELF, 16($sp) # pass Thread::Current |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1244 | RETURN_IF_ZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1245 | END art_quick_set32_instance |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1246 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1247 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 1248 | * 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] | 1249 | */ |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 1250 | .extern artSet64InstanceFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1251 | ENTRY art_quick_set64_instance |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1252 | lw $t1, 0($sp) # load referrer's Method* |
Andreas Gampe | 8d36591 | 2015-01-13 11:32:32 -0800 | [diff] [blame] | 1253 | # 64 bit new_val is in a2:a3 pair |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1254 | 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] | 1255 | sw rSELF, 20($sp) # pass Thread::Current |
| 1256 | jal artSet64InstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*) |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1257 | sw $t1, 16($sp) # pass referrer's Method* |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1258 | RETURN_IF_ZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1259 | END art_quick_set64_instance |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1260 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1261 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 1262 | * 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] | 1263 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1264 | .extern artSetObjInstanceFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1265 | ENTRY art_quick_set_obj_instance |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1266 | lw $a3, 0($sp) # pass referrer's Method* |
| 1267 | 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] | 1268 | jal artSetObjInstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*) |
jeffhao | fa147e2 | 2012-10-12 17:03:32 -0700 | [diff] [blame] | 1269 | sw rSELF, 16($sp) # pass Thread::Current |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1270 | RETURN_IF_ZERO |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1271 | END art_quick_set_obj_instance |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1272 | |
Vladimir Marko | a3c3827 | 2015-04-28 12:37:09 +0100 | [diff] [blame] | 1273 | // Macro to facilitate adding new allocation entrypoints. |
Vladimir Marko | 5ea536a | 2015-04-20 20:11:30 +0100 | [diff] [blame] | 1274 | .macro ONE_ARG_DOWNCALL name, entrypoint, return |
| 1275 | .extern \entrypoint |
| 1276 | ENTRY \name |
| 1277 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC |
| 1278 | jal \entrypoint |
| 1279 | move $a1, rSELF # pass Thread::Current |
| 1280 | \return |
| 1281 | END \name |
| 1282 | .endm |
| 1283 | |
Mathieu Chartier | cbb2d20 | 2013-11-14 17:45:16 -0800 | [diff] [blame] | 1284 | .macro TWO_ARG_DOWNCALL name, entrypoint, return |
| 1285 | .extern \entrypoint |
| 1286 | ENTRY \name |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1287 | 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] | 1288 | jal \entrypoint |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 1289 | move $a2, rSELF # pass Thread::Current |
Mathieu Chartier | cbb2d20 | 2013-11-14 17:45:16 -0800 | [diff] [blame] | 1290 | \return |
| 1291 | END \name |
| 1292 | .endm |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1293 | |
Mathieu Chartier | cbb2d20 | 2013-11-14 17:45:16 -0800 | [diff] [blame] | 1294 | .macro THREE_ARG_DOWNCALL name, entrypoint, return |
| 1295 | .extern \entrypoint |
| 1296 | ENTRY \name |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1297 | 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] | 1298 | jal \entrypoint |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 1299 | move $a3, rSELF # pass Thread::Current |
Mathieu Chartier | cbb2d20 | 2013-11-14 17:45:16 -0800 | [diff] [blame] | 1300 | \return |
| 1301 | END \name |
| 1302 | .endm |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1303 | |
Jeff Hao | 848f70a | 2014-01-15 13:49:50 -0800 | [diff] [blame] | 1304 | .macro FOUR_ARG_DOWNCALL name, entrypoint, return |
| 1305 | .extern \entrypoint |
| 1306 | ENTRY \name |
Vladimir Marko | a3c3827 | 2015-04-28 12:37:09 +0100 | [diff] [blame] | 1307 | 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] | 1308 | jal \entrypoint |
Vladimir Marko | a3c3827 | 2015-04-28 12:37:09 +0100 | [diff] [blame] | 1309 | sw rSELF, 16($sp) # pass Thread::Current |
Jeff Hao | 848f70a | 2014-01-15 13:49:50 -0800 | [diff] [blame] | 1310 | \return |
| 1311 | END \name |
| 1312 | .endm |
| 1313 | |
Mathieu Chartier | 7410f29 | 2013-11-24 13:17:35 -0800 | [diff] [blame] | 1314 | // Generate the allocation entrypoints for each allocator. |
Pavle Batuta | 712c59d | 2015-12-02 18:39:01 +0100 | [diff] [blame^] | 1315 | GENERATE_ALLOC_ENTRYPOINTS_FOR_EACH_ALLOCATOR |
| 1316 | GENERATE_ALLOC_ENTRYPOINTS_ALLOC_OBJECT(_tlab, TLAB) |
| 1317 | // A hand-written override for GENERATE_ALLOC_ENTRYPOINTS_ALLOC_OBJECT(_rosalloc, RosAlloc). |
| 1318 | ENTRY art_quick_alloc_object_rosalloc |
| 1319 | |
| 1320 | # Fast path rosalloc allocation |
| 1321 | # a0: type_idx |
| 1322 | # a1: ArtMethod* |
| 1323 | # s1: Thread::Current |
| 1324 | # ----------------------------- |
| 1325 | # t0: class |
| 1326 | # t1: object size |
| 1327 | # t2: rosalloc run |
| 1328 | # t3: thread stack top offset |
| 1329 | # t4: thread stack bottom offset |
| 1330 | # v0: free list head |
| 1331 | # |
| 1332 | # t5, t6 : temps |
| 1333 | |
| 1334 | lw $t0, ART_METHOD_DEX_CACHE_TYPES_OFFSET_32($a1) # Load dex cache resolved types |
| 1335 | # array. |
| 1336 | |
| 1337 | sll $t5, $a0, COMPRESSED_REFERENCE_SIZE_SHIFT # Shift the value. |
| 1338 | addu $t5, $t0, $t5 # Compute the index. |
| 1339 | lw $t0, 0($t5) # Load class (t0). |
| 1340 | beqz $t0, .Lart_quick_alloc_object_rosalloc_slow_path |
| 1341 | |
| 1342 | li $t6, MIRROR_CLASS_STATUS_INITIALIZED |
| 1343 | lw $t5, MIRROR_CLASS_STATUS_OFFSET($t0) # Check class status. |
| 1344 | bne $t5, $t6, .Lart_quick_alloc_object_rosalloc_slow_path |
| 1345 | |
| 1346 | # Add a fake dependence from the following access flag and size loads to the status load. This |
| 1347 | # is to prevent those loads from being reordered above the status load and reading wrong values. |
| 1348 | xor $t5, $t5, $t5 |
| 1349 | addu $t0, $t0, $t5 |
| 1350 | |
| 1351 | lw $t5, MIRROR_CLASS_ACCESS_FLAGS_OFFSET($t0) # Check if access flags has |
| 1352 | li $t6, ACCESS_FLAGS_CLASS_IS_FINALIZABLE # kAccClassIsFinalizable. |
| 1353 | and $t6, $t5, $t6 |
| 1354 | bnez $t6, .Lart_quick_alloc_object_rosalloc_slow_path |
| 1355 | |
| 1356 | lw $t3, THREAD_LOCAL_ALLOC_STACK_TOP_OFFSET($s1) # Check if thread local allocation |
| 1357 | lw $t4, THREAD_LOCAL_ALLOC_STACK_END_OFFSET($s1) # stack has any room left. |
| 1358 | bgeu $t3, $t4, .Lart_quick_alloc_object_rosalloc_slow_path |
| 1359 | |
| 1360 | lw $t1, MIRROR_CLASS_OBJECT_SIZE_OFFSET($t0) # Load object size (t1). |
| 1361 | li $t5, ROSALLOC_MAX_THREAD_LOCAL_BRACKET_SIZE # Check if size is for a thread local |
| 1362 | # allocation. |
| 1363 | bgtu $t1, $t5, .Lart_quick_alloc_object_rosalloc_slow_path |
| 1364 | |
| 1365 | # Compute the rosalloc bracket index from the size. Allign up the size by the rosalloc bracket |
| 1366 | # quantum size and divide by the quantum size and subtract by 1. |
| 1367 | |
| 1368 | addiu $t1, $t1, -1 # Decrease obj size and shift right |
| 1369 | srl $t1, $t1, ROSALLOC_BRACKET_QUANTUM_SIZE_SHIFT # by quantum. |
| 1370 | |
| 1371 | sll $t2, $t1, POINTER_SIZE_SHIFT |
| 1372 | addu $t2, $t2, $s1 |
| 1373 | lw $t2, THREAD_ROSALLOC_RUNS_OFFSET($t2) # Load rosalloc run (t2). |
| 1374 | |
| 1375 | # Load the free list head (v0). |
| 1376 | # NOTE: this will be the return val. |
| 1377 | |
| 1378 | lw $v0, (ROSALLOC_RUN_FREE_LIST_OFFSET + ROSALLOC_RUN_FREE_LIST_HEAD_OFFSET)($t2) |
| 1379 | beqz $v0, .Lart_quick_alloc_object_rosalloc_slow_path |
| 1380 | nop |
| 1381 | |
| 1382 | # Load the next pointer of the head and update the list head with the next pointer. |
| 1383 | |
| 1384 | lw $t5, ROSALLOC_SLOT_NEXT_OFFSET($v0) |
| 1385 | sw $t5, (ROSALLOC_RUN_FREE_LIST_OFFSET + ROSALLOC_RUN_FREE_LIST_HEAD_OFFSET)($t2) |
| 1386 | |
| 1387 | # Store the class pointer in the header. This also overwrites the first pointer. The offsets are |
| 1388 | # asserted to match. |
| 1389 | |
| 1390 | #if ROSALLOC_SLOT_NEXT_OFFSET != MIRROR_OBJECT_CLASS_OFFSET |
| 1391 | #error "Class pointer needs to overwrite next pointer." |
| 1392 | #endif |
| 1393 | |
| 1394 | POISON_HEAP_REF $t0 |
| 1395 | sw $t0, MIRROR_OBJECT_CLASS_OFFSET($v0) |
| 1396 | |
| 1397 | # Push the new object onto the thread local allocation stack and increment the thread local |
| 1398 | # allocation stack top. |
| 1399 | |
| 1400 | sw $v0, 0($t3) |
| 1401 | addiu $t3, $t3, COMPRESSED_REFERENCE_SIZE |
| 1402 | sw $t3, THREAD_LOCAL_ALLOC_STACK_TOP_OFFSET($s1) |
| 1403 | |
| 1404 | # Decrement the size of the free list. |
| 1405 | |
| 1406 | lw $t5, (ROSALLOC_RUN_FREE_LIST_OFFSET + ROSALLOC_RUN_FREE_LIST_SIZE_OFFSET)($t2) |
| 1407 | addiu $t5, $t5, -1 |
| 1408 | sw $t5, (ROSALLOC_RUN_FREE_LIST_OFFSET + ROSALLOC_RUN_FREE_LIST_SIZE_OFFSET)($t2) |
| 1409 | |
| 1410 | sync # Fence. |
| 1411 | |
| 1412 | jalr $zero, $ra |
| 1413 | nop |
| 1414 | |
| 1415 | .Lart_quick_alloc_object_rosalloc_slow_path: |
| 1416 | |
| 1417 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME |
| 1418 | jal artAllocObjectFromCodeRosAlloc |
| 1419 | move $a2 ,$s1 # Pass self as argument. |
| 1420 | RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER |
| 1421 | |
| 1422 | END art_quick_alloc_object_rosalloc |
Hiroshi Yamauchi | 3b4c189 | 2013-09-12 21:33:12 -0700 | [diff] [blame] | 1423 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1424 | /* |
Andreas Gampe | 1cc7dba | 2014-12-17 18:43:01 -0800 | [diff] [blame] | 1425 | * 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] | 1426 | * exception on error. On success the String is returned. A0 holds the string index. The fast |
| 1427 | * path check for hit in strings cache has already been performed. |
Andreas Gampe | 1cc7dba | 2014-12-17 18:43:01 -0800 | [diff] [blame] | 1428 | */ |
Vladimir Marko | 5ea536a | 2015-04-20 20:11:30 +0100 | [diff] [blame] | 1429 | 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] | 1430 | |
| 1431 | /* |
| 1432 | * Entry from managed code when uninitialized static storage, this stub will run the class |
| 1433 | * initializer and deliver the exception on error. On success the static storage base is |
| 1434 | * returned. |
| 1435 | */ |
Vladimir Marko | 5ea536a | 2015-04-20 20:11:30 +0100 | [diff] [blame] | 1436 | 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] | 1437 | |
| 1438 | /* |
| 1439 | * Entry from managed code when dex cache misses for a type_idx. |
| 1440 | */ |
Vladimir Marko | 5ea536a | 2015-04-20 20:11:30 +0100 | [diff] [blame] | 1441 | 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] | 1442 | |
| 1443 | /* |
| 1444 | * Entry from managed code when type_idx needs to be checked for access and dex cache may also |
| 1445 | * miss. |
| 1446 | */ |
Vladimir Marko | 5ea536a | 2015-04-20 20:11:30 +0100 | [diff] [blame] | 1447 | 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] | 1448 | |
| 1449 | /* |
Ian Rogers | 57b86d4 | 2012-03-27 16:05:41 -0700 | [diff] [blame] | 1450 | * 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] | 1451 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1452 | .extern artTestSuspendFromCode |
| 1453 | ENTRY art_quick_test_suspend |
Ian Rogers | 474b6da | 2012-09-25 00:20:38 -0700 | [diff] [blame] | 1454 | lh $a0, THREAD_FLAGS_OFFSET(rSELF) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1455 | bnez $a0, 1f |
Duane Sand | e34652f | 2014-11-04 11:09:36 -0800 | [diff] [blame] | 1456 | addiu rSUSPEND, $zero, SUSPEND_CHECK_INTERVAL # reset rSUSPEND to SUSPEND_CHECK_INTERVAL |
Andreas Gampe | 8d36591 | 2015-01-13 11:32:32 -0800 | [diff] [blame] | 1457 | jalr $zero, $ra |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1458 | nop |
| 1459 | 1: |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 1460 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves for stack crawl |
| 1461 | jal artTestSuspendFromCode # (Thread*) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1462 | move $a0, rSELF |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 1463 | RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME_AND_RETURN |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1464 | END art_quick_test_suspend |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1465 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1466 | /* |
| 1467 | * 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] | 1468 | * r0 holds the proxy method; r1, r2 and r3 may contain arguments. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1469 | */ |
Jeff Hao | 5fa60c3 | 2013-04-04 17:57:01 -0700 | [diff] [blame] | 1470 | .extern artQuickProxyInvokeHandler |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1471 | ENTRY art_quick_proxy_invoke_handler |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1472 | SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME_WITH_METHOD_IN_A0 |
| 1473 | move $a2, rSELF # pass Thread::Current |
Jeff Hao | 5fa60c3 | 2013-04-04 17:57:01 -0700 | [diff] [blame] | 1474 | jal artQuickProxyInvokeHandler # (Method* proxy method, receiver, Thread*, SP) |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1475 | addiu $a3, $sp, ARG_SLOT_SIZE # pass $sp (remove arg slots) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1476 | lw $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1477 | RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1478 | bnez $t0, 1f |
Duane Sand | e34652f | 2014-11-04 11:09:36 -0800 | [diff] [blame] | 1479 | # don't care if $v0 and/or $v1 are modified, when exception branch taken |
| 1480 | MTD $v0, $v1, $f0, $f1 # move float value to return value |
Andreas Gampe | 8d36591 | 2015-01-13 11:32:32 -0800 | [diff] [blame] | 1481 | jalr $zero, $ra |
Duane Sand | e34652f | 2014-11-04 11:09:36 -0800 | [diff] [blame] | 1482 | nop |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1483 | 1: |
| 1484 | DELIVER_PENDING_EXCEPTION |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1485 | END art_quick_proxy_invoke_handler |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1486 | |
Jeff Hao | 88474b4 | 2013-10-23 16:24:40 -0700 | [diff] [blame] | 1487 | /* |
| 1488 | * Called to resolve an imt conflict. t0 is a hidden argument that holds the target method's |
| 1489 | * dex method index. |
| 1490 | */ |
Douglas Leung | 13738bf | 2014-10-27 14:44:47 -0700 | [diff] [blame] | 1491 | ENTRY art_quick_imt_conflict_trampoline |
Nicolas Geoffray | 8ea18d0 | 2015-05-26 16:29:08 +0100 | [diff] [blame] | 1492 | move $a0, $t0 |
Andreas Gampe | 3031c8d | 2015-07-13 20:11:06 -0700 | [diff] [blame] | 1493 | INVOKE_TRAMPOLINE_BODY artInvokeInterfaceTrampoline |
Jeff Hao | 88474b4 | 2013-10-23 16:24:40 -0700 | [diff] [blame] | 1494 | END art_quick_imt_conflict_trampoline |
| 1495 | |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1496 | .extern artQuickResolutionTrampoline |
| 1497 | ENTRY art_quick_resolution_trampoline |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 1498 | SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1499 | move $a2, rSELF # pass Thread::Current |
Ian Rogers | 65d1b22 | 2013-09-27 10:59:41 -0700 | [diff] [blame] | 1500 | jal artQuickResolutionTrampoline # (Method* called, receiver, Thread*, SP) |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1501 | addiu $a3, $sp, ARG_SLOT_SIZE # pass $sp (remove arg slots) |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1502 | beqz $v0, 1f |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1503 | lw $a0, ARG_SLOT_SIZE($sp) # load resolved method to $a0 |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 1504 | RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME |
Ian Rogers | 65d1b22 | 2013-09-27 10:59:41 -0700 | [diff] [blame] | 1505 | 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] | 1506 | jalr $zero, $t9 # tail call to method |
Mathieu Chartier | 1984152 | 2013-10-22 11:29:00 -0700 | [diff] [blame] | 1507 | nop |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1508 | 1: |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 1509 | RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1510 | DELIVER_PENDING_EXCEPTION |
| 1511 | END art_quick_resolution_trampoline |
| 1512 | |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1513 | .extern artQuickGenericJniTrampoline |
| 1514 | .extern artQuickGenericJniEndTrampoline |
| 1515 | ENTRY art_quick_generic_jni_trampoline |
| 1516 | SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME_WITH_METHOD_IN_A0 |
| 1517 | move $s8, $sp # save $sp to $s8 |
| 1518 | move $s3, $gp # save $gp to $s3 |
| 1519 | |
| 1520 | # prepare for call to artQuickGenericJniTrampoline(Thread*, SP) |
| 1521 | move $a0, rSELF # pass Thread::Current |
| 1522 | addiu $a1, $sp, ARG_SLOT_SIZE # save $sp (remove arg slots) |
| 1523 | jal artQuickGenericJniTrampoline # (Thread*, SP) |
| 1524 | addiu $sp, $sp, -5120 # reserve space on the stack |
| 1525 | |
| 1526 | # The C call will have registered the complete save-frame on success. |
| 1527 | # The result of the call is: |
| 1528 | # v0: ptr to native code, 0 on error. |
| 1529 | # v1: ptr to the bottom of the used area of the alloca, can restore stack till here. |
| 1530 | beq $v0, $zero, 1f # check entry error |
| 1531 | move $t9, $v0 # save the code ptr |
| 1532 | move $sp, $v1 # release part of the alloca |
| 1533 | |
| 1534 | # Load parameters from stack into registers |
| 1535 | lw $a0, 0($sp) |
| 1536 | lw $a1, 4($sp) |
| 1537 | lw $a2, 8($sp) |
| 1538 | |
| 1539 | # Load FPRs the same as GPRs. Look at BuildNativeCallFrameStateMachine. |
| 1540 | jalr $t9 # native call |
| 1541 | lw $a3, 12($sp) |
| 1542 | addiu $sp, $sp, 16 # remove arg slots |
| 1543 | |
| 1544 | move $gp, $s3 # restore $gp from $s3 |
| 1545 | |
| 1546 | # result sign extension is handled in C code |
| 1547 | # prepare for call to artQuickGenericJniEndTrampoline(Thread*, result, result_f) |
| 1548 | move $a0, rSELF # pass Thread::Current |
| 1549 | move $a2, $v0 # pass result |
| 1550 | move $a3, $v1 |
| 1551 | addiu $sp, $sp, -24 # reserve arg slots |
| 1552 | jal artQuickGenericJniEndTrampoline |
| 1553 | s.d $f0, 16($sp) # pass result_f |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1554 | |
| 1555 | lw $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ |
Nicolas Geoffray | 126d659 | 2015-03-03 14:28:35 +0000 | [diff] [blame] | 1556 | bne $t0, $zero, 1f # check for pending exceptions |
| 1557 | |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1558 | move $sp, $s8 # tear down the alloca |
| 1559 | |
| 1560 | # tear dpown the callee-save frame |
| 1561 | RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME |
| 1562 | |
Duane Sand | e34652f | 2014-11-04 11:09:36 -0800 | [diff] [blame] | 1563 | MTD $v0, $v1, $f0, $f1 # move float value to return value |
Andreas Gampe | 8d36591 | 2015-01-13 11:32:32 -0800 | [diff] [blame] | 1564 | jalr $zero, $ra |
Duane Sand | e34652f | 2014-11-04 11:09:36 -0800 | [diff] [blame] | 1565 | nop |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1566 | |
| 1567 | 1: |
Nicolas Geoffray | 126d659 | 2015-03-03 14:28:35 +0000 | [diff] [blame] | 1568 | lw $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF) |
| 1569 | # This will create a new save-all frame, required by the runtime. |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1570 | DELIVER_PENDING_EXCEPTION |
| 1571 | END art_quick_generic_jni_trampoline |
Andreas Gampe | 2da8823 | 2014-02-27 12:26:20 -0800 | [diff] [blame] | 1572 | |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1573 | .extern artQuickToInterpreterBridge |
| 1574 | ENTRY art_quick_to_interpreter_bridge |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 1575 | SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1576 | move $a1, rSELF # pass Thread::Current |
| 1577 | jal artQuickToInterpreterBridge # (Method* method, Thread*, SP) |
| 1578 | addiu $a2, $sp, ARG_SLOT_SIZE # pass $sp (remove arg slots) |
Ian Rogers | 7db619b | 2013-01-16 18:35:48 -0800 | [diff] [blame] | 1579 | lw $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1580 | RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME |
Ian Rogers | 7db619b | 2013-01-16 18:35:48 -0800 | [diff] [blame] | 1581 | bnez $t0, 1f |
Duane Sand | e34652f | 2014-11-04 11:09:36 -0800 | [diff] [blame] | 1582 | # don't care if $v0 and/or $v1 are modified, when exception branch taken |
| 1583 | MTD $v0, $v1, $f0, $f1 # move float value to return value |
Andreas Gampe | 8d36591 | 2015-01-13 11:32:32 -0800 | [diff] [blame] | 1584 | jalr $zero, $ra |
Duane Sand | e34652f | 2014-11-04 11:09:36 -0800 | [diff] [blame] | 1585 | nop |
Ian Rogers | 7db619b | 2013-01-16 18:35:48 -0800 | [diff] [blame] | 1586 | 1: |
| 1587 | DELIVER_PENDING_EXCEPTION |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1588 | END art_quick_to_interpreter_bridge |
Ian Rogers | 7db619b | 2013-01-16 18:35:48 -0800 | [diff] [blame] | 1589 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1590 | /* |
jeffhao | 725a957 | 2012-11-13 18:20:12 -0800 | [diff] [blame] | 1591 | * Routine that intercepts method calls and returns. |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1592 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1593 | .extern artInstrumentationMethodEntryFromCode |
| 1594 | .extern artInstrumentationMethodExitFromCode |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1595 | ENTRY art_quick_instrumentation_entry |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 1596 | SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1597 | sw $a0, 28($sp) # save arg0 in free arg slot |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 1598 | move $a3, $ra # pass $ra |
| 1599 | jal artInstrumentationMethodEntryFromCode # (Method*, Object*, Thread*, LR) |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 1600 | move $a2, rSELF # pass Thread::Current |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 1601 | move $t9, $v0 # $t9 holds reference to code |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1602 | lw $a0, 28($sp) # restore arg0 from free arg slot |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 1603 | RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 1604 | jalr $t9 # call method |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 1605 | nop |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1606 | END art_quick_instrumentation_entry |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1607 | /* intentional fallthrough */ |
Ian Rogers | 468532e | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 1608 | .global art_quick_instrumentation_exit |
| 1609 | art_quick_instrumentation_exit: |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1610 | .cfi_startproc |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 1611 | addiu $t9, $ra, 4 # put current address into $t9 to rebuild $gp |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 1612 | .cpload $t9 |
Douglas Leung | c3d131e | 2014-07-16 17:32:41 -0700 | [diff] [blame] | 1613 | 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] | 1614 | |
Douglas Leung | f96e8bd | 2015-03-27 15:38:30 -0700 | [diff] [blame] | 1615 | SETUP_REFS_ONLY_CALLEE_SAVE_FRAME |
Douglas Leung | 735b855 | 2014-10-31 12:21:40 -0700 | [diff] [blame] | 1616 | addiu $sp, $sp, -16 # allocate temp storage on the stack |
| 1617 | .cfi_adjust_cfa_offset 16 |
Douglas Leung | f96e8bd | 2015-03-27 15:38:30 -0700 | [diff] [blame] | 1618 | sw $v0, ARG_SLOT_SIZE+12($sp) |
| 1619 | .cfi_rel_offset 2, ARG_SLOT_SIZE+12 |
| 1620 | sw $v1, ARG_SLOT_SIZE+8($sp) |
| 1621 | .cfi_rel_offset 3, ARG_SLOT_SIZE+8 |
| 1622 | s.d $f0, ARG_SLOT_SIZE($sp) |
Duane Sand | e34652f | 2014-11-04 11:09:36 -0800 | [diff] [blame] | 1623 | s.d $f0, 16($sp) # pass fpr result |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 1624 | move $a2, $v0 # pass gpr result |
| 1625 | move $a3, $v1 |
Douglas Leung | f96e8bd | 2015-03-27 15:38:30 -0700 | [diff] [blame] | 1626 | 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] | 1627 | jal artInstrumentationMethodExitFromCode # (Thread*, SP, gpr_res, fpr_res) |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 1628 | move $a0, rSELF # pass Thread::Current |
Douglas Leung | f96e8bd | 2015-03-27 15:38:30 -0700 | [diff] [blame] | 1629 | move $t9, $v0 # set aside returned link register |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 1630 | move $ra, $v1 # set link register for deoptimization |
Douglas Leung | f96e8bd | 2015-03-27 15:38:30 -0700 | [diff] [blame] | 1631 | lw $v0, ARG_SLOT_SIZE+12($sp) # restore return values |
| 1632 | lw $v1, ARG_SLOT_SIZE+8($sp) |
| 1633 | l.d $f0, ARG_SLOT_SIZE($sp) |
| 1634 | jalr $zero, $t9 # return |
| 1635 | addiu $sp, $sp, ARG_SLOT_SIZE+FRAME_SIZE_REFS_ONLY_CALLEE_SAVE+16 # restore stack |
| 1636 | .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] | 1637 | END art_quick_instrumentation_exit |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1638 | |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 1639 | /* |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 1640 | * Instrumentation has requested that we deoptimize into the interpreter. The deoptimization |
| 1641 | * will long jump to the upcall with a special exception of -1. |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 1642 | */ |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1643 | .extern artDeoptimize |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1644 | ENTRY art_quick_deoptimize |
Jeff Hao | 14dd5a8 | 2013-04-11 10:23:36 -0700 | [diff] [blame] | 1645 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 1646 | jal artDeoptimize # artDeoptimize(Thread*) |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 1647 | # Returns caller method's frame size. |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 1648 | move $a0, rSELF # pass Thread::current |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1649 | END art_quick_deoptimize |
jeffhao | 12051ea | 2013-01-10 11:24:31 -0800 | [diff] [blame] | 1650 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1651 | /* |
Sebastien Hertz | 0747466 | 2015-08-25 15:12:33 +0000 | [diff] [blame] | 1652 | * Compiled code has requested that we deoptimize into the interpreter. The deoptimization |
| 1653 | * will long jump to the upcall with a special exception of -1. |
| 1654 | */ |
| 1655 | .extern artDeoptimizeFromCompiledCode |
| 1656 | ENTRY art_quick_deoptimize_from_compiled_code |
| 1657 | SETUP_SAVE_ALL_CALLEE_SAVE_FRAME |
| 1658 | jal artDeoptimizeFromCompiledCode # artDeoptimizeFromCompiledCode(Thread*) |
| 1659 | # Returns caller method's frame size. |
| 1660 | move $a0, rSELF # pass Thread::current |
| 1661 | END art_quick_deoptimize_from_compiled_code |
| 1662 | |
| 1663 | /* |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1664 | * Long integer shift. This is different from the generic 32/64-bit |
| 1665 | * binary operations because vAA/vBB are 64-bit but vCC (the shift |
| 1666 | * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low |
| 1667 | * 6 bits. |
| 1668 | * On entry: |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1669 | * $a0: low word |
| 1670 | * $a1: high word |
| 1671 | * $a2: shift count |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1672 | */ |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 1673 | ENTRY_NO_GP art_quick_shl_long |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1674 | /* shl-long vAA, vBB, vCC */ |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1675 | sll $v0, $a0, $a2 # rlo<- alo << (shift&31) |
| 1676 | not $v1, $a2 # rhi<- 31-shift (shift is 5b) |
| 1677 | srl $a0, 1 |
| 1678 | srl $a0, $v1 # alo<- alo >> (32-(shift&31)) |
| 1679 | sll $v1, $a1, $a2 # rhi<- ahi << (shift&31) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1680 | andi $a2, 0x20 # shift< shift & 0x20 |
Duane Sand | e34652f | 2014-11-04 11:09:36 -0800 | [diff] [blame] | 1681 | beqz $a2, 1f |
| 1682 | or $v1, $a0 # rhi<- rhi | alo |
| 1683 | |
| 1684 | move $v1, $v0 # rhi<- rlo (if shift&0x20) |
| 1685 | move $v0, $zero # rlo<- 0 (if shift&0x20) |
| 1686 | |
Andreas Gampe | 8d36591 | 2015-01-13 11:32:32 -0800 | [diff] [blame] | 1687 | 1: jalr $zero, $ra |
Duane Sand | e34652f | 2014-11-04 11:09:36 -0800 | [diff] [blame] | 1688 | nop |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1689 | END art_quick_shl_long |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1690 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1691 | /* |
| 1692 | * Long integer shift. This is different from the generic 32/64-bit |
| 1693 | * binary operations because vAA/vBB are 64-bit but vCC (the shift |
| 1694 | * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low |
| 1695 | * 6 bits. |
| 1696 | * On entry: |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1697 | * $a0: low word |
| 1698 | * $a1: high word |
| 1699 | * $a2: shift count |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1700 | */ |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 1701 | ENTRY_NO_GP art_quick_shr_long |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1702 | sra $v1, $a1, $a2 # rhi<- ahi >> (shift&31) |
| 1703 | srl $v0, $a0, $a2 # rlo<- alo >> (shift&31) |
| 1704 | sra $a3, $a1, 31 # $a3<- sign(ah) |
| 1705 | not $a0, $a2 # alo<- 31-shift (shift is 5b) |
| 1706 | sll $a1, 1 |
| 1707 | sll $a1, $a0 # ahi<- ahi << (32-(shift&31)) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1708 | andi $a2, 0x20 # shift & 0x20 |
Douglas Leung | 475cfd8 | 2014-12-16 20:15:41 -0800 | [diff] [blame] | 1709 | beqz $a2, 1f |
Duane Sand | e34652f | 2014-11-04 11:09:36 -0800 | [diff] [blame] | 1710 | or $v0, $a1 # rlo<- rlo | ahi |
| 1711 | |
| 1712 | move $v0, $v1 # rlo<- rhi (if shift&0x20) |
| 1713 | move $v1, $a3 # rhi<- sign(ahi) (if shift&0x20) |
| 1714 | |
Andreas Gampe | 8d36591 | 2015-01-13 11:32:32 -0800 | [diff] [blame] | 1715 | 1: jalr $zero, $ra |
Duane Sand | e34652f | 2014-11-04 11:09:36 -0800 | [diff] [blame] | 1716 | nop |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1717 | END art_quick_shr_long |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1718 | |
buzbee | 5bc5a7b | 2012-03-07 15:52:59 -0800 | [diff] [blame] | 1719 | /* |
| 1720 | * Long integer shift. This is different from the generic 32/64-bit |
| 1721 | * binary operations because vAA/vBB are 64-bit but vCC (the shift |
| 1722 | * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low |
| 1723 | * 6 bits. |
| 1724 | * On entry: |
| 1725 | * r0: low word |
| 1726 | * r1: high word |
| 1727 | * r2: shift count |
| 1728 | */ |
| 1729 | /* ushr-long vAA, vBB, vCC */ |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 1730 | ENTRY_NO_GP art_quick_ushr_long |
jeffhao | fc6a30e | 2012-10-18 18:24:15 -0700 | [diff] [blame] | 1731 | srl $v1, $a1, $a2 # rhi<- ahi >> (shift&31) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1732 | srl $v0, $a0, $a2 # rlo<- alo >> (shift&31) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1733 | not $a0, $a2 # alo<- 31-shift (shift is 5b) |
| 1734 | sll $a1, 1 |
| 1735 | sll $a1, $a0 # ahi<- ahi << (32-(shift&31)) |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1736 | andi $a2, 0x20 # shift & 0x20 |
Duane Sand | e34652f | 2014-11-04 11:09:36 -0800 | [diff] [blame] | 1737 | beqz $a2, 1f |
| 1738 | or $v0, $a1 # rlo<- rlo | ahi |
| 1739 | |
| 1740 | move $v0, $v1 # rlo<- rhi (if shift&0x20) |
| 1741 | move $v1, $zero # rhi<- 0 (if shift&0x20) |
| 1742 | |
Andreas Gampe | 8d36591 | 2015-01-13 11:32:32 -0800 | [diff] [blame] | 1743 | 1: jalr $zero, $ra |
Duane Sand | e34652f | 2014-11-04 11:09:36 -0800 | [diff] [blame] | 1744 | nop |
Jeff Hao | d4c3f7d | 2013-02-14 14:14:44 -0800 | [diff] [blame] | 1745 | END art_quick_ushr_long |
jeffhao | 7fbee07 | 2012-08-24 17:56:54 -0700 | [diff] [blame] | 1746 | |
Ian Rogers | 1d8cdbc | 2014-09-22 22:51:09 -0700 | [diff] [blame] | 1747 | UNIMPLEMENTED art_quick_indexof |
| 1748 | UNIMPLEMENTED art_quick_string_compareto |