quick_entrypoints_arm.S revision aded5f7ab991f3c1132851599d3bc60ff6707eed
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 244f0d07c783afef89703dce32c94440fc8621a29bIan Rogers * Runtime::CreateCalleeSaveMethod(kRefsOnly) 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 324f0d07c783afef89703dce32c94440fc8621a29bIan Rogers add sp, #4 334f0d07c783afef89703dce32c94440fc8621a29bIan Rogers pop {r5-r8, r10-r11, lr} @ 7 words of callee saves 344f0d07c783afef89703dce32c94440fc8621a29bIan Rogers.endm 354f0d07c783afef89703dce32c94440fc8621a29bIan Rogers 364f0d07c783afef89703dce32c94440fc8621a29bIan Rogers.macro RESTORE_REF_ONLY_CALLEE_SAVE_FRAME_AND_RETURN 374f0d07c783afef89703dce32c94440fc8621a29bIan Rogers add sp, #4 384f0d07c783afef89703dce32c94440fc8621a29bIan Rogers pop {r5-r8, r10-r11, pc} @ 7 words of callee saves 394f0d07c783afef89703dce32c94440fc8621a29bIan Rogers.endm 404f0d07c783afef89703dce32c94440fc8621a29bIan Rogers 414f0d07c783afef89703dce32c94440fc8621a29bIan Rogers /* 424f0d07c783afef89703dce32c94440fc8621a29bIan Rogers * Macro that sets up the callee save frame to conform with 434f0d07c783afef89703dce32c94440fc8621a29bIan Rogers * Runtime::CreateCalleeSaveMethod(kRefsAndArgs) 444f0d07c783afef89703dce32c94440fc8621a29bIan Rogers */ 454f0d07c783afef89703dce32c94440fc8621a29bIan Rogers.macro SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME 464f0d07c783afef89703dce32c94440fc8621a29bIan Rogers push {r1-r3, r5-r8, r10-r11, lr} @ 10 words of callee saves 474f0d07c783afef89703dce32c94440fc8621a29bIan Rogers sub sp, #8 @ 2 words of space, bottom word will hold Method* 484f0d07c783afef89703dce32c94440fc8621a29bIan Rogers.endm 494f0d07c783afef89703dce32c94440fc8621a29bIan Rogers 504f0d07c783afef89703dce32c94440fc8621a29bIan Rogers.macro RESTORE_REF_AND_ARGS_CALLEE_SAVE_FRAME 514f0d07c783afef89703dce32c94440fc8621a29bIan Rogers add sp, #8 524f0d07c783afef89703dce32c94440fc8621a29bIan Rogers pop {r1-r3, r5-r8, r10-r11, lr} @ 10 words of callee saves 5315fdb8cfb5b2e3fc882113ec0648d492cebf852cIan Rogers.endm 5415fdb8cfb5b2e3fc882113ec0648d492cebf852cIan Rogers 55ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers /* 56ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers * Macro that set calls through to artDeliverPendingExceptionFromCode, where the pending 57ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers * exception is Thread::Current()->exception_ 58ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers */ 59ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers.macro DELIVER_PENDING_EXCEPTION 60ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers SETUP_CALLEE_SAVE_FRAME @ save callee saves for throw 61ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers mov r0, r9 @ pass Thread::Current 62ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers mov r1, sp @ pass SP 63ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers b artDeliverPendingExceptionFromCode @ artDeliverPendingExceptionFromCode(Thread*, SP) 64ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers.endm 65ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers 66ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers .global art_deliver_exception_from_code 67bdb0391258abc54bf77c676e36847d28a783bfe5Ian Rogers /* 68ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * Called by managed code, saves mosts registers (forms basis of long jump context) and passes 69ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * the bottom of the stack. artDeliverExceptionFromCode will place the callee save Method* at 70ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * the bottom of the thread. On entry r0 holds Throwable* 71bdb0391258abc54bf77c676e36847d28a783bfe5Ian Rogers */ 72ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogersart_deliver_exception_from_code: 7315fdb8cfb5b2e3fc882113ec0648d492cebf852cIan Rogers SETUP_CALLEE_SAVE_FRAME 74ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers mov r1, r9 @ pass Thread::Current 75ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers mov r2, sp @ pass SP 76ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers b artDeliverExceptionFromCode @ artDeliverExceptionFromCode(Throwable*, Thread*, SP) 779651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers 789651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers .global art_throw_null_pointer_exception_from_code 79ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers .extern artThrowNullPointerExceptionFromCode 809651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers /* 81ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * Called by managed code to create and deliver a NullPointerException 829651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers */ 839651f425f7413772a7b5352da2b04eb7de7d416fIan Rogersart_throw_null_pointer_exception_from_code: 8415fdb8cfb5b2e3fc882113ec0648d492cebf852cIan Rogers SETUP_CALLEE_SAVE_FRAME 85ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers mov r0, r9 @ pass Thread::Current 86ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers mov r1, sp @ pass SP 87ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers b artThrowNullPointerExceptionFromCode @ artThrowNullPointerExceptionFromCode(Thread*, SP) 889651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers 899651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers .global art_throw_div_zero_from_code 90ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers .extern artThrowDivZeroFromCode 919651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers /* 92ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * Called by managed code to create and deliver an ArithmeticException 939651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers */ 949651f425f7413772a7b5352da2b04eb7de7d416fIan Rogersart_throw_div_zero_from_code: 9515fdb8cfb5b2e3fc882113ec0648d492cebf852cIan Rogers SETUP_CALLEE_SAVE_FRAME 96ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers mov r0, r9 @ pass Thread::Current 97ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers mov r1, sp @ pass SP 98ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers b artThrowDivZeroFromCode @ artThrowDivZeroFromCode(Thread*, SP) 999651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers 1009651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers .global art_throw_array_bounds_from_code 101ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers .extern artThrowArrayBoundsFromCode 1029651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers /* 103ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * Called by managed code to create and deliver an ArrayIndexOutOfBoundsException 1049651f425f7413772a7b5352da2b04eb7de7d416fIan Rogers */ 1059651f425f7413772a7b5352da2b04eb7de7d416fIan Rogersart_throw_array_bounds_from_code: 10615fdb8cfb5b2e3fc882113ec0648d492cebf852cIan Rogers SETUP_CALLEE_SAVE_FRAME 107ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers mov r2, r9 @ pass Thread::Current 108ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers mov r3, sp @ pass SP 109ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers b artThrowArrayBoundsFromCode @ artThrowArrayBoundsFromCode(index, limit, Thread*, SP) 110bdb0391258abc54bf77c676e36847d28a783bfe5Ian Rogers 111932746a4f22951abcba7b7c4c94c27b1bf164272Ian Rogers .global art_throw_stack_overflow_from_code 112932746a4f22951abcba7b7c4c94c27b1bf164272Ian Rogers .extern artThrowStackOverflowFromCode 113932746a4f22951abcba7b7c4c94c27b1bf164272Ian Rogersart_throw_stack_overflow_from_code: 11415fdb8cfb5b2e3fc882113ec0648d492cebf852cIan Rogers SETUP_CALLEE_SAVE_FRAME 115932746a4f22951abcba7b7c4c94c27b1bf164272Ian Rogers mov r1, r9 @ pass Thread::Current 116932746a4f22951abcba7b7c4c94c27b1bf164272Ian Rogers mov r2, sp @ pass SP 117932746a4f22951abcba7b7c4c94c27b1bf164272Ian Rogers b artThrowStackOverflowFromCode @ artThrowStackOverflowFromCode(method, Thread*, SP) 118932746a4f22951abcba7b7c4c94c27b1bf164272Ian Rogers 119c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers .global art_throw_neg_array_size_from_code 120c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers .extern artThrowNegArraySizeFromCode 121c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogersart_throw_neg_array_size_from_code: 12215fdb8cfb5b2e3fc882113ec0648d492cebf852cIan Rogers SETUP_CALLEE_SAVE_FRAME 123c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers mov r1, r9 @ pass Thread::Current 124c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers mov r2, sp @ pass SP 125c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers b artThrowNegArraySizeFromCode @ artThrowNegArraySizeFromCode(size, Thread*, SP) 126c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers 127c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers .global art_throw_no_such_method_from_code 128c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers .extern artThrowNoSuchMethodFromCode 129c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogersart_throw_no_such_method_from_code: 13015fdb8cfb5b2e3fc882113ec0648d492cebf852cIan Rogers SETUP_CALLEE_SAVE_FRAME 131c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers mov r1, r9 @ pass Thread::Current 132c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers mov r2, sp @ pass SP 133c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers b artThrowNoSuchMethodFromCode @ artThrowNoSuchMethodFromCode(method_idx, Thread*, SP) 134c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers 135c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers .global art_throw_verification_error_from_code 136c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers .extern artThrowVerificationErrorFromCode 137c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogersart_throw_verification_error_from_code: 13815fdb8cfb5b2e3fc882113ec0648d492cebf852cIan Rogers SETUP_CALLEE_SAVE_FRAME 139c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers mov r2, r9 @ pass Thread::Current 140c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers mov r3, sp @ pass SP 1416c8867daab4af4667e0e816f6beafa7c5d13e043Elliott Hughes b artThrowVerificationErrorFromCode @ artThrowVerificationErrorFromCode(kind, ref, Thread*, SP) 142c0c8dc8e677957d167066a2d06973126f108a6aaIan Rogers 1434a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee .global art_invoke_interface_trampoline 144ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers .extern artFindInterfaceMethodInCacheFromCode 1454a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee /* 146ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * All generated callsites for interface invokes will load arguments as usual - except instead 147ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * of loading arg0/r0 with the target Method*, arg0/r0 will contain the method_idx. This 148ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * wrapper will save arg1-arg3, load the caller's Method*, align the stack and call the helper 149ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * artFindInterfaceMethodInCacheFromCode(idx, this, method); 150ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * NOTE: "this" is first visable argument of the target, and so can be found in arg1/r1. 1514a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee * 152ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * artFindInterfaceMethodInCacheFromCode will attempt to locate the target and return a 64-bit 153ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * result in r0/r1 consisting of the target Method* in r0 and method->code_ in r1. 1544a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee * 155ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * If unsuccessful, artFindInterfaceMethodInCacheFromCode will return NULL/NULL. There will be 156ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * a pending exception in the thread and we branch to another stub to deliver it. 1574a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee * 158ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * On success this wrapper will restore arguments and *jump* to the target, leaving the lr 159ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * pointing back to the original caller. 1604a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee */ 161ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogersart_invoke_interface_trampoline: 1624f0d07c783afef89703dce32c94440fc8621a29bIan Rogers SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME @ save callee saves in case allocation triggers GC 1634f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r2, r9 @ pass Thread::Current 1644f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r3, sp @ pass SP 1654f0d07c783afef89703dce32c94440fc8621a29bIan Rogers bl artFindInterfaceMethodInCacheFromCode @ (method_idx, this, Thread*, SP) 1664f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r12, r1 @ save r0->code_ 1674f0d07c783afef89703dce32c94440fc8621a29bIan Rogers RESTORE_REF_AND_ARGS_CALLEE_SAVE_FRAME 1684f0d07c783afef89703dce32c94440fc8621a29bIan Rogers cmp r0, #0 @ did we find the target? 1694f0d07c783afef89703dce32c94440fc8621a29bIan Rogers bxne r12 @ tail call to target if so 170ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers DELIVER_PENDING_EXCEPTION 171ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers 172ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers .global art_handle_fill_data_from_code 173ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers .extern artHandleFillArrayDataFromCode 174ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers /* 175ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * Entry from managed code that calls artHandleFillArrayDataFromCode and delivers exception on 176ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * failure. 177ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers */ 178ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogersart_handle_fill_data_from_code: 1794f0d07c783afef89703dce32c94440fc8621a29bIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case exception allocation triggers GC 1804f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r2, r9 @ pass Thread::Current 1814f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r3, sp @ pass SP 1824f0d07c783afef89703dce32c94440fc8621a29bIan Rogers bl artHandleFillArrayDataFromCode @ (Array* array, const uint16_t* table, Thread*, SP) 1834f0d07c783afef89703dce32c94440fc8621a29bIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME 1844f0d07c783afef89703dce32c94440fc8621a29bIan Rogers cmp r0, #0 @ success? 185ae67599981e17cdfd51418c35e56e2a7c5ef4c72Ian Rogers bxeq lr @ return on success 186ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers DELIVER_PENDING_EXCEPTION 1874f0d07c783afef89703dce32c94440fc8621a29bIan Rogers 1884f0d07c783afef89703dce32c94440fc8621a29bIan Rogers .global art_lock_object_from_code 1894f0d07c783afef89703dce32c94440fc8621a29bIan Rogers .extern artLockObjectFromCode 1904f0d07c783afef89703dce32c94440fc8621a29bIan Rogers /* 1914f0d07c783afef89703dce32c94440fc8621a29bIan Rogers * Entry from managed code that calls artLockObjectFromCode, may block for GC 1924f0d07c783afef89703dce32c94440fc8621a29bIan Rogers */ 1934f0d07c783afef89703dce32c94440fc8621a29bIan Rogersart_lock_object_from_code: 1944f0d07c783afef89703dce32c94440fc8621a29bIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case we block 1954f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r1, r9 @ pass Thread::Current 1964f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r2, sp @ pass SP 1974f0d07c783afef89703dce32c94440fc8621a29bIan Rogers bl artLockObjectFromCode @ (Object* obj, Thread*, SP) 1984f0d07c783afef89703dce32c94440fc8621a29bIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME_AND_RETURN 199ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers 200ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers .global art_unlock_object_from_code 201ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers .extern artUnlockObjectFromCode 202ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers /* 203ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * Entry from managed code that calls artUnlockObjectFromCode and delivers exception on failure. 204ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers */ 205ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogersart_unlock_object_from_code: 2064f0d07c783afef89703dce32c94440fc8621a29bIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case exception allocation triggers GC 2074f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r1, r9 @ pass Thread::Current 2084f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r2, sp @ pass SP 2094f0d07c783afef89703dce32c94440fc8621a29bIan Rogers bl artUnlockObjectFromCode @ (Object* obj, Thread*, SP) 2104f0d07c783afef89703dce32c94440fc8621a29bIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME 2114f0d07c783afef89703dce32c94440fc8621a29bIan Rogers cmp r0, #0 @ success? 212ae67599981e17cdfd51418c35e56e2a7c5ef4c72Ian Rogers bxeq lr @ return on success 213ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers DELIVER_PENDING_EXCEPTION 214ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers 215ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers .global art_check_cast_from_code 216ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers .extern artCheckCastFromCode 217ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers /* 218ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * Entry from managed code that calls artCheckCastFromCode and delivers exception on failure. 219ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers */ 220ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogersart_check_cast_from_code: 2214f0d07c783afef89703dce32c94440fc8621a29bIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case exception allocation triggers GC 2224f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r2, r9 @ pass Thread::Current 2234f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r3, sp @ pass SP 2244f0d07c783afef89703dce32c94440fc8621a29bIan Rogers bl artCheckCastFromCode @ (Class* a, Class* b, Thread*, SP) 2254f0d07c783afef89703dce32c94440fc8621a29bIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME 2264f0d07c783afef89703dce32c94440fc8621a29bIan Rogers cmp r0, #0 @ success? 227ae67599981e17cdfd51418c35e56e2a7c5ef4c72Ian Rogers bxeq lr @ return on success 228ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers DELIVER_PENDING_EXCEPTION 229e51a511ccee3f3c0120807321bcc160fcaa664beIan Rogers 230e51a511ccee3f3c0120807321bcc160fcaa664beIan Rogers .global art_can_put_array_element_from_code 231e51a511ccee3f3c0120807321bcc160fcaa664beIan Rogers .extern artCanPutArrayElementFromCode 232e51a511ccee3f3c0120807321bcc160fcaa664beIan Rogers /* 233e51a511ccee3f3c0120807321bcc160fcaa664beIan Rogers * Entry from managed code that calls artCanPutArrayElementFromCode and delivers exception on 234e51a511ccee3f3c0120807321bcc160fcaa664beIan Rogers * failure. 235e51a511ccee3f3c0120807321bcc160fcaa664beIan Rogers */ 236e51a511ccee3f3c0120807321bcc160fcaa664beIan Rogersart_can_put_array_element_from_code: 2374f0d07c783afef89703dce32c94440fc8621a29bIan Rogers cmp r0, #0 @ return if element == NULL 238ae67599981e17cdfd51418c35e56e2a7c5ef4c72Ian Rogers bxeq lr 2394f0d07c783afef89703dce32c94440fc8621a29bIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case exception allocation triggers GC 2404f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r2, r9 @ pass Thread::Current 2414f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r3, sp @ pass SP 2424f0d07c783afef89703dce32c94440fc8621a29bIan Rogers bl artCanPutArrayElementFromCode @ (Object* element, Class* array_class, Thread*, SP) 2434f0d07c783afef89703dce32c94440fc8621a29bIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME 2444f0d07c783afef89703dce32c94440fc8621a29bIan Rogers cmp r0, #0 @ success? 245ae67599981e17cdfd51418c35e56e2a7c5ef4c72Ian Rogers bxeq lr @ return on success 246ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers DELIVER_PENDING_EXCEPTION 247cbba6ac9bf9a6c630a7aafae6d8767b5ddbb6fd5Ian Rogers 248cbba6ac9bf9a6c630a7aafae6d8767b5ddbb6fd5Ian Rogers .global art_initialize_static_storage_from_code 2494f0d07c783afef89703dce32c94440fc8621a29bIan Rogers .extern artInitializeStaticStorageFromCode 250cbba6ac9bf9a6c630a7aafae6d8767b5ddbb6fd5Ian Rogers /* 251cbba6ac9bf9a6c630a7aafae6d8767b5ddbb6fd5Ian Rogers * Entry from managed code when uninitialized static storage, this stub will run the class 252cbba6ac9bf9a6c630a7aafae6d8767b5ddbb6fd5Ian Rogers * initializer and deliver the exception on error. On success the static storage base is 253cbba6ac9bf9a6c630a7aafae6d8767b5ddbb6fd5Ian Rogers * returned. 254cbba6ac9bf9a6c630a7aafae6d8767b5ddbb6fd5Ian Rogers */ 255cbba6ac9bf9a6c630a7aafae6d8767b5ddbb6fd5Ian Rogersart_initialize_static_storage_from_code: 2564f0d07c783afef89703dce32c94440fc8621a29bIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case of GC 2574f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r2, r9 @ pass Thread::Current 2584f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r3, sp @ pass SP 259aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom @ artInitializeStaticStorageFromCode(uint32_t type_idx, Method* referrer, Thread*, SP) 2604f0d07c783afef89703dce32c94440fc8621a29bIan Rogers bl artInitializeStaticStorageFromCode 2614f0d07c783afef89703dce32c94440fc8621a29bIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME 2624f0d07c783afef89703dce32c94440fc8621a29bIan Rogers cmp r0, #0 @ success if result is non-null 263ae67599981e17cdfd51418c35e56e2a7c5ef4c72Ian Rogers bxne lr @ return on success 264ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers DELIVER_PENDING_EXCEPTION 265ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers 266ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers .global art_find_instance_field_from_code 267ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers .extern artFindInstanceFieldFromCode 268ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers /* 269ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers * Called by managed code to resolve a field of an object 270ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers */ 271ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogersart_find_instance_field_from_code: 272ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case of GC 273ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers mov r2, r9 @ pass Thread::Current 274ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers mov r3, sp @ pass SP 275ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers bl artFindInstanceFieldFromCode @ (uint32_t field_idx, const Method* referrer, Thread*, SP) 276ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME 277ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers cmp r0, #0 @ success if result is non-null 278ae67599981e17cdfd51418c35e56e2a7c5ef4c72Ian Rogers bxne lr @ return on success 279ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers DELIVER_PENDING_EXCEPTION 280ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers 281ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers .global art_get32_static_from_code 282ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers .extern artGet32StaticFromCode 283ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers /* 284ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers * Called by managed code to resolve a static field and load a 32-bit primitive value 285ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers */ 286ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogersart_get32_static_from_code: 287ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case of GC 288ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers mov r2, r9 @ pass Thread::Current 289ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers mov r3, sp @ pass SP 290ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers bl artGet32StaticFromCode @ (uint32_t field_idx, const Method* referrer, Thread*, SP) 291ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers ldr r12, [r9, #THREAD_EXCEPTION_OFFSET] @ load Thread::Current()->exception_ 292ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME 293ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers cmp r12, #0 @ success if no exception is pending 294ae67599981e17cdfd51418c35e56e2a7c5ef4c72Ian Rogers bxeq lr @ return on success 295ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers DELIVER_PENDING_EXCEPTION 296ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers 297ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers .global art_get64_static_from_code 298ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers .extern artGet64StaticFromCode 299ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers /* 300ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers * Called by managed code to resolve a static field and load a 64-bit primitive value 301ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers */ 302ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogersart_get64_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 artGet64StaticFromCode @ (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_get_obj_static_from_code 314ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers .extern artGetObjStaticFromCode 315ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers /* 316ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers * Called by managed code to resolve a static field and load an object reference 317ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers */ 318ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogersart_get_obj_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 artGetObjStaticFromCode @ (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_set32_static_from_code 330ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers .extern artSet32StaticFromCode 331ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers /* 332ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers * Called by managed code to resolve a static field and store a 32-bit primitive value 333ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers */ 334ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogersart_set32_static_from_code: 335ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case of GC 336ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers mov r3, r9 @ pass Thread::Current 337ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers str sp, [sp, #0] @ pass SP 338ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers bl artSet32StaticFromCode @ (field_idx, referrer, new_val, Thread*, SP) 339ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME 340ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers cmp r0, #0 @ success if result is 0 341ae67599981e17cdfd51418c35e56e2a7c5ef4c72Ian Rogers bxeq lr @ return on success 342ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers DELIVER_PENDING_EXCEPTION 343ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers 344ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers .global art_set64_static_from_code 345ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers .extern artSet32StaticFromCode 346ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers /* 347ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers * Called by managed code to resolve a static field and store a 64-bit primitive value 348ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers */ 349ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogersart_set64_static_from_code: 350ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case of GC 351ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers mov r12, sp @ save SP 352ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers sub sp, #8 @ grow frame for alignment with stack args 353ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers push {r9, r12} @ pass Thread::Current and SP 354ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers bl artSet64StaticFromCode @ (field_idx, referrer, new_val, Thread*, SP) 355ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers add sp, #16 @ release out args 356ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME @ TODO: we can clearly save an add here 357ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers cmp r0, #0 @ success if result is 0 358ae67599981e17cdfd51418c35e56e2a7c5ef4c72Ian Rogers bxeq lr @ return on success 359ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers DELIVER_PENDING_EXCEPTION 360ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers 361ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers .global art_set_obj_static_from_code 362ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers .extern artSetObjStaticFromCode 363ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers /* 364ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers * Called by managed code to resolve a static field and store an object reference 365ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers */ 366ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogersart_set_obj_static_from_code: 367ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case of GC 368ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers mov r3, r9 @ pass Thread::Current 369ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers str sp, [sp, #0] @ pass SP 370ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers bl artSetObjStaticFromCode @ (field_idx, referrer, new_val, Thread*, SP) 371ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME 372ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers cmp r0, #0 @ success if result is 0 373ae67599981e17cdfd51418c35e56e2a7c5ef4c72Ian Rogers bxeq lr @ return on success 374ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers DELIVER_PENDING_EXCEPTION 3754a3164faefd255b1c1e911e7ad7c3d57749caaf6buzbee 376aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom .global art_resolve_string_from_code 377aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom .extern artResolveStringFromCode 378aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom /* 379aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom * Entry from managed code to resolve a string, this stub will 380aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom * allocate a String and deliver an exception on error. On 381aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom * success the String is returned. 382aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom */ 383aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom art_resolve_string_from_code: 384aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case of GC 385aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom mov r2, r9 @ pass Thread::Current 386aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom mov r3, sp @ pass SP 387aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom @ artResolveStringFromCode(Method* referrer, uint32_t type_idx, Thread*, SP) 388aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom bl artResolveStringFromCode 389aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom RESTORE_REF_ONLY_CALLEE_SAVE_FRAME 390aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom cmp r0, #0 @ success if result is non-null 391aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom bxne lr @ return on success 392aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom DELIVER_PENDING_EXCEPTION 393aded5f7ab991f3c1132851599d3bc60ff6707eedBrian Carlstrom 39421d9e8323124a832a21679ca83808bc9c68ed365Ian Rogers .global art_alloc_object_from_code 39521d9e8323124a832a21679ca83808bc9c68ed365Ian Rogers .extern artAllocObjectFromCode 39621d9e8323124a832a21679ca83808bc9c68ed365Ian Rogers /* 39721d9e8323124a832a21679ca83808bc9c68ed365Ian Rogers * Called by managed code to allocate an object 39821d9e8323124a832a21679ca83808bc9c68ed365Ian Rogers */ 39921d9e8323124a832a21679ca83808bc9c68ed365Ian Rogersart_alloc_object_from_code: 4004f0d07c783afef89703dce32c94440fc8621a29bIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case of GC 4014f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r2, r9 @ pass Thread::Current 4024f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r3, sp @ pass SP 4034f0d07c783afef89703dce32c94440fc8621a29bIan Rogers bl artAllocObjectFromCode @ (uint32_t type_idx, Method* method, Thread*, SP) 4044f0d07c783afef89703dce32c94440fc8621a29bIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME 4054f0d07c783afef89703dce32c94440fc8621a29bIan Rogers cmp r0, #0 @ success if result is non-null 406ae67599981e17cdfd51418c35e56e2a7c5ef4c72Ian Rogers bxne lr @ return on success 407ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers DELIVER_PENDING_EXCEPTION 40821d9e8323124a832a21679ca83808bc9c68ed365Ian Rogers 409b408de744566a5c5a80be1ba7f5c88407e816945Elliott Hughes .global art_alloc_array_from_code 410b408de744566a5c5a80be1ba7f5c88407e816945Elliott Hughes .extern artAllocArrayFromCode 411b886da8e3c26443ab4d2aa63268bd673c354c3d2Ian Rogers /* 412b886da8e3c26443ab4d2aa63268bd673c354c3d2Ian Rogers * Called by managed code to allocate an array 413b886da8e3c26443ab4d2aa63268bd673c354c3d2Ian Rogers */ 414b408de744566a5c5a80be1ba7f5c88407e816945Elliott Hughesart_alloc_array_from_code: 4154f0d07c783afef89703dce32c94440fc8621a29bIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves in case of GC 4164f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r3, r9 @ pass Thread::Current 4174f0d07c783afef89703dce32c94440fc8621a29bIan Rogers str sp, [sp, #0] @ pass SP 4184f0d07c783afef89703dce32c94440fc8621a29bIan Rogers @ artAllocArrayFromCode(uint32_t type_idx, Method* method, int32_t component_count, Thread*, SP) 4194f0d07c783afef89703dce32c94440fc8621a29bIan Rogers bl artAllocArrayFromCode 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 424b886da8e3c26443ab4d2aa63268bd673c354c3d2Ian Rogers 425b408de744566a5c5a80be1ba7f5c88407e816945Elliott Hughes .global art_check_and_alloc_array_from_code 426b408de744566a5c5a80be1ba7f5c88407e816945Elliott Hughes .extern artCheckAndAllocArrayFromCode 427b886da8e3c26443ab4d2aa63268bd673c354c3d2Ian Rogers /* 428b886da8e3c26443ab4d2aa63268bd673c354c3d2Ian Rogers * Called by managed code to allocate an array 429b886da8e3c26443ab4d2aa63268bd673c354c3d2Ian Rogers */ 430b408de744566a5c5a80be1ba7f5c88407e816945Elliott Hughesart_check_and_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 @ artCheckAndAllocArrayFromCode(uint32_t type_idx, Method* method, int32_t count, Thread* , SP) 4354f0d07c783afef89703dce32c94440fc8621a29bIan Rogers bl artCheckAndAllocArrayFromCode 4364f0d07c783afef89703dce32c94440fc8621a29bIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME 437ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers cmp r0, #0 @ success if result is non-null 438ae67599981e17cdfd51418c35e56e2a7c5ef4c72Ian Rogers bxne lr @ return on success 439ce9eca6de042f26e9eebc41c9bee8b4d14f753aaIan Rogers DELIVER_PENDING_EXCEPTION 440b886da8e3c26443ab4d2aa63268bd673c354c3d2Ian Rogers 4414f0d07c783afef89703dce32c94440fc8621a29bIan Rogers .global art_test_suspend 4424a510d8750d50b77353d0a5a891d1b9b3a48ecd5Ian Rogers .extern artTestSuspendFromCode 4434f0d07c783afef89703dce32c94440fc8621a29bIan Rogersart_test_suspend: 4444f0d07c783afef89703dce32c94440fc8621a29bIan Rogers ldr r0, [rSELF, #THREAD_SUSPEND_COUNT_OFFSET] 4454f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov rSUSPEND, #SUSPEND_CHECK_INTERVAL @ reset rSUSPEND to SUSPEND_CHECK_INTERVAL 4464f0d07c783afef89703dce32c94440fc8621a29bIan Rogers cmp r0, #0 @ check Thread::Current()->suspend_count_ == 0 4474f0d07c783afef89703dce32c94440fc8621a29bIan Rogers bxeq rLR @ return if suspend_count_ == 0 4484f0d07c783afef89703dce32c94440fc8621a29bIan Rogers mov r0, rSELF 4494f0d07c783afef89703dce32c94440fc8621a29bIan Rogers SETUP_REF_ONLY_CALLEE_SAVE_FRAME @ save callee saves for stack crawl 450c10717a0b86d5719556ac3286fcb47aa2f2416fcbuzbee mov r1, sp 4514a510d8750d50b77353d0a5a891d1b9b3a48ecd5Ian Rogers bl artTestSuspendFromCode @ (Thread*, SP) 4524f0d07c783afef89703dce32c94440fc8621a29bIan Rogers RESTORE_REF_ONLY_CALLEE_SAVE_FRAME_AND_RETURN 4534f0d07c783afef89703dce32c94440fc8621a29bIan Rogers 4545433072f589b61413e042eddf76e8190a048f71dbuzbee .global art_shl_long 4555433072f589b61413e042eddf76e8190a048f71dbuzbeeart_shl_long: 4565433072f589b61413e042eddf76e8190a048f71dbuzbee /* 4575433072f589b61413e042eddf76e8190a048f71dbuzbee * Long integer shift. This is different from the generic 32/64-bit 4585433072f589b61413e042eddf76e8190a048f71dbuzbee * binary operations because vAA/vBB are 64-bit but vCC (the shift 4595433072f589b61413e042eddf76e8190a048f71dbuzbee * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low 4605433072f589b61413e042eddf76e8190a048f71dbuzbee * 6 bits. 4615433072f589b61413e042eddf76e8190a048f71dbuzbee * On entry: 4625433072f589b61413e042eddf76e8190a048f71dbuzbee * r0: low word 4635433072f589b61413e042eddf76e8190a048f71dbuzbee * r1: high word 4645433072f589b61413e042eddf76e8190a048f71dbuzbee * r2: shift count 4655433072f589b61413e042eddf76e8190a048f71dbuzbee */ 4665433072f589b61413e042eddf76e8190a048f71dbuzbee /* shl-long vAA, vBB, vCC */ 4675433072f589b61413e042eddf76e8190a048f71dbuzbee and r2, r2, #63 @ r2<- r2 & 0x3f 4685433072f589b61413e042eddf76e8190a048f71dbuzbee mov r1, r1, asl r2 @ r1<- r1 << r2 4695433072f589b61413e042eddf76e8190a048f71dbuzbee rsb r3, r2, #32 @ r3<- 32 - r2 4705433072f589b61413e042eddf76e8190a048f71dbuzbee orr r1, r1, r0, lsr r3 @ r1<- r1 | (r0 << (32-r2)) 4715433072f589b61413e042eddf76e8190a048f71dbuzbee subs ip, r2, #32 @ ip<- r2 - 32 4725433072f589b61413e042eddf76e8190a048f71dbuzbee movpl r1, r0, asl ip @ if r2 >= 32, r1<- r0 << (r2-32) 4735433072f589b61413e042eddf76e8190a048f71dbuzbee mov r0, r0, asl r2 @ r0<- r0 << r2 4745433072f589b61413e042eddf76e8190a048f71dbuzbee bx lr 4755433072f589b61413e042eddf76e8190a048f71dbuzbee 4765433072f589b61413e042eddf76e8190a048f71dbuzbee .balign 4 4775433072f589b61413e042eddf76e8190a048f71dbuzbee .global art_shr_long 4785433072f589b61413e042eddf76e8190a048f71dbuzbeeart_shr_long: 4795433072f589b61413e042eddf76e8190a048f71dbuzbee /* 4805433072f589b61413e042eddf76e8190a048f71dbuzbee * Long integer shift. This is different from the generic 32/64-bit 4815433072f589b61413e042eddf76e8190a048f71dbuzbee * binary operations because vAA/vBB are 64-bit but vCC (the shift 4825433072f589b61413e042eddf76e8190a048f71dbuzbee * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low 4835433072f589b61413e042eddf76e8190a048f71dbuzbee * 6 bits. 4845433072f589b61413e042eddf76e8190a048f71dbuzbee * On entry: 4855433072f589b61413e042eddf76e8190a048f71dbuzbee * r0: low word 4865433072f589b61413e042eddf76e8190a048f71dbuzbee * r1: high word 4875433072f589b61413e042eddf76e8190a048f71dbuzbee * r2: shift count 4885433072f589b61413e042eddf76e8190a048f71dbuzbee */ 4895433072f589b61413e042eddf76e8190a048f71dbuzbee /* shr-long vAA, vBB, vCC */ 4905433072f589b61413e042eddf76e8190a048f71dbuzbee and r2, r2, #63 @ r0<- r0 & 0x3f 4915433072f589b61413e042eddf76e8190a048f71dbuzbee mov r0, r0, lsr r2 @ r0<- r2 >> r2 4925433072f589b61413e042eddf76e8190a048f71dbuzbee rsb r3, r2, #32 @ r3<- 32 - r2 4935433072f589b61413e042eddf76e8190a048f71dbuzbee orr r0, r0, r1, asl r3 @ r0<- r0 | (r1 << (32-r2)) 4945433072f589b61413e042eddf76e8190a048f71dbuzbee subs ip, r2, #32 @ ip<- r2 - 32 4955433072f589b61413e042eddf76e8190a048f71dbuzbee movpl r0, r1, asr ip @ if r2 >= 32, r0<-r1 >> (r2-32) 4965433072f589b61413e042eddf76e8190a048f71dbuzbee mov r1, r1, asr r2 @ r1<- r1 >> r2 4975433072f589b61413e042eddf76e8190a048f71dbuzbee bx lr 4985433072f589b61413e042eddf76e8190a048f71dbuzbee 4995433072f589b61413e042eddf76e8190a048f71dbuzbee .balign 4 5005433072f589b61413e042eddf76e8190a048f71dbuzbee .global art_ushr_long 5015433072f589b61413e042eddf76e8190a048f71dbuzbeeart_ushr_long: 5025433072f589b61413e042eddf76e8190a048f71dbuzbee /* 5035433072f589b61413e042eddf76e8190a048f71dbuzbee * Long integer shift. This is different from the generic 32/64-bit 5045433072f589b61413e042eddf76e8190a048f71dbuzbee * binary operations because vAA/vBB are 64-bit but vCC (the shift 5055433072f589b61413e042eddf76e8190a048f71dbuzbee * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low 5065433072f589b61413e042eddf76e8190a048f71dbuzbee * 6 bits. 5075433072f589b61413e042eddf76e8190a048f71dbuzbee * On entry: 5085433072f589b61413e042eddf76e8190a048f71dbuzbee * r0: low word 5095433072f589b61413e042eddf76e8190a048f71dbuzbee * r1: high word 5105433072f589b61413e042eddf76e8190a048f71dbuzbee * r2: shift count 5115433072f589b61413e042eddf76e8190a048f71dbuzbee */ 5125433072f589b61413e042eddf76e8190a048f71dbuzbee /* ushr-long vAA, vBB, vCC */ 5135433072f589b61413e042eddf76e8190a048f71dbuzbee and r2, r2, #63 @ r0<- r0 & 0x3f 5145433072f589b61413e042eddf76e8190a048f71dbuzbee mov r0, r0, lsr r2 @ r0<- r2 >> r2 5155433072f589b61413e042eddf76e8190a048f71dbuzbee rsb r3, r2, #32 @ r3<- 32 - r2 5165433072f589b61413e042eddf76e8190a048f71dbuzbee orr r0, r0, r1, asl r3 @ r0<- r0 | (r1 << (32-r2)) 5175433072f589b61413e042eddf76e8190a048f71dbuzbee subs ip, r2, #32 @ ip<- r2 - 32 5185433072f589b61413e042eddf76e8190a048f71dbuzbee movpl r0, r1, lsr ip @ if r2 >= 32, r0<-r1 >>> (r2-32) 5195433072f589b61413e042eddf76e8190a048f71dbuzbee mov r1, r1, lsr r2 @ r1<- r1 >>> r2 5205433072f589b61413e042eddf76e8190a048f71dbuzbee bx lr 5215433072f589b61413e042eddf76e8190a048f71dbuzbee 5225433072f589b61413e042eddf76e8190a048f71dbuzbee#endif 52367375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers 52467375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers#if defined(__i386__) 52567375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers 526ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers .global art_deliver_exception_from_code 527ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers .extern artDeliverExceptionFromCode 52867375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers /* 529ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers * Called by managed code, saves callee saves and then calls artThrowException 53067375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers * that will place a mock Method* at the bottom of the stack. 53167375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers * EAX holds the exception. 53267375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers */ 533ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogersart_deliver_exception_from_code: 53467375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers // Create frame 53567375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers pushl %edi // Save callee saves 53667375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers pushl %esi 53767375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers pushl %ebp 53867375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers pushl %ebx 53967375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers pushl $0 54067375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers pushl $0 54167375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers pushl $0 // Will be clobbered to be Method* 54267375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers mov %esp, %ecx 54367375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers // Outgoing argument set up 544ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers pushl $0 // Alignment padding 545ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers pushl %ecx // pass SP 546ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers pushl %fs:THREAD_SELF_OFFSET // pass fs:offsetof(Thread,self_) 547ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers pushl %eax // pass Throwable* 548ff1ed4770bf7ff024a807b9f909b1a26abb78341Ian Rogers call artDeliverExceptionFromCode // artDeliverExceptionFromCode(Throwable*, Thread*, SP) 54967375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers int3 55067375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers 55167375acd9fec74cc2054554fe1ed0a7d213e1e47Ian Rogers#endif 552