quick_entrypoints_arm.S revision 3b4c18933c24b8a33f38573c2ebcdb9aa16efeb5
10f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes/*
20f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes * Copyright (C) 2012 The Android Open Source Project
30f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes *
40f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes * Licensed under the Apache License, Version 2.0 (the "License");
50f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes * you may not use this file except in compliance with the License.
60f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes * You may obtain a copy of the License at
70f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes *
80f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes *      http://www.apache.org/licenses/LICENSE-2.0
90f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes *
100f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes * Unless required by applicable law or agreed to in writing, software
110f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes * distributed under the License is distributed on an "AS IS" BASIS,
120f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
130f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes * See the License for the specific language governing permissions and
140f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes * limitations under the License.
150f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes */
160f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes
177655f29fabc0a12765de828914a18314382e5a35Ian Rogers#include "asm_support_arm.S"
189651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers
19ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers    /* Deliver the given exception */
20ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers    .extern artDeliverExceptionFromCode
21ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers    /* Deliver an exception pending on a thread */
22ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers    .extern artDeliverPendingException
23ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers
244f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    /*
254f0d07c783afef89703dce32c94440fc8621a29bIan Rogers     * Macro that sets up the callee save frame to conform with
264f0d07c783afef89703dce32c94440fc8621a29bIan Rogers     * Runtime::CreateCalleeSaveMethod(kSaveAll)
274f0d07c783afef89703dce32c94440fc8621a29bIan Rogers     */
2857b86d47b66322693a070185fadfb43cb9c12eabIan Rogers.macro SETUP_SAVE_ALL_CALLEE_SAVE_FRAME
294f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    push {r4-r11, lr} @ 9 words of callee saves
309329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .save {r4-r11, lr}
319329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset 36
329329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r4, 0
339329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r5, 4
349329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r6, 8
359329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r7, 12
369329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r8, 16
379329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r9, 20
389329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r10, 24
399329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r11, 28
409329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset lr, 32
4115fdb8cfb5b2e3fc882113ec0648d492cebf852cIan Rogers    vpush {s0-s31}
429329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .pad #128
439329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset 128
444f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    sub sp, #12       @ 3 words of space, bottom word will hold Method*
459329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .pad #12
469329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset 12
474f0d07c783afef89703dce32c94440fc8621a29bIan Rogers.endm
484f0d07c783afef89703dce32c94440fc8621a29bIan Rogers
494f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    /*
504f0d07c783afef89703dce32c94440fc8621a29bIan Rogers     * Macro that sets up the callee save frame to conform with
51dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers     * Runtime::CreateCalleeSaveMethod(kRefsOnly). Restoration assumes non-moving GC.
524f0d07c783afef89703dce32c94440fc8621a29bIan Rogers     */
534f0d07c783afef89703dce32c94440fc8621a29bIan Rogers.macro SETUP_REF_ONLY_CALLEE_SAVE_FRAME
544f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    push {r5-r8, r10-r11, lr} @ 7 words of callee saves
559329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .save {r5-r8, r10-r11, lr}
569329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset 28
579329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r5, 0
589329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r6, 4
599329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r7, 8
609329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r8, 12
619329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r10, 16
629329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r11, 20
639329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset lr, 24
644f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    sub sp, #4                @ bottom word will hold Method*
659329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .pad #4
669329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset 4
674f0d07c783afef89703dce32c94440fc8621a29bIan Rogers.endm
684f0d07c783afef89703dce32c94440fc8621a29bIan Rogers
694f0d07c783afef89703dce32c94440fc8621a29bIan Rogers.macro RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
70dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers    ldr lr, [sp, #28]  @ restore lr for return
71dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers    add sp, #32        @ unwind stack
729329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset -32
734f0d07c783afef89703dce32c94440fc8621a29bIan Rogers.endm
744f0d07c783afef89703dce32c94440fc8621a29bIan Rogers
754f0d07c783afef89703dce32c94440fc8621a29bIan Rogers.macro RESTORE_REF_ONLY_CALLEE_SAVE_FRAME_AND_RETURN
76dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers    ldr lr, [sp, #28]  @ restore lr for return
77dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers    add sp, #32        @ unwind stack
789329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset -32
79dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers    bx  lr             @ return
804f0d07c783afef89703dce32c94440fc8621a29bIan Rogers.endm
814f0d07c783afef89703dce32c94440fc8621a29bIan Rogers
824f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    /*
834f0d07c783afef89703dce32c94440fc8621a29bIan Rogers     * Macro that sets up the callee save frame to conform with
84dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers     * Runtime::CreateCalleeSaveMethod(kRefsAndArgs). Restoration assumes non-moving GC.
854f0d07c783afef89703dce32c94440fc8621a29bIan Rogers     */
864f0d07c783afef89703dce32c94440fc8621a29bIan Rogers.macro SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME
87dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers    push {r1-r3, r5-r8, r10-r11, lr}  @ 10 words of callee saves
889329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .save {r1-r3, r5-r8, r10-r11, lr}
899329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset 40
905d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    .cfi_rel_offset r1, 0
915d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    .cfi_rel_offset r2, 4
925d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    .cfi_rel_offset r3, 8
935d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    .cfi_rel_offset r5, 12
945d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    .cfi_rel_offset r6, 16
955d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    .cfi_rel_offset r7, 20
965d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    .cfi_rel_offset r8, 24
975d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    .cfi_rel_offset r10, 28
985d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    .cfi_rel_offset r11, 32
995d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    .cfi_rel_offset lr, 36
100dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers    sub sp, #8                        @ 2 words of space, bottom word will hold Method*
1019329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .pad #8
1029329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset 8
1034f0d07c783afef89703dce32c94440fc8621a29bIan Rogers.endm
1044f0d07c783afef89703dce32c94440fc8621a29bIan Rogers
1054f0d07c783afef89703dce32c94440fc8621a29bIan Rogers.macro RESTORE_REF_AND_ARGS_CALLEE_SAVE_FRAME
106dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers    ldr  r1, [sp, #8]          @ restore non-callee save r1
107dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers    ldrd r2, [sp, #12]         @ restore non-callee saves r2-r3
108dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers    ldr  lr, [sp, #44]         @ restore lr
109dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers    add  sp, #48               @ rewind sp
1109329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset -48
11115fdb8cfb5b2e3fc882113ec0648d492cebf852cIan Rogers.endm
11215fdb8cfb5b2e3fc882113ec0648d492cebf852cIan Rogers
113637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers.macro RETURN_IF_RESULT_IS_ZERO
114637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    cbnz   r0, 1f              @ result non-zero branch over
115637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    bx     lr                  @ return
116637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers1:
117637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers.endm
118637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers
119637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers.macro RETURN_IF_RESULT_IS_NON_ZERO
120637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    cbz    r0, 1f              @ result zero branch over
121637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    bx     lr                  @ return
122637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers1:
123637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers.endm
124637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers
125ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    /*
126ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers     * Macro that set calls through to artDeliverPendingExceptionFromCode, where the pending
127ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers     * exception is Thread::Current()->exception_
128ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers     */
129ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers.macro DELIVER_PENDING_EXCEPTION
1309329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .fnend
1319329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .fnstart
13257b86d47b66322693a070185fadfb43cb9c12eabIan Rogers    SETUP_SAVE_ALL_CALLEE_SAVE_FRAME           @ save callee saves for throw
133ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    mov    r0, r9                              @ pass Thread::Current
134ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    mov    r1, sp                              @ pass SP
135ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    b      artDeliverPendingExceptionFromCode  @ artDeliverPendingExceptionFromCode(Thread*, SP)
136ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers.endm
137ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers
13857b86d47b66322693a070185fadfb43cb9c12eabIan Rogers.macro NO_ARG_RUNTIME_EXCEPTION c_name, cxx_name
13957b86d47b66322693a070185fadfb43cb9c12eabIan Rogers    .extern \cxx_name
1409329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian RogersENTRY \c_name
14157b86d47b66322693a070185fadfb43cb9c12eabIan Rogers    SETUP_SAVE_ALL_CALLEE_SAVE_FRAME  // save all registers as basis for long jump context
14257b86d47b66322693a070185fadfb43cb9c12eabIan Rogers    mov r0, r9                      @ pass Thread::Current
14357b86d47b66322693a070185fadfb43cb9c12eabIan Rogers    mov r1, sp                      @ pass SP
14457b86d47b66322693a070185fadfb43cb9c12eabIan Rogers    b   \cxx_name                   @ \cxx_name(Thread*, SP)
1459329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian RogersEND \c_name
14657b86d47b66322693a070185fadfb43cb9c12eabIan Rogers.endm
14757b86d47b66322693a070185fadfb43cb9c12eabIan Rogers
14857b86d47b66322693a070185fadfb43cb9c12eabIan Rogers.macro ONE_ARG_RUNTIME_EXCEPTION c_name, cxx_name
14957b86d47b66322693a070185fadfb43cb9c12eabIan Rogers    .extern \cxx_name
1509329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian RogersENTRY \c_name
15157b86d47b66322693a070185fadfb43cb9c12eabIan Rogers    SETUP_SAVE_ALL_CALLEE_SAVE_FRAME  // save all registers as basis for long jump context
15257b86d47b66322693a070185fadfb43cb9c12eabIan Rogers    mov r1, r9                      @ pass Thread::Current
15357b86d47b66322693a070185fadfb43cb9c12eabIan Rogers    mov r2, sp                      @ pass SP
15457b86d47b66322693a070185fadfb43cb9c12eabIan Rogers    b   \cxx_name                   @ \cxx_name(Thread*, SP)
1559329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian RogersEND \c_name
15657b86d47b66322693a070185fadfb43cb9c12eabIan Rogers.endm
15757b86d47b66322693a070185fadfb43cb9c12eabIan Rogers
15857b86d47b66322693a070185fadfb43cb9c12eabIan Rogers.macro TWO_ARG_RUNTIME_EXCEPTION c_name, cxx_name
15957b86d47b66322693a070185fadfb43cb9c12eabIan Rogers    .extern \cxx_name
1609329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian RogersENTRY \c_name
16157b86d47b66322693a070185fadfb43cb9c12eabIan Rogers    SETUP_SAVE_ALL_CALLEE_SAVE_FRAME  // save all registers as basis for long jump context
16257b86d47b66322693a070185fadfb43cb9c12eabIan Rogers    mov r2, r9                      @ pass Thread::Current
16357b86d47b66322693a070185fadfb43cb9c12eabIan Rogers    mov r3, sp                      @ pass SP
16457b86d47b66322693a070185fadfb43cb9c12eabIan Rogers    b   \cxx_name                   @ \cxx_name(Thread*, SP)
1659329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian RogersEND \c_name
16657b86d47b66322693a070185fadfb43cb9c12eabIan Rogers.endm
16757b86d47b66322693a070185fadfb43cb9c12eabIan Rogers
16844b412bb795fa6999129b2bc16f5eec1ea97e8f8buzbee    /*
16957b86d47b66322693a070185fadfb43cb9c12eabIan Rogers     * Called by managed code, saves callee saves and then calls artThrowException
17057b86d47b66322693a070185fadfb43cb9c12eabIan Rogers     * that will place a mock Method* at the bottom of the stack. Arg1 holds the exception.
17144b412bb795fa6999129b2bc16f5eec1ea97e8f8buzbee     */
172468532ea115657709bc32ee498e701a4c71762d4Ian RogersONE_ARG_RUNTIME_EXCEPTION art_quick_deliver_exception, artDeliverExceptionFromCode
17344b412bb795fa6999129b2bc16f5eec1ea97e8f8buzbee
1746f495f2898a418f87e2a919e04fe23521bb0b9e9Brian Carlstrom    /*
17557b86d47b66322693a070185fadfb43cb9c12eabIan Rogers     * Called by managed code to create and deliver a NullPointerException.
1766f495f2898a418f87e2a919e04fe23521bb0b9e9Brian Carlstrom     */
177468532ea115657709bc32ee498e701a4c71762d4Ian RogersNO_ARG_RUNTIME_EXCEPTION art_quick_throw_null_pointer_exception, artThrowNullPointerExceptionFromCode
1786f495f2898a418f87e2a919e04fe23521bb0b9e9Brian Carlstrom
179bdb0391258abc54bf77c676e36847d28a783bfe5Ian Rogers    /*
18057b86d47b66322693a070185fadfb43cb9c12eabIan Rogers     * Called by managed code to create and deliver an ArithmeticException.
181bdb0391258abc54bf77c676e36847d28a783bfe5Ian Rogers     */
182468532ea115657709bc32ee498e701a4c71762d4Ian RogersNO_ARG_RUNTIME_EXCEPTION art_quick_throw_div_zero, artThrowDivZeroFromCode
1839651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers
1849651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers    /*
18557b86d47b66322693a070185fadfb43cb9c12eabIan Rogers     * Called by managed code to create and deliver an ArrayIndexOutOfBoundsException. Arg1 holds
18657b86d47b66322693a070185fadfb43cb9c12eabIan Rogers     * index, arg2 holds limit.
1879651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers     */
188468532ea115657709bc32ee498e701a4c71762d4Ian RogersTWO_ARG_RUNTIME_EXCEPTION art_quick_throw_array_bounds, artThrowArrayBoundsFromCode
1899651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers
1909651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers    /*
19157b86d47b66322693a070185fadfb43cb9c12eabIan Rogers     * Called by managed code to create and deliver a StackOverflowError.
1929651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers     */
193468532ea115657709bc32ee498e701a4c71762d4Ian RogersNO_ARG_RUNTIME_EXCEPTION art_quick_throw_stack_overflow, artThrowStackOverflowFromCode
1949651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers
1959651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers    /*
19657b86d47b66322693a070185fadfb43cb9c12eabIan Rogers     * Called by managed code to create and deliver a NoSuchMethodError.
1979651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers     */
198468532ea115657709bc32ee498e701a4c71762d4Ian RogersONE_ARG_RUNTIME_EXCEPTION art_quick_throw_no_such_method, artThrowNoSuchMethodFromCode
19957b86d47b66322693a070185fadfb43cb9c12eabIan Rogers
20057b86d47b66322693a070185fadfb43cb9c12eabIan Rogers    /*
201c8b306f5221658c7e4b5516be8917dc8c9288e7eIan Rogers     * All generated callsites for interface invokes and invocation slow paths will load arguments
202c8b306f5221658c7e4b5516be8917dc8c9288e7eIan Rogers     * as usual - except instead of loading arg0/r0 with the target Method*, arg0/r0 will contain
203c8b306f5221658c7e4b5516be8917dc8c9288e7eIan Rogers     * the method_idx.  This wrapper will save arg1-arg3, load the caller's Method*, align the
204c8b306f5221658c7e4b5516be8917dc8c9288e7eIan Rogers     * stack and call the appropriate C helper.
205634eb2eb14f87753519d0ef2c5f256e55888f378Elliott Hughes     * NOTE: "this" is first visible argument of the target, and so can be found in arg1/r1.
2064a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee     *
207c8b306f5221658c7e4b5516be8917dc8c9288e7eIan Rogers     * The helper will attempt to locate the target and return a 64-bit result in r0/r1 consisting
208c8b306f5221658c7e4b5516be8917dc8c9288e7eIan Rogers     * of the target Method* in r0 and method->code_ in r1.
2094a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee     *
210c8b306f5221658c7e4b5516be8917dc8c9288e7eIan Rogers     * If unsuccessful, the helper will return NULL/NULL. There will bea pending exception in the
211c8b306f5221658c7e4b5516be8917dc8c9288e7eIan Rogers     * thread and we branch to another stub to deliver it.
2124a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee     *
213ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers     * On success this wrapper will restore arguments and *jump* to the target, leaving the lr
214ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers     * pointing back to the original caller.
2154a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee     */
216c8b306f5221658c7e4b5516be8917dc8c9288e7eIan Rogers.macro INVOKE_TRAMPOLINE c_name, cxx_name
217c8b306f5221658c7e4b5516be8917dc8c9288e7eIan Rogers    .extern \cxx_name
2189329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian RogersENTRY \c_name
2194f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME  @ save callee saves in case allocation triggers GC
220c8b306f5221658c7e4b5516be8917dc8c9288e7eIan Rogers    ldr    r2, [sp, #48]                  @ pass caller Method*
221c8b306f5221658c7e4b5516be8917dc8c9288e7eIan Rogers    mov    r3, r9                         @ pass Thread::Current
222865e6e01486e3d7d61b7d0d952b420e5912c8219buzbee    mov    r12, sp
223865e6e01486e3d7d61b7d0d952b420e5912c8219buzbee    str    r12, [sp, #-16]!               @ expand the frame and pass SP
2249329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .pad #16
2259329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset 16
226c8b306f5221658c7e4b5516be8917dc8c9288e7eIan Rogers    bl     \cxx_name                      @ (method_idx, this, caller, Thread*, SP)
227865e6e01486e3d7d61b7d0d952b420e5912c8219buzbee    add    sp, #16                        @ strip the extra frame
2289329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset -16
229634eb2eb14f87753519d0ef2c5f256e55888f378Elliott Hughes    mov    r12, r1                        @ save Method*->code_
230a32a6fd4a781262dff4fec102da053d16b7ef6c0Ian Rogers    RESTORE_REF_AND_ARGS_CALLEE_SAVE_FRAME
231637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    cbz    r0, 1f                         @ did we find the target? if not go to exception delivery
232637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    bx     r12                            @ tail call to target
233637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers1:
234a32a6fd4a781262dff4fec102da053d16b7ef6c0Ian Rogers    DELIVER_PENDING_EXCEPTION
2359329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian RogersEND \c_name
236c8b306f5221658c7e4b5516be8917dc8c9288e7eIan Rogers.endm
237a32a6fd4a781262dff4fec102da053d16b7ef6c0Ian Rogers
2388dbb708c7dc05c786329eb5c3fff3194ab6472acLogan ChienINVOKE_TRAMPOLINE art_quick_invoke_interface_trampoline, artInvokeInterfaceTrampoline
2398dbb708c7dc05c786329eb5c3fff3194ab6472acLogan ChienINVOKE_TRAMPOLINE art_quick_invoke_interface_trampoline_with_access_check, artInvokeInterfaceTrampolineWithAccessCheck
240a32a6fd4a781262dff4fec102da053d16b7ef6c0Ian Rogers
2418dbb708c7dc05c786329eb5c3fff3194ab6472acLogan ChienINVOKE_TRAMPOLINE art_quick_invoke_static_trampoline_with_access_check, artInvokeStaticTrampolineWithAccessCheck
2428dbb708c7dc05c786329eb5c3fff3194ab6472acLogan ChienINVOKE_TRAMPOLINE art_quick_invoke_direct_trampoline_with_access_check, artInvokeDirectTrampolineWithAccessCheck
2438dbb708c7dc05c786329eb5c3fff3194ab6472acLogan ChienINVOKE_TRAMPOLINE art_quick_invoke_super_trampoline_with_access_check, artInvokeSuperTrampolineWithAccessCheck
2448dbb708c7dc05c786329eb5c3fff3194ab6472acLogan ChienINVOKE_TRAMPOLINE art_quick_invoke_virtual_trampoline_with_access_check, artInvokeVirtualTrampolineWithAccessCheck
245ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers
24657b86d47b66322693a070185fadfb43cb9c12eabIan Rogers    /*
2476474d190d5604898354ebf767f1944b6e3e9b445Jeff Hao     * Quick invocation stub.
2486474d190d5604898354ebf767f1944b6e3e9b445Jeff Hao     * On entry:
2496474d190d5604898354ebf767f1944b6e3e9b445Jeff Hao     *   r0 = method pointer
2506474d190d5604898354ebf767f1944b6e3e9b445Jeff Hao     *   r1 = argument array or NULL for no argument methods
2516474d190d5604898354ebf767f1944b6e3e9b445Jeff Hao     *   r2 = size of argument array in bytes
2526474d190d5604898354ebf767f1944b6e3e9b445Jeff Hao     *   r3 = (managed) thread pointer
2536474d190d5604898354ebf767f1944b6e3e9b445Jeff Hao     *   [sp] = JValue* result
2546474d190d5604898354ebf767f1944b6e3e9b445Jeff Hao     *   [sp + 4] = result type char
2555d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao     */
2565d9173014c1ca09f7249a6b07629aa37778b5f8fJeff HaoENTRY art_quick_invoke_stub
2575d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    push   {r0, r4, r5, r9, r11, lr}       @ spill regs
2585d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    .save  {r0, r4, r5, r9, r11, lr}
2595d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    .pad #24
2605d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    .cfi_adjust_cfa_offset 24
2615d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    .cfi_rel_offset r0, 0
2625d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    .cfi_rel_offset r4, 4
2635d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    .cfi_rel_offset r5, 8
2645d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    .cfi_rel_offset r9, 12
2655d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    .cfi_rel_offset r11, 16
2665d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    .cfi_rel_offset lr, 20
2675d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    mov    r11, sp                         @ save the stack pointer
2685d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    .cfi_def_cfa_register r11
2695d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    mov    r9, r3                          @ move managed thread pointer into r9
2705d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    mov    r4, #SUSPEND_CHECK_INTERVAL     @ reset r4 to suspend check interval
2715d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    add    r5, r2, #16                     @ create space for method pointer in frame
2726474d190d5604898354ebf767f1944b6e3e9b445Jeff Hao    and    r5, #0xFFFFFFF0                 @ align frame size to 16 bytes
2735d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    sub    sp, r5                          @ reserve stack space for argument array
2745d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    add    r0, sp, #4                      @ pass stack pointer + method ptr as dest for memcpy
2755d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    bl     memcpy                          @ memcpy (dest, src, bytes)
2765d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    ldr    r0, [r11]                       @ restore method*
2775d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    ldr    r1, [sp, #4]                    @ copy arg value for r1
2785d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    ldr    r2, [sp, #8]                    @ copy arg value for r2
2795d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    ldr    r3, [sp, #12]                   @ copy arg value for r3
2805d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    mov    ip, #0                          @ set ip to 0
2815d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    str    ip, [sp]                        @ store NULL for method* at bottom of frame
2825d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    ldr    ip, [r0, #METHOD_CODE_OFFSET]   @ get pointer to the code
2835d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    blx    ip                              @ call the method
2846474d190d5604898354ebf767f1944b6e3e9b445Jeff Hao    mov    sp, r11                         @ restore the stack pointer
2855d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    ldr    ip, [sp, #24]                   @ load the result pointer
2865d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    strd   r0, [ip]                        @ store r0/r1 into result pointer
2875d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    pop    {r0, r4, r5, r9, r11, lr}       @ restore spill regs
2885d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    .cfi_adjust_cfa_offset -24
2895d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    bx     lr
2905d9173014c1ca09f7249a6b07629aa37778b5f8fJeff HaoEND art_quick_invoke_stub
2916474d190d5604898354ebf767f1944b6e3e9b445Jeff Hao
2925d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao    /*
29357b86d47b66322693a070185fadfb43cb9c12eabIan Rogers     * On entry r0 is uint32_t* gprs_ and r1 is uint32_t* fprs_
29457b86d47b66322693a070185fadfb43cb9c12eabIan Rogers     */
295637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan RogersARM_ENTRY art_quick_do_long_jump
29657b86d47b66322693a070185fadfb43cb9c12eabIan Rogers    vldm r1, {s0-s31}     @ load all fprs from argument fprs_
29757b86d47b66322693a070185fadfb43cb9c12eabIan Rogers    ldr  r2, [r0, #60]    @ r2 = r15 (PC from gprs_ 60=4*15)
29857b86d47b66322693a070185fadfb43cb9c12eabIan Rogers    add  r0, r0, #12      @ increment r0 to skip gprs_[0..2] 12=4*3
29957b86d47b66322693a070185fadfb43cb9c12eabIan Rogers    ldm  r0, {r3-r14}     @ load remaining gprs from argument gprs_
30057b86d47b66322693a070185fadfb43cb9c12eabIan Rogers    mov  r0, #0           @ clear result registers r0 and r1
30157b86d47b66322693a070185fadfb43cb9c12eabIan Rogers    mov  r1, #0
30257b86d47b66322693a070185fadfb43cb9c12eabIan Rogers    bx   r2               @ do long jump
3039329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian RogersEND art_quick_do_long_jump
30457b86d47b66322693a070185fadfb43cb9c12eabIan Rogers
30560db5ab3a2e480db9236325a14cb5a867881d8bbIan Rogers    /*
306ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers     * Entry from managed code that calls artHandleFillArrayDataFromCode and delivers exception on
307ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers     * failure.
308ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers     */
3099329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artHandleFillArrayDataFromCode
310468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_handle_fill_data
3114f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    SETUP_REF_ONLY_CALLEE_SAVE_FRAME  @ save callee saves in case exception allocation triggers GC
3124f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    mov    r2, r9                          @ pass Thread::Current
3134f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    mov    r3, sp                          @ pass SP
314af778e627aa41ec6c176cba537062b95d4d960b6Elliott Hughes    bl     artHandleFillArrayDataFromCode  @ (Array*, const DexFile::Payload*, Thread*, SP)
3154f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
316637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    RETURN_IF_RESULT_IS_ZERO
317ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    DELIVER_PENDING_EXCEPTION
318468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_handle_fill_data
3194f0d07c783afef89703dce32c94440fc8621a29bIan Rogers
3204f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    /*
32157b86d47b66322693a070185fadfb43cb9c12eabIan Rogers     * Entry from managed code that calls artLockObjectFromCode, may block for GC.
3224f0d07c783afef89703dce32c94440fc8621a29bIan Rogers     */
3239329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artLockObjectFromCode
324468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_lock_object
3254f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    SETUP_REF_ONLY_CALLEE_SAVE_FRAME  @ save callee saves in case we block
3264f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    mov    r1, r9                     @ pass Thread::Current
3274f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    mov    r2, sp                     @ pass SP
3284f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    bl     artLockObjectFromCode      @ (Object* obj, Thread*, SP)
3294f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME_AND_RETURN
330468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_lock_object
331ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers
332ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers    /*
333ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers     * Entry from managed code that calls artUnlockObjectFromCode and delivers exception on failure.
334ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers     */
3359329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artUnlockObjectFromCode
336468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_unlock_object
3374f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    SETUP_REF_ONLY_CALLEE_SAVE_FRAME  @ save callee saves in case exception allocation triggers GC
338637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    mov    r1, r9                     @ pass Thread::Current
339637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    mov    r2, sp                     @ pass SP
340637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    bl     artUnlockObjectFromCode    @ (Object* obj, Thread*, SP)
3414f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
342637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    RETURN_IF_RESULT_IS_ZERO
343ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    DELIVER_PENDING_EXCEPTION
344468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_unlock_object
345ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers
346ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers    /*
347ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers     * Entry from managed code that calls artCheckCastFromCode and delivers exception on failure.
348ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers     */
3499329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artCheckCastFromCode
350468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_check_cast
3514f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    SETUP_REF_ONLY_CALLEE_SAVE_FRAME    @ save callee saves in case exception allocation triggers GC
3524f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    mov    r2, r9                       @ pass Thread::Current
3534f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    mov    r3, sp                       @ pass SP
3544f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    bl     artCheckCastFromCode         @ (Class* a, Class* b, Thread*, SP)
3554f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
356637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    RETURN_IF_RESULT_IS_ZERO
357ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    DELIVER_PENDING_EXCEPTION
358468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_check_cast
359e51a511ccee3f3c0120807321bcc160fcaa664beIan Rogers
360e51a511ccee3f3c0120807321bcc160fcaa664beIan Rogers    /*
361e51a511ccee3f3c0120807321bcc160fcaa664beIan Rogers     * Entry from managed code that calls artCanPutArrayElementFromCode and delivers exception on
362e51a511ccee3f3c0120807321bcc160fcaa664beIan Rogers     * failure.
363e51a511ccee3f3c0120807321bcc160fcaa664beIan Rogers     */
3649329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artCanPutArrayElementFromCode
365468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_can_put_array_element
3664f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    SETUP_REF_ONLY_CALLEE_SAVE_FRAME    @ save callee saves in case exception allocation triggers GC
3674f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    mov    r2, r9                         @ pass Thread::Current
3684f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    mov    r3, sp                         @ pass SP
3694f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    bl     artCanPutArrayElementFromCode  @ (Object* element, Class* array_class, Thread*, SP)
3704f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
371637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    RETURN_IF_RESULT_IS_ZERO
372ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    DELIVER_PENDING_EXCEPTION
373468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_can_put_array_element
374cbba6ac9bf9a6c630a7aafae6d8767b5ddbb6fd5Ian Rogers
375cbba6ac9bf9a6c630a7aafae6d8767b5ddbb6fd5Ian Rogers    /*
376cbba6ac9bf9a6c630a7aafae6d8767b5ddbb6fd5Ian Rogers     * Entry from managed code when uninitialized static storage, this stub will run the class
377cbba6ac9bf9a6c630a7aafae6d8767b5ddbb6fd5Ian Rogers     * initializer and deliver the exception on error. On success the static storage base is
378cbba6ac9bf9a6c630a7aafae6d8767b5ddbb6fd5Ian Rogers     * returned.
379cbba6ac9bf9a6c630a7aafae6d8767b5ddbb6fd5Ian Rogers     */
3809329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artInitializeStaticStorageFromCode
381468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_initialize_static_storage
3824f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    SETUP_REF_ONLY_CALLEE_SAVE_FRAME           @ save callee saves in case of GC
3834f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    mov    r2, r9                              @ pass Thread::Current
3844f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    mov    r3, sp                              @ pass SP
385aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom    @ artInitializeStaticStorageFromCode(uint32_t type_idx, Method* referrer, Thread*, SP)
3864f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    bl     artInitializeStaticStorageFromCode
3874f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
388637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    RETURN_IF_RESULT_IS_NON_ZERO
389ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    DELIVER_PENDING_EXCEPTION
390468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_initialize_static_storage
391ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers
39228ad40dc3ec2f09b0ffd4f6d6787bf1b532ccd5dIan Rogers    /*
39328ad40dc3ec2f09b0ffd4f6d6787bf1b532ccd5dIan Rogers     * Entry from managed code when dex cache misses for a type_idx
39428ad40dc3ec2f09b0ffd4f6d6787bf1b532ccd5dIan Rogers     */
3959329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artInitializeTypeFromCode
396468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_initialize_type
39728ad40dc3ec2f09b0ffd4f6d6787bf1b532ccd5dIan Rogers    SETUP_REF_ONLY_CALLEE_SAVE_FRAME           @ save callee saves in case of GC
39828ad40dc3ec2f09b0ffd4f6d6787bf1b532ccd5dIan Rogers    mov    r2, r9                              @ pass Thread::Current
39928ad40dc3ec2f09b0ffd4f6d6787bf1b532ccd5dIan Rogers    mov    r3, sp                              @ pass SP
40028ad40dc3ec2f09b0ffd4f6d6787bf1b532ccd5dIan Rogers    @ artInitializeTypeFromCode(uint32_t type_idx, Method* referrer, Thread*, SP)
40128ad40dc3ec2f09b0ffd4f6d6787bf1b532ccd5dIan Rogers    bl     artInitializeTypeFromCode
40228ad40dc3ec2f09b0ffd4f6d6787bf1b532ccd5dIan Rogers    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
403637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    RETURN_IF_RESULT_IS_NON_ZERO
404b093c6b27f8ea9bbe2d49c03ebe345203a121199Ian Rogers    DELIVER_PENDING_EXCEPTION
405468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_initialize_type
406b093c6b27f8ea9bbe2d49c03ebe345203a121199Ian Rogers
407b093c6b27f8ea9bbe2d49c03ebe345203a121199Ian Rogers    /*
408b093c6b27f8ea9bbe2d49c03ebe345203a121199Ian Rogers     * Entry from managed code when type_idx needs to be checked for access and dex cache may also
40957b86d47b66322693a070185fadfb43cb9c12eabIan Rogers     * miss.
410b093c6b27f8ea9bbe2d49c03ebe345203a121199Ian Rogers     */
4119329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artInitializeTypeAndVerifyAccessFromCode
412468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_initialize_type_and_verify_access
413b093c6b27f8ea9bbe2d49c03ebe345203a121199Ian Rogers    SETUP_REF_ONLY_CALLEE_SAVE_FRAME           @ save callee saves in case of GC
414b093c6b27f8ea9bbe2d49c03ebe345203a121199Ian Rogers    mov    r2, r9                              @ pass Thread::Current
415b093c6b27f8ea9bbe2d49c03ebe345203a121199Ian Rogers    mov    r3, sp                              @ pass SP
4168a1ea9f2707a34483faa0e49cdbf8653e0e8bb6dElliott Hughes    @ artInitializeTypeAndVerifyAccessFromCode(uint32_t type_idx, Method* referrer, Thread*, SP)
417b093c6b27f8ea9bbe2d49c03ebe345203a121199Ian Rogers    bl     artInitializeTypeAndVerifyAccessFromCode
418b093c6b27f8ea9bbe2d49c03ebe345203a121199Ian Rogers    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
419637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    RETURN_IF_RESULT_IS_NON_ZERO
42028ad40dc3ec2f09b0ffd4f6d6787bf1b532ccd5dIan Rogers    DELIVER_PENDING_EXCEPTION
421468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_initialize_type_and_verify_access
42228ad40dc3ec2f09b0ffd4f6d6787bf1b532ccd5dIan Rogers
423ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    /*
42457b86d47b66322693a070185fadfb43cb9c12eabIan Rogers     * Called by managed code to resolve a static field and load a 32-bit primitive value.
425ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers     */
4269329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artGet32StaticFromCode
427468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_get32_static
428ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    SETUP_REF_ONLY_CALLEE_SAVE_FRAME     @ save callee saves in case of GC
4291bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    ldr    r1, [sp, #32]                 @ pass referrer
430ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    mov    r2, r9                        @ pass Thread::Current
431ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    mov    r3, sp                        @ pass SP
432ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    bl     artGet32StaticFromCode        @ (uint32_t field_idx, const Method* referrer, Thread*, SP)
433637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    ldr    r1, [r9, #THREAD_EXCEPTION_OFFSET]  @ load Thread::Current()->exception_
434ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
435637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    cbnz   r1, 1f                        @ success if no exception pending
436637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    bx     lr                            @ return on success
437637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers1:
438ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    DELIVER_PENDING_EXCEPTION
439468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_get32_static
440ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers
441ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    /*
44257b86d47b66322693a070185fadfb43cb9c12eabIan Rogers     * Called by managed code to resolve a static field and load a 64-bit primitive value.
443ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers     */
4449329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artGet64StaticFromCode
445468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_get64_static
446ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    SETUP_REF_ONLY_CALLEE_SAVE_FRAME     @ save callee saves in case of GC
4471bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    ldr    r1, [sp, #32]                 @ pass referrer
448ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    mov    r2, r9                        @ pass Thread::Current
449ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    mov    r3, sp                        @ pass SP
450ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    bl     artGet64StaticFromCode        @ (uint32_t field_idx, const Method* referrer, Thread*, SP)
451637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    ldr    r2, [r9, #THREAD_EXCEPTION_OFFSET]  @ load Thread::Current()->exception_
452ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
453637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    cbnz   r2, 1f                        @ success if no exception pending
454637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    bx     lr                            @ return on success
455637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers1:
456ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    DELIVER_PENDING_EXCEPTION
457468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_get64_static
458ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers
459ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    /*
46057b86d47b66322693a070185fadfb43cb9c12eabIan Rogers     * Called by managed code to resolve a static field and load an object reference.
461ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers     */
4629329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artGetObjStaticFromCode
463468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_get_obj_static
464ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    SETUP_REF_ONLY_CALLEE_SAVE_FRAME     @ save callee saves in case of GC
4651bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    ldr    r1, [sp, #32]                 @ pass referrer
466ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    mov    r2, r9                        @ pass Thread::Current
467ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    mov    r3, sp                        @ pass SP
468ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    bl     artGetObjStaticFromCode       @ (uint32_t field_idx, const Method* referrer, Thread*, SP)
469637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    ldr    r1, [r9, #THREAD_EXCEPTION_OFFSET]  @ load Thread::Current()->exception_
470ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
471637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    cbnz   r1, 1f                        @ success if no exception pending
472637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    bx     lr                            @ return on success
473637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers1:
474ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    DELIVER_PENDING_EXCEPTION
475468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_get_obj_static
476ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers
4771bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    /*
47857b86d47b66322693a070185fadfb43cb9c12eabIan Rogers     * Called by managed code to resolve an instance field and load a 32-bit primitive value.
4791bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers     */
4809329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artGet32InstanceFromCode
481468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_get32_instance
4821bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    SETUP_REF_ONLY_CALLEE_SAVE_FRAME     @ save callee saves in case of GC
4831bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    ldr    r2, [sp, #32]                 @ pass referrer
4841bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    mov    r3, r9                        @ pass Thread::Current
485865e6e01486e3d7d61b7d0d952b420e5912c8219buzbee    mov    r12, sp
486865e6e01486e3d7d61b7d0d952b420e5912c8219buzbee    str    r12, [sp, #-16]!              @ expand the frame and pass SP
4871bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    bl     artGet32InstanceFromCode      @ (field_idx, Object*, referrer, Thread*, SP)
488865e6e01486e3d7d61b7d0d952b420e5912c8219buzbee    add    sp, #16                       @ strip the extra frame
489637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    ldr    r1, [r9, #THREAD_EXCEPTION_OFFSET]  @ load Thread::Current()->exception_
4901bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
491637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    cbnz   r1, 1f                        @ success if no exception pending
492637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    bx     lr                            @ return on success
493637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers1:
4941bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    DELIVER_PENDING_EXCEPTION
495468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_get32_instance
4961bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers
4971bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    /*
49857b86d47b66322693a070185fadfb43cb9c12eabIan Rogers     * Called by managed code to resolve an instance field and load a 64-bit primitive value.
4991bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers     */
5009329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artGet64InstanceFromCode
501468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_get64_instance
5021bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    SETUP_REF_ONLY_CALLEE_SAVE_FRAME     @ save callee saves in case of GC
5031bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    ldr    r2, [sp, #32]                 @ pass referrer
5041bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    mov    r3, r9                        @ pass Thread::Current
505865e6e01486e3d7d61b7d0d952b420e5912c8219buzbee    mov    r12, sp
506865e6e01486e3d7d61b7d0d952b420e5912c8219buzbee    str    r12, [sp, #-16]!              @ expand the frame and pass SP
5079329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .pad #16
5089329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset 16
5091bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    bl     artGet64InstanceFromCode      @ (field_idx, Object*, referrer, Thread*, SP)
510865e6e01486e3d7d61b7d0d952b420e5912c8219buzbee    add    sp, #16                       @ strip the extra frame
5119329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset -16
512637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    ldr    r2, [r9, #THREAD_EXCEPTION_OFFSET]  @ load Thread::Current()->exception_
5131bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
514637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    cbnz   r2, 1f                        @ success if no exception pending
515637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    bx     lr                            @ return on success
516637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers1:
5171bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    DELIVER_PENDING_EXCEPTION
518468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_get64_instance
5191bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers
5201bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    /*
52157b86d47b66322693a070185fadfb43cb9c12eabIan Rogers     * Called by managed code to resolve an instance field and load an object reference.
5221bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers     */
5239329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artGetObjInstanceFromCode
524468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_get_obj_instance
5251bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    SETUP_REF_ONLY_CALLEE_SAVE_FRAME     @ save callee saves in case of GC
5261bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    ldr    r2, [sp, #32]                 @ pass referrer
5271bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    mov    r3, r9                        @ pass Thread::Current
528865e6e01486e3d7d61b7d0d952b420e5912c8219buzbee    mov    r12, sp
529865e6e01486e3d7d61b7d0d952b420e5912c8219buzbee    str    r12, [sp, #-16]!              @ expand the frame and pass SP
5309329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .pad #16
5319329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset 16
5321bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    bl     artGetObjInstanceFromCode     @ (field_idx, Object*, referrer, Thread*, SP)
533865e6e01486e3d7d61b7d0d952b420e5912c8219buzbee    add    sp, #16                       @ strip the extra frame
5349329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset -16
535637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    ldr    r1, [r9, #THREAD_EXCEPTION_OFFSET]  @ load Thread::Current()->exception_
5361bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
537637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    cbnz   r1, 1f                        @ success if no exception pending
538637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    bx     lr                            @ return on success
539637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers1:
5401bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    DELIVER_PENDING_EXCEPTION
541468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_get_obj_instance
5421bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers
543ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    /*
54457b86d47b66322693a070185fadfb43cb9c12eabIan Rogers     * Called by managed code to resolve a static field and store a 32-bit primitive value.
545ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers     */
5469329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artSet32StaticFromCode
547468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_set32_static
548ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    SETUP_REF_ONLY_CALLEE_SAVE_FRAME     @ save callee saves in case of GC
5491bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    ldr    r2, [sp, #32]                 @ pass referrer
550ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    mov    r3, r9                        @ pass Thread::Current
551865e6e01486e3d7d61b7d0d952b420e5912c8219buzbee    mov    r12, sp
552865e6e01486e3d7d61b7d0d952b420e5912c8219buzbee    str    r12, [sp, #-16]!              @ expand the frame and pass SP
5539329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .pad #16
5549329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset 16
5551bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    bl     artSet32StaticFromCode        @ (field_idx, new_val, referrer, Thread*, SP)
556865e6e01486e3d7d61b7d0d952b420e5912c8219buzbee    add    sp, #16                       @ strip the extra frame
5579329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset -16
558ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
559637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    RETURN_IF_RESULT_IS_ZERO
560ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    DELIVER_PENDING_EXCEPTION
561468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_set32_static
562ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers
563ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    /*
56457b86d47b66322693a070185fadfb43cb9c12eabIan Rogers     * Called by managed code to resolve a static field and store a 64-bit primitive value.
56519abfb4f9af450e2ce3a801c5a0c34c4193e3e57Brian Carlstrom     * On entry r0 holds field index, r1:r2 hold new_val
566ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers     */
5679329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artSet64StaticFromCode
568468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_set64_static
569ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    SETUP_REF_ONLY_CALLEE_SAVE_FRAME     @ save callee saves in case of GC
57019abfb4f9af450e2ce3a801c5a0c34c4193e3e57Brian Carlstrom    mov    r3, r2                        @ pass one half of wide argument
57119abfb4f9af450e2ce3a801c5a0c34c4193e3e57Brian Carlstrom    mov    r2, r1                        @ pass other half of wide argument
5721bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    ldr    r1, [sp, #32]                 @ pass referrer
573ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    mov    r12, sp                       @ save SP
574ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    sub    sp, #8                        @ grow frame for alignment with stack args
5759329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .pad #8
5769329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset 8
577ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    push   {r9, r12}                     @ pass Thread::Current and SP
5789329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .save {r9, r12}
5799329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset 8
5809329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r9, 0
581ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    bl     artSet64StaticFromCode        @ (field_idx, referrer, new_val, Thread*, SP)
582ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    add    sp, #16                       @ release out args
583ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME   @ TODO: we can clearly save an add here
584637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    RETURN_IF_RESULT_IS_ZERO
585ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    DELIVER_PENDING_EXCEPTION
586468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_set64_static
587ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers
588ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    /*
58957b86d47b66322693a070185fadfb43cb9c12eabIan Rogers     * Called by managed code to resolve a static field and store an object reference.
590ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers     */
5919329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artSetObjStaticFromCode
592468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_set_obj_static
593ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    SETUP_REF_ONLY_CALLEE_SAVE_FRAME     @ save callee saves in case of GC
5941bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    ldr    r2, [sp, #32]                 @ pass referrer
595ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    mov    r3, r9                        @ pass Thread::Current
596865e6e01486e3d7d61b7d0d952b420e5912c8219buzbee    mov    r12, sp
597865e6e01486e3d7d61b7d0d952b420e5912c8219buzbee    str    r12, [sp, #-16]!              @ expand the frame and pass SP
5989329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .pad #16
5999329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset 16
6001bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    bl     artSetObjStaticFromCode       @ (field_idx, new_val, referrer, Thread*, SP)
601865e6e01486e3d7d61b7d0d952b420e5912c8219buzbee    add    sp, #16                       @ strip the extra frame
6029329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset -16
603ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
604637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    RETURN_IF_RESULT_IS_ZERO
6051bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    DELIVER_PENDING_EXCEPTION
606468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_set_obj_static
6071bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers
6081bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    /*
60957b86d47b66322693a070185fadfb43cb9c12eabIan Rogers     * Called by managed code to resolve an instance field and store a 32-bit primitive value.
6101bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers     */
6119329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artSet32InstanceFromCode
612468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_set32_instance
6131bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    SETUP_REF_ONLY_CALLEE_SAVE_FRAME     @ save callee saves in case of GC
6141bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    ldr    r3, [sp, #32]                 @ pass referrer
6151bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    mov    r12, sp                       @ save SP
6161bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    sub    sp, #8                        @ grow frame for alignment with stack args
6179329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .pad #8
6189329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset 8
6191bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    push   {r9, r12}                     @ pass Thread::Current and SP
6209329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .save {r9, r12}
6219329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset 8
6229329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r9, 0
6239329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r12, 4
6241bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    bl     artSet32InstanceFromCode      @ (field_idx, Object*, new_val, referrer, Thread*, SP)
6251bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    add    sp, #16                       @ release out args
6269329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset -16
6271bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME   @ TODO: we can clearly save an add here
628637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    RETURN_IF_RESULT_IS_ZERO
6291bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    DELIVER_PENDING_EXCEPTION
630468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_set32_instance
6311bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers
6321bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    /*
63357b86d47b66322693a070185fadfb43cb9c12eabIan Rogers     * Called by managed code to resolve an instance field and store a 64-bit primitive value.
6341bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers     */
6359329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artSet32InstanceFromCode
636468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_set64_instance
6371bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    SETUP_REF_ONLY_CALLEE_SAVE_FRAME     @ save callee saves in case of GC
6381bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    mov    r12, sp                       @ save SP
6391bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    sub    sp, #8                        @ grow frame for alignment with stack args
6409329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .pad #8
6419329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset 8
6421bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    push   {r9, r12}                     @ pass Thread::Current and SP
6439329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .save {r9, r12}
6449329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset 8
6459329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r9, 0
6461bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    bl     artSet64InstanceFromCode      @ (field_idx, Object*, new_val, Thread*, SP)
6471bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    add    sp, #16                       @ release out args
6489329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset -16
6491bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME   @ TODO: we can clearly save an add here
650637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    RETURN_IF_RESULT_IS_ZERO
6511bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    DELIVER_PENDING_EXCEPTION
652468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_set64_instance
6531bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers
6541bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    /*
65557b86d47b66322693a070185fadfb43cb9c12eabIan Rogers     * Called by managed code to resolve an instance field and store an object reference.
6561bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers     */
6579329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artSetObjInstanceFromCode
658468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_set_obj_instance
6591bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    SETUP_REF_ONLY_CALLEE_SAVE_FRAME     @ save callee saves in case of GC
6601bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    ldr    r3, [sp, #32]                 @ pass referrer
6611bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    mov    r12, sp                       @ save SP
6621bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    sub    sp, #8                        @ grow frame for alignment with stack args
6639329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .pad #8
6649329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset 8
6651bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    push   {r9, r12}                     @ pass Thread::Current and SP
6669329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .save {r9, r12}
6679329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset 8
6689329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r9, 0
6691bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    bl     artSetObjInstanceFromCode     @ (field_idx, Object*, new_val, referrer, Thread*, SP)
6701bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    add    sp, #16                       @ release out args
6719329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset -16
6721bddec3a6521f16df37499754000a3b1787a52e9Ian Rogers    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME   @ TODO: we can clearly save an add here
673637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    RETURN_IF_RESULT_IS_ZERO
674ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    DELIVER_PENDING_EXCEPTION
675468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_set_obj_instance
6764a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee
677aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom    /*
678caab8c4ef372db5c119bfac1911fa27b174a935cIan Rogers     * Entry from managed code to resolve a string, this stub will allocate a String and deliver an
679caab8c4ef372db5c119bfac1911fa27b174a935cIan Rogers     * exception on error. On success the String is returned. R0 holds the referring method,
680caab8c4ef372db5c119bfac1911fa27b174a935cIan Rogers     * R1 holds the string index. The fast path check for hit in strings cache has already been
681caab8c4ef372db5c119bfac1911fa27b174a935cIan Rogers     * performed.
682aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom     */
6839329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artResolveStringFromCode
684468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_resolve_string
685caab8c4ef372db5c119bfac1911fa27b174a935cIan Rogers    SETUP_REF_ONLY_CALLEE_SAVE_FRAME  @ save callee saves in case of GC
686caab8c4ef372db5c119bfac1911fa27b174a935cIan Rogers    mov    r2, r9                     @ pass Thread::Current
687caab8c4ef372db5c119bfac1911fa27b174a935cIan Rogers    mov    r3, sp                     @ pass SP
688caab8c4ef372db5c119bfac1911fa27b174a935cIan Rogers    @ artResolveStringFromCode(Method* referrer, uint32_t string_idx, Thread*, SP)
689aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom    bl     artResolveStringFromCode
690aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
691637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    RETURN_IF_RESULT_IS_NON_ZERO
692aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom    DELIVER_PENDING_EXCEPTION
693468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_resolve_string
694aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom
69521d9e8323124a832a21679ca83808bc9c68ed365Ian Rogers    /*
69621d9e8323124a832a21679ca83808bc9c68ed365Ian Rogers     * Called by managed code to allocate an object
69721d9e8323124a832a21679ca83808bc9c68ed365Ian Rogers     */
6989329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artAllocObjectFromCode
699468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_alloc_object
7004f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    SETUP_REF_ONLY_CALLEE_SAVE_FRAME  @ save callee saves in case of GC
7014f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    mov    r2, r9                     @ pass Thread::Current
7024f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    mov    r3, sp                     @ pass SP
7034f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    bl     artAllocObjectFromCode     @ (uint32_t type_idx, Method* method, Thread*, SP)
7044f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
705637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    RETURN_IF_RESULT_IS_NON_ZERO
706ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    DELIVER_PENDING_EXCEPTION
707468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_alloc_object
70821d9e8323124a832a21679ca83808bc9c68ed365Ian Rogers
7093b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    .extern artAllocObjectFromCodeInstrumented
7103b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi YamauchiENTRY art_quick_alloc_object_instrumented
7113b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    SETUP_REF_ONLY_CALLEE_SAVE_FRAME  @ save callee saves in case of GC
7123b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    mov    r2, r9                     @ pass Thread::Current
7133b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    mov    r3, sp                     @ pass SP
7143b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    bl     artAllocObjectFromCodeInstrumented     @ (uint32_t type_idx, Method* method, Thread*, SP)
7153b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
7163b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    RETURN_IF_RESULT_IS_NON_ZERO
7173b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    DELIVER_PENDING_EXCEPTION
7183b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi YamauchiEND art_quick_alloc_object_instrumented
7193b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi
720cc4540ece917ef4b5c81ee684e3294e47e49ff5bbuzbee    /*
72128ad40dc3ec2f09b0ffd4f6d6787bf1b532ccd5dIan Rogers     * Called by managed code to allocate an object when the caller doesn't know whether it has
72257b86d47b66322693a070185fadfb43cb9c12eabIan Rogers     * access to the created type.
723cc4540ece917ef4b5c81ee684e3294e47e49ff5bbuzbee     */
7249329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artAllocObjectFromCodeWithAccessCheck
725468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_alloc_object_with_access_check
726cc4540ece917ef4b5c81ee684e3294e47e49ff5bbuzbee    SETUP_REF_ONLY_CALLEE_SAVE_FRAME  @ save callee saves in case of GC
727cc4540ece917ef4b5c81ee684e3294e47e49ff5bbuzbee    mov    r2, r9                     @ pass Thread::Current
728cc4540ece917ef4b5c81ee684e3294e47e49ff5bbuzbee    mov    r3, sp                     @ pass SP
72928ad40dc3ec2f09b0ffd4f6d6787bf1b532ccd5dIan Rogers    bl     artAllocObjectFromCodeWithAccessCheck  @ (uint32_t type_idx, Method* method, Thread*, SP)
730cc4540ece917ef4b5c81ee684e3294e47e49ff5bbuzbee    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
731637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    RETURN_IF_RESULT_IS_NON_ZERO
732cc4540ece917ef4b5c81ee684e3294e47e49ff5bbuzbee    DELIVER_PENDING_EXCEPTION
733468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_alloc_object_with_access_check
734cc4540ece917ef4b5c81ee684e3294e47e49ff5bbuzbee
7353b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    .extern artAllocObjectFromCodeWithAccessCheckInstrumented
7363b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi YamauchiENTRY art_quick_alloc_object_with_access_check_instrumented
7373b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    SETUP_REF_ONLY_CALLEE_SAVE_FRAME  @ save callee saves in case of GC
7383b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    mov    r2, r9                     @ pass Thread::Current
7393b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    mov    r3, sp                     @ pass SP
7403b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    bl     artAllocObjectFromCodeWithAccessCheckInstrumented  @ (uint32_t type_idx, Method* method, Thread*, SP)
7413b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
7423b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    RETURN_IF_RESULT_IS_NON_ZERO
7433b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    DELIVER_PENDING_EXCEPTION
7443b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi YamauchiEND art_quick_alloc_object_with_access_check_instrumented
7453b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi
746b886da8e3c26443ab4d2aa63268bd673c354c3d2Ian Rogers    /*
74757b86d47b66322693a070185fadfb43cb9c12eabIan Rogers     * Called by managed code to allocate an array.
748b886da8e3c26443ab4d2aa63268bd673c354c3d2Ian Rogers     */
7499329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artAllocArrayFromCode
750468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_alloc_array
7514f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    SETUP_REF_ONLY_CALLEE_SAVE_FRAME  @ save callee saves in case of GC
7524f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    mov    r3, r9                     @ pass Thread::Current
753865e6e01486e3d7d61b7d0d952b420e5912c8219buzbee    mov    r12, sp
754865e6e01486e3d7d61b7d0d952b420e5912c8219buzbee    str    r12, [sp, #-16]!           @ expand the frame and pass SP
7559329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .pad #16
7569329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset 16
7574f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    @ artAllocArrayFromCode(uint32_t type_idx, Method* method, int32_t component_count, Thread*, SP)
7584f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    bl     artAllocArrayFromCode
759865e6e01486e3d7d61b7d0d952b420e5912c8219buzbee    add    sp, #16                    @ strip the extra frame
7609329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset -16
7614f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
762637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    RETURN_IF_RESULT_IS_NON_ZERO
763ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    DELIVER_PENDING_EXCEPTION
764468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_alloc_array
765b886da8e3c26443ab4d2aa63268bd673c354c3d2Ian Rogers
7663b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    .extern artAllocArrayFromCodeInstrumented
7673b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi YamauchiENTRY art_quick_alloc_array_instrumented
7683b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    SETUP_REF_ONLY_CALLEE_SAVE_FRAME  @ save callee saves in case of GC
7693b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    mov    r3, r9                     @ pass Thread::Current
7703b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    mov    r12, sp
7713b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    str    r12, [sp, #-16]!           @ expand the frame and pass SP
7723b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    .pad #16
7733b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    .cfi_adjust_cfa_offset 16
7743b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    @ artAllocArrayFromCodeInstrumented(uint32_t type_idx, Method* method, int32_t component_count, Thread*, SP)
7753b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    bl     artAllocArrayFromCodeInstrumented
7763b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    add    sp, #16                    @ strip the extra frame
7773b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    .cfi_adjust_cfa_offset -16
7783b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
7793b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    RETURN_IF_RESULT_IS_NON_ZERO
7803b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    DELIVER_PENDING_EXCEPTION
7813b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi YamauchiEND art_quick_alloc_array_instrumented
7823b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi
7830eb7d7e2a0c2767b5fd86bd52436c618fd4c3120Ian Rogers    /*
7840eb7d7e2a0c2767b5fd86bd52436c618fd4c3120Ian Rogers     * Called by managed code to allocate an array when the caller doesn't know whether it has
78557b86d47b66322693a070185fadfb43cb9c12eabIan Rogers     * access to the created type.
7860eb7d7e2a0c2767b5fd86bd52436c618fd4c3120Ian Rogers     */
7879329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artAllocArrayFromCodeWithAccessCheck
788468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_alloc_array_with_access_check
7890eb7d7e2a0c2767b5fd86bd52436c618fd4c3120Ian Rogers    SETUP_REF_ONLY_CALLEE_SAVE_FRAME  @ save callee saves in case of GC
7900eb7d7e2a0c2767b5fd86bd52436c618fd4c3120Ian Rogers    mov    r3, r9                     @ pass Thread::Current
791865e6e01486e3d7d61b7d0d952b420e5912c8219buzbee    mov    r12, sp
792865e6e01486e3d7d61b7d0d952b420e5912c8219buzbee    str    r12, [sp, #-16]!           @ expand the frame and pass SP
7939329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .pad #16
7949329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset 16
7950eb7d7e2a0c2767b5fd86bd52436c618fd4c3120Ian Rogers    @ artAllocArrayFromCodeWithAccessCheck(type_idx, method, component_count, Thread*, SP)
7960eb7d7e2a0c2767b5fd86bd52436c618fd4c3120Ian Rogers    bl     artAllocArrayFromCodeWithAccessCheck
797865e6e01486e3d7d61b7d0d952b420e5912c8219buzbee    add    sp, #16                    @ strip the extra frame
7989329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset -16
7990eb7d7e2a0c2767b5fd86bd52436c618fd4c3120Ian Rogers    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
800637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    RETURN_IF_RESULT_IS_NON_ZERO
8010eb7d7e2a0c2767b5fd86bd52436c618fd4c3120Ian Rogers    DELIVER_PENDING_EXCEPTION
802468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_alloc_array_with_access_check
8030eb7d7e2a0c2767b5fd86bd52436c618fd4c3120Ian Rogers
8043b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    .extern artAllocArrayFromCodeWithAccessCheckInstrumented
8053b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi YamauchiENTRY art_quick_alloc_array_with_access_check_instrumented
8063b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    SETUP_REF_ONLY_CALLEE_SAVE_FRAME  @ save callee saves in case of GC
8073b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    mov    r3, r9                     @ pass Thread::Current
8083b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    mov    r12, sp
8093b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    str    r12, [sp, #-16]!           @ expand the frame and pass SP
8103b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    .pad #16
8113b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    .cfi_adjust_cfa_offset 16
8123b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    @ artAllocArrayFromCodeWithAccessCheckInstrumented(type_idx, method, component_count, Thread*, SP)
8133b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    bl     artAllocArrayFromCodeWithAccessCheckInstrumented
8143b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    add    sp, #16                    @ strip the extra frame
8153b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    .cfi_adjust_cfa_offset -16
8163b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
8173b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    RETURN_IF_RESULT_IS_NON_ZERO
8183b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    DELIVER_PENDING_EXCEPTION
8193b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi YamauchiEND art_quick_alloc_array_with_access_check_instrumented
8203b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi
821b886da8e3c26443ab4d2aa63268bd673c354c3d2Ian Rogers    /*
82257b86d47b66322693a070185fadfb43cb9c12eabIan Rogers     * Called by managed code to allocate an array in a special case for FILLED_NEW_ARRAY.
823b886da8e3c26443ab4d2aa63268bd673c354c3d2Ian Rogers     */
8249329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artCheckAndAllocArrayFromCode
825468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_check_and_alloc_array
8264f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    SETUP_REF_ONLY_CALLEE_SAVE_FRAME  @ save callee saves in case of GC
8274f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    mov    r3, r9                     @ pass Thread::Current
828865e6e01486e3d7d61b7d0d952b420e5912c8219buzbee    mov    r12, sp
829865e6e01486e3d7d61b7d0d952b420e5912c8219buzbee    str    r12, [sp, #-16]!           @ expand the frame and pass SP
8309329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .pad #16
8319329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset 16
8324f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    @ artCheckAndAllocArrayFromCode(uint32_t type_idx, Method* method, int32_t count, Thread* , SP)
8334f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    bl     artCheckAndAllocArrayFromCode
834865e6e01486e3d7d61b7d0d952b420e5912c8219buzbee    add    sp, #16                    @ strip the extra frame
8359329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset -16
8364f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
837637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    RETURN_IF_RESULT_IS_NON_ZERO
838ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers    DELIVER_PENDING_EXCEPTION
839468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_check_and_alloc_array
840b886da8e3c26443ab4d2aa63268bd673c354c3d2Ian Rogers
8413b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    .extern artCheckAndAllocArrayFromCodeInstrumented
8423b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi YamauchiENTRY art_quick_check_and_alloc_array_instrumented
8433b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    SETUP_REF_ONLY_CALLEE_SAVE_FRAME  @ save callee saves in case of GC
8443b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    mov    r3, r9                     @ pass Thread::Current
8453b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    mov    r12, sp
8463b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    str    r12, [sp, #-16]!           @ expand the frame and pass SP
8473b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    .pad #16
8483b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    .cfi_adjust_cfa_offset 16
8493b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    @ artCheckAndAllocArrayFromCodeInstrumented(uint32_t type_idx, Method* method, int32_t count, Thread* , SP)
8503b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    bl     artCheckAndAllocArrayFromCodeInstrumented
8513b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    add    sp, #16                    @ strip the extra frame
8523b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    .cfi_adjust_cfa_offset -16
8533b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
8543b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    RETURN_IF_RESULT_IS_NON_ZERO
8553b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    DELIVER_PENDING_EXCEPTION
8563b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi YamauchiEND art_quick_check_and_alloc_array_instrumented
8573b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi
8580eb7d7e2a0c2767b5fd86bd52436c618fd4c3120Ian Rogers    /*
85957b86d47b66322693a070185fadfb43cb9c12eabIan Rogers     * Called by managed code to allocate an array in a special case for FILLED_NEW_ARRAY.
8600eb7d7e2a0c2767b5fd86bd52436c618fd4c3120Ian Rogers     */
8619329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artCheckAndAllocArrayFromCodeWithAccessCheck
862468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_check_and_alloc_array_with_access_check
8630eb7d7e2a0c2767b5fd86bd52436c618fd4c3120Ian Rogers    SETUP_REF_ONLY_CALLEE_SAVE_FRAME  @ save callee saves in case of GC
8640eb7d7e2a0c2767b5fd86bd52436c618fd4c3120Ian Rogers    mov    r3, r9                     @ pass Thread::Current
865865e6e01486e3d7d61b7d0d952b420e5912c8219buzbee    mov    r12, sp
866865e6e01486e3d7d61b7d0d952b420e5912c8219buzbee    str    r12, [sp, #-16]!           @ expand the frame and pass SP
8679329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .pad #16
8689329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset 16
8690eb7d7e2a0c2767b5fd86bd52436c618fd4c3120Ian Rogers    @ artCheckAndAllocArrayFromCodeWithAccessCheck(type_idx, method, count, Thread* , SP)
8700eb7d7e2a0c2767b5fd86bd52436c618fd4c3120Ian Rogers    bl     artCheckAndAllocArrayFromCodeWithAccessCheck
871865e6e01486e3d7d61b7d0d952b420e5912c8219buzbee    add    sp, #16                    @ strip the extra frame
8729329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset -16
8730eb7d7e2a0c2767b5fd86bd52436c618fd4c3120Ian Rogers    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
874637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    RETURN_IF_RESULT_IS_NON_ZERO
8750eb7d7e2a0c2767b5fd86bd52436c618fd4c3120Ian Rogers    DELIVER_PENDING_EXCEPTION
876468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_check_and_alloc_array_with_access_check
8770eb7d7e2a0c2767b5fd86bd52436c618fd4c3120Ian Rogers
8783b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    .extern artCheckAndAllocArrayFromCodeWithAccessCheckInstrumented
8793b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi YamauchiENTRY art_quick_check_and_alloc_array_with_access_check_instrumented
8803b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    SETUP_REF_ONLY_CALLEE_SAVE_FRAME  @ save callee saves in case of GC
8813b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    mov    r3, r9                     @ pass Thread::Current
8823b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    mov    r12, sp
8833b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    str    r12, [sp, #-16]!           @ expand the frame and pass SP
8843b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    .pad #16
8853b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    .cfi_adjust_cfa_offset 16
8863b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    @ artCheckAndAllocArrayFromCodeWithAccessCheckInstrumented(type_idx, method, count, Thread* , SP)
8873b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    bl     artCheckAndAllocArrayFromCodeWithAccessCheckInstrumented
8883b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    add    sp, #16                    @ strip the extra frame
8893b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    .cfi_adjust_cfa_offset -16
8903b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
8913b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    RETURN_IF_RESULT_IS_NON_ZERO
8923b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi    DELIVER_PENDING_EXCEPTION
8933b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi YamauchiEND art_quick_check_and_alloc_array_with_access_check_instrumented
8943b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi
895dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers    /*
89657b86d47b66322693a070185fadfb43cb9c12eabIan Rogers     * Called by managed code when the value in rSUSPEND has been decremented to 0.
897dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers     */
8989329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artTestSuspendFromCode
8999329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian RogersENTRY art_quick_test_suspend
900474b6da273c7ce6df50a4e51eb9929a77e1611c3Ian Rogers    ldrh    r0, [rSELF, #THREAD_FLAGS_OFFSET]
9014f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    mov    rSUSPEND, #SUSPEND_CHECK_INTERVAL  @ reset rSUSPEND to SUSPEND_CHECK_INTERVAL
902637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    cbnz   r0, 1f                             @ check Thread::Current()->suspend_count_ == 0
903637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    bx     lr                                 @ return if suspend_count_ == 0
904637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers1:
9054f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    mov    r0, rSELF
9064f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    SETUP_REF_ONLY_CALLEE_SAVE_FRAME          @ save callee saves for stack crawl
907c10717a0b86d5719556ac3286fcb47aa2f2416fcbuzbee    mov    r1, sp
9084a510d8750d50b77353d0a5a891d1b9b3a48ecd5Ian Rogers    bl     artTestSuspendFromCode             @ (Thread*, SP)
9094f0d07c783afef89703dce32c94440fc8621a29bIan Rogers    RESTORE_REF_ONLY_CALLEE_SAVE_FRAME_AND_RETURN
9109329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian RogersEND art_quick_test_suspend
9114f0d07c783afef89703dce32c94440fc8621a29bIan Rogers
912dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers    /*
913dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers     * Called by managed code that is attempting to call a method on a proxy class. On entry
914af6e67a4816d2593586115b89faa659225363246Ian Rogers     * r0 holds the proxy method and r1 holds the receiver; r2 and r3 may contain arguments. The
915af6e67a4816d2593586115b89faa659225363246Ian Rogers     * frame size of the invoked proxy method agrees with a ref and args callee save frame.
916dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers     */
9175fa60c3db4208df407113b5a69d295a9c93d53b1Jeff Hao     .extern artQuickProxyInvokeHandler
9189329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian RogersENTRY art_quick_proxy_invoke_handler
919dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers    SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME
920dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers    str     r0, [sp, #0]           @ place proxy method at bottom of frame
921dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers    mov     r2, r9                 @ pass Thread::Current
922af6e67a4816d2593586115b89faa659225363246Ian Rogers    mov     r3, sp                 @ pass SP
9235fa60c3db4208df407113b5a69d295a9c93d53b1Jeff Hao    blx     artQuickProxyInvokeHandler  @ (Method* proxy method, receiver, Thread*, SP)
924637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    ldr     r2, [r9, #THREAD_EXCEPTION_OFFSET]  @ load Thread::Current()->exception_
925466bb25416b88fabd5d4387b7c7e5cc1ece78b8cIan Rogers    ldr     lr,  [sp, #44]         @ restore lr
926466bb25416b88fabd5d4387b7c7e5cc1ece78b8cIan Rogers    add     sp,  #48               @ pop frame
927d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao    .cfi_adjust_cfa_offset -48
928637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    cbnz    r2, 1f                 @ success if no exception is pending
929637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    bx      lr                     @ return on success
930637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers1:
931dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers    DELIVER_PENDING_EXCEPTION
9329329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian RogersEND art_quick_proxy_invoke_handler
933dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers
934468532ea115657709bc32ee498e701a4c71762d4Ian Rogers    .extern artQuickResolutionTrampoline
935468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_resolution_trampoline
936468532ea115657709bc32ee498e701a4c71762d4Ian Rogers    SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME
937468532ea115657709bc32ee498e701a4c71762d4Ian Rogers    mov     r2, r9                 @ pass Thread::Current
938468532ea115657709bc32ee498e701a4c71762d4Ian Rogers    mov     r3, sp                 @ pass SP
939468532ea115657709bc32ee498e701a4c71762d4Ian Rogers    blx     artQuickResolutionTrampoline  @ (Method* called, receiver, Thread*, SP)
940637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    cbz     r0, 1f                 @ is code pointer null? goto exception
941468532ea115657709bc32ee498e701a4c71762d4Ian Rogers    mov     r12, r0
942468532ea115657709bc32ee498e701a4c71762d4Ian Rogers    ldr  r0, [sp, #0]              @ load resolved method in r0
943468532ea115657709bc32ee498e701a4c71762d4Ian Rogers    ldr  r1, [sp, #8]              @ restore non-callee save r1
944468532ea115657709bc32ee498e701a4c71762d4Ian Rogers    ldrd r2, [sp, #12]             @ restore non-callee saves r2-r3
945468532ea115657709bc32ee498e701a4c71762d4Ian Rogers    ldr  lr, [sp, #44]             @ restore lr
946468532ea115657709bc32ee498e701a4c71762d4Ian Rogers    add  sp, #48                   @ rewind sp
947468532ea115657709bc32ee498e701a4c71762d4Ian Rogers    .cfi_adjust_cfa_offset -48
948468532ea115657709bc32ee498e701a4c71762d4Ian Rogers    bx      r12                    @ tail-call into actual code
949468532ea115657709bc32ee498e701a4c71762d4Ian Rogers1:
950468532ea115657709bc32ee498e701a4c71762d4Ian Rogers    RESTORE_REF_AND_ARGS_CALLEE_SAVE_FRAME
951468532ea115657709bc32ee498e701a4c71762d4Ian Rogers    DELIVER_PENDING_EXCEPTION
952468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_resolution_trampoline
953468532ea115657709bc32ee498e701a4c71762d4Ian Rogers
954468532ea115657709bc32ee498e701a4c71762d4Ian Rogers    .extern artQuickToInterpreterBridge
955468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_to_interpreter_bridge
9567db619bb2a4e01e8532a04b613745d4926b205d7Ian Rogers    SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME
9577db619bb2a4e01e8532a04b613745d4926b205d7Ian Rogers    mov     r1, r9                 @ pass Thread::Current
9587db619bb2a4e01e8532a04b613745d4926b205d7Ian Rogers    mov     r2, sp                 @ pass SP
959468532ea115657709bc32ee498e701a4c71762d4Ian Rogers    blx     artQuickToInterpreterBridge    @ (Method* method, Thread*, SP)
960637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    ldr     r2, [r9, #THREAD_EXCEPTION_OFFSET]  @ load Thread::Current()->exception_
9617db619bb2a4e01e8532a04b613745d4926b205d7Ian Rogers    ldr     lr,  [sp, #44]         @ restore lr
9627db619bb2a4e01e8532a04b613745d4926b205d7Ian Rogers    add     sp,  #48               @ pop frame
963d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao    .cfi_adjust_cfa_offset -48
964637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    cbnz    r2, 1f                 @ success if no exception is pending
965637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    bx    lr                       @ return on success
966637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers1:
9677db619bb2a4e01e8532a04b613745d4926b205d7Ian Rogers    DELIVER_PENDING_EXCEPTION
968468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_to_interpreter_bridge
9697db619bb2a4e01e8532a04b613745d4926b205d7Ian Rogers
970e343b76af81a005ef64f5e75a555389fd9147dabjeffhao    /*
9710791adc2249366c50684935a4c42ba5e58bc3746jeffhao     * Routine that intercepts method calls and returns.
972e343b76af81a005ef64f5e75a555389fd9147dabjeffhao     */
9739329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artInstrumentationMethodEntryFromCode
9749329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artInstrumentationMethodExitFromCode
975468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_instrumentation_entry
97662d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers    SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME
97762d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers    str   r0, [sp, #4]     @ preserve r0
97862d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers    mov   r12, sp          @ remember sp
97962d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers    str   lr, [sp, #-16]!  @ expand the frame and pass LR
98062d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers    .pad #16
9819329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset 16
98262d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers    .cfi_rel_offset lr, 0
98362d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers    mov   r2, r9         @ pass Thread::Current
98462d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers    mov   r3, r12        @ pass SP
98562d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers    blx   artInstrumentationMethodEntryFromCode  @ (Method*, Object*, Thread*, SP, LR)
98662d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers    add   sp, #16        @ remove out argument and padding from stack
9879329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset -16
98862d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers    mov   r12, r0        @ r12 holds reference to code
98962d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers    ldr   r0, [sp, #4]   @ restore r0
99062d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers    RESTORE_REF_AND_ARGS_CALLEE_SAVE_FRAME
991468532ea115657709bc32ee498e701a4c71762d4Ian Rogers    blx   r12            @ call method with lr set to art_quick_instrumentation_exit
992468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_instrumentation_entry
993468532ea115657709bc32ee498e701a4c71762d4Ian Rogers    .type art_quick_instrumentation_exit, #function
994468532ea115657709bc32ee498e701a4c71762d4Ian Rogers    .global art_quick_instrumentation_exit
995468532ea115657709bc32ee498e701a4c71762d4Ian Rogersart_quick_instrumentation_exit:
9969329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_startproc
9979329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .fnstart
99862d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers    mov   lr, #0         @ link register is to here, so clobber with 0 for later checks
99962d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers    SETUP_REF_ONLY_CALLEE_SAVE_FRAME
1000306057fd278d75bf3794bd5243a3b6652c487d18Ian Rogers    mov   r12, sp        @ remember bottom of caller's frame
1001e343b76af81a005ef64f5e75a555389fd9147dabjeffhao    push  {r0-r1}        @ save return value
10029329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .save {r0-r1}
10039329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset 8
10049329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r0, 0
10059329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r1, 4
100662d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers    sub   sp, #8         @ space for return value argument
10079329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .pad #8
10089329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset 8
100962d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers    strd r0, [sp]        @ r0/r1 -> [sp] for fpr_res
101062d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers    mov   r2, r0         @ pass return value as gpr_res
101162d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers    mov   r3, r1
1012306057fd278d75bf3794bd5243a3b6652c487d18Ian Rogers    mov   r0, r9         @ pass Thread::Current
1013306057fd278d75bf3794bd5243a3b6652c487d18Ian Rogers    mov   r1, r12        @ pass SP
101462d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers    blx   artInstrumentationMethodExitFromCode  @ (Thread*, SP, gpr_res, fpr_res)
1015306057fd278d75bf3794bd5243a3b6652c487d18Ian Rogers    add   sp, #8
10169329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset -8
101762d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers
1018306057fd278d75bf3794bd5243a3b6652c487d18Ian Rogers    mov   r2, r0         @ link register saved by instrumentation
1019306057fd278d75bf3794bd5243a3b6652c487d18Ian Rogers    mov   lr, r1         @ r1 is holding link register if we're to bounce to deoptimize
1020e343b76af81a005ef64f5e75a555389fd9147dabjeffhao    pop   {r0, r1}       @ restore return value
102162d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers    add sp, #32          @ remove callee save frame
102262d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers    .cfi_adjust_cfa_offset -32
1023306057fd278d75bf3794bd5243a3b6652c487d18Ian Rogers    bx    r2             @ return
1024468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_instrumentation_exit
1025306057fd278d75bf3794bd5243a3b6652c487d18Ian Rogers
1026306057fd278d75bf3794bd5243a3b6652c487d18Ian Rogers    /*
102762d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers     * Instrumentation has requested that we deoptimize into the interpreter. The deoptimization
102862d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers     * will long jump to the upcall with a special exception of -1.
1029306057fd278d75bf3794bd5243a3b6652c487d18Ian Rogers     */
10309329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .extern artDeoptimize
10319329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian RogersENTRY art_quick_deoptimize
103214dd5a82ad85a28612bf86e755ff929d767cea4cJeff Hao    SETUP_SAVE_ALL_CALLEE_SAVE_FRAME
103362d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers    mov    r0, r9         @ Set up args.
103462d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers    mov    r1, sp
103562d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers    blx    artDeoptimize  @ artDeoptimize(Thread*, SP)
10369329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian RogersEND art_quick_deoptimize
1037e343b76af81a005ef64f5e75a555389fd9147dabjeffhao
1038324e190e9de0d81d39d88474e189acef9b10bcc8Ian Rogers    /*
1039324e190e9de0d81d39d88474e189acef9b10bcc8Ian Rogers     * Signed 64-bit integer multiply.
1040324e190e9de0d81d39d88474e189acef9b10bcc8Ian Rogers     *
1041324e190e9de0d81d39d88474e189acef9b10bcc8Ian Rogers     * Consider WXxYZ (r1r0 x r3r2) with a long multiply:
1042324e190e9de0d81d39d88474e189acef9b10bcc8Ian Rogers     *        WX
1043324e190e9de0d81d39d88474e189acef9b10bcc8Ian Rogers     *      x YZ
1044324e190e9de0d81d39d88474e189acef9b10bcc8Ian Rogers     *  --------
1045324e190e9de0d81d39d88474e189acef9b10bcc8Ian Rogers     *     ZW ZX
1046324e190e9de0d81d39d88474e189acef9b10bcc8Ian Rogers     *  YW YX
1047324e190e9de0d81d39d88474e189acef9b10bcc8Ian Rogers     *
1048324e190e9de0d81d39d88474e189acef9b10bcc8Ian Rogers     * The low word of the result holds ZX, the high word holds
1049324e190e9de0d81d39d88474e189acef9b10bcc8Ian Rogers     * (ZW+YX) + (the high overflow from ZX).  YW doesn't matter because
1050324e190e9de0d81d39d88474e189acef9b10bcc8Ian Rogers     * it doesn't fit in the low 64 bits.
1051324e190e9de0d81d39d88474e189acef9b10bcc8Ian Rogers     *
1052324e190e9de0d81d39d88474e189acef9b10bcc8Ian Rogers     * Unlike most ARM math operations, multiply instructions have
1053324e190e9de0d81d39d88474e189acef9b10bcc8Ian Rogers     * restrictions on using the same register more than once (Rd and Rm
1054324e190e9de0d81d39d88474e189acef9b10bcc8Ian Rogers     * cannot be the same).
1055324e190e9de0d81d39d88474e189acef9b10bcc8Ian Rogers     */
1056324e190e9de0d81d39d88474e189acef9b10bcc8Ian Rogers    /* mul-long vAA, vBB, vCC */
10579329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian RogersENTRY art_quick_mul_long
1058324e190e9de0d81d39d88474e189acef9b10bcc8Ian Rogers    push    {r9 - r10}
10599329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .save {r9 - r10}
10609329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset 8
10619329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r9, 0
10629329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r10, 4
1063324e190e9de0d81d39d88474e189acef9b10bcc8Ian Rogers    mul     ip, r2, r1                  @  ip<- ZxW
1064324e190e9de0d81d39d88474e189acef9b10bcc8Ian Rogers    umull   r9, r10, r2, r0             @  r9/r10 <- ZxX
1065324e190e9de0d81d39d88474e189acef9b10bcc8Ian Rogers    mla     r2, r0, r3, ip              @  r2<- YxX + (ZxW)
1066324e190e9de0d81d39d88474e189acef9b10bcc8Ian Rogers    add     r10, r2, r10                @  r10<- r10 + low(ZxW + (YxX))
1067324e190e9de0d81d39d88474e189acef9b10bcc8Ian Rogers    mov     r0,r9
1068324e190e9de0d81d39d88474e189acef9b10bcc8Ian Rogers    mov     r1,r10
1069324e190e9de0d81d39d88474e189acef9b10bcc8Ian Rogers    pop     {r9 - r10}
10709329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset -8
1071324e190e9de0d81d39d88474e189acef9b10bcc8Ian Rogers    bx      lr
10729329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian RogersEND art_quick_mul_long
1073324e190e9de0d81d39d88474e189acef9b10bcc8Ian Rogers
10745433072f589b61413e042eddf76e8190a048f71dbuzbee    /*
10755433072f589b61413e042eddf76e8190a048f71dbuzbee     * Long integer shift.  This is different from the generic 32/64-bit
10765433072f589b61413e042eddf76e8190a048f71dbuzbee     * binary operations because vAA/vBB are 64-bit but vCC (the shift
10775433072f589b61413e042eddf76e8190a048f71dbuzbee     * distance) is 32-bit.  Also, Dalvik requires us to ignore all but the low
10785433072f589b61413e042eddf76e8190a048f71dbuzbee     * 6 bits.
10795433072f589b61413e042eddf76e8190a048f71dbuzbee     * On entry:
10805433072f589b61413e042eddf76e8190a048f71dbuzbee     *   r0: low word
10815433072f589b61413e042eddf76e8190a048f71dbuzbee     *   r1: high word
10825433072f589b61413e042eddf76e8190a048f71dbuzbee     *   r2: shift count
10835433072f589b61413e042eddf76e8190a048f71dbuzbee     */
10845433072f589b61413e042eddf76e8190a048f71dbuzbee    /* shl-long vAA, vBB, vCC */
1085637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan RogersARM_ENTRY art_quick_shl_long            @ ARM code as thumb code requires spills
10865433072f589b61413e042eddf76e8190a048f71dbuzbee    and     r2, r2, #63                 @ r2<- r2 & 0x3f
10875433072f589b61413e042eddf76e8190a048f71dbuzbee    mov     r1, r1, asl r2              @  r1<- r1 << r2
10885433072f589b61413e042eddf76e8190a048f71dbuzbee    rsb     r3, r2, #32                 @  r3<- 32 - r2
10895433072f589b61413e042eddf76e8190a048f71dbuzbee    orr     r1, r1, r0, lsr r3          @  r1<- r1 | (r0 << (32-r2))
10905433072f589b61413e042eddf76e8190a048f71dbuzbee    subs    ip, r2, #32                 @  ip<- r2 - 32
10915433072f589b61413e042eddf76e8190a048f71dbuzbee    movpl   r1, r0, asl ip              @  if r2 >= 32, r1<- r0 << (r2-32)
10925433072f589b61413e042eddf76e8190a048f71dbuzbee    mov     r0, r0, asl r2              @  r0<- r0 << r2
10935433072f589b61413e042eddf76e8190a048f71dbuzbee    bx      lr
10949329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian RogersEND art_quick_shl_long
10955433072f589b61413e042eddf76e8190a048f71dbuzbee
10965433072f589b61413e042eddf76e8190a048f71dbuzbee    /*
10975433072f589b61413e042eddf76e8190a048f71dbuzbee     * Long integer shift.  This is different from the generic 32/64-bit
10985433072f589b61413e042eddf76e8190a048f71dbuzbee     * binary operations because vAA/vBB are 64-bit but vCC (the shift
10995433072f589b61413e042eddf76e8190a048f71dbuzbee     * distance) is 32-bit.  Also, Dalvik requires us to ignore all but the low
11005433072f589b61413e042eddf76e8190a048f71dbuzbee     * 6 bits.
11015433072f589b61413e042eddf76e8190a048f71dbuzbee     * On entry:
11025433072f589b61413e042eddf76e8190a048f71dbuzbee     *   r0: low word
11035433072f589b61413e042eddf76e8190a048f71dbuzbee     *   r1: high word
11045433072f589b61413e042eddf76e8190a048f71dbuzbee     *   r2: shift count
11055433072f589b61413e042eddf76e8190a048f71dbuzbee     */
11065433072f589b61413e042eddf76e8190a048f71dbuzbee    /* shr-long vAA, vBB, vCC */
1107637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan RogersARM_ENTRY art_quick_shr_long            @ ARM code as thumb code requires spills
11085433072f589b61413e042eddf76e8190a048f71dbuzbee    and     r2, r2, #63                 @ r0<- r0 & 0x3f
11095433072f589b61413e042eddf76e8190a048f71dbuzbee    mov     r0, r0, lsr r2              @  r0<- r2 >> r2
11105433072f589b61413e042eddf76e8190a048f71dbuzbee    rsb     r3, r2, #32                 @  r3<- 32 - r2
11115433072f589b61413e042eddf76e8190a048f71dbuzbee    orr     r0, r0, r1, asl r3          @  r0<- r0 | (r1 << (32-r2))
11125433072f589b61413e042eddf76e8190a048f71dbuzbee    subs    ip, r2, #32                 @  ip<- r2 - 32
11135433072f589b61413e042eddf76e8190a048f71dbuzbee    movpl   r0, r1, asr ip              @  if r2 >= 32, r0<-r1 >> (r2-32)
11145433072f589b61413e042eddf76e8190a048f71dbuzbee    mov     r1, r1, asr r2              @  r1<- r1 >> r2
11155433072f589b61413e042eddf76e8190a048f71dbuzbee    bx      lr
11169329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian RogersEND art_quick_shr_long
11175433072f589b61413e042eddf76e8190a048f71dbuzbee
11185433072f589b61413e042eddf76e8190a048f71dbuzbee    /*
11195433072f589b61413e042eddf76e8190a048f71dbuzbee     * Long integer shift.  This is different from the generic 32/64-bit
11205433072f589b61413e042eddf76e8190a048f71dbuzbee     * binary operations because vAA/vBB are 64-bit but vCC (the shift
11215433072f589b61413e042eddf76e8190a048f71dbuzbee     * distance) is 32-bit.  Also, Dalvik requires us to ignore all but the low
11225433072f589b61413e042eddf76e8190a048f71dbuzbee     * 6 bits.
11235433072f589b61413e042eddf76e8190a048f71dbuzbee     * On entry:
11245433072f589b61413e042eddf76e8190a048f71dbuzbee     *   r0: low word
11255433072f589b61413e042eddf76e8190a048f71dbuzbee     *   r1: high word
11265433072f589b61413e042eddf76e8190a048f71dbuzbee     *   r2: shift count
11275433072f589b61413e042eddf76e8190a048f71dbuzbee     */
11285433072f589b61413e042eddf76e8190a048f71dbuzbee    /* ushr-long vAA, vBB, vCC */
1129637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan RogersARM_ENTRY art_quick_ushr_long           @ ARM code as thumb code requires spills
11305433072f589b61413e042eddf76e8190a048f71dbuzbee    and     r2, r2, #63                 @ r0<- r0 & 0x3f
11315433072f589b61413e042eddf76e8190a048f71dbuzbee    mov     r0, r0, lsr r2              @  r0<- r2 >> r2
11325433072f589b61413e042eddf76e8190a048f71dbuzbee    rsb     r3, r2, #32                 @  r3<- 32 - r2
11335433072f589b61413e042eddf76e8190a048f71dbuzbee    orr     r0, r0, r1, asl r3          @  r0<- r0 | (r1 << (32-r2))
11345433072f589b61413e042eddf76e8190a048f71dbuzbee    subs    ip, r2, #32                 @  ip<- r2 - 32
11355433072f589b61413e042eddf76e8190a048f71dbuzbee    movpl   r0, r1, lsr ip              @  if r2 >= 32, r0<-r1 >>> (r2-32)
11365433072f589b61413e042eddf76e8190a048f71dbuzbee    mov     r1, r1, lsr r2              @  r1<- r1 >>> r2
11375433072f589b61413e042eddf76e8190a048f71dbuzbee    bx      lr
11389329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian RogersEND art_quick_ushr_long
1139fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee
1140fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    /*
1141fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     * String's indexOf.
1142fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     *
1143fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     * On entry:
1144fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     *    r0:   string object (known non-null)
114586e4671975752b112b2e8969ac6652c72c8e86c7jeffhao     *    r1:   char to match (known <= 0xFFFF)
1146fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     *    r2:   Starting offset in string data
1147fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     */
11489329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian RogersENTRY art_quick_indexof
1149fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    push {r4, r10-r11, lr} @ 4 words of callee saves
11509329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .save {r4, r10-r11, lr}
11519329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset 16
11529329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r4, 0
11539329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r10, 4
11549329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r11, 8
11559329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset lr, 12
1156fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    ldr   r3, [r0, #STRING_COUNT_OFFSET]
1157fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    ldr   r12, [r0, #STRING_OFFSET_OFFSET]
1158fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    ldr   r0, [r0, #STRING_VALUE_OFFSET]
1159fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee
1160fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    /* Clamp start to [0..count] */
1161fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    cmp   r2, #0
1162637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    it    lt
1163fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    movlt r2, #0
1164fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    cmp   r2, r3
1165637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    it    gt
1166fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    movgt r2, r3
1167fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee
1168fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    /* Build a pointer to the start of string data */
1169fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    add   r0, #STRING_DATA_OFFSET
1170fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    add   r0, r0, r12, lsl #1
1171fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee
1172fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    /* Save a copy in r12 to later compute result */
1173fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    mov   r12, r0
1174fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee
1175fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    /* Build pointer to start of data to compare and pre-bias */
1176fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    add   r0, r0, r2, lsl #1
1177fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    sub   r0, #2
1178fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee
1179fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    /* Compute iteration count */
1180fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    sub   r2, r3, r2
1181fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee
1182fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    /*
1183fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     * At this point we have:
1184fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     *   r0: start of data to test
1185fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     *   r1: char to compare
1186fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     *   r2: iteration count
1187fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     *   r12: original start of string data
1188fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     *   r3, r4, r10, r11 available for loading string data
1189fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     */
1190fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee
1191fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    subs  r2, #4
1192fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    blt   indexof_remainder
1193fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee
1194fc9e6fabed89d948fa8c0e9d673e430076712c60buzbeeindexof_loop4:
1195fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    ldrh  r3, [r0, #2]!
1196fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    ldrh  r4, [r0, #2]!
1197fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    ldrh  r10, [r0, #2]!
1198fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    ldrh  r11, [r0, #2]!
1199fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    cmp   r3, r1
1200fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    beq   match_0
1201fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    cmp   r4, r1
1202fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    beq   match_1
1203fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    cmp   r10, r1
1204fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    beq   match_2
1205fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    cmp   r11, r1
1206fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    beq   match_3
1207fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    subs  r2, #4
1208fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    bge   indexof_loop4
1209fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee
1210fc9e6fabed89d948fa8c0e9d673e430076712c60buzbeeindexof_remainder:
1211fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    adds    r2, #4
1212fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    beq     indexof_nomatch
1213fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee
1214fc9e6fabed89d948fa8c0e9d673e430076712c60buzbeeindexof_loop1:
1215fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    ldrh  r3, [r0, #2]!
1216fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    cmp   r3, r1
1217fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    beq   match_3
1218fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    subs  r2, #1
1219fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    bne   indexof_loop1
1220fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee
1221fc9e6fabed89d948fa8c0e9d673e430076712c60buzbeeindexof_nomatch:
1222fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    mov   r0, #-1
1223fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    pop {r4, r10-r11, pc}
1224fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee
1225fc9e6fabed89d948fa8c0e9d673e430076712c60buzbeematch_0:
1226fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    sub   r0, #6
1227fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    sub   r0, r12
1228fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    asr   r0, r0, #1
1229fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    pop {r4, r10-r11, pc}
1230fc9e6fabed89d948fa8c0e9d673e430076712c60buzbeematch_1:
1231fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    sub   r0, #4
1232fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    sub   r0, r12
1233fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    asr   r0, r0, #1
1234fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    pop {r4, r10-r11, pc}
1235fc9e6fabed89d948fa8c0e9d673e430076712c60buzbeematch_2:
1236fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    sub   r0, #2
1237fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    sub   r0, r12
1238fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    asr   r0, r0, #1
1239fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    pop {r4, r10-r11, pc}
1240fc9e6fabed89d948fa8c0e9d673e430076712c60buzbeematch_3:
1241fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    sub   r0, r12
1242fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    asr   r0, r0, #1
1243fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    pop {r4, r10-r11, pc}
12449329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian RogersEND art_quick_indexof
1245fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee
1246fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee   /*
1247fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     * String's compareTo.
1248fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     *
1249fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     * Requires rARG0/rARG1 to have been previously checked for null.  Will
1250fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     * return negative if this's string is < comp, 0 if they are the
1251fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     * same and positive if >.
1252fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     *
1253fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     * On entry:
1254fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     *    r0:   this object pointer
1255fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     *    r1:   comp object pointer
1256fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     *
1257fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     */
1258fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    .extern __memcmp16
12599329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian RogersENTRY art_quick_string_compareto
1260fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    mov    r2, r0         @ this to r2, opening up r0 for return value
1261637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    sub    r0, r2, r1     @ Same?
1262637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    cbnz   r0,1f
1263637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    bx     lr
1264637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers1:                        @ Same strings, return.
1265fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee
1266fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    push {r4, r7-r12, lr} @ 8 words - keep alignment
12679329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .save {r4, r7-r12, lr}
12689329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_adjust_cfa_offset 32
12699329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r4, 0
12709329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r7, 4
12719329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r8, 8
12729329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r9, 12
12739329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r10, 16
12749329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r11, 20
12759329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset r12, 24
12769329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian Rogers    .cfi_rel_offset lr, 28
1277fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee
1278fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    ldr    r4, [r2, #STRING_OFFSET_OFFSET]
1279fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    ldr    r9, [r1, #STRING_OFFSET_OFFSET]
1280fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    ldr    r7, [r2, #STRING_COUNT_OFFSET]
1281fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    ldr    r10, [r1, #STRING_COUNT_OFFSET]
1282fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    ldr    r2, [r2, #STRING_VALUE_OFFSET]
1283fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    ldr    r1, [r1, #STRING_VALUE_OFFSET]
1284fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee
1285fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    /*
1286fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     * At this point, we have:
1287fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     *    value:  r2/r1
1288fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     *    offset: r4/r9
1289fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     *    count:  r7/r10
1290fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     * We're going to compute
1291fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     *    r11 <- countDiff
1292fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     *    r10 <- minCount
1293fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     */
1294fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     subs  r11, r7, r10
1295637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers     it    ls
1296fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     movls r10, r7
1297fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee
1298fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     /* Now, build pointers to the string data */
1299fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     add   r2, r2, r4, lsl #1
1300fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     add   r1, r1, r9, lsl #1
1301fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     /*
1302fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee      * Note: data pointers point to previous element so we can use pre-index
1303fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee      * mode with base writeback.
1304fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee      */
1305fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     add   r2, #STRING_DATA_OFFSET-2   @ offset to contents[-1]
1306fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     add   r1, #STRING_DATA_OFFSET-2   @ offset to contents[-1]
1307fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee
1308fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee     /*
1309fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee      * At this point we have:
1310fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee      *   r2: *this string data
1311fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee      *   r1: *comp string data
1312fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee      *   r10: iteration count for comparison
1313fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee      *   r11: value to return if the first part of the string is equal
1314fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee      *   r0: reserved for result
1315fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee      *   r3, r4, r7, r8, r9, r12 available for loading string data
1316fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee      */
1317fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee
1318fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    subs  r10, #2
1319fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    blt   do_remainder2
1320fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee
1321fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee      /*
1322fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee       * Unroll the first two checks so we can quickly catch early mismatch
1323fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee       * on long strings (but preserve incoming alignment)
1324fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee       */
1325fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee
1326fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    ldrh  r3, [r2, #2]!
1327fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    ldrh  r4, [r1, #2]!
1328fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    ldrh  r7, [r2, #2]!
1329fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    ldrh  r8, [r1, #2]!
1330fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    subs  r0, r3, r4
1331637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    it    eq
1332637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    subseq  r0, r7, r8
1333fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    bne   done
1334fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    cmp   r10, #28
1335fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    bgt   do_memcmp16
1336fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    subs  r10, #3
1337fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    blt   do_remainder
1338fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee
1339fc9e6fabed89d948fa8c0e9d673e430076712c60buzbeeloopback_triple:
1340fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    ldrh  r3, [r2, #2]!
1341fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    ldrh  r4, [r1, #2]!
1342fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    ldrh  r7, [r2, #2]!
1343fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    ldrh  r8, [r1, #2]!
1344fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    ldrh  r9, [r2, #2]!
1345fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    ldrh  r12,[r1, #2]!
1346fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    subs  r0, r3, r4
1347637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    it    eq
1348637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    subseq  r0, r7, r8
1349637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    it    eq
1350637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    subseq  r0, r9, r12
1351fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    bne   done
1352fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    subs  r10, #3
1353fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    bge   loopback_triple
1354fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee
1355fc9e6fabed89d948fa8c0e9d673e430076712c60buzbeedo_remainder:
1356fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    adds  r10, #3
1357fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    beq   returnDiff
1358fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee
1359fc9e6fabed89d948fa8c0e9d673e430076712c60buzbeeloopback_single:
1360fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    ldrh  r3, [r2, #2]!
1361fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    ldrh  r4, [r1, #2]!
1362fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    subs  r0, r3, r4
1363fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    bne   done
1364fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    subs  r10, #1
1365fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    bne     loopback_single
1366fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee
1367fc9e6fabed89d948fa8c0e9d673e430076712c60buzbeereturnDiff:
1368fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    mov   r0, r11
1369fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    pop   {r4, r7-r12, pc}
1370fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee
1371fc9e6fabed89d948fa8c0e9d673e430076712c60buzbeedo_remainder2:
1372fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    adds  r10, #2
1373fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    bne   loopback_single
1374fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    mov   r0, r11
1375fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    pop   {r4, r7-r12, pc}
1376fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee
1377fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    /* Long string case */
1378fc9e6fabed89d948fa8c0e9d673e430076712c60buzbeedo_memcmp16:
1379fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    mov   r7, r11
1380fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    add   r0, r2, #2
1381fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    add   r1, r1, #2
1382fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    mov   r2, r10
1383fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    bl    __memcmp16
1384fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    cmp   r0, #0
1385637859cef76e7d41f7fdfd1f1aea7d60b4a315dcIan Rogers    it    eq
1386fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    moveq r0, r7
1387fc9e6fabed89d948fa8c0e9d673e430076712c60buzbeedone:
1388fc9e6fabed89d948fa8c0e9d673e430076712c60buzbee    pop   {r4, r7-r12, pc}
13899329bbb44d19866a70c6f2ff1657eafe399c5bf5Ian RogersEND art_quick_string_compareto
1390