quick_entrypoints_arm.S revision dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9e
19651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers#include "asm_support.h" 29651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers 35433072f589b61413e042eddf76e8190a048f71dbuzbee#if defined(__arm__) 45433072f589b61413e042eddf76e8190a048f71dbuzbee 55433072f589b61413e042eddf76e8190a048f71dbuzbee .balign 4 64a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee 7ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers /* Deliver the given exception */ 8ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers .extern artDeliverExceptionFromCode 9ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers /* Deliver an exception pending on a thread */ 10ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers .extern artDeliverPendingException 11ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers 124f0d07c783afef89703dce32c94440fc8621a29bIan Rogers /* 134f0d07c783afef89703dce32c94440fc8621a29bIan Rogers * Macro that sets up the callee save frame to conform with 144f0d07c783afef89703dce32c94440fc8621a29bIan Rogers * Runtime::CreateCalleeSaveMethod(kSaveAll) 154f0d07c783afef89703dce32c94440fc8621a29bIan Rogers */ 1615fdb8cfb5b2e3fc882113ec0648d492cebf852cIan Rogers.macro SETUP_CALLEE_SAVE_FRAME 174f0d07c783afef89703dce32c94440fc8621a29bIan Rogers push {r4-r11, lr} @ 9 words of callee saves 1815fdb8cfb5b2e3fc882113ec0648d492cebf852cIan Rogers vpush {s0-s31} 194f0d07c783afef89703dce32c94440fc8621a29bIan Rogers sub sp, #12 @ 3 words of space, bottom word will hold Method* 204f0d07c783afef89703dce32c94440fc8621a29bIan Rogers.endm 214f0d07c783afef89703dce32c94440fc8621a29bIan Rogers 224f0d07c783afef89703dce32c94440fc8621a29bIan Rogers /* 234f0d07c783afef89703dce32c94440fc8621a29bIan Rogers * Macro that sets up the callee save frame to conform with 24dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers * Runtime::CreateCalleeSaveMethod(kRefsOnly). Restoration assumes non-moving GC. 254f0d07c783afef89703dce32c94440fc8621a29bIan Rogers */ 264f0d07c783afef89703dce32c94440fc8621a29bIan Rogers.macro SETUP_REF_ONLY_CALLEE_SAVE_FRAME 274f0d07c783afef89703dce32c94440fc8621a29bIan Rogers push {r5-r8, r10-r11, lr} @ 7 words of callee saves 284f0d07c783afef89703dce32c94440fc8621a29bIan Rogers sub sp, #4 @ bottom word will hold Method* 294f0d07c783afef89703dce32c94440fc8621a29bIan Rogers.endm 304f0d07c783afef89703dce32c94440fc8621a29bIan Rogers 314f0d07c783afef89703dce32c94440fc8621a29bIan Rogers.macro RESTORE_REF_ONLY_CALLEE_SAVE_FRAME 32dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers ldr lr, [sp, #28] @ restore lr for return 33dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers add sp, #32 @ unwind stack 344f0d07c783afef89703dce32c94440fc8621a29bIan Rogers.endm 354f0d07c783afef89703dce32c94440fc8621a29bIan Rogers 364f0d07c783afef89703dce32c94440fc8621a29bIan Rogers.macro RESTORE_REF_ONLY_CALLEE_SAVE_FRAME_AND_RETURN 37dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers ldr lr, [sp, #28] @ restore lr for return 38dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers add sp, #32 @ unwind stack 39dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers bx lr @ return 404f0d07c783afef89703dce32c94440fc8621a29bIan Rogers.endm 414f0d07c783afef89703dce32c94440fc8621a29bIan Rogers 424f0d07c783afef89703dce32c94440fc8621a29bIan Rogers /* 434f0d07c783afef89703dce32c94440fc8621a29bIan Rogers * Macro that sets up the callee save frame to conform with 44dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers * Runtime::CreateCalleeSaveMethod(kRefsAndArgs). Restoration assumes non-moving GC. 454f0d07c783afef89703dce32c94440fc8621a29bIan Rogers */ 464f0d07c783afef89703dce32c94440fc8621a29bIan Rogers.macro SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME 47dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers push {r1-r3, r5-r8, r10-r11, lr} @ 10 words of callee saves 48dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers sub sp, #8 @ 2 words of space, bottom word will hold Method* 494f0d07c783afef89703dce32c94440fc8621a29bIan Rogers.endm 504f0d07c783afef89703dce32c94440fc8621a29bIan Rogers 514f0d07c783afef89703dce32c94440fc8621a29bIan Rogers.macro RESTORE_REF_AND_ARGS_CALLEE_SAVE_FRAME 52dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers ldr r1, [sp, #8] @ restore non-callee save r1 53dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers ldrd r2, [sp, #12] @ restore non-callee saves r2-r3 54dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers ldr lr, [sp, #44] @ restore lr 55dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers add sp, #48 @ rewind sp 5615fdb8cfb5b2e3fc882113ec0648d492cebf852cIan Rogers.endm 5715fdb8cfb5b2e3fc882113ec0648d492cebf852cIan Rogers 58ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers /* 59ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers * Macro that set calls through to artDeliverPendingExceptionFromCode, where the pending 60ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers * exception is Thread::Current()->exception_ 61ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers */ 62ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers.macro DELIVER_PENDING_EXCEPTION 63ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers SETUP_CALLEE_SAVE_FRAME @ save callee saves for throw 64ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers mov r0, r9 @ pass Thread::Current 65ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers mov r1, sp @ pass SP 66ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers b artDeliverPendingExceptionFromCode @ artDeliverPendingExceptionFromCode(Thread*, SP) 67ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers.endm 68ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers 696f495f2898a418f87e2a919e04fe23521bb0b9e9Brian Carlstrom .global art_do_long_jump 706f495f2898a418f87e2a919e04fe23521bb0b9e9Brian Carlstrom /* 716f495f2898a418f87e2a919e04fe23521bb0b9e9Brian Carlstrom * On entry r0 is uint32_t* gprs_ and r1 is uint32_t* fprs_ 726f495f2898a418f87e2a919e04fe23521bb0b9e9Brian Carlstrom */ 73dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogersart_do_long_jump: 746f495f2898a418f87e2a919e04fe23521bb0b9e9Brian Carlstrom vldm r1, {s0-s31} @ load all fprs from argument fprs_ 756f495f2898a418f87e2a919e04fe23521bb0b9e9Brian Carlstrom ldr r2, [r0, #60] @ r2 = r15 (PC from gprs_ 60=4*15) 766f495f2898a418f87e2a919e04fe23521bb0b9e9Brian Carlstrom add r0, r0, #12 @ increment r0 to skip gprs_[0..2] 12=4*3 776f495f2898a418f87e2a919e04fe23521bb0b9e9Brian Carlstrom ldm r0, {r3-r14} @ load remaining gprs from argument gprs_ 786f495f2898a418f87e2a919e04fe23521bb0b9e9Brian Carlstrom mov r0, #0 @ clear result registers r0 and r1 796f495f2898a418f87e2a919e04fe23521bb0b9e9Brian Carlstrom mov r1, #0 806f495f2898a418f87e2a919e04fe23521bb0b9e9Brian Carlstrom bx r2 @ do long jump 816f495f2898a418f87e2a919e04fe23521bb0b9e9Brian Carlstrom 82ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers .global art_deliver_exception_from_code 83bdb0391258abc54bf77c676e36847d28a783bfe5Ian Rogers /* 84ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * Called by managed code, saves mosts registers (forms basis of long jump context) and passes 85ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * the bottom of the stack. artDeliverExceptionFromCode will place the callee save Method* at 86ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * the bottom of the thread. On entry r0 holds Throwable* 87bdb0391258abc54bf77c676e36847d28a783bfe5Ian Rogers */ 88ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogersart_deliver_exception_from_code: 8915fdb8cfb5b2e3fc882113ec0648d492cebf852cIan Rogers SETUP_CALLEE_SAVE_FRAME 90ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers mov r1, r9 @ pass Thread::Current 91ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers mov r2, sp @ pass SP 92ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers b artDeliverExceptionFromCode @ artDeliverExceptionFromCode(Throwable*, Thread*, SP) 939651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers 949651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers .global art_throw_null_pointer_exception_from_code 95ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers .extern artThrowNullPointerExceptionFromCode 969651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers /* 97ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * Called by managed code to create and deliver a NullPointerException 989651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers */ 999651f425f7413772a7b5352da2b04eb7de7d416fIan Rogersart_throw_null_pointer_exception_from_code: 10015fdb8cfb5b2e3fc882113ec0648d492cebf852cIan Rogers SETUP_CALLEE_SAVE_FRAME 101ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers mov r0, r9 @ pass Thread::Current 102ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers mov r1, sp @ pass SP 103ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers b artThrowNullPointerExceptionFromCode @ artThrowNullPointerExceptionFromCode(Thread*, SP) 1049651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers 1059651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers .global art_throw_div_zero_from_code 106ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers .extern artThrowDivZeroFromCode 1079651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers /* 108ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * Called by managed code to create and deliver an ArithmeticException 1099651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers */ 1109651f425f7413772a7b5352da2b04eb7de7d416fIan Rogersart_throw_div_zero_from_code: 11115fdb8cfb5b2e3fc882113ec0648d492cebf852cIan Rogers SETUP_CALLEE_SAVE_FRAME 112ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers mov r0, r9 @ pass Thread::Current 113ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers mov r1, sp @ pass SP 114ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers b artThrowDivZeroFromCode @ artThrowDivZeroFromCode(Thread*, SP) 1159651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers 1169651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers .global art_throw_array_bounds_from_code 117ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers .extern artThrowArrayBoundsFromCode 1189651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers /* 119ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * Called by managed code to create and deliver an ArrayIndexOutOfBoundsException 1209651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers */ 1219651f425f7413772a7b5352da2b04eb7de7d416fIan Rogersart_throw_array_bounds_from_code: 12215fdb8cfb5b2e3fc882113ec0648d492cebf852cIan Rogers SETUP_CALLEE_SAVE_FRAME 123ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers mov r2, r9 @ pass Thread::Current 124ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers mov r3, sp @ pass SP 125ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers b artThrowArrayBoundsFromCode @ artThrowArrayBoundsFromCode(index, limit, Thread*, SP) 126bdb0391258abc54bf77c676e36847d28a783bfe5Ian Rogers 127932746a4f22951abcba7b7c4c94c27b1bf164272Ian Rogers .global art_throw_stack_overflow_from_code 128932746a4f22951abcba7b7c4c94c27b1bf164272Ian Rogers .extern artThrowStackOverflowFromCode 129932746a4f22951abcba7b7c4c94c27b1bf164272Ian Rogersart_throw_stack_overflow_from_code: 13015fdb8cfb5b2e3fc882113ec0648d492cebf852cIan Rogers SETUP_CALLEE_SAVE_FRAME 131932746a4f22951abcba7b7c4c94c27b1bf164272Ian Rogers mov r1, r9 @ pass Thread::Current 132932746a4f22951abcba7b7c4c94c27b1bf164272Ian Rogers mov r2, sp @ pass SP 133932746a4f22951abcba7b7c4c94c27b1bf164272Ian Rogers b artThrowStackOverflowFromCode @ artThrowStackOverflowFromCode(method, Thread*, SP) 134932746a4f22951abcba7b7c4c94c27b1bf164272Ian Rogers 135c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers .global art_throw_neg_array_size_from_code 136c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers .extern artThrowNegArraySizeFromCode 137c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogersart_throw_neg_array_size_from_code: 13815fdb8cfb5b2e3fc882113ec0648d492cebf852cIan Rogers SETUP_CALLEE_SAVE_FRAME 139c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers mov r1, r9 @ pass Thread::Current 140c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers mov r2, sp @ pass SP 141c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers b artThrowNegArraySizeFromCode @ artThrowNegArraySizeFromCode(size, Thread*, SP) 142c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers 143c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers .global art_throw_no_such_method_from_code 144c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers .extern artThrowNoSuchMethodFromCode 145c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogersart_throw_no_such_method_from_code: 14615fdb8cfb5b2e3fc882113ec0648d492cebf852cIan Rogers SETUP_CALLEE_SAVE_FRAME 147c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers mov r1, r9 @ pass Thread::Current 148c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers mov r2, sp @ pass SP 149c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers b artThrowNoSuchMethodFromCode @ artThrowNoSuchMethodFromCode(method_idx, Thread*, SP) 150c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers 151c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers .global art_throw_verification_error_from_code 152c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers .extern artThrowVerificationErrorFromCode 153c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogersart_throw_verification_error_from_code: 15415fdb8cfb5b2e3fc882113ec0648d492cebf852cIan Rogers SETUP_CALLEE_SAVE_FRAME 155c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers mov r2, r9 @ pass Thread::Current 156c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers mov r3, sp @ pass SP 1576c8867daab4af4667e0e816f6beafa7c5d13e043Elliott Hughes b artThrowVerificationErrorFromCode @ artThrowVerificationErrorFromCode(kind, ref, Thread*, SP) 158c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers 1594a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee .global art_invoke_interface_trampoline 160ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers .extern artFindInterfaceMethodInCacheFromCode 1614a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee /* 162ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * All generated callsites for interface invokes will load arguments as usual - except instead 163ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * of loading arg0/r0 with the target Method*, arg0/r0 will contain the method_idx. This 164ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * wrapper will save arg1-arg3, load the caller's Method*, align the stack and call the helper 165ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * artFindInterfaceMethodInCacheFromCode(idx, this, method); 166ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * NOTE: "this" is first visable argument of the target, and so can be found in arg1/r1. 1674a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee * 168ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * artFindInterfaceMethodInCacheFromCode will attempt to locate the target and return a 64-bit 169ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * result in r0/r1 consisting of the target Method* in r0 and method->code_ in r1. 1704a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee * 171ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * If unsuccessful, artFindInterfaceMethodInCacheFromCode will return NULL/NULL. There will be 172ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * a pending exception in the thread and we branch to another stub to deliver it. 1734a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee * 174ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * On success this wrapper will restore arguments and *jump* to the target, leaving the lr 175ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * pointing back to the original caller. 1764a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee */ 177ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogersart_invoke_interface_trampoline: 1784f0d07c783afef89703dce32c94440fc8621a29bIan Rogers SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME @ save callee saves in case allocation triggers GC 1794f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r2, r9 @ pass Thread::Current 1804f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r3, sp @ pass SP 1814f0d07c783afef89703dce32c94440fc8621a29bIan Rogers bl artFindInterfaceMethodInCacheFromCode @ (method_idx, this, Thread*, SP) 1824f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r12, r1 @ save r0->code_ 1834f0d07c783afef89703dce32c94440fc8621a29bIan Rogers RESTORE_REF_AND_ARGS_CALLEE_SAVE_FRAME 1844f0d07c783afef89703dce32c94440fc8621a29bIan Rogers cmp r0, #0 @ did we find the target? 1854f0d07c783afef89703dce32c94440fc8621a29bIan Rogers bxne r12 @ tail call to target if so 186ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers DELIVER_PENDING_EXCEPTION 187ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers 188ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers .global art_handle_fill_data_from_code 189ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers .extern artHandleFillArrayDataFromCode 190ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers /* 191ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * Entry from managed code that calls artHandleFillArrayDataFromCode and delivers exception on 192ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * failure. 193ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers */ 194ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogersart_handle_fill_data_from_code: 1954f0d07c783afef89703dce32c94440fc8621a29bIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case exception allocation triggers GC 1964f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r2, r9 @ pass Thread::Current 1974f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r3, sp @ pass SP 1984f0d07c783afef89703dce32c94440fc8621a29bIan Rogers bl artHandleFillArrayDataFromCode @ (Array* array, const uint16_t* table, Thread*, SP) 1994f0d07c783afef89703dce32c94440fc8621a29bIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME 2004f0d07c783afef89703dce32c94440fc8621a29bIan Rogers cmp r0, #0 @ success? 201ae67599981e17cdfd51418c35e56e2a7c5ef4c72Ian Rogers bxeq lr @ return on success 202ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers DELIVER_PENDING_EXCEPTION 2034f0d07c783afef89703dce32c94440fc8621a29bIan Rogers 2044f0d07c783afef89703dce32c94440fc8621a29bIan Rogers .global art_lock_object_from_code 2054f0d07c783afef89703dce32c94440fc8621a29bIan Rogers .extern artLockObjectFromCode 2064f0d07c783afef89703dce32c94440fc8621a29bIan Rogers /* 2074f0d07c783afef89703dce32c94440fc8621a29bIan Rogers * Entry from managed code that calls artLockObjectFromCode, may block for GC 2084f0d07c783afef89703dce32c94440fc8621a29bIan Rogers */ 2094f0d07c783afef89703dce32c94440fc8621a29bIan Rogersart_lock_object_from_code: 2104f0d07c783afef89703dce32c94440fc8621a29bIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case we block 2114f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r1, r9 @ pass Thread::Current 2124f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r2, sp @ pass SP 2134f0d07c783afef89703dce32c94440fc8621a29bIan Rogers bl artLockObjectFromCode @ (Object* obj, Thread*, SP) 2144f0d07c783afef89703dce32c94440fc8621a29bIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME_AND_RETURN 215ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers 216ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers .global art_unlock_object_from_code 217ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers .extern artUnlockObjectFromCode 218ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers /* 219ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * Entry from managed code that calls artUnlockObjectFromCode and delivers exception on failure. 220ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers */ 221ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogersart_unlock_object_from_code: 2224f0d07c783afef89703dce32c94440fc8621a29bIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case exception allocation triggers GC 2234f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r1, r9 @ pass Thread::Current 2244f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r2, sp @ pass SP 2254f0d07c783afef89703dce32c94440fc8621a29bIan Rogers bl artUnlockObjectFromCode @ (Object* obj, Thread*, SP) 2264f0d07c783afef89703dce32c94440fc8621a29bIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME 2274f0d07c783afef89703dce32c94440fc8621a29bIan Rogers cmp r0, #0 @ success? 228ae67599981e17cdfd51418c35e56e2a7c5ef4c72Ian Rogers bxeq lr @ return on success 229ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers DELIVER_PENDING_EXCEPTION 230ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers 231ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers .global art_check_cast_from_code 232ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers .extern artCheckCastFromCode 233ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers /* 234ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * Entry from managed code that calls artCheckCastFromCode and delivers exception on failure. 235ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers */ 236ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogersart_check_cast_from_code: 2374f0d07c783afef89703dce32c94440fc8621a29bIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case exception allocation triggers GC 2384f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r2, r9 @ pass Thread::Current 2394f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r3, sp @ pass SP 2404f0d07c783afef89703dce32c94440fc8621a29bIan Rogers bl artCheckCastFromCode @ (Class* a, Class* b, Thread*, SP) 2414f0d07c783afef89703dce32c94440fc8621a29bIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME 2424f0d07c783afef89703dce32c94440fc8621a29bIan Rogers cmp r0, #0 @ success? 243ae67599981e17cdfd51418c35e56e2a7c5ef4c72Ian Rogers bxeq lr @ return on success 244ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers DELIVER_PENDING_EXCEPTION 245e51a511ccee3f3c0120807321bcc160fcaa664beIan Rogers 246e51a511ccee3f3c0120807321bcc160fcaa664beIan Rogers .global art_can_put_array_element_from_code 247e51a511ccee3f3c0120807321bcc160fcaa664beIan Rogers .extern artCanPutArrayElementFromCode 248e51a511ccee3f3c0120807321bcc160fcaa664beIan Rogers /* 249e51a511ccee3f3c0120807321bcc160fcaa664beIan Rogers * Entry from managed code that calls artCanPutArrayElementFromCode and delivers exception on 250e51a511ccee3f3c0120807321bcc160fcaa664beIan Rogers * failure. 251e51a511ccee3f3c0120807321bcc160fcaa664beIan Rogers */ 252e51a511ccee3f3c0120807321bcc160fcaa664beIan Rogersart_can_put_array_element_from_code: 2534f0d07c783afef89703dce32c94440fc8621a29bIan Rogers cmp r0, #0 @ return if element == NULL 254ae67599981e17cdfd51418c35e56e2a7c5ef4c72Ian Rogers bxeq lr 2554f0d07c783afef89703dce32c94440fc8621a29bIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case exception allocation triggers GC 2564f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r2, r9 @ pass Thread::Current 2574f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r3, sp @ pass SP 2584f0d07c783afef89703dce32c94440fc8621a29bIan Rogers bl artCanPutArrayElementFromCode @ (Object* element, Class* array_class, Thread*, SP) 2594f0d07c783afef89703dce32c94440fc8621a29bIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME 2604f0d07c783afef89703dce32c94440fc8621a29bIan Rogers cmp r0, #0 @ success? 261ae67599981e17cdfd51418c35e56e2a7c5ef4c72Ian Rogers bxeq lr @ return on success 262ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers DELIVER_PENDING_EXCEPTION 263cbba6ac9bf9a6c630a7aafae6d8767b5ddbb6fd5Ian Rogers 264cbba6ac9bf9a6c630a7aafae6d8767b5ddbb6fd5Ian Rogers .global art_initialize_static_storage_from_code 2654f0d07c783afef89703dce32c94440fc8621a29bIan Rogers .extern artInitializeStaticStorageFromCode 266cbba6ac9bf9a6c630a7aafae6d8767b5ddbb6fd5Ian Rogers /* 267cbba6ac9bf9a6c630a7aafae6d8767b5ddbb6fd5Ian Rogers * Entry from managed code when uninitialized static storage, this stub will run the class 268cbba6ac9bf9a6c630a7aafae6d8767b5ddbb6fd5Ian Rogers * initializer and deliver the exception on error. On success the static storage base is 269cbba6ac9bf9a6c630a7aafae6d8767b5ddbb6fd5Ian Rogers * returned. 270cbba6ac9bf9a6c630a7aafae6d8767b5ddbb6fd5Ian Rogers */ 271cbba6ac9bf9a6c630a7aafae6d8767b5ddbb6fd5Ian Rogersart_initialize_static_storage_from_code: 2724f0d07c783afef89703dce32c94440fc8621a29bIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case of GC 2734f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r2, r9 @ pass Thread::Current 2744f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r3, sp @ pass SP 275aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom @ artInitializeStaticStorageFromCode(uint32_t type_idx, Method* referrer, Thread*, SP) 2764f0d07c783afef89703dce32c94440fc8621a29bIan Rogers bl artInitializeStaticStorageFromCode 2774f0d07c783afef89703dce32c94440fc8621a29bIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME 2784f0d07c783afef89703dce32c94440fc8621a29bIan Rogers cmp r0, #0 @ success if result is non-null 279ae67599981e17cdfd51418c35e56e2a7c5ef4c72Ian Rogers bxne lr @ return on success 280ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers DELIVER_PENDING_EXCEPTION 281ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers 282ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers .global art_find_instance_field_from_code 283ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers .extern artFindInstanceFieldFromCode 284ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers /* 285ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers * Called by managed code to resolve a field of an object 286ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers */ 287ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogersart_find_instance_field_from_code: 288ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case of GC 289ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers mov r2, r9 @ pass Thread::Current 290ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers mov r3, sp @ pass SP 291ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers bl artFindInstanceFieldFromCode @ (uint32_t field_idx, const Method* referrer, Thread*, SP) 292ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME 293ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers cmp r0, #0 @ success if result is non-null 294ae67599981e17cdfd51418c35e56e2a7c5ef4c72Ian Rogers bxne lr @ return on success 295ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers DELIVER_PENDING_EXCEPTION 296ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers 297ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers .global art_get32_static_from_code 298ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers .extern artGet32StaticFromCode 299ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers /* 300ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers * Called by managed code to resolve a static field and load a 32-bit primitive value 301ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers */ 302ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogersart_get32_static_from_code: 303ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case of GC 304ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers mov r2, r9 @ pass Thread::Current 305ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers mov r3, sp @ pass SP 306ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers bl artGet32StaticFromCode @ (uint32_t field_idx, const Method* referrer, Thread*, SP) 307ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers ldr r12, [r9, #THREAD_EXCEPTION_OFFSET] @ load Thread::Current()->exception_ 308ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME 309ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers cmp r12, #0 @ success if no exception is pending 310ae67599981e17cdfd51418c35e56e2a7c5ef4c72Ian Rogers bxeq lr @ return on success 311ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers DELIVER_PENDING_EXCEPTION 312ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers 313ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers .global art_get64_static_from_code 314ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers .extern artGet64StaticFromCode 315ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers /* 316ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers * Called by managed code to resolve a static field and load a 64-bit primitive value 317ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers */ 318ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogersart_get64_static_from_code: 319ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case of GC 320ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers mov r2, r9 @ pass Thread::Current 321ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers mov r3, sp @ pass SP 322ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers bl artGet64StaticFromCode @ (uint32_t field_idx, const Method* referrer, Thread*, SP) 323ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers ldr r12, [r9, #THREAD_EXCEPTION_OFFSET] @ load Thread::Current()->exception_ 324ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME 325ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers cmp r12, #0 @ success if no exception is pending 326ae67599981e17cdfd51418c35e56e2a7c5ef4c72Ian Rogers bxeq lr @ return on success 327ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers DELIVER_PENDING_EXCEPTION 328ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers 329ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers .global art_get_obj_static_from_code 330ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers .extern artGetObjStaticFromCode 331ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers /* 332ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers * Called by managed code to resolve a static field and load an object reference 333ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers */ 334ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogersart_get_obj_static_from_code: 335ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case of GC 336ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers mov r2, r9 @ pass Thread::Current 337ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers mov r3, sp @ pass SP 338ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers bl artGetObjStaticFromCode @ (uint32_t field_idx, const Method* referrer, Thread*, SP) 339ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers ldr r12, [r9, #THREAD_EXCEPTION_OFFSET] @ load Thread::Current()->exception_ 340ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME 341ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers cmp r12, #0 @ success if no exception is pending 342ae67599981e17cdfd51418c35e56e2a7c5ef4c72Ian Rogers bxeq lr @ return on success 343ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers DELIVER_PENDING_EXCEPTION 344ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers 345ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers .global art_set32_static_from_code 346ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers .extern artSet32StaticFromCode 347ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers /* 348ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers * Called by managed code to resolve a static field and store a 32-bit primitive value 349ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers */ 350ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogersart_set32_static_from_code: 351ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case of GC 352ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers mov r3, r9 @ pass Thread::Current 353ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers str sp, [sp, #0] @ pass SP 354ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers bl artSet32StaticFromCode @ (field_idx, referrer, new_val, Thread*, SP) 355ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME 356ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers cmp r0, #0 @ success if result is 0 357ae67599981e17cdfd51418c35e56e2a7c5ef4c72Ian Rogers bxeq lr @ return on success 358ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers DELIVER_PENDING_EXCEPTION 359ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers 360ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers .global art_set64_static_from_code 361ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers .extern artSet32StaticFromCode 362ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers /* 363ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers * Called by managed code to resolve a static field and store a 64-bit primitive value 364ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers */ 365ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogersart_set64_static_from_code: 366ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case of GC 367ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers mov r12, sp @ save SP 368ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers sub sp, #8 @ grow frame for alignment with stack args 369ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers push {r9, r12} @ pass Thread::Current and SP 370ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers bl artSet64StaticFromCode @ (field_idx, referrer, new_val, Thread*, SP) 371ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers add sp, #16 @ release out args 372ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME @ TODO: we can clearly save an add here 373ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers cmp r0, #0 @ success if result is 0 374ae67599981e17cdfd51418c35e56e2a7c5ef4c72Ian Rogers bxeq lr @ return on success 375ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers DELIVER_PENDING_EXCEPTION 376ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers 377ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers .global art_set_obj_static_from_code 378ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers .extern artSetObjStaticFromCode 379ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers /* 380ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers * Called by managed code to resolve a static field and store an object reference 381ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers */ 382ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogersart_set_obj_static_from_code: 383ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case of GC 384ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers mov r3, r9 @ pass Thread::Current 385ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers str sp, [sp, #0] @ pass SP 386ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers bl artSetObjStaticFromCode @ (field_idx, referrer, new_val, Thread*, SP) 387ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME 388ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers cmp r0, #0 @ success if result is 0 389ae67599981e17cdfd51418c35e56e2a7c5ef4c72Ian Rogers bxeq lr @ return on success 390ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers DELIVER_PENDING_EXCEPTION 3914a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee 392aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom .global art_resolve_string_from_code 393aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom .extern artResolveStringFromCode 394aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom /* 395aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom * Entry from managed code to resolve a string, this stub will 396aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom * allocate a String and deliver an exception on error. On 397aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom * success the String is returned. 398aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom */ 3996f495f2898a418f87e2a919e04fe23521bb0b9e9Brian Carlstromart_resolve_string_from_code: 400aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case of GC 401aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom mov r2, r9 @ pass Thread::Current 402aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom mov r3, sp @ pass SP 403aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom @ artResolveStringFromCode(Method* referrer, uint32_t type_idx, Thread*, SP) 404aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom bl artResolveStringFromCode 405aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom RESTORE_REF_ONLY_CALLEE_SAVE_FRAME 406aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom cmp r0, #0 @ success if result is non-null 407aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom bxne lr @ return on success 408aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom DELIVER_PENDING_EXCEPTION 409aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom 41021d9e8323124a832a21679ca83808bc9c68ed365Ian Rogers .global art_alloc_object_from_code 41121d9e8323124a832a21679ca83808bc9c68ed365Ian Rogers .extern artAllocObjectFromCode 41221d9e8323124a832a21679ca83808bc9c68ed365Ian Rogers /* 41321d9e8323124a832a21679ca83808bc9c68ed365Ian Rogers * Called by managed code to allocate an object 41421d9e8323124a832a21679ca83808bc9c68ed365Ian Rogers */ 41521d9e8323124a832a21679ca83808bc9c68ed365Ian Rogersart_alloc_object_from_code: 4164f0d07c783afef89703dce32c94440fc8621a29bIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case of GC 4174f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r2, r9 @ pass Thread::Current 4184f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r3, sp @ pass SP 4194f0d07c783afef89703dce32c94440fc8621a29bIan Rogers bl artAllocObjectFromCode @ (uint32_t type_idx, Method* method, Thread*, SP) 4204f0d07c783afef89703dce32c94440fc8621a29bIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME 4214f0d07c783afef89703dce32c94440fc8621a29bIan Rogers cmp r0, #0 @ success if result is non-null 422ae67599981e17cdfd51418c35e56e2a7c5ef4c72Ian Rogers bxne lr @ return on success 423ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers DELIVER_PENDING_EXCEPTION 42421d9e8323124a832a21679ca83808bc9c68ed365Ian Rogers 425b408de744566a5c5a80be1ba7f5c88407e816945Elliott Hughes .global art_alloc_array_from_code 426b408de744566a5c5a80be1ba7f5c88407e816945Elliott Hughes .extern artAllocArrayFromCode 427b886da8e3c26443ab4d2aa63268bd673c354c3d2Ian Rogers /* 428b886da8e3c26443ab4d2aa63268bd673c354c3d2Ian Rogers * Called by managed code to allocate an array 429b886da8e3c26443ab4d2aa63268bd673c354c3d2Ian Rogers */ 430b408de744566a5c5a80be1ba7f5c88407e816945Elliott Hughesart_alloc_array_from_code: 4314f0d07c783afef89703dce32c94440fc8621a29bIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case of GC 4324f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r3, r9 @ pass Thread::Current 4334f0d07c783afef89703dce32c94440fc8621a29bIan Rogers str sp, [sp, #0] @ pass SP 4344f0d07c783afef89703dce32c94440fc8621a29bIan Rogers @ artAllocArrayFromCode(uint32_t type_idx, Method* method, int32_t component_count, Thread*, SP) 4354f0d07c783afef89703dce32c94440fc8621a29bIan Rogers bl artAllocArrayFromCode 4364f0d07c783afef89703dce32c94440fc8621a29bIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME 4374f0d07c783afef89703dce32c94440fc8621a29bIan Rogers cmp r0, #0 @ success if result is non-null 438ae67599981e17cdfd51418c35e56e2a7c5ef4c72Ian Rogers bxne lr @ return on success 439ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers DELIVER_PENDING_EXCEPTION 440b886da8e3c26443ab4d2aa63268bd673c354c3d2Ian Rogers 441b408de744566a5c5a80be1ba7f5c88407e816945Elliott Hughes .global art_check_and_alloc_array_from_code 442b408de744566a5c5a80be1ba7f5c88407e816945Elliott Hughes .extern artCheckAndAllocArrayFromCode 443b886da8e3c26443ab4d2aa63268bd673c354c3d2Ian Rogers /* 444b886da8e3c26443ab4d2aa63268bd673c354c3d2Ian Rogers * Called by managed code to allocate an array 445b886da8e3c26443ab4d2aa63268bd673c354c3d2Ian Rogers */ 446b408de744566a5c5a80be1ba7f5c88407e816945Elliott Hughesart_check_and_alloc_array_from_code: 4474f0d07c783afef89703dce32c94440fc8621a29bIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case of GC 4484f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r3, r9 @ pass Thread::Current 4494f0d07c783afef89703dce32c94440fc8621a29bIan Rogers str sp, [sp, #0] @ pass SP 4504f0d07c783afef89703dce32c94440fc8621a29bIan Rogers @ artCheckAndAllocArrayFromCode(uint32_t type_idx, Method* method, int32_t count, Thread* , SP) 4514f0d07c783afef89703dce32c94440fc8621a29bIan Rogers bl artCheckAndAllocArrayFromCode 4524f0d07c783afef89703dce32c94440fc8621a29bIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME 453ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers cmp r0, #0 @ success if result is non-null 454ae67599981e17cdfd51418c35e56e2a7c5ef4c72Ian Rogers bxne lr @ return on success 455ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers DELIVER_PENDING_EXCEPTION 456b886da8e3c26443ab4d2aa63268bd673c354c3d2Ian Rogers 4574f0d07c783afef89703dce32c94440fc8621a29bIan Rogers .global art_test_suspend 4584a510d8750d50b77353d0a5a891d1b9b3a48ecd5Ian Rogers .extern artTestSuspendFromCode 459dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers /* 460dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers * Called by managed code when the value in rSUSPEND has been decremented to 0 461dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers */ 4624f0d07c783afef89703dce32c94440fc8621a29bIan Rogersart_test_suspend: 4634f0d07c783afef89703dce32c94440fc8621a29bIan Rogers ldr r0, [rSELF, #THREAD_SUSPEND_COUNT_OFFSET] 4644f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov rSUSPEND, #SUSPEND_CHECK_INTERVAL @ reset rSUSPEND to SUSPEND_CHECK_INTERVAL 4654f0d07c783afef89703dce32c94440fc8621a29bIan Rogers cmp r0, #0 @ check Thread::Current()->suspend_count_ == 0 4664f0d07c783afef89703dce32c94440fc8621a29bIan Rogers bxeq rLR @ return if suspend_count_ == 0 4674f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r0, rSELF 4684f0d07c783afef89703dce32c94440fc8621a29bIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves for stack crawl 469c10717a0b86d5719556ac3286fcb47aa2f2416fcbuzbee mov r1, sp 4704a510d8750d50b77353d0a5a891d1b9b3a48ecd5Ian Rogers bl artTestSuspendFromCode @ (Thread*, SP) 4714f0d07c783afef89703dce32c94440fc8621a29bIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME_AND_RETURN 4724f0d07c783afef89703dce32c94440fc8621a29bIan Rogers 473dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers .global art_proxy_invoke_handler 474dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers .extern artProxyInvokeHandler 475dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers /* 476dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers * Called by managed code that is attempting to call a method on a proxy class. On entry 477dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers * r0 holds the proxy method; r1, r2 and r3 may contain arguments 478dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers */ 479dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogersart_proxy_invoke_handler: 480dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME 481dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers str r0, [sp, #0] @ place proxy method at bottom of frame 482dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers mov r2, r9 @ pass Thread::Current 483dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers add r3, sp, #12 @ pointer to r2/r3/LR/caller's Method**/out-args as second arg 484dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers blx artProxyInvokeHandler @ (Method* proxy method, receiver, Thread*, args...) 485dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers ldr r12, [r9, #THREAD_EXCEPTION_OFFSET] @ load Thread::Current()->exception_ 486dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers ldrd r0, [sp, #12] @ load r0/r1 from r2/r3 that were overwritten with the out args 487dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers RESTORE_REF_AND_ARGS_CALLEE_SAVE_FRAME 488dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers cmp r12, #0 @ success if no exception is pending 489dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers bxeq lr @ return on success 490dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers DELIVER_PENDING_EXCEPTION 491dfcdf1a0d2d8d75b4c701317e4a092498a8d1e9eIan Rogers 4925433072f589b61413e042eddf76e8190a048f71dbuzbee .global art_shl_long 4935433072f589b61413e042eddf76e8190a048f71dbuzbeeart_shl_long: 4945433072f589b61413e042eddf76e8190a048f71dbuzbee /* 4955433072f589b61413e042eddf76e8190a048f71dbuzbee * Long integer shift. This is different from the generic 32/64-bit 4965433072f589b61413e042eddf76e8190a048f71dbuzbee * binary operations because vAA/vBB are 64-bit but vCC (the shift 4975433072f589b61413e042eddf76e8190a048f71dbuzbee * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low 4985433072f589b61413e042eddf76e8190a048f71dbuzbee * 6 bits. 4995433072f589b61413e042eddf76e8190a048f71dbuzbee * On entry: 5005433072f589b61413e042eddf76e8190a048f71dbuzbee * r0: low word 5015433072f589b61413e042eddf76e8190a048f71dbuzbee * r1: high word 5025433072f589b61413e042eddf76e8190a048f71dbuzbee * r2: shift count 5035433072f589b61413e042eddf76e8190a048f71dbuzbee */ 5045433072f589b61413e042eddf76e8190a048f71dbuzbee /* shl-long vAA, vBB, vCC */ 5055433072f589b61413e042eddf76e8190a048f71dbuzbee and r2, r2, #63 @ r2<- r2 & 0x3f 5065433072f589b61413e042eddf76e8190a048f71dbuzbee mov r1, r1, asl r2 @ r1<- r1 << r2 5075433072f589b61413e042eddf76e8190a048f71dbuzbee rsb r3, r2, #32 @ r3<- 32 - r2 5085433072f589b61413e042eddf76e8190a048f71dbuzbee orr r1, r1, r0, lsr r3 @ r1<- r1 | (r0 << (32-r2)) 5095433072f589b61413e042eddf76e8190a048f71dbuzbee subs ip, r2, #32 @ ip<- r2 - 32 5105433072f589b61413e042eddf76e8190a048f71dbuzbee movpl r1, r0, asl ip @ if r2 >= 32, r1<- r0 << (r2-32) 5115433072f589b61413e042eddf76e8190a048f71dbuzbee mov r0, r0, asl r2 @ r0<- r0 << r2 5125433072f589b61413e042eddf76e8190a048f71dbuzbee bx lr 5135433072f589b61413e042eddf76e8190a048f71dbuzbee 5145433072f589b61413e042eddf76e8190a048f71dbuzbee .balign 4 5155433072f589b61413e042eddf76e8190a048f71dbuzbee .global art_shr_long 5165433072f589b61413e042eddf76e8190a048f71dbuzbeeart_shr_long: 5175433072f589b61413e042eddf76e8190a048f71dbuzbee /* 5185433072f589b61413e042eddf76e8190a048f71dbuzbee * Long integer shift. This is different from the generic 32/64-bit 5195433072f589b61413e042eddf76e8190a048f71dbuzbee * binary operations because vAA/vBB are 64-bit but vCC (the shift 5205433072f589b61413e042eddf76e8190a048f71dbuzbee * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low 5215433072f589b61413e042eddf76e8190a048f71dbuzbee * 6 bits. 5225433072f589b61413e042eddf76e8190a048f71dbuzbee * On entry: 5235433072f589b61413e042eddf76e8190a048f71dbuzbee * r0: low word 5245433072f589b61413e042eddf76e8190a048f71dbuzbee * r1: high word 5255433072f589b61413e042eddf76e8190a048f71dbuzbee * r2: shift count 5265433072f589b61413e042eddf76e8190a048f71dbuzbee */ 5275433072f589b61413e042eddf76e8190a048f71dbuzbee /* shr-long vAA, vBB, vCC */ 5285433072f589b61413e042eddf76e8190a048f71dbuzbee and r2, r2, #63 @ r0<- r0 & 0x3f 5295433072f589b61413e042eddf76e8190a048f71dbuzbee mov r0, r0, lsr r2 @ r0<- r2 >> r2 5305433072f589b61413e042eddf76e8190a048f71dbuzbee rsb r3, r2, #32 @ r3<- 32 - r2 5315433072f589b61413e042eddf76e8190a048f71dbuzbee orr r0, r0, r1, asl r3 @ r0<- r0 | (r1 << (32-r2)) 5325433072f589b61413e042eddf76e8190a048f71dbuzbee subs ip, r2, #32 @ ip<- r2 - 32 5335433072f589b61413e042eddf76e8190a048f71dbuzbee movpl r0, r1, asr ip @ if r2 >= 32, r0<-r1 >> (r2-32) 5345433072f589b61413e042eddf76e8190a048f71dbuzbee mov r1, r1, asr r2 @ r1<- r1 >> r2 5355433072f589b61413e042eddf76e8190a048f71dbuzbee bx lr 5365433072f589b61413e042eddf76e8190a048f71dbuzbee 5375433072f589b61413e042eddf76e8190a048f71dbuzbee .balign 4 5385433072f589b61413e042eddf76e8190a048f71dbuzbee .global art_ushr_long 5395433072f589b61413e042eddf76e8190a048f71dbuzbeeart_ushr_long: 5405433072f589b61413e042eddf76e8190a048f71dbuzbee /* 5415433072f589b61413e042eddf76e8190a048f71dbuzbee * Long integer shift. This is different from the generic 32/64-bit 5425433072f589b61413e042eddf76e8190a048f71dbuzbee * binary operations because vAA/vBB are 64-bit but vCC (the shift 5435433072f589b61413e042eddf76e8190a048f71dbuzbee * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low 5445433072f589b61413e042eddf76e8190a048f71dbuzbee * 6 bits. 5455433072f589b61413e042eddf76e8190a048f71dbuzbee * On entry: 5465433072f589b61413e042eddf76e8190a048f71dbuzbee * r0: low word 5475433072f589b61413e042eddf76e8190a048f71dbuzbee * r1: high word 5485433072f589b61413e042eddf76e8190a048f71dbuzbee * r2: shift count 5495433072f589b61413e042eddf76e8190a048f71dbuzbee */ 5505433072f589b61413e042eddf76e8190a048f71dbuzbee /* ushr-long vAA, vBB, vCC */ 5515433072f589b61413e042eddf76e8190a048f71dbuzbee and r2, r2, #63 @ r0<- r0 & 0x3f 5525433072f589b61413e042eddf76e8190a048f71dbuzbee mov r0, r0, lsr r2 @ r0<- r2 >> r2 5535433072f589b61413e042eddf76e8190a048f71dbuzbee rsb r3, r2, #32 @ r3<- 32 - r2 5545433072f589b61413e042eddf76e8190a048f71dbuzbee orr r0, r0, r1, asl r3 @ r0<- r0 | (r1 << (32-r2)) 5555433072f589b61413e042eddf76e8190a048f71dbuzbee subs ip, r2, #32 @ ip<- r2 - 32 5565433072f589b61413e042eddf76e8190a048f71dbuzbee movpl r0, r1, lsr ip @ if r2 >= 32, r0<-r1 >>> (r2-32) 5575433072f589b61413e042eddf76e8190a048f71dbuzbee mov r1, r1, lsr r2 @ r1<- r1 >>> r2 5585433072f589b61413e042eddf76e8190a048f71dbuzbee bx lr 5595433072f589b61413e042eddf76e8190a048f71dbuzbee 5605433072f589b61413e042eddf76e8190a048f71dbuzbee#endif 56167375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers 56267375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers#if defined(__i386__) 56367375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers 564ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers .global art_deliver_exception_from_code 565ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers .extern artDeliverExceptionFromCode 56667375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers /* 567ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * Called by managed code, saves callee saves and then calls artThrowException 56867375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers * that will place a mock Method* at the bottom of the stack. 56967375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers * EAX holds the exception. 57067375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers */ 571ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogersart_deliver_exception_from_code: 57267375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers // Create frame 57367375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers pushl %edi // Save callee saves 57467375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers pushl %esi 57567375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers pushl %ebp 57667375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers pushl %ebx 57767375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers pushl $0 57867375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers pushl $0 57967375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers pushl $0 // Will be clobbered to be Method* 58067375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers mov %esp, %ecx 58167375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers // Outgoing argument set up 582ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers pushl $0 // Alignment padding 583ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers pushl %ecx // pass SP 584ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers pushl %fs:THREAD_SELF_OFFSET // pass fs:offsetof(Thread,self_) 585ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers pushl %eax // pass Throwable* 586ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers call artDeliverExceptionFromCode // artDeliverExceptionFromCode(Throwable*, Thread*, SP) 58767375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers int3 58867375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers 58967375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers#endif 590