blob: 697bf003ea81e77b42528bf24fed4a0e017e77ed [file] [log] [blame]
Andreas Gampe1a5c4062015-01-15 12:10:47 -08001/*
2 * Copyright (C) 2014 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
17#include "asm_support_mips64.S"
18
19#include "arch/quick_alloc_entrypoints.S"
20
21 .set noreorder
22 .balign 16
23
24 /* Deliver the given exception */
25 .extern artDeliverExceptionFromCode
26 /* Deliver an exception pending on a thread */
27 .extern artDeliverPendingExceptionFromCode
28
29 /*
30 * Macro that sets up the callee save frame to conform with
31 * Runtime::CreateCalleeSaveMethod(kSaveAll)
32 * callee-save: padding + $f24-$f31 + $s0-$s7 + $gp + $ra + $s8 = 19 total + 1x8 bytes padding
33 */
34.macro SETUP_SAVE_ALL_CALLEE_SAVE_FRAME
35 daddiu $sp, $sp, -160
36 .cfi_adjust_cfa_offset 160
37
38 // Ugly compile-time check, but we only have the preprocessor.
39#if (FRAME_SIZE_SAVE_ALL_CALLEE_SAVE != 160)
40#error "SAVE_ALL_CALLEE_SAVE_FRAME(MIPS64) size not as expected."
41#endif
42
43 sd $ra, 152($sp)
44 .cfi_rel_offset 31, 152
45 sd $s8, 144($sp)
46 .cfi_rel_offset 30, 144
47 sd $gp, 136($sp)
48 .cfi_rel_offset 28, 136
49 sd $s7, 128($sp)
50 .cfi_rel_offset 23, 128
51 sd $s6, 120($sp)
52 .cfi_rel_offset 22, 120
53 sd $s5, 112($sp)
54 .cfi_rel_offset 21, 112
55 sd $s4, 104($sp)
56 .cfi_rel_offset 20, 104
57 sd $s3, 96($sp)
58 .cfi_rel_offset 19, 96
59 sd $s2, 88($sp)
60 .cfi_rel_offset 18, 88
61 sd $s1, 80($sp)
62 .cfi_rel_offset 17, 80
63 sd $s0, 72($sp)
64 .cfi_rel_offset 16, 72
65
66 // FP callee-saves
67 s.d $f31, 64($sp)
68 s.d $f30, 56($sp)
69 s.d $f29, 48($sp)
70 s.d $f28, 40($sp)
71 s.d $f27, 32($sp)
72 s.d $f26, 24($sp)
73 s.d $f25, 16($sp)
74 s.d $f24, 8($sp)
75
76 # load appropriate callee-save-method
77 ld $v0, %got(_ZN3art7Runtime9instance_E)($gp)
78 ld $v0, 0($v0)
79 THIS_LOAD_REQUIRES_READ_BARRIER
80 ld $v0, RUNTIME_SAVE_ALL_CALLEE_SAVE_FRAME_OFFSET($v0)
81 sw $v0, 0($sp) # Place Method* at bottom of stack.
82 sd $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF) # Place sp in Thread::Current()->top_quick_frame.
83.endm
84
85 /*
86 * Macro that sets up the callee save frame to conform with
87 * Runtime::CreateCalleeSaveMethod(kRefsOnly). Restoration assumes
88 * non-moving GC.
89 * Does not include rSUSPEND or rSELF
90 * callee-save: padding + $s2-$s7 + $gp + $ra + $s8 = 9 total + 1x8 bytes padding
91 */
92.macro SETUP_REFS_ONLY_CALLEE_SAVE_FRAME
93 daddiu $sp, $sp, -80
94 .cfi_adjust_cfa_offset 80
95
96 // Ugly compile-time check, but we only have the preprocessor.
97#if (FRAME_SIZE_REFS_ONLY_CALLEE_SAVE != 80)
98#error "REFS_ONLY_CALLEE_SAVE_FRAME(MIPS64) size not as expected."
99#endif
100
101 sd $ra, 72($sp)
102 .cfi_rel_offset 31, 72
103 sd $s8, 64($sp)
104 .cfi_rel_offset 30, 64
105 sd $gp, 56($sp)
106 .cfi_rel_offset 28, 56
107 sd $s7, 48($sp)
108 .cfi_rel_offset 23, 48
109 sd $s6, 40($sp)
110 .cfi_rel_offset 22, 40
111 sd $s5, 32($sp)
112 .cfi_rel_offset 21, 32
113 sd $s4, 24($sp)
114 .cfi_rel_offset 20, 24
115 sd $s3, 16($sp)
116 .cfi_rel_offset 19, 16
117 sd $s2, 8($sp)
118 .cfi_rel_offset 18, 8
119 # load appropriate callee-save-method
120 ld $v0, %got(_ZN3art7Runtime9instance_E)($gp)
121 ld $v0, 0($v0)
122 THIS_LOAD_REQUIRES_READ_BARRIER
123 ld $v0, RUNTIME_REFS_ONLY_CALLEE_SAVE_FRAME_OFFSET($v0)
124 sw $v0, 0($sp) # Place Method* at bottom of stack.
125 sd $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF) # Place sp in Thread::Current()->top_quick_frame.
126.endm
127
128.macro RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME
129 ld $ra, 72($sp)
130 .cfi_restore 31
131 ld $s8, 64($sp)
132 .cfi_restore 30
133 ld $gp, 56($sp)
134 .cfi_restore 28
135 ld $s7, 48($sp)
136 .cfi_restore 23
137 ld $s6, 40($sp)
138 .cfi_restore 22
139 ld $s5, 32($sp)
140 .cfi_restore 21
141 ld $s4, 24($sp)
142 .cfi_restore 20
143 ld $s3, 16($sp)
144 .cfi_restore 19
145 ld $s2, 8($sp)
146 .cfi_restore 18
147 daddiu $sp, $sp, 80
148 .cfi_adjust_cfa_offset -80
149.endm
150
151.macro RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME_AND_RETURN
152 ld $ra, 72($sp)
153 .cfi_restore 31
154 ld $s8, 64($sp)
155 .cfi_restore 30
156 ld $gp, 56($sp)
157 .cfi_restore 28
158 ld $s7, 48($sp)
159 .cfi_restore 23
160 ld $s6, 40($sp)
161 .cfi_restore 22
162 ld $s5, 32($sp)
163 .cfi_restore 21
164 ld $s4, 24($sp)
165 .cfi_restore 20
166 ld $s3, 16($sp)
167 .cfi_restore 19
168 ld $s2, 8($sp)
169 .cfi_restore 18
170 jalr $zero, $ra
171 daddiu $sp, $sp, 80
172 .cfi_adjust_cfa_offset -80
173.endm
174
175// This assumes the top part of these stack frame types are identical.
176#define REFS_AND_ARGS_MINUS_REFS_SIZE (FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE - FRAME_SIZE_REFS_ONLY_CALLEE_SAVE)
177
178 /*
179 * Macro that sets up the callee save frame to conform with
180 * Runtime::CreateCalleeSaveMethod(kRefsAndArgs). Restoration assumes
181 * non-moving GC.
182 * callee-save: padding + $f12-$f19 + $a1-$a7 + $s2-$s7 + $gp + $ra + $s8 = 24 total + 1 words padding + Method*
183 */
184.macro SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME_INTERNAL
185 daddiu $sp, $sp, -208
186 .cfi_adjust_cfa_offset 208
187
188 // Ugly compile-time check, but we only have the preprocessor.
189#if (FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE != 208)
190#error "REFS_AND_ARGS_CALLEE_SAVE_FRAME(MIPS64) size not as expected."
191#endif
192
193 sd $ra, 200($sp) # = kQuickCalleeSaveFrame_RefAndArgs_LrOffset
194 .cfi_rel_offset 31, 200
195 sd $s8, 192($sp)
196 .cfi_rel_offset 30, 192
197 sd $gp, 184($sp)
198 .cfi_rel_offset 28, 184
199 sd $s7, 176($sp)
200 .cfi_rel_offset 23, 176
201 sd $s6, 168($sp)
202 .cfi_rel_offset 22, 168
203 sd $s5, 160($sp)
204 .cfi_rel_offset 21, 160
205 sd $s4, 152($sp)
206 .cfi_rel_offset 20, 152
207 sd $s3, 144($sp)
208 .cfi_rel_offset 19, 144
209 sd $s2, 136($sp)
210 .cfi_rel_offset 18, 136
211
212 sd $a7, 128($sp)
213 .cfi_rel_offset 11, 128
214 sd $a6, 120($sp)
215 .cfi_rel_offset 10, 120
216 sd $a5, 112($sp)
217 .cfi_rel_offset 9, 112
218 sd $a4, 104($sp)
219 .cfi_rel_offset 8, 104
220 sd $a3, 96($sp)
221 .cfi_rel_offset 7, 96
222 sd $a2, 88($sp)
223 .cfi_rel_offset 6, 88
224 sd $a1, 80($sp) # = kQuickCalleeSaveFrame_RefAndArgs_Gpr1Offset
225 .cfi_rel_offset 5, 80
226
227 s.d $f19, 72($sp)
228 s.d $f18, 64($sp)
229 s.d $f17, 56($sp)
230 s.d $f16, 48($sp)
231 s.d $f15, 40($sp)
232 s.d $f14, 32($sp)
233 s.d $f13, 24($sp) # = kQuickCalleeSaveFrame_RefAndArgs_Fpr1Offset
234 s.d $f12, 16($sp) # This isn't necessary to store.
235
236 # 1x8 bytes paddig + Method*
237 ld $v0, %got(_ZN3art7Runtime9instance_E)($gp)
238 ld $v0, 0($v0)
239 THIS_LOAD_REQUIRES_READ_BARRIER
240 ld $v0, RUNTIME_REFS_ONLY_CALLEE_SAVE_FRAME_OFFSET($v0)
241 sw $v0, 0($sp) # Place Method* at bottom of stack.
242 sd $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF) # Place sp in Thread::Current()->top_quick_frame.
243.endm
244
245.macro SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME
246 SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME_INTERNAL
247 # load appropriate callee-save-method
248 ld $v0, %got(_ZN3art7Runtime9instance_E)($gp)
249 ld $v0, 0($v0)
250 THIS_LOAD_REQUIRES_READ_BARRIER
251 ld $v0, RUNTIME_REFS_AND_ARGS_CALLEE_SAVE_FRAME_OFFSET($v0)
252 sw $v0, 0($sp) # Place Method* at bottom of stack.
253 sd $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF) # Place sp in Thread::Current()->top_quick_frame.
254.endm
255
256.macro RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME
257 ld $ra, 200($sp)
258 .cfi_restore 31
259 ld $s8, 192($sp)
260 .cfi_restore 30
261 ld $gp, 184($sp)
262 .cfi_restore 28
263 ld $s7, 176($sp)
264 .cfi_restore 23
265 ld $s6, 168($sp)
266 .cfi_restore 22
267 ld $s5, 160($sp)
268 .cfi_restore 21
269 ld $s4, 152($sp)
270 .cfi_restore 20
271 ld $s3, 144($sp)
272 .cfi_restore 19
273 ld $s2, 136($sp)
274 .cfi_restore 18
275
276 ld $a7, 128($sp)
277 .cfi_restore 11
278 ld $a6, 120($sp)
279 .cfi_restore 10
280 ld $a5, 112($sp)
281 .cfi_restore 9
282 ld $a4, 104($sp)
283 .cfi_restore 8
284 ld $a3, 96($sp)
285 .cfi_restore 7
286 ld $a2, 88($sp)
287 .cfi_restore 6
288 ld $a1, 80($sp)
289 .cfi_restore 5
290
291 l.d $f19, 72($sp)
292 l.d $f18, 64($sp)
293 l.d $f17, 56($sp)
294 l.d $f16, 48($sp)
295 l.d $f15, 40($sp)
296 l.d $f14, 32($sp)
297 l.d $f13, 24($sp)
298 l.d $f12, 16($sp)
299
300 daddiu $sp, $sp, 208
301 .cfi_adjust_cfa_offset -208
302.endm
303
304 /*
305 * Macro that set calls through to artDeliverPendingExceptionFromCode,
306 * where the pending
307 * exception is Thread::Current()->exception_
308 */
309.macro DELIVER_PENDING_EXCEPTION
310 SETUP_SAVE_ALL_CALLEE_SAVE_FRAME # save callee saves for throw
311 dla $t9, artDeliverPendingExceptionFromCode
312 jalr $zero, $t9 # artDeliverPendingExceptionFromCode(Thread*)
313 move $a0, rSELF # pass Thread::Current
314.endm
315
316.macro RETURN_IF_NO_EXCEPTION
317 ld $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_
318 RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME
319 bne $t0, $zero, 1f # success if no exception is pending
320 nop
321 jalr $zero, $ra
322 nop
3231:
324 DELIVER_PENDING_EXCEPTION
325.endm
326
327.macro RETURN_IF_ZERO
328 RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME
329 bne $v0, $zero, 1f # success?
330 nop
331 jalr $zero, $ra # return on success
332 nop
3331:
334 DELIVER_PENDING_EXCEPTION
335.endm
336
337.macro RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER
338 RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME
339 beq $v0, $zero, 1f # success?
340 nop
341 jalr $zero, $ra # return on success
342 nop
3431:
344 DELIVER_PENDING_EXCEPTION
345.endm
346
347 /*
348 * On entry $a0 is uint32_t* gprs_ and $a1 is uint32_t* fprs_
349 * FIXME: just guessing about the shape of the jmpbuf. Where will pc be?
350 */
351ENTRY art_quick_do_long_jump
352 l.d $f0, 0($a1)
353 l.d $f1, 8($a1)
354 l.d $f2, 16($a1)
355 l.d $f3, 24($a1)
356 l.d $f4, 32($a1)
357 l.d $f5, 40($a1)
358 l.d $f6, 48($a1)
359 l.d $f7, 56($a1)
360 l.d $f8, 64($a1)
361 l.d $f9, 72($a1)
362 l.d $f10, 80($a1)
363 l.d $f11, 88($a1)
364 l.d $f12, 96($a1)
365 l.d $f13, 104($a1)
366 l.d $f14, 112($a1)
367 l.d $f15, 120($a1)
368 l.d $f16, 128($a1)
369 l.d $f17, 136($a1)
370 l.d $f18, 144($a1)
371 l.d $f19, 152($a1)
372 l.d $f20, 160($a1)
373 l.d $f21, 168($a1)
374 l.d $f22, 176($a1)
375 l.d $f23, 184($a1)
376 l.d $f24, 192($a1)
377 l.d $f25, 200($a1)
378 l.d $f26, 208($a1)
379 l.d $f27, 216($a1)
380 l.d $f28, 224($a1)
381 l.d $f29, 232($a1)
382 l.d $f30, 240($a1)
383 l.d $f31, 248($a1)
384 .set push
385 .set nomacro
386 .set noat
387# no need to load zero
388 ld $at, 8($a0)
389 .set pop
390 ld $v0, 16($a0)
391 ld $v1, 24($a0)
392# a0 has to be loaded last
393 ld $a1, 40($a0)
394 ld $a2, 48($a0)
395 ld $a3, 56($a0)
396 ld $a4, 64($a0)
397 ld $a5, 72($a0)
398 ld $a6, 80($a0)
399 ld $a7, 88($a0)
400 ld $t0, 96($a0)
401 ld $t1, 104($a0)
402 ld $t2, 112($a0)
403 ld $t3, 120($a0)
404 ld $s0, 128($a0)
405 ld $s1, 136($a0)
406 ld $s2, 144($a0)
407 ld $s3, 152($a0)
408 ld $s4, 160($a0)
409 ld $s5, 168($a0)
410 ld $s6, 176($a0)
411 ld $s7, 184($a0)
412 ld $t8, 192($a0)
413 ld $t9, 200($a0)
414# no need to load k0, k1
415 ld $gp, 224($a0)
416 ld $sp, 232($a0)
417 ld $s8, 240($a0)
418 ld $ra, 248($a0)
419 ld $a0, 32($a0)
420 move $v0, $zero # clear result registers v0 and v1
421 jalr $zero, $ra # do long jump
422 move $v1, $zero
423END art_quick_do_long_jump
424
Maja Gagic6ea651f2015-02-24 16:55:04 +0100425 /*
426 * Called by managed code, saves most registers (forms basis of long jump
427 * context) and passes the bottom of the stack.
428 * artDeliverExceptionFromCode will place the callee save Method* at
429 * the bottom of the thread. On entry v0 holds Throwable*
430 */
431ENTRY art_quick_deliver_exception
432 SETUP_SAVE_ALL_CALLEE_SAVE_FRAME
433 dla $t9, artDeliverExceptionFromCode
434 jalr $zero, $t9 # artDeliverExceptionFromCode(Throwable*, Thread*)
435 move $a1, rSELF # pass Thread::Current
436END art_quick_deliver_exception
Andreas Gampe1a5c4062015-01-15 12:10:47 -0800437
Maja Gagic6ea651f2015-02-24 16:55:04 +0100438 /*
439 * Called by managed code to create and deliver a NullPointerException
440 */
441 .extern artThrowNullPointerExceptionFromCode
442ENTRY art_quick_throw_null_pointer_exception
443.Lart_quick_throw_null_pointer_exception_gp_set:
444 SETUP_SAVE_ALL_CALLEE_SAVE_FRAME
445 dla $t9, artThrowNullPointerExceptionFromCode
446 jalr $zero, $t9 # artThrowNullPointerExceptionFromCode(Thread*)
447 move $a0, rSELF # pass Thread::Current
448END art_quick_throw_null_pointer_exception
Andreas Gampe1a5c4062015-01-15 12:10:47 -0800449
Maja Gagic6ea651f2015-02-24 16:55:04 +0100450 /*
451 * Called by managed code to create and deliver an ArithmeticException
452 */
453 .extern artThrowDivZeroFromCode
454ENTRY art_quick_throw_div_zero
455 SETUP_SAVE_ALL_CALLEE_SAVE_FRAME
456 dla $t9, artThrowDivZeroFromCode
457 jalr $zero, $t9 # artThrowDivZeroFromCode(Thread*)
458 move $a0, rSELF # pass Thread::Current
459END art_quick_throw_div_zero
460
461 /*
462 * Called by managed code to create and deliver an
463 * ArrayIndexOutOfBoundsException
464 */
465 .extern artThrowArrayBoundsFromCode
466ENTRY art_quick_throw_array_bounds
467.Lart_quick_throw_array_bounds_gp_set:
468 SETUP_SAVE_ALL_CALLEE_SAVE_FRAME
469 dla $t9, artThrowArrayBoundsFromCode
470 jalr $zero, $t9 # artThrowArrayBoundsFromCode(index, limit, Thread*)
471 move $a2, rSELF # pass Thread::Current
472END art_quick_throw_array_bounds
473
474 /*
475 * Called by managed code to create and deliver a StackOverflowError.
476 */
477 .extern artThrowStackOverflowFromCode
478ENTRY art_quick_throw_stack_overflow
479 SETUP_SAVE_ALL_CALLEE_SAVE_FRAME
480 dla $t9, artThrowStackOverflowFromCode
481 jalr $zero, $t9 # artThrowStackOverflowFromCode(Thread*)
482 move $a0, rSELF # pass Thread::Current
483END art_quick_throw_stack_overflow
484
485 /*
486 * Called by managed code to create and deliver a NoSuchMethodError.
487 */
488 .extern artThrowNoSuchMethodFromCode
489ENTRY art_quick_throw_no_such_method
490 SETUP_SAVE_ALL_CALLEE_SAVE_FRAME
491 dla $t9, artThrowNoSuchMethodFromCode
492 jalr $zero, $t9 # artThrowNoSuchMethodFromCode(method_idx, Thread*)
493 move $a1, rSELF # pass Thread::Current
494END art_quick_throw_no_such_method
495
496 /*
497 * All generated callsites for interface invokes and invocation slow paths will load arguments
498 * as usual - except instead of loading arg0/$a0 with the target Method*, arg0/$a0 will contain
499 * the method_idx. This wrapper will save arg1-arg3, load the caller's Method*, align the
500 * stack and call the appropriate C helper.
501 * NOTE: "this" is first visable argument of the target, and so can be found in arg1/$a1.
502 *
503 * The helper will attempt to locate the target and return a 128-bit result in $v0/$v1 consisting
504 * of the target Method* in $v0 and method->code_ in $v1.
505 *
506 * If unsuccessful, the helper will return NULL/NULL. There will be a pending exception in the
507 * thread and we branch to another stub to deliver it.
508 *
509 * On success this wrapper will restore arguments and *jump* to the target, leaving the ra
510 * pointing back to the original caller.
511 */
512.macro INVOKE_TRAMPOLINE c_name, cxx_name
513 .extern \cxx_name
514ENTRY \c_name
515 SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME # save callee saves in case allocation triggers GC
516 lwu $a2, FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE($sp) # pass caller Method*
517 move $a3, rSELF # pass Thread::Current
518 jal \cxx_name # (method_idx, this, caller, Thread*, $sp)
519 move $a4, $sp # pass $sp
520 move $a0, $v0 # save target Method*
521 move $t9, $v1 # save $v0->code_
522 RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME
523 beq $v0, $zero, 1f
524 nop
525 jalr $zero, $t9
526 nop
5271:
528 DELIVER_PENDING_EXCEPTION
529END \c_name
530.endm
531
532INVOKE_TRAMPOLINE art_quick_invoke_interface_trampoline, artInvokeInterfaceTrampoline
533INVOKE_TRAMPOLINE art_quick_invoke_interface_trampoline_with_access_check, artInvokeInterfaceTrampolineWithAccessCheck
534
535INVOKE_TRAMPOLINE art_quick_invoke_static_trampoline_with_access_check, artInvokeStaticTrampolineWithAccessCheck
536INVOKE_TRAMPOLINE art_quick_invoke_direct_trampoline_with_access_check, artInvokeDirectTrampolineWithAccessCheck
537INVOKE_TRAMPOLINE art_quick_invoke_super_trampoline_with_access_check, artInvokeSuperTrampolineWithAccessCheck
538INVOKE_TRAMPOLINE art_quick_invoke_virtual_trampoline_with_access_check, artInvokeVirtualTrampolineWithAccessCheck
Andreas Gampe1a5c4062015-01-15 12:10:47 -0800539
540 # On entry:
541 # t0 = shorty
542 # t1 = ptr to arg_array
543 # t2 = number of argument bytes remain
544 # v0 = ptr to stack frame where to copy arg_array
545 # This macro modifies t3, t9 and v0
546.macro LOOP_OVER_SHORTY_LOADING_REG gpu, fpu, label
547 lbu $t3, 0($t0) # get argument type from shorty
548 beqz $t3, \label
549 daddiu $t0, 1
550 li $t9, 68 # put char 'D' into t9
551 beq $t9, $t3, 1f # branch if result type char == 'D'
552 li $t9, 70 # put char 'F' into t9
553 beq $t9, $t3, 2f # branch if result type char == 'F'
554 li $t9, 74 # put char 'J' into t9
555 beq $t9, $t3, 3f # branch if result type char == 'J'
556 nop
Maja Gagic6ea651f2015-02-24 16:55:04 +0100557 lw $\gpu, 0($t1)
Andreas Gampe1a5c4062015-01-15 12:10:47 -0800558 sw $\gpu, 0($v0)
559 daddiu $v0, 4
560 daddiu $t1, 4
561 b 4f
562 daddiu $t2, -4 # delay slot
563
5641: # found double
565 lwu $t3, 0($t1)
566 mtc1 $t3, $\fpu
567 sw $t3, 0($v0)
568 lwu $t3, 4($t1)
569 mthc1 $t3, $\fpu
570 sw $t3, 4($v0)
571 daddiu $v0, 8
572 daddiu $t1, 8
573 b 4f
574 daddiu $t2, -8 # delay slot
575
5762: # found float
577 lwu $t3, 0($t1)
578 mtc1 $t3, $\fpu
579 sw $t3, 0($v0)
580 daddiu $v0, 4
581 daddiu $t1, 4
582 b 4f
583 daddiu $t2, -4 # delay slot
584
5853: # found long (8 bytes)
586 lwu $t3, 0($t1)
587 sw $t3, 0($v0)
588 lwu $t9, 4($t1)
589 sw $t9, 4($v0)
590 dsll $t9, $t9, 32
591 or $\gpu, $t9, $t3
592 daddiu $v0, 8
593 daddiu $t1, 8
594 daddiu $t2, -8
5954:
596.endm
597
598 /*
599 * Invocation stub for quick code.
600 * On entry:
601 * a0 = method pointer
602 * a1 = argument array that must at least contain the this ptr.
603 * a2 = size of argument array in bytes
604 * a3 = (managed) thread pointer
605 * a4 = JValue* result
606 * a5 = shorty
607 */
608ENTRY art_quick_invoke_stub
609 # push a4, a5, s0(rSUSPEND), s1(rSELF), s8, ra onto the stack
610 daddiu $sp, $sp, -48
611 .cfi_adjust_cfa_offset 48
612 sd $ra, 40($sp)
613 .cfi_rel_offset 31, 40
614 sd $s8, 32($sp)
615 .cfi_rel_offset 30, 32
616 sd $s1, 24($sp)
617 .cfi_rel_offset 17, 24
618 sd $s0, 16($sp)
619 .cfi_rel_offset 16, 16
620 sd $a5, 8($sp)
621 .cfi_rel_offset 9, 8
622 sd $a4, 0($sp)
623 .cfi_rel_offset 8, 0
624
625 daddiu $s0, $zero, SUSPEND_CHECK_INTERVAL # reset rSUSPEND to SUSPEND_CHECK_INTERVAL
626 move $s1, $a3 # move managed thread pointer into s1 (rSELF)
627 move $s8, $sp # save sp in s8 (fp)
628
629 daddiu $t3, $a2, 20 # add 4 for method* and 16 for stack alignment
630 dsrl $t3, $t3, 4 # shift the frame size right 4
631 dsll $t3, $t3, 4 # shift the frame size left 4 to align to 16 bytes
632 dsubu $sp, $sp, $t3 # reserve stack space for argument array
633
634 daddiu $t0, $a5, 1 # t0 = shorty[1] (skip 1 for return type)
635 daddiu $t1, $a1, 4 # t1 = ptr to arg_array[4] (skip this ptr)
636 daddiu $t2, $a2, -4 # t2 = number of argument bytes remain (skip this ptr)
637 daddiu $v0, $sp, 8 # v0 points to where to copy arg_array
638 LOOP_OVER_SHORTY_LOADING_REG a2, f14, call_fn
639 LOOP_OVER_SHORTY_LOADING_REG a3, f15, call_fn
640 LOOP_OVER_SHORTY_LOADING_REG a4, f16, call_fn
641 LOOP_OVER_SHORTY_LOADING_REG a5, f17, call_fn
642 LOOP_OVER_SHORTY_LOADING_REG a6, f18, call_fn
643 LOOP_OVER_SHORTY_LOADING_REG a7, f19, call_fn
644
645 # copy arguments onto stack (t2 should be multiples of 4)
646 ble $t2, $zero, call_fn # t2 = number of argument bytes remain
6471:
648 lw $t3, 0($t1) # load from argument array
649 daddiu $t1, $t1, 4
650 sw $t3, 0($v0) # save to stack
651 daddiu $t2, -4
652 bgt $t2, $zero, 1b # t2 = number of argument bytes remain
653 daddiu $v0, $v0, 4
654
655call_fn:
656 # call method (a0 and a1 have been untouched)
657 lwu $a1, 0($a1) # make a1 = this ptr
658 sw $a1, 4($sp) # copy this ptr (skip 4 bytes for method*)
659 sw $zero, 0($sp) # store NULL for method* at bottom of frame
660 ld $t9, MIRROR_ART_METHOD_QUICK_CODE_OFFSET_64($a0) # get pointer to the code
661 jalr $t9 # call the method
662 nop
663 move $sp, $s8 # restore sp
664
665 # pop a4, a5, s1(rSELF), s8, ra off of the stack
666 ld $a4, 0($sp)
667 .cfi_restore 8
668 ld $a5, 8($sp)
669 .cfi_restore 9
670 ld $s0, 16($sp)
671 .cfi_restore 16
672 ld $s1, 24($sp)
673 .cfi_restore 17
674 ld $s8, 32($sp)
675 .cfi_restore 30
676 ld $ra, 40($sp)
677 .cfi_restore 31
678 daddiu $sp, $sp, 48
679 .cfi_adjust_cfa_offset -48
680
681 # a4 = JValue* result
682 # a5 = shorty string
683 lbu $t1, 0($a5) # get result type from shorty
684 li $t2, 68 # put char 'D' into t2
685 beq $t1, $t2, 1f # branch if result type char == 'D'
686 li $t3, 70 # put char 'F' into t3
687 beq $t1, $t3, 1f # branch if result type char == 'F'
688 sw $v0, 0($a4) # store the result
689 dsrl $v1, $v0, 32
690 jalr $zero, $ra
691 sw $v1, 4($a4) # store the other half of the result
6921:
693 mfc1 $v0, $f0
694 mfhc1 $v1, $f0
695 sw $v0, 0($a4) # store the result
696 jalr $zero, $ra
697 sw $v1, 4($a4) # store the other half of the result
698END art_quick_invoke_stub
699
700 /*
701 * Invocation static stub for quick code.
702 * On entry:
703 * a0 = method pointer
704 * a1 = argument array that must at least contain the this ptr.
705 * a2 = size of argument array in bytes
706 * a3 = (managed) thread pointer
707 * a4 = JValue* result
708 * a5 = shorty
709 */
710ENTRY art_quick_invoke_static_stub
711
712 # push a4, a5, s0(rSUSPEND), s1(rSELF), s8, ra, onto the stack
713 daddiu $sp, $sp, -48
714 .cfi_adjust_cfa_offset 48
715 sd $ra, 40($sp)
716 .cfi_rel_offset 31, 40
717 sd $s8, 32($sp)
718 .cfi_rel_offset 30, 32
719 sd $s1, 24($sp)
720 .cfi_rel_offset 17, 24
721 sd $s0, 16($sp)
722 .cfi_rel_offset 16, 16
723 sd $a5, 8($sp)
724 .cfi_rel_offset 9, 8
725 sd $a4, 0($sp)
726 .cfi_rel_offset 8, 0
727
728 daddiu $s0, $zero, SUSPEND_CHECK_INTERVAL # reset rSUSPEND to SUSPEND_CHECK_INTERVAL
729 move $s1, $a3 # move managed thread pointer into s1 (rSELF)
730 move $s8, $sp # save sp in s8 (fp)
731
732 daddiu $t3, $a2, 20 # add 4 for method* and 16 for stack alignment
733 dsrl $t3, $t3, 4 # shift the frame size right 4
734 dsll $t3, $t3, 4 # shift the frame size left 4 to align to 16 bytes
735 dsubu $sp, $sp, $t3 # reserve stack space for argument array
736
737 daddiu $t0, $a5, 1 # t0 = shorty[1] (skip 1 for return type)
738 move $t1, $a1 # t1 = arg_array
739 move $t2, $a2 # t2 = number of argument bytes remain
740 daddiu $v0, $sp, 4 # v0 points to where to copy arg_array
741 LOOP_OVER_SHORTY_LOADING_REG a1, f13, call_sfn
742 LOOP_OVER_SHORTY_LOADING_REG a2, f14, call_sfn
743 LOOP_OVER_SHORTY_LOADING_REG a3, f15, call_sfn
744 LOOP_OVER_SHORTY_LOADING_REG a4, f16, call_sfn
745 LOOP_OVER_SHORTY_LOADING_REG a5, f17, call_sfn
746 LOOP_OVER_SHORTY_LOADING_REG a6, f18, call_sfn
747 LOOP_OVER_SHORTY_LOADING_REG a7, f19, call_sfn
748
749 # copy arguments onto stack (t2 should be multiples of 4)
750 ble $t2, $zero, call_sfn # t2 = number of argument bytes remain
7511:
752 lw $t3, 0($t1) # load from argument array
753 daddiu $t1, $t1, 4
754 sw $t3, 0($v0) # save to stack
755 daddiu $t2, -4
756 bgt $t2, $zero, 1b # t2 = number of argument bytes remain
757 daddiu $v0, $v0, 4
758
759call_sfn:
760 # call method (a0 has been untouched)
761 sw $zero, 0($sp) # store NULL for method* at bottom of frame
762 ld $t9, MIRROR_ART_METHOD_QUICK_CODE_OFFSET_64($a0) # get pointer to the code
763 jalr $t9 # call the method
764 nop
765 move $sp, $s8 # restore sp
766
767 # pop a4, a5, s0(rSUSPEND), s1(rSELF), s8, ra off of the stack
768 ld $a4, 0($sp)
769 .cfi_restore 8
770 ld $a5, 8($sp)
771 .cfi_restore 9
772 ld $s0, 16($sp)
773 .cfi_restore 16
774 ld $s1, 24($sp)
775 .cfi_restore 17
776 ld $s8, 32($sp)
777 .cfi_restore 30
778 ld $ra, 40($sp)
779 .cfi_restore 31
780 daddiu $sp, $sp, 48
781 .cfi_adjust_cfa_offset -48
782
783 # a4 = JValue* result
784 # a5 = shorty string
785 lbu $t1, 0($a5) # get result type from shorty
786 li $t2, 68 # put char 'D' into t2
787 beq $t1, $t2, 1f # branch if result type char == 'D'
788 li $t3, 70 # put char 'F' into t3
789 beq $t1, $t3, 1f # branch if result type char == 'F'
790 sw $v0, 0($a4) # store the result
791 dsrl $v1, $v0, 32
792 jalr $zero, $ra
793 sw $v1, 4($a4) # store the other half of the result
7941:
795 mfc1 $v0, $f0
796 mfhc1 $v1, $f0
797 sw $v0, 0($a4) # store the result
798 jalr $zero, $ra
799 sw $v1, 4($a4) # store the other half of the result
800END art_quick_invoke_static_stub
801
Maja Gagic6ea651f2015-02-24 16:55:04 +0100802 /*
803 * Entry from managed code that calls artHandleFillArrayDataFromCode and
804 * delivers exception on failure.
805 */
806 .extern artHandleFillArrayDataFromCode
807ENTRY art_quick_handle_fill_data
808 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case exception allocation triggers GC
809 lwu $a2, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method*
810 jal artHandleFillArrayDataFromCode # (payload offset, Array*, method, Thread*)
811 move $a3, rSELF # pass Thread::Current
812 RETURN_IF_ZERO
813END art_quick_handle_fill_data
Andreas Gampe1a5c4062015-01-15 12:10:47 -0800814
Maja Gagic6ea651f2015-02-24 16:55:04 +0100815 /*
816 * Entry from managed code that calls artLockObjectFromCode, may block for GC.
817 */
818 .extern artLockObjectFromCode
819ENTRY art_quick_lock_object
820 beq $a0, $zero, .Lart_quick_throw_null_pointer_exception_gp_set
821 nop
822 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case we block
823 jal artLockObjectFromCode # (Object* obj, Thread*)
824 move $a1, rSELF # pass Thread::Current
825 RETURN_IF_ZERO
826END art_quick_lock_object
Andreas Gampe1a5c4062015-01-15 12:10:47 -0800827
Maja Gagic6ea651f2015-02-24 16:55:04 +0100828 /*
829 * Entry from managed code that calls artUnlockObjectFromCode and delivers exception on failure.
830 */
831 .extern artUnlockObjectFromCode
832ENTRY art_quick_unlock_object
833 beq $a0, $zero, .Lart_quick_throw_null_pointer_exception_gp_set
834 nop
835 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case exception allocation triggers GC
836 jal artUnlockObjectFromCode # (Object* obj, Thread*)
837 move $a1, rSELF # pass Thread::Current
838 RETURN_IF_ZERO
839END art_quick_unlock_object
840
841 /*
842 * Entry from managed code that calls artCheckCastFromCode and delivers exception on failure.
843 */
844 .extern artThrowClassCastException
845ENTRY art_quick_check_cast
846 daddiu $sp, $sp, -32
847 .cfi_adjust_cfa_offset 32
848 sd $ra, 24($sp)
849 .cfi_rel_offset 31, 24
850 sd $t9, 16($sp)
851 sd $a1, 8($sp)
852 sd $a0, 0($sp)
853 jal artIsAssignableFromCode
854 nop
855 beq $v0, $zero, .Lthrow_class_cast_exception
856 ld $ra, 24($sp)
857 jalr $zero, $ra
858 daddiu $sp, $sp, 32
859 .cfi_adjust_cfa_offset -32
860.Lthrow_class_cast_exception:
861 ld $t9, 16($sp)
862 ld $a1, 8($sp)
863 ld $a0, 0($sp)
864 daddiu $sp, $sp, 32
865 .cfi_adjust_cfa_offset -32
866 SETUP_SAVE_ALL_CALLEE_SAVE_FRAME
867 dla $t9, artThrowClassCastException
868 jalr $zero, $t9 # artThrowClassCastException (Class*, Class*, Thread*)
869 move $a2, rSELF # pass Thread::Current
870END art_quick_check_cast
871
872 /*
873 * Entry from managed code for array put operations of objects where the value being stored
874 * needs to be checked for compatibility.
875 * a0 = array, a1 = index, a2 = value
876 */
877ENTRY art_quick_aput_obj_with_null_and_bound_check
878 bne $a0, $zero, .Lart_quick_aput_obj_with_bound_check_gp_set
879 nop
880 b .Lart_quick_throw_null_pointer_exception_gp_set
881 nop
882END art_quick_aput_obj_with_null_and_bound_check
883
884ENTRY art_quick_aput_obj_with_bound_check
885 lwu $t0, MIRROR_ARRAY_LENGTH_OFFSET($a0)
886 sltu $t1, $a1, $t0
887 bne $t1, $zero, .Lart_quick_aput_obj_gp_set
888 nop
889 move $a0, $a1
890 b .Lart_quick_throw_array_bounds_gp_set
891 move $a1, $t0
892END art_quick_aput_obj_with_bound_check
893
894ENTRY art_quick_aput_obj
895 beq $a2, $zero, .Ldo_aput_null
896 nop
897 lwu $t0, MIRROR_OBJECT_CLASS_OFFSET($a0)
898 lwu $t1, MIRROR_OBJECT_CLASS_OFFSET($a2)
899 lwu $t0, MIRROR_CLASS_COMPONENT_TYPE_OFFSET($t0)
900 bne $t1, $t0, .Lcheck_assignability # value's type == array's component type - trivial assignability
901 nop
902.Ldo_aput:
903 dsll $a1, $a1, 2
904 daddu $t0, $a0, $a1
905 sw $a2, MIRROR_OBJECT_ARRAY_DATA_OFFSET($t0)
906 ld $t0, THREAD_CARD_TABLE_OFFSET(rSELF)
907 dsrl $t1, $a0, 7
908 daddu $t1, $t1, $t0
909 sb $t0, ($t1)
910 jalr $zero, $ra
911 nop
912.Ldo_aput_null:
913 dsll $a1, $a1, 2
914 daddu $t0, $a0, $a1
915 sw $a2, MIRROR_OBJECT_ARRAY_DATA_OFFSET($t0)
916 jalr $zero, $ra
917 nop
918.Lcheck_assignability:
919 daddiu $sp, $sp, -64
920 .cfi_adjust_cfa_offset 64
921 sd $ra, 56($sp)
922 .cfi_rel_offset 31, 56
923 sd $t9, 24($sp)
924 sd $a2, 16($sp)
925 sd $a1, 8($sp)
926 sd $a0, 0($sp)
927 move $a1, $t1
928 move $a0, $t0
929 jal artIsAssignableFromCode # (Class*, Class*)
930 nop
931 ld $ra, 56($sp)
932 ld $t9, 24($sp)
933 ld $a2, 16($sp)
934 ld $a1, 8($sp)
935 ld $a0, 0($sp)
936 daddiu $sp, $sp, 64
937 .cfi_adjust_cfa_offset -64
938 bne $v0, $zero, .Ldo_aput
939 nop
940 SETUP_SAVE_ALL_CALLEE_SAVE_FRAME
941 move $a1, $a2
942 dla $t9, artThrowArrayStoreException
943 jalr $zero, $t9 # artThrowArrayStoreException(Class*, Class*, Thread*)
944 move $a2, rSELF # pass Thread::Current
945END art_quick_aput_obj
946
947 /*
948 * Entry from managed code when uninitialized static storage, this stub will run the class
949 * initializer and deliver the exception on error. On success the static storage base is
950 * returned.
951 */
952 .extern artInitializeStaticStorageFromCode
953ENTRY art_quick_initialize_static_storage
954 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC
955 # artInitializeStaticStorageFromCode(uint32_t type_idx, Method* referrer, Thread*)
956 jal artInitializeStaticStorageFromCode
957 move $a2, rSELF # pass Thread::Current
958 RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER
959END art_quick_initialize_static_storage
960
961 /*
962 * Entry from managed code when dex cache misses for a type_idx.
963 */
964 .extern artInitializeTypeFromCode
965ENTRY art_quick_initialize_type
966 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC
967 # artInitializeTypeFromCode(uint32_t type_idx, Method* referrer, Thread*)
968 jal artInitializeTypeFromCode
969 move $a2, rSELF # pass Thread::Current
970 RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER
971END art_quick_initialize_type
972
973 /*
974 * Entry from managed code when type_idx needs to be checked for access and dex cache may also
975 * miss.
976 */
977 .extern artInitializeTypeAndVerifyAccessFromCode
978ENTRY art_quick_initialize_type_and_verify_access
979 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC
980 # artInitializeTypeFromCode(uint32_t type_idx, Method* referrer, Thread*)
981 jal artInitializeTypeAndVerifyAccessFromCode
982 move $a2, rSELF # pass Thread::Current
983 RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER
984END art_quick_initialize_type_and_verify_access
985
986 /*
987 * Called by managed code to resolve a static field and load a boolean primitive value.
988 */
989 .extern artGetBooleanStaticFromCode
990ENTRY art_quick_get_boolean_static
991 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC
992 lwu $a1, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method*
993 jal artGetBooleanStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*)
994 move $a2, rSELF # pass Thread::Current
995 RETURN_IF_NO_EXCEPTION
996END art_quick_get_boolean_static
997
998 /*
999 * Called by managed code to resolve a static field and load a byte primitive value.
1000 */
1001 .extern artGetByteStaticFromCode
1002ENTRY art_quick_get_byte_static
1003 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC
1004 lwu $a1, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method*
1005 jal artGetByteStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*)
1006 move $a2, rSELF # pass Thread::Current
1007 RETURN_IF_NO_EXCEPTION
1008END art_quick_get_byte_static
1009
1010 /*
1011 * Called by managed code to resolve a static field and load a char primitive value.
1012 */
1013 .extern artGetCharStaticFromCode
1014ENTRY art_quick_get_char_static
1015 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC
1016 lwu $a1, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method*
1017 jal artGetCharStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*)
1018 move $a2, rSELF # pass Thread::Current
1019 RETURN_IF_NO_EXCEPTION
1020END art_quick_get_char_static
1021
1022 /*
1023 * Called by managed code to resolve a static field and load a short primitive value.
1024 */
1025 .extern artGetShortStaticFromCode
1026ENTRY art_quick_get_short_static
1027 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC
1028 lwu $a1, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method*
1029 jal artGetShortStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*)
1030 move $a2, rSELF # pass Thread::Current
1031 RETURN_IF_NO_EXCEPTION
1032END art_quick_get_short_static
1033
1034 /*
1035 * Called by managed code to resolve a static field and load a 32-bit primitive value.
1036 */
1037 .extern artGet32StaticFromCode
1038ENTRY art_quick_get32_static
1039 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC
1040 lwu $a1, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method*
1041 jal artGet32StaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*)
1042 move $a2, rSELF # pass Thread::Current
1043 RETURN_IF_NO_EXCEPTION
1044END art_quick_get32_static
1045
1046 /*
1047 * Called by managed code to resolve a static field and load a 64-bit primitive value.
1048 */
1049 .extern artGet64StaticFromCode
1050ENTRY art_quick_get64_static
1051 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC
1052 lwu $a1, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method*
1053 jal artGet64StaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*)
1054 move $a2, rSELF # pass Thread::Current
1055 RETURN_IF_NO_EXCEPTION
1056END art_quick_get64_static
1057
1058 /*
1059 * Called by managed code to resolve a static field and load an object reference.
1060 */
1061 .extern artGetObjStaticFromCode
1062ENTRY art_quick_get_obj_static
1063 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC
1064 lwu $a1, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method*
1065 jal artGetObjStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*)
1066 move $a2, rSELF # pass Thread::Current
1067 RETURN_IF_NO_EXCEPTION
1068END art_quick_get_obj_static
1069
1070 /*
1071 * Called by managed code to resolve an instance field and load a boolean primitive value.
1072 */
1073 .extern artGetBooleanInstanceFromCode
1074ENTRY art_quick_get_boolean_instance
1075 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC
1076 lwu $a2, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method*
1077 jal artGetBooleanInstanceFromCode # (field_idx, Object*, referrer, Thread*)
1078 move $a3, rSELF # pass Thread::Current
1079 RETURN_IF_NO_EXCEPTION
1080END art_quick_get_boolean_instance
1081
1082 /*
1083 * Called by managed code to resolve an instance field and load a byte primitive value.
1084 */
1085 .extern artGetByteInstanceFromCode
1086ENTRY art_quick_get_byte_instance
1087 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC
1088 lwu $a2, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method*
1089 jal artGetByteInstanceFromCode # (field_idx, Object*, referrer, Thread*)
1090 move $a3, rSELF # pass Thread::Current
1091 RETURN_IF_NO_EXCEPTION
1092END art_quick_get_byte_instance
1093
1094 /*
1095 * Called by managed code to resolve an instance field and load a char primitive value.
1096 */
1097 .extern artGetCharInstanceFromCode
1098ENTRY art_quick_get_char_instance
1099 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC
1100 lwu $a2, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method*
1101 jal artGetCharInstanceFromCode # (field_idx, Object*, referrer, Thread*)
1102 move $a3, rSELF # pass Thread::Current
1103 RETURN_IF_NO_EXCEPTION
1104END art_quick_get_char_instance
1105
1106 /*
1107 * Called by managed code to resolve an instance field and load a short primitive value.
1108 */
1109 .extern artGetShortInstanceFromCode
1110ENTRY art_quick_get_short_instance
1111 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC
1112 lwu $a2, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method*
1113 jal artGetShortInstanceFromCode # (field_idx, Object*, referrer, Thread*)
1114 move $a3, rSELF # pass Thread::Current
1115 RETURN_IF_NO_EXCEPTION
1116END art_quick_get_short_instance
1117
1118 /*
1119 * Called by managed code to resolve an instance field and load a 32-bit primitive value.
1120 */
1121 .extern artGet32InstanceFromCode
1122ENTRY art_quick_get32_instance
1123 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC
1124 lwu $a2, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method*
1125 jal artGet32InstanceFromCode # (field_idx, Object*, referrer, Thread*)
1126 move $a3, rSELF # pass Thread::Current
1127 RETURN_IF_NO_EXCEPTION
1128END art_quick_get32_instance
1129
1130 /*
1131 * Called by managed code to resolve an instance field and load a 64-bit primitive value.
1132 */
1133 .extern artGet64InstanceFromCode
1134ENTRY art_quick_get64_instance
1135 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC
1136 lwu $a2, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method*
1137 jal artGet64InstanceFromCode # (field_idx, Object*, referrer, Thread*)
1138 move $a3, rSELF # pass Thread::Current
1139 RETURN_IF_NO_EXCEPTION
1140END art_quick_get64_instance
1141
1142 /*
1143 * Called by managed code to resolve an instance field and load an object reference.
1144 */
1145 .extern artGetObjInstanceFromCode
1146ENTRY art_quick_get_obj_instance
1147 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC
1148 lwu $a2, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method*
1149 jal artGetObjInstanceFromCode # (field_idx, Object*, referrer, Thread*)
1150 move $a3, rSELF # pass Thread::Current
1151 RETURN_IF_NO_EXCEPTION
1152END art_quick_get_obj_instance
1153
1154 /*
1155 * Called by managed code to resolve a static field and store a 8-bit primitive value.
1156 */
1157 .extern artSet8StaticFromCode
1158ENTRY art_quick_set8_static
1159 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC
1160 lwu $a2, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method*
1161 jal artSet8StaticFromCode # (field_idx, new_val, referrer, Thread*)
1162 move $a3, rSELF # pass Thread::Current
1163 RETURN_IF_ZERO
1164END art_quick_set8_static
1165
1166 /*
1167 * Called by managed code to resolve a static field and store a 16-bit primitive value.
1168 */
1169 .extern artSet16StaticFromCode
1170ENTRY art_quick_set16_static
1171 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC
1172 lwu $a2, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method*
1173 jal artSet16StaticFromCode # (field_idx, new_val, referrer, Thread*)
1174 move $a3, rSELF # pass Thread::Current
1175 RETURN_IF_ZERO
1176END art_quick_set16_static
1177
1178 /*
1179 * Called by managed code to resolve a static field and store a 32-bit primitive value.
1180 */
1181 .extern artSet32StaticFromCode
1182ENTRY art_quick_set32_static
1183 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC
1184 lwu $a2, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method*
1185 jal artSet32StaticFromCode # (field_idx, new_val, referrer, Thread*)
1186 move $a3, rSELF # pass Thread::Current
1187 RETURN_IF_ZERO
1188END art_quick_set32_static
1189
1190 /*
1191 * Called by managed code to resolve a static field and store a 64-bit primitive value.
1192 */
1193 .extern artSet64StaticFromCode
1194ENTRY art_quick_set64_static
1195 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC
1196 move $a2, $a1 # pass new_val
1197 lwu $a1, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method*
1198 jal artSet64StaticFromCode # (field_idx, referrer, new_val, Thread*)
1199 move $a3, rSELF # pass Thread::Current
1200 RETURN_IF_ZERO
1201END art_quick_set64_static
1202
1203 /*
1204 * Called by managed code to resolve a static field and store an object reference.
1205 */
1206 .extern artSetObjStaticFromCode
1207ENTRY art_quick_set_obj_static
1208 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC
1209 lwu $a2, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method*
1210 jal artSetObjStaticFromCode # (field_idx, new_val, referrer, Thread*)
1211 move $a3, rSELF # pass Thread::Current
1212 RETURN_IF_ZERO
1213END art_quick_set_obj_static
1214
1215 /*
1216 * Called by managed code to resolve an instance field and store a 8-bit primitive value.
1217 */
1218 .extern artSet8InstanceFromCode
1219ENTRY art_quick_set8_instance
1220 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC
1221 lwu $a3, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method*
1222 jal artSet8InstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*)
1223 move $a4, rSELF # pass Thread::Current
1224 RETURN_IF_ZERO
1225END art_quick_set8_instance
1226
1227 /*
1228 * Called by managed code to resolve an instance field and store a 16-bit primitive value.
1229 */
1230 .extern artSet16InstanceFromCode
1231ENTRY art_quick_set16_instance
1232 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC
1233 lwu $a3, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method*
1234 jal artSet16InstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*)
1235 move $a4, rSELF # pass Thread::Current
1236 RETURN_IF_ZERO
1237END art_quick_set16_instance
1238
1239 /*
1240 * Called by managed code to resolve an instance field and store a 32-bit primitive value.
1241 */
1242 .extern artSet32InstanceFromCode
1243ENTRY art_quick_set32_instance
1244 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC
1245 lwu $a3, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method*
1246 jal artSet32InstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*)
1247 move $a4, rSELF # pass Thread::Current
1248 RETURN_IF_ZERO
1249END art_quick_set32_instance
1250
1251 /*
1252 * Called by managed code to resolve an instance field and store a 64-bit primitive value.
1253 */
1254 .extern artSet64InstanceFromCode
1255ENTRY art_quick_set64_instance
1256 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC
1257 lwu $a3, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method*
1258 jal artSet64InstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*)
1259 move $a4, rSELF # pass Thread::Current
1260 RETURN_IF_ZERO
1261END art_quick_set64_instance
1262
1263 /*
1264 * Called by managed code to resolve an instance field and store an object reference.
1265 */
1266 .extern artSetObjInstanceFromCode
1267ENTRY art_quick_set_obj_instance
1268 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC
1269 lwu $a3, FRAME_SIZE_REFS_ONLY_CALLEE_SAVE($sp) # pass referrer's Method*
1270 jal artSetObjInstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*)
1271 move $a4, rSELF # pass Thread::Current
1272 RETURN_IF_ZERO
1273END art_quick_set_obj_instance
1274
1275 /*
1276 * Entry from managed code to resolve a string, this stub will allocate a String and deliver an
1277 * exception on error. On success the String is returned. R0 holds the referring method,
1278 * R1 holds the string index. The fast path check for hit in strings cache has already been
1279 * performed.
1280 */
1281 .extern artResolveStringFromCode
1282ENTRY art_quick_resolve_string
1283 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC
1284 # artResolveStringFromCode(Method* referrer, uint32_t string_idx, Thread*, $sp)
1285 jal artResolveStringFromCode
1286 move $a2, rSELF # pass Thread::Current
1287 RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER
1288END art_quick_resolve_string
Andreas Gampe1a5c4062015-01-15 12:10:47 -08001289
1290// Macro to facilitate adding new allocation entrypoints.
1291.macro TWO_ARG_DOWNCALL name, entrypoint, return
Maja Gagic6ea651f2015-02-24 16:55:04 +01001292 .extern \entrypoint
Andreas Gampe1a5c4062015-01-15 12:10:47 -08001293ENTRY \name
Maja Gagic6ea651f2015-02-24 16:55:04 +01001294 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC
1295 jal \entrypoint
1296 move $a2, rSELF # pass Thread::Current
1297 \return
Andreas Gampe1a5c4062015-01-15 12:10:47 -08001298END \name
1299.endm
1300
1301.macro THREE_ARG_DOWNCALL name, entrypoint, return
Maja Gagic6ea651f2015-02-24 16:55:04 +01001302 .extern \entrypoint
Andreas Gampe1a5c4062015-01-15 12:10:47 -08001303ENTRY \name
Maja Gagic6ea651f2015-02-24 16:55:04 +01001304 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC
1305 jal \entrypoint
1306 move $a3, rSELF # pass Thread::Current
1307 \return
Andreas Gampe1a5c4062015-01-15 12:10:47 -08001308END \name
1309.endm
1310
1311// Generate the allocation entrypoints for each allocator.
1312GENERATE_ALL_ALLOC_ENTRYPOINTS
1313
Maja Gagic6ea651f2015-02-24 16:55:04 +01001314 /*
1315 * Called by managed code when the value in rSUSPEND has been decremented to 0.
1316 */
1317 .extern artTestSuspendFromCode
1318ENTRY art_quick_test_suspend
1319 lh $a0, THREAD_FLAGS_OFFSET(rSELF)
1320 bne $a0, $zero, 1f
1321 daddiu rSUSPEND, $zero, SUSPEND_CHECK_INTERVAL # reset rSUSPEND to SUSPEND_CHECK_INTERVAL
1322 jalr $zero, $ra
1323 nop
13241:
1325 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves for stack crawl
1326 jal artTestSuspendFromCode # (Thread*)
1327 move $a0, rSELF
1328 RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME_AND_RETURN
1329END art_quick_test_suspend
Douglas Leung6461d192015-01-30 18:13:58 -08001330
1331 /*
1332 * Called by managed code that is attempting to call a method on a proxy class. On entry
1333 * r0 holds the proxy method; r1, r2 and r3 may contain arguments.
1334 */
1335 .extern artQuickProxyInvokeHandler
1336ENTRY art_quick_proxy_invoke_handler
1337 SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME
1338 sd $a0, 0($sp) # place proxy method at bottom of frame
1339 move $a2, rSELF # pass Thread::Current
1340 jal artQuickProxyInvokeHandler # (Method* proxy method, receiver, Thread*, SP)
1341 move $a3, $sp # pass $sp
1342 ld $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_
1343 daddiu $sp, $sp, REFS_AND_ARGS_MINUS_REFS_SIZE # skip a0-a7 and f12-f19
1344 RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME
1345 bne $t0, $zero, 1f
1346 dmtc1 $v0, $f0 # place return value to FP return value
1347 jalr $zero, $ra
1348 dmtc1 $v1, $f1 # place return value to FP return value
13491:
1350 DELIVER_PENDING_EXCEPTION
1351END art_quick_proxy_invoke_handler
1352
Maja Gagic6ea651f2015-02-24 16:55:04 +01001353 /*
1354 * Called to resolve an imt conflict. t0 is a hidden argument that holds the target method's
1355 * dex method index.
1356 */
1357ENTRY art_quick_imt_conflict_trampoline
1358 lwu $a0, 0($sp) # load caller Method*
1359 lwu $a0, MIRROR_ART_METHOD_DEX_CACHE_METHODS_OFFSET($a0) # load dex_cache_resolved_methods
1360 dsll $t0, 2 # convert target method offset to bytes
1361 daddu $a0, $t0 # get address of target method
1362 dla $t9, art_quick_invoke_interface_trampoline
1363 jalr $zero, $t9
1364 lwu $a0, MIRROR_OBJECT_ARRAY_DATA_OFFSET($a0) # load the target method
1365END art_quick_imt_conflict_trampoline
Andreas Gampecc7c39d2015-01-30 17:04:45 -08001366
1367 .extern artQuickResolutionTrampoline
1368ENTRY art_quick_resolution_trampoline
1369 SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME
1370 move $a2, rSELF # pass Thread::Current
1371 jal artQuickResolutionTrampoline # (Method* called, receiver, Thread*, SP)
1372 move $a3, $sp # pass $sp
1373 beq $v0, $zero, 1f
1374 lwu $a0, 0($sp) # load resolved method in $a0
1375 # artQuickResolutionTrampoline puts resolved method in *SP
1376 RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME
1377 move $t9, $v0 # code pointer must be in $t9 to generate the global pointer
1378 jalr $zero, $t9 # tail call to method
1379 nop
13801:
1381 RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME
1382 DELIVER_PENDING_EXCEPTION
1383END art_quick_resolution_trampoline
Andreas Gampe1a5c4062015-01-15 12:10:47 -08001384
1385 .extern artQuickGenericJniTrampoline
1386 .extern artQuickGenericJniEndTrampoline
1387ENTRY art_quick_generic_jni_trampoline
1388 SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME_INTERNAL
1389 sd $a0, 0($sp) # store native ArtMethod* to bottom of stack
1390 move $s8, $sp # save $sp
1391
1392 # prepare for call to artQuickGenericJniTrampoline(Thread*, SP)
1393 move $a0, rSELF # pass Thread::Current
1394 move $a1, $sp # pass $sp
1395 jal artQuickGenericJniTrampoline # (Thread*, SP)
1396 daddiu $sp, $sp, -5120 # reserve space on the stack
1397
1398 # The C call will have registered the complete save-frame on success.
1399 # The result of the call is:
1400 # v0: ptr to native code, 0 on error.
1401 # v1: ptr to the bottom of the used area of the alloca, can restore stack till here.
1402 beq $v0, $zero, 1f # check entry error
1403 move $t9, $v0 # save the code ptr
1404 move $sp, $v1 # release part of the alloca
1405
1406 # Load parameters from stack into registers
1407 ld $a0, 0($sp)
1408 ld $a1, 8($sp)
1409 ld $a2, 16($sp)
1410 ld $a3, 24($sp)
1411 ld $a4, 32($sp)
1412 ld $a5, 40($sp)
1413 ld $a6, 48($sp)
1414 ld $a7, 56($sp)
1415 # Load FPRs the same as GPRs. Look at BuildNativeCallFrameStateMachine.
1416 l.d $f12, 0($sp)
1417 l.d $f13, 8($sp)
1418 l.d $f14, 16($sp)
1419 l.d $f15, 24($sp)
1420 l.d $f16, 32($sp)
1421 l.d $f17, 40($sp)
1422 l.d $f18, 48($sp)
1423 l.d $f19, 56($sp)
1424 jalr $t9 # native call
1425 daddiu $sp, $sp, 64
1426
1427 # result sign extension is handled in C code
1428 # prepare for call to artQuickGenericJniEndTrampoline(Thread*, result, result_f)
1429 move $a0, rSELF # pass Thread::Current
1430 move $a1, $v0
1431 jal artQuickGenericJniEndTrampoline
1432 dmfc1 $a2, $f0
1433
1434 ld $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_
Nicolas Geoffray126d6592015-03-03 14:28:35 +00001435 bne $t0, $zero, 1f # check for pending exceptions
Andreas Gampe1a5c4062015-01-15 12:10:47 -08001436 move $sp, $s8 # tear down the alloca
1437
1438 # tear dpown the callee-save frame
1439 RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME
1440
1441 jalr $zero, $ra
1442 dmtc1 $v0, $f0 # place return value to FP return value
1443
14441:
Nicolas Geoffray126d6592015-03-03 14:28:35 +00001445 ld $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF)
1446 # This will create a new save-all frame, required by the runtime.
Andreas Gampe1a5c4062015-01-15 12:10:47 -08001447 DELIVER_PENDING_EXCEPTION
1448END art_quick_generic_jni_trampoline
1449
1450 .extern artQuickToInterpreterBridge
1451ENTRY art_quick_to_interpreter_bridge
1452 SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME
1453 move $a1, rSELF # pass Thread::Current
1454 jal artQuickToInterpreterBridge # (Method* method, Thread*, SP)
1455 move $a2, $sp # pass $sp
1456 ld $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_
1457 daddiu $sp, $sp, REFS_AND_ARGS_MINUS_REFS_SIZE # skip a0-a7 and f12-f19
1458 RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME
1459 bne $t0, $zero, 1f
1460 dmtc1 $v0, $f0 # place return value to FP return value
1461 jalr $zero, $ra
1462 dmtc1 $v1, $f1 # place return value to FP return value
14631:
1464 DELIVER_PENDING_EXCEPTION
1465END art_quick_to_interpreter_bridge
1466
1467 /*
1468 * Routine that intercepts method calls and returns.
1469 */
1470 .extern artInstrumentationMethodEntryFromCode
1471 .extern artInstrumentationMethodExitFromCode
1472ENTRY art_quick_instrumentation_entry
1473 SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME
1474 daddiu $sp, $sp, -16 # space for saving arg0
1475 .cfi_adjust_cfa_offset 16
1476 sd $a0, 0($sp) # save arg0
1477 move $a3, $ra # pass $ra
1478 jal artInstrumentationMethodEntryFromCode # (Method*, Object*, Thread*, RA)
1479 move $a2, rSELF # pass Thread::Current
1480 move $t9, $v0 # $t9 holds reference to code
1481 ld $a0, 0($sp) # restore arg0
1482 daddiu $sp, $sp, 16 # remove args
1483 .cfi_adjust_cfa_offset -16
1484 RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME
1485 jalr $t9 # call method
1486 nop
1487END art_quick_instrumentation_entry
1488 /* intentional fallthrough */
1489 .global art_quick_instrumentation_exit
1490art_quick_instrumentation_exit:
1491 .cfi_startproc
1492 daddiu $t9, $ra, 4 # put current address into $t9 to rebuild $gp
1493 .cpload $t9
1494 move $ra, $zero # link register is to here, so clobber with 0 for later checks
1495 SETUP_REFS_ONLY_CALLEE_SAVE_FRAME
1496 move $t0, $sp # remember bottom of caller's frame
1497 daddiu $sp, $sp, -16 # save return values and set up args
1498 .cfi_adjust_cfa_offset 16
1499 sd $v0, 0($sp)
1500 .cfi_rel_offset 2, 0
1501 s.d $f0, 8($sp)
1502 mov.d $f15, $f0 # pass fpr result
1503 move $a2, $v0 # pass gpr result
1504 move $a1, $t0 # pass $sp
1505 jal artInstrumentationMethodExitFromCode # (Thread*, SP, gpr_res, fpr_res)
1506 move $a0, rSELF # pass Thread::Current
Douglas Leungf96e8bd2015-03-27 15:38:30 -07001507 move $t9, $v0 # set aside returned link register
Andreas Gampe1a5c4062015-01-15 12:10:47 -08001508 move $ra, $v1 # set link register for deoptimization
1509 ld $v0, 0($sp) # restore return values
1510 l.d $f0, 8($sp)
Douglas Leungf96e8bd2015-03-27 15:38:30 -07001511 jalr $zero, $t9 # return
Andreas Gampe1a5c4062015-01-15 12:10:47 -08001512 daddiu $sp, $sp, 16+FRAME_SIZE_REFS_ONLY_CALLEE_SAVE # 16 bytes of saved values + ref_only callee save frame
1513 .cfi_adjust_cfa_offset -(16+FRAME_SIZE_REFS_ONLY_CALLEE_SAVE)
1514END art_quick_instrumentation_exit
1515
Maja Gagic6ea651f2015-02-24 16:55:04 +01001516 /*
1517 * Instrumentation has requested that we deoptimize into the interpreter. The deoptimization
1518 * will long jump to the upcall with a special exception of -1.
1519 */
1520 .extern artDeoptimize
1521 .extern artEnterInterpreterFromDeoptimize
1522ENTRY art_quick_deoptimize
1523 SETUP_SAVE_ALL_CALLEE_SAVE_FRAME
1524 jal artDeoptimize # artDeoptimize(Thread*, SP)
1525 # Returns caller method's frame size.
1526 move $a0, rSELF # pass Thread::current
1527END art_quick_deoptimize
1528
Andreas Gampe1a5c4062015-01-15 12:10:47 -08001529UNIMPLEMENTED art_quick_indexof
1530UNIMPLEMENTED art_quick_string_compareto