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