quick_entrypoints_mips64.S revision 239d6eaff0cbb5c4c0139f7053a012758799f186
11a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe/* 21a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * Copyright (C) 2014 The Android Open Source Project 31a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * 41a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * Licensed under the Apache License, Version 2.0 (the "License"); 51a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * you may not use this file except in compliance with the License. 61a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * You may obtain a copy of the License at 71a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * 81a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * http://www.apache.org/licenses/LICENSE-2.0 91a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * 101a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * Unless required by applicable law or agreed to in writing, software 111a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * distributed under the License is distributed on an "AS IS" BASIS, 121a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 131a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * See the License for the specific language governing permissions and 141a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * limitations under the License. 151a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe */ 161a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 171a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe#include "asm_support_mips64.S" 181a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 191a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe#include "arch/quick_alloc_entrypoints.S" 201a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 211a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .set noreorder 221a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .balign 16 231a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 241a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe /* Deliver the given exception */ 251a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .extern artDeliverExceptionFromCode 261a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe /* Deliver an exception pending on a thread */ 271a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .extern artDeliverPendingExceptionFromCode 281a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 291a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe /* 3004568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic * Macro that sets up $gp and stores the previous $gp value to $t8. 3104568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic * This macro modifies v1 and t8. 3204568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic */ 3304568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic.macro SETUP_GP 3404568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic move $v1, $ra 3504568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic bal 1f 3604568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic nop 3704568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic1: 3804568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic .cpsetup $ra, $t8, 1b 3904568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic move $ra, $v1 4004568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic.endm 4104568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic 4204568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic /* 431a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * Macro that sets up the callee save frame to conform with 44fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko * Runtime::CreateCalleeSaveMethod(kSaveAllCalleeSaves) 451a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * callee-save: padding + $f24-$f31 + $s0-$s7 + $gp + $ra + $s8 = 19 total + 1x8 bytes padding 461a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe */ 47fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko.macro SETUP_SAVE_ALL_CALLEE_SAVES_FRAME 481a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $sp, $sp, -160 491a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_adjust_cfa_offset 160 501a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 511a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe // Ugly compile-time check, but we only have the preprocessor. 52fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko#if (FRAME_SIZE_SAVE_ALL_CALLEE_SAVES != 160) 53fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko#error "FRAME_SIZE_SAVE_ALL_CALLEE_SAVES(MIPS64) size not as expected." 541a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe#endif 551a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 561a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $ra, 152($sp) 571a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 31, 152 581a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s8, 144($sp) 591a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 30, 144 6004568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic sd $t8, 136($sp) # t8 holds caller's gp, now save it to the stack. 6104568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic .cfi_rel_offset 28, 136 # Value from gp is pushed, so set the cfi offset accordingly. 621a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s7, 128($sp) 631a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 23, 128 641a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s6, 120($sp) 651a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 22, 120 661a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s5, 112($sp) 671a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 21, 112 681a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s4, 104($sp) 691a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 20, 104 701a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s3, 96($sp) 711a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 19, 96 721a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s2, 88($sp) 731a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 18, 88 741a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s1, 80($sp) 751a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 17, 80 761a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s0, 72($sp) 771a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 16, 72 781a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 791a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe // FP callee-saves 801a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe s.d $f31, 64($sp) 811a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe s.d $f30, 56($sp) 821a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe s.d $f29, 48($sp) 831a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe s.d $f28, 40($sp) 841a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe s.d $f27, 32($sp) 851a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe s.d $f26, 24($sp) 861a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe s.d $f25, 16($sp) 871a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe s.d $f24, 8($sp) 881a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 891a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # load appropriate callee-save-method 9084bc06e30ba12c3ff07e577c52b63b9df162af7eLazar Trsic ld $t1, %got(_ZN3art7Runtime9instance_E)($gp) 9184bc06e30ba12c3ff07e577c52b63b9df162af7eLazar Trsic ld $t1, 0($t1) 92fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $t1, RUNTIME_SAVE_ALL_CALLEE_SAVES_METHOD_OFFSET($t1) 9384bc06e30ba12c3ff07e577c52b63b9df162af7eLazar Trsic sd $t1, 0($sp) # Place ArtMethod* at bottom of stack. 941a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF) # Place sp in Thread::Current()->top_quick_frame. 951a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.endm 961a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 971a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe /* 981a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * Macro that sets up the callee save frame to conform with 99fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko * Runtime::CreateCalleeSaveMethod(kSaveRefsOnly). Restoration assumes 1001a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * non-moving GC. 1011a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * Does not include rSUSPEND or rSELF 1021a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * callee-save: padding + $s2-$s7 + $gp + $ra + $s8 = 9 total + 1x8 bytes padding 1031a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe */ 104fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko.macro SETUP_SAVE_REFS_ONLY_FRAME 1051a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $sp, $sp, -80 1061a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_adjust_cfa_offset 80 1071a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 1081a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe // Ugly compile-time check, but we only have the preprocessor. 109fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko#if (FRAME_SIZE_SAVE_REFS_ONLY != 80) 110fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko#error "FRAME_SIZE_SAVE_REFS_ONLY(MIPS64) size not as expected." 1111a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe#endif 1121a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 1131a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $ra, 72($sp) 1141a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 31, 72 1151a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s8, 64($sp) 1161a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 30, 64 11704568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic sd $t8, 56($sp) # t8 holds caller's gp, now save it to the stack. 11804568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic .cfi_rel_offset 28, 56 # Value from gp is pushed, so set the cfi offset accordingly. 1191a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s7, 48($sp) 1201a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 23, 48 1211a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s6, 40($sp) 1221a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 22, 40 1231a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s5, 32($sp) 1241a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 21, 32 1251a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s4, 24($sp) 1261a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 20, 24 1271a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s3, 16($sp) 1281a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 19, 16 1291a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s2, 8($sp) 1301a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 18, 8 1311a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # load appropriate callee-save-method 13284bc06e30ba12c3ff07e577c52b63b9df162af7eLazar Trsic ld $t1, %got(_ZN3art7Runtime9instance_E)($gp) 13384bc06e30ba12c3ff07e577c52b63b9df162af7eLazar Trsic ld $t1, 0($t1) 134fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $t1, RUNTIME_SAVE_REFS_ONLY_METHOD_OFFSET($t1) 13584bc06e30ba12c3ff07e577c52b63b9df162af7eLazar Trsic sd $t1, 0($sp) # Place Method* at bottom of stack. 1361a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF) # Place sp in Thread::Current()->top_quick_frame. 1371a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.endm 1381a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 139fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko.macro RESTORE_SAVE_REFS_ONLY_FRAME 1401a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $ra, 72($sp) 1411a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 31 1421a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s8, 64($sp) 1431a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 30 14404568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic ld $t8, 56($sp) # Restore gp back to it's temp storage. 1451a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 28 1461a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s7, 48($sp) 1471a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 23 1481a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s6, 40($sp) 1491a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 22 1501a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s5, 32($sp) 1511a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 21 1521a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s4, 24($sp) 1531a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 20 1541a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s3, 16($sp) 1551a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 19 1561a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s2, 8($sp) 1571a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 18 1581a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $sp, $sp, 80 1591a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_adjust_cfa_offset -80 16004568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic .cpreturn 1611a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.endm 1621a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 163fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko.macro RESTORE_SAVE_REFS_ONLY_FRAME_AND_RETURN 1641a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $ra, 72($sp) 1651a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 31 1661a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s8, 64($sp) 1671a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 30 16804568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic ld $t8, 56($sp) # Restore gp back to it's temp storage. 1691a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 28 1701a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s7, 48($sp) 1711a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 23 1721a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s6, 40($sp) 1731a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 22 1741a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s5, 32($sp) 1751a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 21 1761a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s4, 24($sp) 1771a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 20 1781a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s3, 16($sp) 1791a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 19 1801a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s2, 8($sp) 1811a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 18 18204568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic .cpreturn 1831a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jalr $zero, $ra 1841a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $sp, $sp, 80 1851a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_adjust_cfa_offset -80 1861a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.endm 1871a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 1881a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe// This assumes the top part of these stack frame types are identical. 189fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko#define REFS_AND_ARGS_MINUS_REFS_SIZE (FRAME_SIZE_SAVE_REFS_AND_ARGS - FRAME_SIZE_SAVE_REFS_ONLY) 1901a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 191fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko.macro SETUP_SAVE_REFS_AND_ARGS_FRAME_INTERNAL 1921a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $sp, $sp, -208 1931a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_adjust_cfa_offset 208 1941a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 1951a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe // Ugly compile-time check, but we only have the preprocessor. 196fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko#if (FRAME_SIZE_SAVE_REFS_AND_ARGS != 208) 197fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko#error "FRAME_SIZE_SAVE_REFS_AND_ARGS(MIPS64) size not as expected." 1981a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe#endif 1991a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 2001a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $ra, 200($sp) # = kQuickCalleeSaveFrame_RefAndArgs_LrOffset 2011a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 31, 200 2021a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s8, 192($sp) 2031a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 30, 192 20404568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic sd $t8, 184($sp) # t8 holds caller's gp, now save it to the stack. 20504568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic .cfi_rel_offset 28, 184 # Value from gp is pushed, so set the cfi offset accordingly. 2061a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s7, 176($sp) 2071a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 23, 176 2081a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s6, 168($sp) 2091a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 22, 168 2101a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s5, 160($sp) 2111a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 21, 160 2121a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s4, 152($sp) 2131a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 20, 152 2141a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s3, 144($sp) 2151a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 19, 144 2161a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s2, 136($sp) 2171a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 18, 136 2181a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 2191a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $a7, 128($sp) 2201a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 11, 128 2211a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $a6, 120($sp) 2221a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 10, 120 2231a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $a5, 112($sp) 2241a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 9, 112 2251a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $a4, 104($sp) 2261a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 8, 104 2271a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $a3, 96($sp) 2281a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 7, 96 2291a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $a2, 88($sp) 2301a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 6, 88 2311a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $a1, 80($sp) # = kQuickCalleeSaveFrame_RefAndArgs_Gpr1Offset 2321a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 5, 80 2331a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 2341a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe s.d $f19, 72($sp) 2351a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe s.d $f18, 64($sp) 2361a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe s.d $f17, 56($sp) 2371a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe s.d $f16, 48($sp) 2381a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe s.d $f15, 40($sp) 2391a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe s.d $f14, 32($sp) 2401a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe s.d $f13, 24($sp) # = kQuickCalleeSaveFrame_RefAndArgs_Fpr1Offset 2411a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe s.d $f12, 16($sp) # This isn't necessary to store. 2428223b809a527c15b68f7c5c462d4c55c1335c7a7Douglas Leung # 1x8 bytes padding + Method* 2431a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.endm 2441a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 2458223b809a527c15b68f7c5c462d4c55c1335c7a7Douglas Leung /* 2468223b809a527c15b68f7c5c462d4c55c1335c7a7Douglas Leung * Macro that sets up the callee save frame to conform with 247fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko * Runtime::CreateCalleeSaveMethod(kSaveRefsAndArgs). Restoration assumes 2488223b809a527c15b68f7c5c462d4c55c1335c7a7Douglas Leung * non-moving GC. 2498223b809a527c15b68f7c5c462d4c55c1335c7a7Douglas Leung * callee-save: padding + $f12-$f19 + $a1-$a7 + $s2-$s7 + $gp + $ra + $s8 = 24 total + 1 words padding + Method* 2508223b809a527c15b68f7c5c462d4c55c1335c7a7Douglas Leung */ 251fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko.macro SETUP_SAVE_REFS_AND_ARGS_FRAME 252fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_AND_ARGS_FRAME_INTERNAL 2531a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # load appropriate callee-save-method 25484bc06e30ba12c3ff07e577c52b63b9df162af7eLazar Trsic ld $t1, %got(_ZN3art7Runtime9instance_E)($gp) 25584bc06e30ba12c3ff07e577c52b63b9df162af7eLazar Trsic ld $t1, 0($t1) 256fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $t1, RUNTIME_SAVE_REFS_AND_ARGS_METHOD_OFFSET($t1) 25784bc06e30ba12c3ff07e577c52b63b9df162af7eLazar Trsic sd $t1, 0($sp) # Place Method* at bottom of stack. 2581a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF) # Place sp in Thread::Current()->top_quick_frame. 2591a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.endm 2601a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 261fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko.macro SETUP_SAVE_REFS_AND_ARGS_FRAME_WITH_METHOD_IN_A0 262fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_AND_ARGS_FRAME_INTERNAL 263e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier sd $a0, 0($sp) # Place Method* at bottom of stack. 2648223b809a527c15b68f7c5c462d4c55c1335c7a7Douglas Leung sd $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF) # Place sp in Thread::Current()->top_quick_frame. 2658223b809a527c15b68f7c5c462d4c55c1335c7a7Douglas Leung.endm 2668223b809a527c15b68f7c5c462d4c55c1335c7a7Douglas Leung 267fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko.macro RESTORE_SAVE_REFS_AND_ARGS_FRAME 2681a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $ra, 200($sp) 2691a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 31 2701a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s8, 192($sp) 2711a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 30 27204568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic ld $t8, 184($sp) # Restore gp back to it's temp storage. 2731a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 28 2741a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s7, 176($sp) 2751a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 23 2761a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s6, 168($sp) 2771a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 22 2781a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s5, 160($sp) 2791a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 21 2801a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s4, 152($sp) 2811a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 20 2821a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s3, 144($sp) 2831a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 19 2841a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s2, 136($sp) 2851a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 18 2861a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 2871a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a7, 128($sp) 2881a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 11 2891a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a6, 120($sp) 2901a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 10 2911a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a5, 112($sp) 2921a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 9 2931a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a4, 104($sp) 2941a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 8 2951a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a3, 96($sp) 2961a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 7 2971a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a2, 88($sp) 2981a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 6 2991a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a1, 80($sp) 3001a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 5 3011a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 3021a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f19, 72($sp) 3031a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f18, 64($sp) 3041a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f17, 56($sp) 3051a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f16, 48($sp) 3061a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f15, 40($sp) 3071a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f14, 32($sp) 3081a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f13, 24($sp) 3091a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f12, 16($sp) 3101a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 31104568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic .cpreturn 3121a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $sp, $sp, 208 3131a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_adjust_cfa_offset -208 3141a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.endm 3151a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 3161a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe /* 317952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko * Macro that sets up the callee save frame to conform with 318952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko * Runtime::CreateCalleeSaveMethod(kSaveEverything). 319952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko * callee-save: $at + $v0-$v1 + $a0-$a7 + $t0-$t3 + $s0-$s7 + $t8-$t9 + $gp + $s8 + $ra + $s8, 320952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko * $f0-$f31; 28(GPR)+ 32(FPR) + 1x8 bytes padding + method* 321952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko * This macro sets up $gp; entrypoints using it should start with ENTRY_NO_GP. 322952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko */ 323fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko.macro SETUP_SAVE_EVERYTHING_FRAME 324952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko daddiu $sp, $sp, -496 325952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_adjust_cfa_offset 496 326952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko 327952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko // Ugly compile-time check, but we only have the preprocessor. 328fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko#if (FRAME_SIZE_SAVE_EVERYTHING != 496) 329fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko#error "FRAME_SIZE_SAVE_EVERYTHING(MIPS64) size not as expected." 330952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko#endif 331952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko 332952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko // Save core registers. 333952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $ra, 488($sp) 334952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 31, 488 335952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $s8, 480($sp) 336952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 30, 480 337952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $t9, 464($sp) 338952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 25, 464 339952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $t8, 456($sp) 340952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 24, 456 341952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $s7, 448($sp) 342952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 23, 448 343952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $s6, 440($sp) 344952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 22, 440 345952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $s5, 432($sp) 346952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 21, 432 347952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $s4, 424($sp) 348952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 20, 424 349952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $s3, 416($sp) 350952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 19, 416 351952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $s2, 408($sp) 352952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 18, 408 353952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $s1, 400($sp) 354952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 17, 400 355952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $s0, 392($sp) 356952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 16, 392 357952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $t3, 384($sp) 358952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 15, 384 359952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $t2, 376($sp) 360952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 14, 376 361952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $t1, 368($sp) 362952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 13, 368 363952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $t0, 360($sp) 364952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 12, 360 365952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $a7, 352($sp) 366952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 11, 352 367952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $a6, 344($sp) 368952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 10, 344 369952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $a5, 336($sp) 370952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 9, 336 371952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $a4, 328($sp) 372952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 8, 328 373952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $a3, 320($sp) 374952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 7, 320 375952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $a2, 312($sp) 376952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 6, 312 377952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $a1, 304($sp) 378952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 5, 304 379952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $a0, 296($sp) 380952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 4, 296 381952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $v1, 288($sp) 382952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 3, 288 383952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $v0, 280($sp) 384952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 2, 280 385952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko 386952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko // Set up $gp, clobbering $ra and using the branch delay slot for a useful instruction. 387952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko bal 1f 3882e42cf12e7bd62c5455a9c5ac0fc072de0f31884Goran Jakovljevic .set push 3892e42cf12e7bd62c5455a9c5ac0fc072de0f31884Goran Jakovljevic .set noat 390952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $at, 272($sp) 391952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 1, 272 3922e42cf12e7bd62c5455a9c5ac0fc072de0f31884Goran Jakovljevic .set pop 393952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko1: 3942e42cf12e7bd62c5455a9c5ac0fc072de0f31884Goran Jakovljevic .cpsetup $ra, 472, 1b 395952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko 396952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko // Save FP registers. 397952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f31, 264($sp) 398952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f30, 256($sp) 399952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f29, 248($sp) 400952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f28, 240($sp) 401952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f27, 232($sp) 402952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f26, 224($sp) 403952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f25, 216($sp) 404952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f24, 208($sp) 405952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f23, 200($sp) 406952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f22, 192($sp) 407952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f21, 184($sp) 408952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f20, 176($sp) 409952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f19, 168($sp) 410952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f18, 160($sp) 411952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f17, 152($sp) 412952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f16, 144($sp) 413952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f15, 136($sp) 414952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f14, 128($sp) 415952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f13, 120($sp) 416952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f12, 112($sp) 417952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f11, 104($sp) 418952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f10, 96($sp) 419952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f9, 88($sp) 420952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f8, 80($sp) 421952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f7, 72($sp) 422952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f6, 64($sp) 423952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f5, 56($sp) 424952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f4, 48($sp) 425952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f3, 40($sp) 426952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f2, 32($sp) 427952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f1, 24($sp) 428952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f0, 16($sp) 429952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko 430952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko # load appropriate callee-save-method 431952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $t1, %got(_ZN3art7Runtime9instance_E)($gp) 432952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $t1, 0($t1) 433fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $t1, RUNTIME_SAVE_EVERYTHING_METHOD_OFFSET($t1) 434952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $t1, 0($sp) # Place ArtMethod* at bottom of stack. 435952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko # Place sp in Thread::Current()->top_quick_frame. 436952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF) 437952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko.endm 438952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko 439fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko.macro RESTORE_SAVE_EVERYTHING_FRAME 440952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko // Restore FP registers. 441952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f31, 264($sp) 442952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f30, 256($sp) 443952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f29, 248($sp) 444952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f28, 240($sp) 445952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f27, 232($sp) 446952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f26, 224($sp) 447952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f25, 216($sp) 448952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f24, 208($sp) 449952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f23, 200($sp) 450952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f22, 192($sp) 451952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f21, 184($sp) 452952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f20, 176($sp) 453952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f19, 168($sp) 454952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f18, 160($sp) 455952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f17, 152($sp) 456952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f16, 144($sp) 457952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f15, 136($sp) 458952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f14, 128($sp) 459952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f13, 120($sp) 460952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f12, 112($sp) 461952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f11, 104($sp) 462952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f10, 96($sp) 463952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f9, 88($sp) 464952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f8, 80($sp) 465952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f7, 72($sp) 466952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f6, 64($sp) 467952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f5, 56($sp) 468952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f4, 48($sp) 469952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f3, 40($sp) 470952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f2, 32($sp) 471952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f1, 24($sp) 472952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f0, 16($sp) 473952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko 474952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko // Restore core registers. 4752e42cf12e7bd62c5455a9c5ac0fc072de0f31884Goran Jakovljevic .cpreturn 476952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $ra, 488($sp) 477952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 31 478952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $s8, 480($sp) 479952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 30 480952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $t9, 464($sp) 481952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 25 482952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $t8, 456($sp) 483952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 24 484952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $s7, 448($sp) 485952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 23 486952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $s6, 440($sp) 487952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 22 488952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $s5, 432($sp) 489952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 21 490952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $s4, 424($sp) 491952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 20 492952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $s3, 416($sp) 493952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 19 494952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $s2, 408($sp) 495952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 18 496952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $s1, 400($sp) 497952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 17 498952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $s0, 392($sp) 499952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 16 500952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $t3, 384($sp) 501952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 15 502952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $t2, 376($sp) 503952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 14 504952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $t1, 368($sp) 505952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 13 506952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $t0, 360($sp) 507952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 12 508952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $a7, 352($sp) 509952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 11 510952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $a6, 344($sp) 511952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 10 512952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $a5, 336($sp) 513952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 9 514952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $a4, 328($sp) 515952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 8 516952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $a3, 320($sp) 517952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 7 518952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $a2, 312($sp) 519952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 6 520952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $a1, 304($sp) 521952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 5 522952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $a0, 296($sp) 523952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 4 524952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $v1, 288($sp) 525952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 3 526952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $v0, 280($sp) 527952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 2 5282e42cf12e7bd62c5455a9c5ac0fc072de0f31884Goran Jakovljevic .set push 5292e42cf12e7bd62c5455a9c5ac0fc072de0f31884Goran Jakovljevic .set noat 530952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $at, 272($sp) 531952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 1 5322e42cf12e7bd62c5455a9c5ac0fc072de0f31884Goran Jakovljevic .set pop 533952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko 534952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko daddiu $sp, $sp, 496 535952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_adjust_cfa_offset -496 536952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko.endm 537952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko 538952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko /* 5391a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * Macro that set calls through to artDeliverPendingExceptionFromCode, 5401a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * where the pending 5411a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * exception is Thread::Current()->exception_ 5421a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe */ 5431a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.macro DELIVER_PENDING_EXCEPTION 54404568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic SETUP_GP 545fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_ALL_CALLEE_SAVES_FRAME # save callee saves for throw 5461a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe dla $t9, artDeliverPendingExceptionFromCode 5471a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jalr $zero, $t9 # artDeliverPendingExceptionFromCode(Thread*) 5481a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $a0, rSELF # pass Thread::Current 5491a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.endm 5501a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 5511a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.macro RETURN_IF_NO_EXCEPTION 5521a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ 553fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko RESTORE_SAVE_REFS_ONLY_FRAME 5541a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe bne $t0, $zero, 1f # success if no exception is pending 5551a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe nop 5561a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jalr $zero, $ra 5571a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe nop 5581a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe1: 5591a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe DELIVER_PENDING_EXCEPTION 5601a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.endm 5611a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 5621a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.macro RETURN_IF_ZERO 563fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko RESTORE_SAVE_REFS_ONLY_FRAME 5641a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe bne $v0, $zero, 1f # success? 5651a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe nop 5661a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jalr $zero, $ra # return on success 5671a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe nop 5681a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe1: 5691a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe DELIVER_PENDING_EXCEPTION 5701a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.endm 5711a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 5721a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.macro RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 573fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko RESTORE_SAVE_REFS_ONLY_FRAME 5741a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe beq $v0, $zero, 1f # success? 5751a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe nop 5761a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jalr $zero, $ra # return on success 5771a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe nop 5781a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe1: 5791a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe DELIVER_PENDING_EXCEPTION 5801a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.endm 5811a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 5821a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe /* 5833bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic * On stack replacement stub. 5843bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic * On entry: 5853bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic * a0 = stack to copy 5863bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic * a1 = size of stack 5873bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic * a2 = pc to call 5883bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic * a3 = JValue* result 5893bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic * a4 = shorty 5903bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic * a5 = thread 5913bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic */ 5923bc13817a19e36f3833bb44624ef86800892eaadGoran JakovljevicENTRY art_quick_osr_stub 5933bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic move $t0, $sp # save stack pointer 5943bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic daddiu $t1, $sp, -112 # reserve stack space 5953bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic dsrl $t1, $t1, 4 # enforce 16 byte stack alignment 5963bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic dsll $sp, $t1, 4 # update stack pointer 5973bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic 5983bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic // Save callee general purpose registers, SP, T8(GP), RA, A3, and A4 (8x14 bytes) 5993bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sd $ra, 104($sp) 6003bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_rel_offset 31, 104 6013bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sd $s8, 96($sp) 6023bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_rel_offset 30, 96 6033bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sd $t0, 88($sp) # save original stack pointer stored in t0 6043bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_rel_offset 29, 88 6053bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sd $t8, 80($sp) # t8 holds caller's gp, now save it to the stack. 6063bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_rel_offset 28, 80 # Value from gp is pushed, so set the cfi offset accordingly. 6073bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sd $s7, 72($sp) 6083bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_rel_offset 23, 72 6093bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sd $s6, 64($sp) 6103bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_rel_offset 22, 64 6113bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sd $s5, 56($sp) 6123bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_rel_offset 21, 56 6133bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sd $s4, 48($sp) 6143bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_rel_offset 20, 48 6153bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sd $s3, 40($sp) 6163bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_rel_offset 19, 40 6173bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sd $s2, 32($sp) 6183bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_rel_offset 18, 32 6193bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sd $s1, 24($sp) 6203bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_rel_offset 17, 24 6213bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sd $s0, 16($sp) 6223bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_rel_offset 16, 16 6233bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sd $a4, 8($sp) 6243bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_rel_offset 8, 8 6253bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sd $a3, 0($sp) 6263bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_rel_offset 7, 0 6273bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic move rSELF, $a5 # Save managed thread pointer into rSELF 6283bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic 6293bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic daddiu $sp, $sp, -16 6303bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic jal .Losr_entry 6313bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sd $zero, 0($sp) # Store null for ArtMethod* at bottom of frame 6323bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic daddiu $sp, $sp, 16 6333bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic 6343bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic // Restore return value address and shorty address 6353bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic ld $a4, 8($sp) # shorty address 6363bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_restore 8 6373bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic ld $a3, 0($sp) # result value address 6383bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_restore 7 6393bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic 6403bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic lbu $t1, 0($a4) # load return type 6413bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic li $t2, 'D' # put char 'D' into t2 6423bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic beq $t1, $t2, .Losr_fp_result # branch if result type char == 'D' 6433bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic li $t2, 'F' # put char 'F' into t2 6443bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic beq $t1, $t2, .Losr_fp_result # branch if result type char == 'F' 6453bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic nop 6463bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic b .Losr_exit 6473bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic dsrl $v1, $v0, 32 # put high half of result in v1 6483bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic.Losr_fp_result: 6493bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic mfc1 $v0, $f0 6503bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic mfhc1 $v1, $f0 # put high half of FP result in v1 6513bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic.Losr_exit: 6523bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sw $v0, 0($a3) # store low half of result 6533bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sw $v1, 4($a3) # store high half of result 6543bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic 6553bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic // Restore callee registers 6563bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic ld $ra, 104($sp) 6573bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_restore 31 6583bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic ld $s8, 96($sp) 6593bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_restore 30 6603bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic ld $t0, 88($sp) # save SP into t0 for now 6613bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_restore 29 6623bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic ld $t8, 80($sp) # Restore gp back to it's temp storage. 6633bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_restore 28 6643bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic ld $s7, 72($sp) 6653bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_restore 23 6663bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic ld $s6, 64($sp) 6673bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_restore 22 6683bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic ld $s5, 56($sp) 6693bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_restore 21 6703bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic ld $s4, 48($sp) 6713bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_restore 20 6723bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic ld $s3, 40($sp) 6733bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_restore 19 6743bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic ld $s2, 32($sp) 6753bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_restore 18 6763bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic ld $s1, 24($sp) 6773bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_restore 17 6783bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic ld $s0, 16($sp) 6793bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_restore 16 6803bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic jalr $zero, $ra 6813bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic move $sp, $t0 6823bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic 6833bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic.Losr_entry: 6843bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic dsubu $sp, $sp, $a1 # Reserve space for callee stack 6853bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic daddiu $a1, $a1, -8 6863bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic daddu $t0, $a1, $sp 6873bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sw $ra, 0($t0) # Store low half of RA per compiler ABI 6883bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic dsrl $t1, $ra, 32 6893bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sw $t1, 4($t0) # Store high half of RA per compiler ABI 6903bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic 6913bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic // Copy arguments into callee stack 6923bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic // Use simple copy routine for now. 6933bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic // 4 bytes per slot. 6943bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic // a0 = source address 6953bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic // a1 = args length in bytes (does not include 8 bytes for RA) 6963bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic // sp = destination address 6973bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic beqz $a1, .Losr_loop_exit 6983bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic daddiu $a1, $a1, -4 6993bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic daddu $t1, $a0, $a1 7003bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic daddu $t2, $sp, $a1 7013bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic.Losr_loop_entry: 7023bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic lw $t0, 0($t1) 7033bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic daddiu $t1, $t1, -4 7043bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sw $t0, 0($t2) 7053bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic bne $sp, $t2, .Losr_loop_entry 7063bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic daddiu $t2, $t2, -4 7073bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic 7083bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic.Losr_loop_exit: 7093bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic move $t9, $a2 7103bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic jalr $zero, $t9 # Jump to the OSR entry point. 7113bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic nop 7123bc13817a19e36f3833bb44624ef86800892eaadGoran JakovljevicEND art_quick_osr_stub 7133bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic 7143bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic /* 7151a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * On entry $a0 is uint32_t* gprs_ and $a1 is uint32_t* fprs_ 7161a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * FIXME: just guessing about the shape of the jmpbuf. Where will pc be? 7171a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe */ 71804568815cbfa18f0fa8b8d751fb83a1089909660Goran JakovljevicENTRY_NO_GP art_quick_do_long_jump 7191a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f0, 0($a1) 7201a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f1, 8($a1) 7211a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f2, 16($a1) 7221a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f3, 24($a1) 7231a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f4, 32($a1) 7241a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f5, 40($a1) 7251a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f6, 48($a1) 7261a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f7, 56($a1) 7271a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f8, 64($a1) 7281a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f9, 72($a1) 7291a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f10, 80($a1) 7301a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f11, 88($a1) 7311a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f12, 96($a1) 7321a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f13, 104($a1) 7331a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f14, 112($a1) 7341a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f15, 120($a1) 7351a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f16, 128($a1) 7361a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f17, 136($a1) 7371a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f18, 144($a1) 7381a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f19, 152($a1) 7391a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f20, 160($a1) 7401a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f21, 168($a1) 7411a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f22, 176($a1) 7421a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f23, 184($a1) 7431a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f24, 192($a1) 7441a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f25, 200($a1) 7451a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f26, 208($a1) 7461a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f27, 216($a1) 7471a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f28, 224($a1) 7481a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f29, 232($a1) 7491a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f30, 240($a1) 7501a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f31, 248($a1) 7511a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .set push 7521a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .set nomacro 7531a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .set noat 7541a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe# no need to load zero 7551a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $at, 8($a0) 7561a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .set pop 7571a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $v0, 16($a0) 7581a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $v1, 24($a0) 7591a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe# a0 has to be loaded last 7601a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a1, 40($a0) 7611a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a2, 48($a0) 7621a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a3, 56($a0) 7631a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a4, 64($a0) 7641a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a5, 72($a0) 7651a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a6, 80($a0) 7661a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a7, 88($a0) 7671a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $t0, 96($a0) 7681a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $t1, 104($a0) 7691a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $t2, 112($a0) 7701a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $t3, 120($a0) 7711a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s0, 128($a0) 7721a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s1, 136($a0) 7731a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s2, 144($a0) 7741a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s3, 152($a0) 7751a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s4, 160($a0) 7761a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s5, 168($a0) 7771a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s6, 176($a0) 7781a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s7, 184($a0) 7791a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $t8, 192($a0) 7801a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $t9, 200($a0) 7811a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe# no need to load k0, k1 7821a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $gp, 224($a0) 7831a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $sp, 232($a0) 7841a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s8, 240($a0) 7851a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $ra, 248($a0) 7861a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a0, 32($a0) 7871a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $v0, $zero # clear result registers v0 and v1 788dbf056d38dddda10c5f409e3155c7b4211183f63Andreas Gampe jalr $zero, $t9 # do long jump (do not use ra, it must not be clobbered) 7891a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $v1, $zero 7901a5c40672783fac98aca5a04ac798a0a0014de65Andreas GampeEND art_quick_do_long_jump 7911a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 7926ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 7936ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code, saves most registers (forms basis of long jump 7946ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * context) and passes the bottom of the stack. 7956ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * artDeliverExceptionFromCode will place the callee save Method* at 79684bc06e30ba12c3ff07e577c52b63b9df162af7eLazar Trsic * the bottom of the thread. On entry a0 holds Throwable* 7976ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 7986ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_deliver_exception 799fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_ALL_CALLEE_SAVES_FRAME 8006ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic dla $t9, artDeliverExceptionFromCode 8016ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jalr $zero, $t9 # artDeliverExceptionFromCode(Throwable*, Thread*) 8026ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a1, rSELF # pass Thread::Current 8036ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_deliver_exception 8046ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 8056ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 8066ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to create and deliver a NullPointerException 8076ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 8086ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artThrowNullPointerExceptionFromCode 8096ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_throw_null_pointer_exception 8106ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic.Lart_quick_throw_null_pointer_exception_gp_set: 811fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_ALL_CALLEE_SAVES_FRAME 8126ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic dla $t9, artThrowNullPointerExceptionFromCode 8136ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jalr $zero, $t9 # artThrowNullPointerExceptionFromCode(Thread*) 8146ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a0, rSELF # pass Thread::Current 8156ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_throw_null_pointer_exception 8161a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 8176ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 818e8e1127da3f154fae8d2eb16a94203544a182159Nicolas Geoffray * Call installed by a signal handler to create and deliver a NullPointerException 819e8e1127da3f154fae8d2eb16a94203544a182159Nicolas Geoffray */ 820e8e1127da3f154fae8d2eb16a94203544a182159Nicolas Geoffray .extern artThrowNullPointerExceptionFromSignal 821e8e1127da3f154fae8d2eb16a94203544a182159Nicolas GeoffrayENTRY art_quick_throw_null_pointer_exception_from_signal 822fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_ALL_CALLEE_SAVES_FRAME 823e8e1127da3f154fae8d2eb16a94203544a182159Nicolas Geoffray dla $t9, artThrowNullPointerExceptionFromSignal 824e8e1127da3f154fae8d2eb16a94203544a182159Nicolas Geoffray jalr $zero, $t9 # artThrowNullPointerExceptionFromSignal(uinptr_t, Thread*) 825e8e1127da3f154fae8d2eb16a94203544a182159Nicolas Geoffray move $a1, rSELF # pass Thread::Current 826e8e1127da3f154fae8d2eb16a94203544a182159Nicolas GeoffrayEND art_quick_throw_null_pointer_exception 827e8e1127da3f154fae8d2eb16a94203544a182159Nicolas Geoffray 828e8e1127da3f154fae8d2eb16a94203544a182159Nicolas Geoffray /* 8296ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to create and deliver an ArithmeticException 8306ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 8316ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artThrowDivZeroFromCode 8326ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_throw_div_zero 833fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_ALL_CALLEE_SAVES_FRAME 8346ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic dla $t9, artThrowDivZeroFromCode 8356ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jalr $zero, $t9 # artThrowDivZeroFromCode(Thread*) 8366ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a0, rSELF # pass Thread::Current 8376ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_throw_div_zero 8381a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 8396ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 8406ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to create and deliver an 8416ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * ArrayIndexOutOfBoundsException 8426ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 8436ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artThrowArrayBoundsFromCode 8446ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_throw_array_bounds 8456ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic.Lart_quick_throw_array_bounds_gp_set: 846fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_ALL_CALLEE_SAVES_FRAME 8476ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic dla $t9, artThrowArrayBoundsFromCode 8486ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jalr $zero, $t9 # artThrowArrayBoundsFromCode(index, limit, Thread*) 8496ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a2, rSELF # pass Thread::Current 8506ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_throw_array_bounds 8516ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 8526ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 85387f3fcbd0db352157fc59148e94647ef21b73bceVladimir Marko * Called by managed code to create and deliver a StringIndexOutOfBoundsException 85487f3fcbd0db352157fc59148e94647ef21b73bceVladimir Marko * as if thrown from a call to String.charAt(). 85587f3fcbd0db352157fc59148e94647ef21b73bceVladimir Marko */ 85687f3fcbd0db352157fc59148e94647ef21b73bceVladimir Marko .extern artThrowStringBoundsFromCode 85787f3fcbd0db352157fc59148e94647ef21b73bceVladimir MarkoENTRY art_quick_throw_string_bounds 85887f3fcbd0db352157fc59148e94647ef21b73bceVladimir Marko.Lart_quick_throw_string_bounds_gp_set: 859fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_ALL_CALLEE_SAVES_FRAME 86087f3fcbd0db352157fc59148e94647ef21b73bceVladimir Marko dla $t9, artThrowStringBoundsFromCode 86187f3fcbd0db352157fc59148e94647ef21b73bceVladimir Marko jalr $zero, $t9 # artThrowStringBoundsFromCode(index, limit, Thread*) 86287f3fcbd0db352157fc59148e94647ef21b73bceVladimir Marko move $a2, rSELF # pass Thread::Current 86387f3fcbd0db352157fc59148e94647ef21b73bceVladimir MarkoEND art_quick_throw_string_bounds 86487f3fcbd0db352157fc59148e94647ef21b73bceVladimir Marko 86587f3fcbd0db352157fc59148e94647ef21b73bceVladimir Marko /* 8666ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to create and deliver a StackOverflowError. 8676ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 8686ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artThrowStackOverflowFromCode 8696ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_throw_stack_overflow 870fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_ALL_CALLEE_SAVES_FRAME 8716ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic dla $t9, artThrowStackOverflowFromCode 8726ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jalr $zero, $t9 # artThrowStackOverflowFromCode(Thread*) 8736ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a0, rSELF # pass Thread::Current 8746ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_throw_stack_overflow 8756ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 8766ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 8776ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to create and deliver a NoSuchMethodError. 8786ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 8796ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artThrowNoSuchMethodFromCode 8806ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_throw_no_such_method 881fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_ALL_CALLEE_SAVES_FRAME 8826ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic dla $t9, artThrowNoSuchMethodFromCode 8836ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jalr $zero, $t9 # artThrowNoSuchMethodFromCode(method_idx, Thread*) 8846ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a1, rSELF # pass Thread::Current 8856ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_throw_no_such_method 8866ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 8876ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 8886ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * All generated callsites for interface invokes and invocation slow paths will load arguments 8896ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * as usual - except instead of loading arg0/$a0 with the target Method*, arg0/$a0 will contain 8906ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * the method_idx. This wrapper will save arg1-arg3, load the caller's Method*, align the 8916ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * stack and call the appropriate C helper. 8926ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * NOTE: "this" is first visable argument of the target, and so can be found in arg1/$a1. 8936ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * 8946ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * The helper will attempt to locate the target and return a 128-bit result in $v0/$v1 consisting 8956ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * of the target Method* in $v0 and method->code_ in $v1. 8966ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * 8972cebb24bfc3247d3e9be138a3350106737455918Mathieu Chartier * If unsuccessful, the helper will return null/null. There will be a pending exception in the 8986ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * thread and we branch to another stub to deliver it. 8996ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * 9006ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * On success this wrapper will restore arguments and *jump* to the target, leaving the ra 9016ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * pointing back to the original caller. 9026ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 9033031c8da0c5009183f770b005c245f9bf2a4d01bAndreas Gampe.macro INVOKE_TRAMPOLINE_BODY cxx_name 9046ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern \cxx_name 905fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_AND_ARGS_FRAME # save callee saves in case allocation triggers GC 9067ea6a170486d81b127e69673cd1020c4db628c93Nicolas Geoffray move $a2, rSELF # pass Thread::Current 9077ea6a170486d81b127e69673cd1020c4db628c93Nicolas Geoffray jal \cxx_name # (method_idx, this, Thread*, $sp) 9087ea6a170486d81b127e69673cd1020c4db628c93Nicolas Geoffray move $a3, $sp # pass $sp 9096ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a0, $v0 # save target Method* 9106ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $t9, $v1 # save $v0->code_ 911fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko RESTORE_SAVE_REFS_AND_ARGS_FRAME 9126ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic beq $v0, $zero, 1f 9136ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic nop 9146ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jalr $zero, $t9 9156ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic nop 9166ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic1: 9176ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic DELIVER_PENDING_EXCEPTION 9183031c8da0c5009183f770b005c245f9bf2a4d01bAndreas Gampe.endm 9193031c8da0c5009183f770b005c245f9bf2a4d01bAndreas Gampe.macro INVOKE_TRAMPOLINE c_name, cxx_name 9203031c8da0c5009183f770b005c245f9bf2a4d01bAndreas GampeENTRY \c_name 9213031c8da0c5009183f770b005c245f9bf2a4d01bAndreas Gampe INVOKE_TRAMPOLINE_BODY \cxx_name 9226ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND \c_name 9236ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic.endm 9246ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 9256ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicINVOKE_TRAMPOLINE art_quick_invoke_interface_trampoline_with_access_check, artInvokeInterfaceTrampolineWithAccessCheck 9266ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 9276ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicINVOKE_TRAMPOLINE art_quick_invoke_static_trampoline_with_access_check, artInvokeStaticTrampolineWithAccessCheck 9286ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicINVOKE_TRAMPOLINE art_quick_invoke_direct_trampoline_with_access_check, artInvokeDirectTrampolineWithAccessCheck 9296ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicINVOKE_TRAMPOLINE art_quick_invoke_super_trampoline_with_access_check, artInvokeSuperTrampolineWithAccessCheck 9306ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicINVOKE_TRAMPOLINE art_quick_invoke_virtual_trampoline_with_access_check, artInvokeVirtualTrampolineWithAccessCheck 9311a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 9321a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # On entry: 9331a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # t0 = shorty 9341a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # t1 = ptr to arg_array 9351a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # t2 = number of argument bytes remain 9361a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # v0 = ptr to stack frame where to copy arg_array 9371a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # This macro modifies t3, t9 and v0 9381a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.macro LOOP_OVER_SHORTY_LOADING_REG gpu, fpu, label 9391a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe lbu $t3, 0($t0) # get argument type from shorty 9401a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe beqz $t3, \label 9411a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t0, 1 9421a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe li $t9, 68 # put char 'D' into t9 9431a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe beq $t9, $t3, 1f # branch if result type char == 'D' 9441a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe li $t9, 70 # put char 'F' into t9 9451a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe beq $t9, $t3, 2f # branch if result type char == 'F' 9461a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe li $t9, 74 # put char 'J' into t9 9471a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe beq $t9, $t3, 3f # branch if result type char == 'J' 9481a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe nop 9496ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic lw $\gpu, 0($t1) 9501a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $\gpu, 0($v0) 9511a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $v0, 4 9521a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t1, 4 9531a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe b 4f 9541a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t2, -4 # delay slot 9551a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 9561a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe1: # found double 9571a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe lwu $t3, 0($t1) 9581a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe mtc1 $t3, $\fpu 9591a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $t3, 0($v0) 9601a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe lwu $t3, 4($t1) 9611a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe mthc1 $t3, $\fpu 9621a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $t3, 4($v0) 9631a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $v0, 8 9641a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t1, 8 9651a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe b 4f 9661a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t2, -8 # delay slot 9671a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 9681a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe2: # found float 9691a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe lwu $t3, 0($t1) 9701a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe mtc1 $t3, $\fpu 9711a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $t3, 0($v0) 9721a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $v0, 4 9731a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t1, 4 9741a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe b 4f 9751a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t2, -4 # delay slot 9761a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 9771a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe3: # found long (8 bytes) 9781a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe lwu $t3, 0($t1) 9791a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $t3, 0($v0) 9801a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe lwu $t9, 4($t1) 9811a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $t9, 4($v0) 9821a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe dsll $t9, $t9, 32 9831a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe or $\gpu, $t9, $t3 9841a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $v0, 8 9851a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t1, 8 9861a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t2, -8 9871a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe4: 9881a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.endm 9891a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 9901a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe /* 9911a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * Invocation stub for quick code. 9921a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * On entry: 9931a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * a0 = method pointer 9941a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * a1 = argument array that must at least contain the this ptr. 9951a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * a2 = size of argument array in bytes 9961a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * a3 = (managed) thread pointer 9971a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * a4 = JValue* result 9981a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * a5 = shorty 9991a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe */ 100004568815cbfa18f0fa8b8d751fb83a1089909660Goran JakovljevicENTRY_NO_GP art_quick_invoke_stub 10011a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # push a4, a5, s0(rSUSPEND), s1(rSELF), s8, ra onto the stack 10021a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $sp, $sp, -48 10031a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_adjust_cfa_offset 48 10041a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $ra, 40($sp) 10051a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 31, 40 10061a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s8, 32($sp) 10071a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 30, 32 10081a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s1, 24($sp) 10091a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 17, 24 10101a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s0, 16($sp) 10111a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 16, 16 10121a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $a5, 8($sp) 10131a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 9, 8 10141a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $a4, 0($sp) 10151a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 8, 0 10161a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 10171a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $s0, $zero, SUSPEND_CHECK_INTERVAL # reset rSUSPEND to SUSPEND_CHECK_INTERVAL 10181a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $s1, $a3 # move managed thread pointer into s1 (rSELF) 10191a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $s8, $sp # save sp in s8 (fp) 10201a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 1021e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier daddiu $t3, $a2, 24 # add 8 for ArtMethod* and 16 for stack alignment 10221a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe dsrl $t3, $t3, 4 # shift the frame size right 4 10231a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe dsll $t3, $t3, 4 # shift the frame size left 4 to align to 16 bytes 10241a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe dsubu $sp, $sp, $t3 # reserve stack space for argument array 10251a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 10261a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t0, $a5, 1 # t0 = shorty[1] (skip 1 for return type) 10271a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t1, $a1, 4 # t1 = ptr to arg_array[4] (skip this ptr) 10281a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t2, $a2, -4 # t2 = number of argument bytes remain (skip this ptr) 102980f7a57e2aec7515c7a54c4b5c9e703a66623feaNikola Veljkovic daddiu $v0, $sp, 12 # v0 points to where to copy arg_array 10301a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe LOOP_OVER_SHORTY_LOADING_REG a2, f14, call_fn 10311a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe LOOP_OVER_SHORTY_LOADING_REG a3, f15, call_fn 10321a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe LOOP_OVER_SHORTY_LOADING_REG a4, f16, call_fn 10331a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe LOOP_OVER_SHORTY_LOADING_REG a5, f17, call_fn 10341a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe LOOP_OVER_SHORTY_LOADING_REG a6, f18, call_fn 10351a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe LOOP_OVER_SHORTY_LOADING_REG a7, f19, call_fn 10361a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 10371a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # copy arguments onto stack (t2 should be multiples of 4) 10381a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ble $t2, $zero, call_fn # t2 = number of argument bytes remain 10391a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe1: 10401a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe lw $t3, 0($t1) # load from argument array 10411a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t1, $t1, 4 10421a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $t3, 0($v0) # save to stack 10431a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t2, -4 10441a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe bgt $t2, $zero, 1b # t2 = number of argument bytes remain 10451a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $v0, $v0, 4 10461a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 10471a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampecall_fn: 10481a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # call method (a0 and a1 have been untouched) 10491a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe lwu $a1, 0($a1) # make a1 = this ptr 1050e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier sw $a1, 8($sp) # copy this ptr (skip 8 bytes for ArtMethod*) 1051e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier sd $zero, 0($sp) # store null for ArtMethod* at bottom of frame 1052e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier ld $t9, ART_METHOD_QUICK_CODE_OFFSET_64($a0) # get pointer to the code 10531a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jalr $t9 # call the method 10541a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe nop 10551a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $sp, $s8 # restore sp 10561a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 10571a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # pop a4, a5, s1(rSELF), s8, ra off of the stack 10581a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a4, 0($sp) 10591a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 8 10601a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a5, 8($sp) 10611a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 9 10621a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s0, 16($sp) 10631a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 16 10641a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s1, 24($sp) 10651a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 17 10661a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s8, 32($sp) 10671a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 30 10681a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $ra, 40($sp) 10691a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 31 10701a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $sp, $sp, 48 10711a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_adjust_cfa_offset -48 10721a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 10731a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # a4 = JValue* result 10741a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # a5 = shorty string 10751a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe lbu $t1, 0($a5) # get result type from shorty 10761a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe li $t2, 68 # put char 'D' into t2 10771a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe beq $t1, $t2, 1f # branch if result type char == 'D' 10781a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe li $t3, 70 # put char 'F' into t3 10791a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe beq $t1, $t3, 1f # branch if result type char == 'F' 10801a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $v0, 0($a4) # store the result 10811a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe dsrl $v1, $v0, 32 10821a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jalr $zero, $ra 10831a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $v1, 4($a4) # store the other half of the result 10841a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe1: 10851a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe mfc1 $v0, $f0 10861a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe mfhc1 $v1, $f0 10871a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $v0, 0($a4) # store the result 10881a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jalr $zero, $ra 10891a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $v1, 4($a4) # store the other half of the result 10901a5c40672783fac98aca5a04ac798a0a0014de65Andreas GampeEND art_quick_invoke_stub 10911a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 10921a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe /* 10931a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * Invocation static stub for quick code. 10941a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * On entry: 10951a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * a0 = method pointer 10961a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * a1 = argument array that must at least contain the this ptr. 10971a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * a2 = size of argument array in bytes 10981a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * a3 = (managed) thread pointer 10991a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * a4 = JValue* result 11001a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * a5 = shorty 11011a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe */ 110204568815cbfa18f0fa8b8d751fb83a1089909660Goran JakovljevicENTRY_NO_GP art_quick_invoke_static_stub 11031a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 11041a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # push a4, a5, s0(rSUSPEND), s1(rSELF), s8, ra, onto the stack 11051a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $sp, $sp, -48 11061a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_adjust_cfa_offset 48 11071a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $ra, 40($sp) 11081a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 31, 40 11091a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s8, 32($sp) 11101a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 30, 32 11111a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s1, 24($sp) 11121a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 17, 24 11131a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s0, 16($sp) 11141a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 16, 16 11151a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $a5, 8($sp) 11161a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 9, 8 11171a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $a4, 0($sp) 11181a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 8, 0 11191a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 11201a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $s0, $zero, SUSPEND_CHECK_INTERVAL # reset rSUSPEND to SUSPEND_CHECK_INTERVAL 11211a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $s1, $a3 # move managed thread pointer into s1 (rSELF) 11221a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $s8, $sp # save sp in s8 (fp) 11231a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 1124e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier daddiu $t3, $a2, 24 # add 8 for ArtMethod* and 16 for stack alignment 11251a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe dsrl $t3, $t3, 4 # shift the frame size right 4 11261a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe dsll $t3, $t3, 4 # shift the frame size left 4 to align to 16 bytes 11271a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe dsubu $sp, $sp, $t3 # reserve stack space for argument array 11281a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 11291a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t0, $a5, 1 # t0 = shorty[1] (skip 1 for return type) 11301a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $t1, $a1 # t1 = arg_array 11311a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $t2, $a2 # t2 = number of argument bytes remain 1132e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier daddiu $v0, $sp, 8 # v0 points to where to copy arg_array 11331a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe LOOP_OVER_SHORTY_LOADING_REG a1, f13, call_sfn 11341a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe LOOP_OVER_SHORTY_LOADING_REG a2, f14, call_sfn 11351a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe LOOP_OVER_SHORTY_LOADING_REG a3, f15, call_sfn 11361a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe LOOP_OVER_SHORTY_LOADING_REG a4, f16, call_sfn 11371a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe LOOP_OVER_SHORTY_LOADING_REG a5, f17, call_sfn 11381a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe LOOP_OVER_SHORTY_LOADING_REG a6, f18, call_sfn 11391a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe LOOP_OVER_SHORTY_LOADING_REG a7, f19, call_sfn 11401a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 11411a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # copy arguments onto stack (t2 should be multiples of 4) 11421a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ble $t2, $zero, call_sfn # t2 = number of argument bytes remain 11431a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe1: 11441a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe lw $t3, 0($t1) # load from argument array 11451a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t1, $t1, 4 11461a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $t3, 0($v0) # save to stack 11471a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t2, -4 11481a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe bgt $t2, $zero, 1b # t2 = number of argument bytes remain 11491a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $v0, $v0, 4 11501a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 11511a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampecall_sfn: 11521a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # call method (a0 has been untouched) 1153e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier sd $zero, 0($sp) # store null for ArtMethod* at bottom of frame 1154e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier ld $t9, ART_METHOD_QUICK_CODE_OFFSET_64($a0) # get pointer to the code 11551a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jalr $t9 # call the method 11561a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe nop 11571a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $sp, $s8 # restore sp 11581a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 11591a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # pop a4, a5, s0(rSUSPEND), s1(rSELF), s8, ra off of the stack 11601a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a4, 0($sp) 11611a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 8 11621a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a5, 8($sp) 11631a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 9 11641a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s0, 16($sp) 11651a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 16 11661a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s1, 24($sp) 11671a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 17 11681a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s8, 32($sp) 11691a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 30 11701a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $ra, 40($sp) 11711a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 31 11721a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $sp, $sp, 48 11731a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_adjust_cfa_offset -48 11741a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 11751a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # a4 = JValue* result 11761a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # a5 = shorty string 11771a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe lbu $t1, 0($a5) # get result type from shorty 11781a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe li $t2, 68 # put char 'D' into t2 11791a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe beq $t1, $t2, 1f # branch if result type char == 'D' 11801a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe li $t3, 70 # put char 'F' into t3 11811a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe beq $t1, $t3, 1f # branch if result type char == 'F' 11821a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $v0, 0($a4) # store the result 11831a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe dsrl $v1, $v0, 32 11841a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jalr $zero, $ra 11851a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $v1, 4($a4) # store the other half of the result 11861a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe1: 11871a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe mfc1 $v0, $f0 11881a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe mfhc1 $v1, $f0 11891a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $v0, 0($a4) # store the result 11901a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jalr $zero, $ra 11911a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $v1, 4($a4) # store the other half of the result 11921a5c40672783fac98aca5a04ac798a0a0014de65Andreas GampeEND art_quick_invoke_static_stub 11931a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 11946ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 11956ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Entry from managed code that calls artHandleFillArrayDataFromCode and 11966ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * delivers exception on failure. 11976ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 11986ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artHandleFillArrayDataFromCode 11996ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_handle_fill_data 1200fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case exception allocation triggers GC 1201fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $a2, FRAME_SIZE_SAVE_REFS_ONLY($sp) # pass referrer's Method* 12026ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artHandleFillArrayDataFromCode # (payload offset, Array*, method, Thread*) 12036ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a3, rSELF # pass Thread::Current 12046ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic RETURN_IF_ZERO 12056ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_handle_fill_data 12066ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 12076ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 12086ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Entry from managed code that calls artLockObjectFromCode, may block for GC. 12096ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 12106ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artLockObjectFromCode 12116ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_lock_object 12126ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic beq $a0, $zero, .Lart_quick_throw_null_pointer_exception_gp_set 12136ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic nop 1214fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case we block 12156ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artLockObjectFromCode # (Object* obj, Thread*) 12166ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a1, rSELF # pass Thread::Current 12176ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic RETURN_IF_ZERO 12186ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_lock_object 12196ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 1220c7ed09bd5d6f2c7af3bcba1c39b3f9185af68796Andreas GampeENTRY art_quick_lock_object_no_inline 1221c7ed09bd5d6f2c7af3bcba1c39b3f9185af68796Andreas Gampe beq $a0, $zero, .Lart_quick_throw_null_pointer_exception_gp_set 1222c7ed09bd5d6f2c7af3bcba1c39b3f9185af68796Andreas Gampe nop 1223fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case we block 1224c7ed09bd5d6f2c7af3bcba1c39b3f9185af68796Andreas Gampe jal artLockObjectFromCode # (Object* obj, Thread*) 1225c7ed09bd5d6f2c7af3bcba1c39b3f9185af68796Andreas Gampe move $a1, rSELF # pass Thread::Current 1226c7ed09bd5d6f2c7af3bcba1c39b3f9185af68796Andreas Gampe RETURN_IF_ZERO 1227c7ed09bd5d6f2c7af3bcba1c39b3f9185af68796Andreas GampeEND art_quick_lock_object_no_inline 1228c7ed09bd5d6f2c7af3bcba1c39b3f9185af68796Andreas Gampe 12296ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 12306ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Entry from managed code that calls artUnlockObjectFromCode and delivers exception on failure. 12316ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 12326ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artUnlockObjectFromCode 12336ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_unlock_object 12346ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic beq $a0, $zero, .Lart_quick_throw_null_pointer_exception_gp_set 12356ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic nop 1236fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case exception allocation triggers GC 12376ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artUnlockObjectFromCode # (Object* obj, Thread*) 12386ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a1, rSELF # pass Thread::Current 12396ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic RETURN_IF_ZERO 12406ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_unlock_object 12416ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 1242c7ed09bd5d6f2c7af3bcba1c39b3f9185af68796Andreas GampeENTRY art_quick_unlock_object_no_inline 1243c7ed09bd5d6f2c7af3bcba1c39b3f9185af68796Andreas Gampe beq $a0, $zero, .Lart_quick_throw_null_pointer_exception_gp_set 1244c7ed09bd5d6f2c7af3bcba1c39b3f9185af68796Andreas Gampe nop 1245fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case exception allocation triggers GC 1246c7ed09bd5d6f2c7af3bcba1c39b3f9185af68796Andreas Gampe jal artUnlockObjectFromCode # (Object* obj, Thread*) 1247c7ed09bd5d6f2c7af3bcba1c39b3f9185af68796Andreas Gampe move $a1, rSELF # pass Thread::Current 1248c7ed09bd5d6f2c7af3bcba1c39b3f9185af68796Andreas Gampe RETURN_IF_ZERO 1249c7ed09bd5d6f2c7af3bcba1c39b3f9185af68796Andreas GampeEND art_quick_unlock_object_no_inline 1250c7ed09bd5d6f2c7af3bcba1c39b3f9185af68796Andreas Gampe 12516ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 12526ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Entry from managed code that calls artCheckCastFromCode and delivers exception on failure. 12536ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 12546ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artThrowClassCastException 12556ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_check_cast 12566ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic daddiu $sp, $sp, -32 12576ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .cfi_adjust_cfa_offset 32 12586ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic sd $ra, 24($sp) 12596ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .cfi_rel_offset 31, 24 12606ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic sd $t9, 16($sp) 12616ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic sd $a1, 8($sp) 12626ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic sd $a0, 0($sp) 12636ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artIsAssignableFromCode 126404568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic .cpreturn # Restore gp from t8 in branch delay slot. 126504568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic # t8 may be clobbered in artIsAssignableFromCode. 12666ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic beq $v0, $zero, .Lthrow_class_cast_exception 12676ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ld $ra, 24($sp) 12686ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jalr $zero, $ra 12696ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic daddiu $sp, $sp, 32 12706ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .cfi_adjust_cfa_offset -32 12716ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic.Lthrow_class_cast_exception: 12726ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ld $t9, 16($sp) 12736ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ld $a1, 8($sp) 12746ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ld $a0, 0($sp) 12756ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic daddiu $sp, $sp, 32 12766ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .cfi_adjust_cfa_offset -32 127704568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic SETUP_GP 1278fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_ALL_CALLEE_SAVES_FRAME 12796ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic dla $t9, artThrowClassCastException 12806ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jalr $zero, $t9 # artThrowClassCastException (Class*, Class*, Thread*) 12816ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a2, rSELF # pass Thread::Current 12826ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_check_cast 12836ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 12841aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao 12851aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao /* 12861aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao * Restore rReg's value from offset($sp) if rReg is not the same as rExclude. 12871aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao * nReg is the register number for rReg. 12881aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao */ 12891aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao.macro POP_REG_NE rReg, nReg, offset, rExclude 12901aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .ifnc \rReg, \rExclude 12911aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao ld \rReg, \offset($sp) # restore rReg 12921aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_restore \nReg 12931aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .endif 12941aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao.endm 12951aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao 12961aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao /* 12971aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao * Macro to insert read barrier, only used in art_quick_aput_obj. 12981aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao * rObj and rDest are registers, offset is a defined literal such as MIRROR_OBJECT_CLASS_OFFSET. 12991aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao * TODO: When read barrier has a fast path, add heap unpoisoning support for the fast path. 13001aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao */ 13011aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao.macro READ_BARRIER rDest, rObj, offset 13021aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao#ifdef USE_READ_BARRIER 13031aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao # saved registers used in art_quick_aput_obj: a0-a2, t0-t1, t9, ra. 16B-aligned. 13041aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao daddiu $sp, $sp, -64 13051aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_adjust_cfa_offset 64 13061aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao sd $ra, 56($sp) 13071aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_rel_offset 31, 56 13081aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao sd $t9, 48($sp) 13091aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_rel_offset 25, 48 13101aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao sd $t1, 40($sp) 13111aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_rel_offset 13, 40 13121aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao sd $t0, 32($sp) 13131aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_rel_offset 12, 32 13141aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao sd $a2, 16($sp) # padding slot at offset 24 (padding can be any slot in the 64B) 13151aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_rel_offset 6, 16 13161aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao sd $a1, 8($sp) 13171aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_rel_offset 5, 8 13181aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao sd $a0, 0($sp) 13191aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_rel_offset 4, 0 13201aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao 13216306921722283d2b0f8aac01883ad83215d6e864Man Cao # move $a0, \rRef # pass ref in a0 (no-op for now since parameter ref is unused) 13221aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .ifnc \rObj, $a1 13231aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao move $a1, \rObj # pass rObj 13241aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .endif 13251aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao daddiu $a2, $zero, \offset # pass offset 13261aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao jal artReadBarrierSlow # artReadBarrierSlow(ref, rObj, offset) 13271aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cpreturn # Restore gp from t8 in branch delay slot. 13281aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao # t8 may be clobbered in artReadBarrierSlow. 13291aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao # No need to unpoison return value in v0, artReadBarrierSlow() would do the unpoisoning. 13301aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao move \rDest, $v0 # save return value in rDest 13311aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao # (rDest cannot be v0 in art_quick_aput_obj) 13321aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao 13331aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao ld $a0, 0($sp) # restore registers except rDest 13341aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao # (rDest can only be t0 or t1 in art_quick_aput_obj) 13351aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_restore 4 13361aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao ld $a1, 8($sp) 13371aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_restore 5 13381aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao ld $a2, 16($sp) 13391aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_restore 6 13401aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao POP_REG_NE $t0, 12, 32, \rDest 13411aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao POP_REG_NE $t1, 13, 40, \rDest 13421aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao ld $t9, 48($sp) 13431aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_restore 25 13441aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao ld $ra, 56($sp) # restore $ra 13451aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_restore 31 13461aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao daddiu $sp, $sp, 64 13471aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_adjust_cfa_offset -64 13481aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao SETUP_GP # set up gp because we are not returning 13491aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao#else 13501aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao lwu \rDest, \offset(\rObj) 13511aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao UNPOISON_HEAP_REF \rDest 13521aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao#endif // USE_READ_BARRIER 13531aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao.endm 13541aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao 13556ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 13566ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Entry from managed code for array put operations of objects where the value being stored 13576ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * needs to be checked for compatibility. 13586ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * a0 = array, a1 = index, a2 = value 13596ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 13606ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_aput_obj_with_null_and_bound_check 13616ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic bne $a0, $zero, .Lart_quick_aput_obj_with_bound_check_gp_set 13626ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic nop 13636ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic b .Lart_quick_throw_null_pointer_exception_gp_set 13646ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic nop 13656ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_aput_obj_with_null_and_bound_check 13661a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 13676ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_aput_obj_with_bound_check 13686ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic lwu $t0, MIRROR_ARRAY_LENGTH_OFFSET($a0) 13696ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic sltu $t1, $a1, $t0 13706ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic bne $t1, $zero, .Lart_quick_aput_obj_gp_set 13716ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic nop 13726ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a0, $a1 13736ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic b .Lart_quick_throw_array_bounds_gp_set 13746ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a1, $t0 13756ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_aput_obj_with_bound_check 13761a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 13776ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_aput_obj 13786ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic beq $a2, $zero, .Ldo_aput_null 13796ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic nop 13801aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao READ_BARRIER $t0, $a0, MIRROR_OBJECT_CLASS_OFFSET 13811aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao READ_BARRIER $t1, $a2, MIRROR_OBJECT_CLASS_OFFSET 13821aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao READ_BARRIER $t0, $t0, MIRROR_CLASS_COMPONENT_TYPE_OFFSET 13836ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic bne $t1, $t0, .Lcheck_assignability # value's type == array's component type - trivial assignability 13846ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic nop 13856ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic.Ldo_aput: 13866ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic dsll $a1, $a1, 2 13876ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic daddu $t0, $a0, $a1 1388bfa5eb6e8d15ea73a36f8df449630f285a91e995Hiroshi Yamauchi POISON_HEAP_REF $a2 13896ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic sw $a2, MIRROR_OBJECT_ARRAY_DATA_OFFSET($t0) 13906ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ld $t0, THREAD_CARD_TABLE_OFFSET(rSELF) 13916ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic dsrl $t1, $a0, 7 13926ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic daddu $t1, $t1, $t0 13936ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic sb $t0, ($t1) 13946ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jalr $zero, $ra 139504568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic .cpreturn # Restore gp from t8 in branch delay slot. 13966ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic.Ldo_aput_null: 13976ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic dsll $a1, $a1, 2 13986ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic daddu $t0, $a0, $a1 13996ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic sw $a2, MIRROR_OBJECT_ARRAY_DATA_OFFSET($t0) 14006ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jalr $zero, $ra 140104568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic .cpreturn # Restore gp from t8 in branch delay slot. 14026ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic.Lcheck_assignability: 14036ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic daddiu $sp, $sp, -64 14046ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .cfi_adjust_cfa_offset 64 14056ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic sd $ra, 56($sp) 14066ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .cfi_rel_offset 31, 56 14076ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic sd $t9, 24($sp) 14086ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic sd $a2, 16($sp) 14096ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic sd $a1, 8($sp) 14106ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic sd $a0, 0($sp) 14116ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a1, $t1 14126ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a0, $t0 14136ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artIsAssignableFromCode # (Class*, Class*) 141404568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic .cpreturn # Restore gp from t8 in branch delay slot. 141504568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic # t8 may be clobbered in artIsAssignableFromCode. 14166ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ld $ra, 56($sp) 14176ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ld $t9, 24($sp) 14186ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ld $a2, 16($sp) 14196ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ld $a1, 8($sp) 14206ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ld $a0, 0($sp) 14216ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic daddiu $sp, $sp, 64 14226ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .cfi_adjust_cfa_offset -64 142304568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic SETUP_GP 14246ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic bne $v0, $zero, .Ldo_aput 14256ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic nop 1426fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_ALL_CALLEE_SAVES_FRAME 14276ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a1, $a2 14286ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic dla $t9, artThrowArrayStoreException 14296ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jalr $zero, $t9 # artThrowArrayStoreException(Class*, Class*, Thread*) 14306ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a2, rSELF # pass Thread::Current 14316ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_aput_obj 14326ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 14336ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 14346ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to resolve a static field and load a boolean primitive value. 14356ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 14366ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artGetBooleanStaticFromCode 14376ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_get_boolean_static 1438fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 1439fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $a1, FRAME_SIZE_SAVE_REFS_ONLY($sp) # pass referrer's Method* 14406ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artGetBooleanStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) 14416ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a2, rSELF # pass Thread::Current 14426ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic RETURN_IF_NO_EXCEPTION 14436ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_get_boolean_static 14446ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 14456ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 14466ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to resolve a static field and load a byte primitive value. 14476ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 14486ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artGetByteStaticFromCode 14496ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_get_byte_static 1450fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 1451fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $a1, FRAME_SIZE_SAVE_REFS_ONLY($sp) # pass referrer's Method* 14526ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artGetByteStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) 14536ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a2, rSELF # pass Thread::Current 14546ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic RETURN_IF_NO_EXCEPTION 14556ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_get_byte_static 14566ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 14576ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 14586ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to resolve a static field and load a char primitive value. 14596ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 14606ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artGetCharStaticFromCode 14616ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_get_char_static 1462fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 1463fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $a1, FRAME_SIZE_SAVE_REFS_ONLY($sp) # pass referrer's Method* 14646ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artGetCharStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) 14656ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a2, rSELF # pass Thread::Current 14666ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic RETURN_IF_NO_EXCEPTION 14676ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_get_char_static 14686ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 14696ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 14706ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to resolve a static field and load a short primitive value. 14716ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 14726ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artGetShortStaticFromCode 14736ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_get_short_static 1474fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 1475fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $a1, FRAME_SIZE_SAVE_REFS_ONLY($sp) # pass referrer's Method* 14766ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artGetShortStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) 14776ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a2, rSELF # pass Thread::Current 14786ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic RETURN_IF_NO_EXCEPTION 14796ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_get_short_static 14806ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 14816ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 14826ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to resolve a static field and load a 32-bit primitive value. 14836ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 14846ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artGet32StaticFromCode 14856ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_get32_static 1486fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 1487fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $a1, FRAME_SIZE_SAVE_REFS_ONLY($sp) # pass referrer's Method* 14886ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artGet32StaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) 14896ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a2, rSELF # pass Thread::Current 14906ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic RETURN_IF_NO_EXCEPTION 14916ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_get32_static 14926ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 14936ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 14946ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to resolve a static field and load a 64-bit primitive value. 14956ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 14966ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artGet64StaticFromCode 14976ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_get64_static 1498fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 1499fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $a1, FRAME_SIZE_SAVE_REFS_ONLY($sp) # pass referrer's Method* 15006ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artGet64StaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) 15016ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a2, rSELF # pass Thread::Current 15026ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic RETURN_IF_NO_EXCEPTION 15036ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_get64_static 15046ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 15056ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 15066ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to resolve a static field and load an object reference. 15076ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 15086ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artGetObjStaticFromCode 15096ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_get_obj_static 1510fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 1511fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $a1, FRAME_SIZE_SAVE_REFS_ONLY($sp) # pass referrer's Method* 15126ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artGetObjStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) 15136ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a2, rSELF # pass Thread::Current 15146ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic RETURN_IF_NO_EXCEPTION 15156ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_get_obj_static 15166ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 15176ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 15186ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to resolve an instance field and load a boolean primitive value. 15196ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 15206ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artGetBooleanInstanceFromCode 15216ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_get_boolean_instance 1522fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 1523fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $a2, FRAME_SIZE_SAVE_REFS_ONLY($sp) # pass referrer's Method* 15246ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artGetBooleanInstanceFromCode # (field_idx, Object*, referrer, Thread*) 15256ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a3, rSELF # pass Thread::Current 15266ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic RETURN_IF_NO_EXCEPTION 15276ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_get_boolean_instance 15286ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 15296ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 15306ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to resolve an instance field and load a byte primitive value. 15316ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 15326ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artGetByteInstanceFromCode 15336ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_get_byte_instance 1534fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 1535fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $a2, FRAME_SIZE_SAVE_REFS_ONLY($sp) # pass referrer's Method* 15366ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artGetByteInstanceFromCode # (field_idx, Object*, referrer, Thread*) 15376ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a3, rSELF # pass Thread::Current 15386ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic RETURN_IF_NO_EXCEPTION 15396ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_get_byte_instance 15406ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 15416ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 15426ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to resolve an instance field and load a char primitive value. 15436ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 15446ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artGetCharInstanceFromCode 15456ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_get_char_instance 1546fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 1547fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $a2, FRAME_SIZE_SAVE_REFS_ONLY($sp) # pass referrer's Method* 15486ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artGetCharInstanceFromCode # (field_idx, Object*, referrer, Thread*) 15496ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a3, rSELF # pass Thread::Current 15506ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic RETURN_IF_NO_EXCEPTION 15516ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_get_char_instance 15526ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 15536ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 15546ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to resolve an instance field and load a short primitive value. 15556ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 15566ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artGetShortInstanceFromCode 15576ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_get_short_instance 1558fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 1559fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $a2, FRAME_SIZE_SAVE_REFS_ONLY($sp) # pass referrer's Method* 15606ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artGetShortInstanceFromCode # (field_idx, Object*, referrer, Thread*) 15616ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a3, rSELF # pass Thread::Current 15626ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic RETURN_IF_NO_EXCEPTION 15636ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_get_short_instance 15646ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 15656ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 15666ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to resolve an instance field and load a 32-bit primitive value. 15676ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 15686ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artGet32InstanceFromCode 15696ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_get32_instance 1570fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 1571fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $a2, FRAME_SIZE_SAVE_REFS_ONLY($sp) # pass referrer's Method* 15726ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artGet32InstanceFromCode # (field_idx, Object*, referrer, Thread*) 15736ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a3, rSELF # pass Thread::Current 15746ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic RETURN_IF_NO_EXCEPTION 15756ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_get32_instance 15766ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 15776ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 15786ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to resolve an instance field and load a 64-bit primitive value. 15796ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 15806ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artGet64InstanceFromCode 15816ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_get64_instance 1582fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 1583fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $a2, FRAME_SIZE_SAVE_REFS_ONLY($sp) # pass referrer's Method* 15846ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artGet64InstanceFromCode # (field_idx, Object*, referrer, Thread*) 15856ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a3, rSELF # pass Thread::Current 15866ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic RETURN_IF_NO_EXCEPTION 15876ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_get64_instance 15886ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 15896ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 15906ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to resolve an instance field and load an object reference. 15916ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 15926ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artGetObjInstanceFromCode 15936ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_get_obj_instance 1594fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 1595fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $a2, FRAME_SIZE_SAVE_REFS_ONLY($sp) # pass referrer's Method* 15966ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artGetObjInstanceFromCode # (field_idx, Object*, referrer, Thread*) 15976ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a3, rSELF # pass Thread::Current 15986ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic RETURN_IF_NO_EXCEPTION 15996ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_get_obj_instance 16006ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 16016ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 16026ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to resolve a static field and store a 8-bit primitive value. 16036ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 16046ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artSet8StaticFromCode 16056ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_set8_static 1606fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 1607fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $a2, FRAME_SIZE_SAVE_REFS_ONLY($sp) # pass referrer's Method* 16086ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artSet8StaticFromCode # (field_idx, new_val, referrer, Thread*) 16096ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a3, rSELF # pass Thread::Current 16106ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic RETURN_IF_ZERO 16116ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_set8_static 16126ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 16136ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 16146ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to resolve a static field and store a 16-bit primitive value. 16156ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 16166ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artSet16StaticFromCode 16176ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_set16_static 1618fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 1619fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $a2, FRAME_SIZE_SAVE_REFS_ONLY($sp) # pass referrer's Method* 16206ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artSet16StaticFromCode # (field_idx, new_val, referrer, Thread*) 16216ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a3, rSELF # pass Thread::Current 16226ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic RETURN_IF_ZERO 16236ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_set16_static 16246ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 16256ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 16266ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to resolve a static field and store a 32-bit primitive value. 16276ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 16286ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artSet32StaticFromCode 16296ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_set32_static 1630fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 1631fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $a2, FRAME_SIZE_SAVE_REFS_ONLY($sp) # pass referrer's Method* 16326ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artSet32StaticFromCode # (field_idx, new_val, referrer, Thread*) 16336ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a3, rSELF # pass Thread::Current 16346ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic RETURN_IF_ZERO 16356ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_set32_static 16366ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 16376ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 16386ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to resolve a static field and store a 64-bit primitive value. 16396ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 16406ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artSet64StaticFromCode 16416ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_set64_static 1642fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 1643e460d1df1f789c7c8bb97024a8efbd713ac175e9Calin Juravle # a2 contains the new val 1644fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $a1, FRAME_SIZE_SAVE_REFS_ONLY($sp) # pass referrer's Method* 16456ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artSet64StaticFromCode # (field_idx, referrer, new_val, Thread*) 16466ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a3, rSELF # pass Thread::Current 16476ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic RETURN_IF_ZERO 16486ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_set64_static 16496ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 16506ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 16516ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to resolve a static field and store an object reference. 16526ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 16536ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artSetObjStaticFromCode 16546ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_set_obj_static 1655fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 1656fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $a2, FRAME_SIZE_SAVE_REFS_ONLY($sp) # pass referrer's Method* 16576ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artSetObjStaticFromCode # (field_idx, new_val, referrer, Thread*) 16586ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a3, rSELF # pass Thread::Current 16596ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic RETURN_IF_ZERO 16606ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_set_obj_static 16616ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 16626ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 16636ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to resolve an instance field and store a 8-bit primitive value. 16646ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 16656ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artSet8InstanceFromCode 16666ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_set8_instance 1667fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 1668fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $a3, FRAME_SIZE_SAVE_REFS_ONLY($sp) # pass referrer's Method* 16696ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artSet8InstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*) 16706ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a4, rSELF # pass Thread::Current 16716ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic RETURN_IF_ZERO 16726ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_set8_instance 16736ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 16746ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 16756ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to resolve an instance field and store a 16-bit primitive value. 16766ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 16776ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artSet16InstanceFromCode 16786ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_set16_instance 1679fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 1680fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $a3, FRAME_SIZE_SAVE_REFS_ONLY($sp) # pass referrer's Method* 16816ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artSet16InstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*) 16826ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a4, rSELF # pass Thread::Current 16836ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic RETURN_IF_ZERO 16846ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_set16_instance 16856ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 16866ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 16876ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to resolve an instance field and store a 32-bit primitive value. 16886ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 16896ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artSet32InstanceFromCode 16906ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_set32_instance 1691fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 1692fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $a3, FRAME_SIZE_SAVE_REFS_ONLY($sp) # pass referrer's Method* 16936ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artSet32InstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*) 16946ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a4, rSELF # pass Thread::Current 16956ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic RETURN_IF_ZERO 16966ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_set32_instance 16976ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 16986ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 16996ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to resolve an instance field and store a 64-bit primitive value. 17006ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 17016ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artSet64InstanceFromCode 17026ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_set64_instance 1703fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 1704fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $a3, FRAME_SIZE_SAVE_REFS_ONLY($sp) # pass referrer's Method* 17056ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artSet64InstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*) 17066ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a4, rSELF # pass Thread::Current 17076ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic RETURN_IF_ZERO 17086ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_set64_instance 17096ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 17106ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 17116ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to resolve an instance field and store an object reference. 17126ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 17136ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artSetObjInstanceFromCode 17146ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_set_obj_instance 1715fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 1716fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $a3, FRAME_SIZE_SAVE_REFS_ONLY($sp) # pass referrer's Method* 17176ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artSetObjInstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*) 17186ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a4, rSELF # pass Thread::Current 17196ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic RETURN_IF_ZERO 17206ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_set_obj_instance 17216ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 17225ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko// Macro to facilitate adding new allocation entrypoints. 17235ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko.macro ONE_ARG_DOWNCALL name, entrypoint, return 17245ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko .extern \entrypoint 17255ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir MarkoENTRY \name 1726fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 17275ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko jal \entrypoint 17285ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko move $a1, rSELF # pass Thread::Current 17295ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko \return 17305ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir MarkoEND \name 17315ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko.endm 17321a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 17331a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe// Macro to facilitate adding new allocation entrypoints. 17341a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.macro TWO_ARG_DOWNCALL name, entrypoint, return 17356ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern \entrypoint 17361a5c40672783fac98aca5a04ac798a0a0014de65Andreas GampeENTRY \name 1737fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 17386ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal \entrypoint 17396ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a2, rSELF # pass Thread::Current 17406ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic \return 17411a5c40672783fac98aca5a04ac798a0a0014de65Andreas GampeEND \name 17421a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.endm 17431a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 17441a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.macro THREE_ARG_DOWNCALL name, entrypoint, return 17456ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern \entrypoint 17461a5c40672783fac98aca5a04ac798a0a0014de65Andreas GampeENTRY \name 1747fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 17486ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal \entrypoint 17496ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a3, rSELF # pass Thread::Current 17506ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic \return 17511a5c40672783fac98aca5a04ac798a0a0014de65Andreas GampeEND \name 17521a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.endm 17531a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 1754e85e123a2dff7d4b20266183a0583f9364a8b824Vladimir Marko.macro FOUR_ARG_DOWNCALL name, entrypoint, return 1755e85e123a2dff7d4b20266183a0583f9364a8b824Vladimir Marko .extern \entrypoint 1756e85e123a2dff7d4b20266183a0583f9364a8b824Vladimir MarkoENTRY \name 1757fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 1758e85e123a2dff7d4b20266183a0583f9364a8b824Vladimir Marko jal \entrypoint 1759e85e123a2dff7d4b20266183a0583f9364a8b824Vladimir Marko move $a4, rSELF # pass Thread::Current 1760e85e123a2dff7d4b20266183a0583f9364a8b824Vladimir Marko \return 1761e85e123a2dff7d4b20266183a0583f9364a8b824Vladimir MarkoEND \name 1762e85e123a2dff7d4b20266183a0583f9364a8b824Vladimir Marko.endm 1763e85e123a2dff7d4b20266183a0583f9364a8b824Vladimir Marko 17641a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe// Generate the allocation entrypoints for each allocator. 1765982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran JakovljevicGENERATE_ALLOC_ENTRYPOINTS_FOR_EACH_ALLOCATOR 176610d4c08c0ea9df0a85a11e1c77974df24078c0ecHiroshi Yamauchi 1767982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic// A hand-written override for GENERATE_ALLOC_ENTRYPOINTS_ALLOC_OBJECT(_rosalloc, RosAlloc). 1768982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran JakovljevicENTRY art_quick_alloc_object_rosalloc 1769982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic 1770982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic # Fast path rosalloc allocation 1771982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic # a0: type_idx 1772982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic # a1: ArtMethod* 1773982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic # s1: Thread::Current 1774982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic # ----------------------------- 1775982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic # t0: class 1776982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic # t1: object size 1777982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic # t2: rosalloc run 1778982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic # t3: thread stack top offset 1779982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic # a4: thread stack bottom offset 1780982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic # v0: free list head 1781982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic # 1782982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic # a5, a6 : temps 1783982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic 1784982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic ld $t0, ART_METHOD_DEX_CACHE_TYPES_OFFSET_64($a1) # Load dex cache resolved types array. 1785982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic 1786982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic dsll $a5, $a0, COMPRESSED_REFERENCE_SIZE_SHIFT # Shift the value. 1787982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic daddu $a5, $t0, $a5 # Compute the index. 1788982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic lwu $t0, 0($a5) # Load class (t0). 1789982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic beqzc $t0, .Lart_quick_alloc_object_rosalloc_slow_path 1790982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic 1791982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic li $a6, MIRROR_CLASS_STATUS_INITIALIZED 1792982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic lwu $a5, MIRROR_CLASS_STATUS_OFFSET($t0) # Check class status. 1793982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic bnec $a5, $a6, .Lart_quick_alloc_object_rosalloc_slow_path 1794982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic 1795982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic # Add a fake dependence from the following access flag and size loads to the status load. This 1796982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic # is to prevent those loads from being reordered above the status load and reading wrong values. 1797982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic xor $a5, $a5, $a5 1798982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic daddu $t0, $t0, $a5 1799982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic 1800982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic lwu $a5, MIRROR_CLASS_ACCESS_FLAGS_OFFSET($t0) # Check if access flags has 1801982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic li $a6, ACCESS_FLAGS_CLASS_IS_FINALIZABLE # kAccClassIsFinalizable. 1802982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic and $a6, $a5, $a6 1803982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic bnezc $a6, .Lart_quick_alloc_object_rosalloc_slow_path 1804982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic 1805982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic ld $t3, THREAD_LOCAL_ALLOC_STACK_TOP_OFFSET($s1) # Check if thread local allocation stack 1806982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic ld $a4, THREAD_LOCAL_ALLOC_STACK_END_OFFSET($s1) # has any room left. 1807982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic bgeuc $t3, $a4, .Lart_quick_alloc_object_rosalloc_slow_path 1808982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic 1809982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic lwu $t1, MIRROR_CLASS_OBJECT_SIZE_OFFSET($t0) # Load object size (t1). 1810982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic li $a5, ROSALLOC_MAX_THREAD_LOCAL_BRACKET_SIZE # Check if size is for a thread local 1811982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic # allocation. 1812982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic bltuc $a5, $t1, .Lart_quick_alloc_object_rosalloc_slow_path 1813982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic 1814982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic # Compute the rosalloc bracket index from the size. Allign up the size by the rosalloc bracket 1815982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic # quantum size and divide by the quantum size and subtract by 1. 1816982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic daddiu $t1, $t1, -1 # Decrease obj size and shift right by 1817982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic dsrl $t1, $t1, ROSALLOC_BRACKET_QUANTUM_SIZE_SHIFT # quantum. 1818982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic 1819982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic dsll $t2, $t1, POINTER_SIZE_SHIFT 1820982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic daddu $t2, $t2, $s1 1821982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic ld $t2, THREAD_ROSALLOC_RUNS_OFFSET($t2) # Load rosalloc run (t2). 1822982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic 1823982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic # Load the free list head (v0). 1824982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic # NOTE: this will be the return val. 1825982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic ld $v0, (ROSALLOC_RUN_FREE_LIST_OFFSET + ROSALLOC_RUN_FREE_LIST_HEAD_OFFSET)($t2) 1826982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic beqzc $v0, .Lart_quick_alloc_object_rosalloc_slow_path 1827982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic 1828982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic # Load the next pointer of the head and update the list head with the next pointer. 1829982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic ld $a5, ROSALLOC_SLOT_NEXT_OFFSET($v0) 1830982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic sd $a5, (ROSALLOC_RUN_FREE_LIST_OFFSET + ROSALLOC_RUN_FREE_LIST_HEAD_OFFSET)($t2) 1831982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic 1832982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic # Store the class pointer in the header. This also overwrites the first pointer. The offsets are 1833982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic # asserted to match. 1834982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic 1835982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic#if ROSALLOC_SLOT_NEXT_OFFSET != MIRROR_OBJECT_CLASS_OFFSET 1836982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic#error "Class pointer needs to overwrite next pointer." 1837982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic#endif 1838982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic 1839982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic POISON_HEAP_REF $t0 1840982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic sw $t0, MIRROR_OBJECT_CLASS_OFFSET($v0) 1841982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic 1842982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic # Push the new object onto the thread local allocation stack and increment the thread local 1843982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic # allocation stack top. 1844982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic sd $v0, 0($t3) 1845982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic daddiu $t3, $t3, COMPRESSED_REFERENCE_SIZE 1846982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic sd $t3, THREAD_LOCAL_ALLOC_STACK_TOP_OFFSET($s1) 1847982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic 1848982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic # Decrement the size of the free list. 1849982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic lw $a5, (ROSALLOC_RUN_FREE_LIST_OFFSET + ROSALLOC_RUN_FREE_LIST_SIZE_OFFSET)($t2) 1850982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic addiu $a5, $a5, -1 1851982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic sw $a5, (ROSALLOC_RUN_FREE_LIST_OFFSET + ROSALLOC_RUN_FREE_LIST_SIZE_OFFSET)($t2) 1852982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic 1853982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic sync # Fence. 1854982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic 1855982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic jalr $zero, $ra 1856982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic .cpreturn # Restore gp from t8 in branch delay slot. 1857982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic 1858982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic.Lart_quick_alloc_object_rosalloc_slow_path: 1859fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME 1860982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic jal artAllocObjectFromCodeRosAlloc 1861982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic move $a2 ,$s1 # Pass self as argument. 1862982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 1863982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran Jakovljevic 1864982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran JakovljevicEND art_quick_alloc_object_rosalloc 18651a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 186610d4c08c0ea9df0a85a11e1c77974df24078c0ecHiroshi YamauchiGENERATE_ALLOC_ENTRYPOINTS_ALLOC_OBJECT(_tlab, TLAB) 186710d4c08c0ea9df0a85a11e1c77974df24078c0ecHiroshi YamauchiGENERATE_ALLOC_ENTRYPOINTS_ALLOC_OBJECT(_region_tlab, RegionTLAB) 186810d4c08c0ea9df0a85a11e1c77974df24078c0ecHiroshi Yamauchi 18696ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 18705ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko * Entry from managed code to resolve a string, this stub will allocate a String and deliver an 18715ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko * exception on error. On success the String is returned. A0 holds the string index. The fast 18725ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko * path check for hit in strings cache has already been performed. 18735ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko */ 18745ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir MarkoONE_ARG_DOWNCALL art_quick_resolve_string, artResolveStringFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 18755ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko 18765ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko /* 18775ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko * Entry from managed code when uninitialized static storage, this stub will run the class 18785ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko * initializer and deliver the exception on error. On success the static storage base is 18795ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko * returned. 18805ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko */ 18815ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir MarkoONE_ARG_DOWNCALL art_quick_initialize_static_storage, artInitializeStaticStorageFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 18825ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko 18835ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko /* 18845ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko * Entry from managed code when dex cache misses for a type_idx. 18855ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko */ 18865ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir MarkoONE_ARG_DOWNCALL art_quick_initialize_type, artInitializeTypeFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 18875ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko 18885ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko /* 18895ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko * Entry from managed code when type_idx needs to be checked for access and dex cache may also 18905ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko * miss. 18915ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko */ 18925ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir MarkoONE_ARG_DOWNCALL art_quick_initialize_type_and_verify_access, artInitializeTypeAndVerifyAccessFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 18935ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko 18945ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko /* 18956ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code when the value in rSUSPEND has been decremented to 0. 18966ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 18976ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artTestSuspendFromCode 1898952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir MarkoENTRY_NO_GP art_quick_test_suspend 1899952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko lh rSUSPEND, THREAD_FLAGS_OFFSET(rSELF) 1900952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko bne rSUSPEND, $zero, 1f 19016ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic daddiu rSUSPEND, $zero, SUSPEND_CHECK_INTERVAL # reset rSUSPEND to SUSPEND_CHECK_INTERVAL 19026ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jalr $zero, $ra 1903952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko nop 19046ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic1: 1905fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_EVERYTHING_FRAME # save everything for stack crawl 19066ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artTestSuspendFromCode # (Thread*) 19076ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a0, rSELF 1908fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko RESTORE_SAVE_EVERYTHING_FRAME 1909952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko jalr $zero, $ra 1910952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko nop 19116ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_test_suspend 19126461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung 19136461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung /* 19146461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung * Called by managed code that is attempting to call a method on a proxy class. On entry 19156461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung * r0 holds the proxy method; r1, r2 and r3 may contain arguments. 19166461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung */ 19176461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung .extern artQuickProxyInvokeHandler 19186461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas LeungENTRY art_quick_proxy_invoke_handler 1919fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_AND_ARGS_FRAME_WITH_METHOD_IN_A0 19206461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung move $a2, rSELF # pass Thread::Current 19216461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung jal artQuickProxyInvokeHandler # (Method* proxy method, receiver, Thread*, SP) 19226461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung move $a3, $sp # pass $sp 19236461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung ld $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ 19246461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung daddiu $sp, $sp, REFS_AND_ARGS_MINUS_REFS_SIZE # skip a0-a7 and f12-f19 1925fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko RESTORE_SAVE_REFS_ONLY_FRAME 19266461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung bne $t0, $zero, 1f 19276461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung dmtc1 $v0, $f0 # place return value to FP return value 19286461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung jalr $zero, $ra 19296461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung dmtc1 $v1, $f1 # place return value to FP return value 19306461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung1: 19316461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung DELIVER_PENDING_EXCEPTION 19326461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas LeungEND art_quick_proxy_invoke_handler 19336461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung 19346ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 193559028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic * Called to resolve an imt conflict. 193659028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic * a0 is the conflict ArtMethod. 193759028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic * t0 is a hidden argument that holds the target interface method's dex method index. 193859028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic * 193959028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic * Mote that this stub writes to a0, t0 and t1. 19406ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 19416ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_imt_conflict_trampoline 194259028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic ld $t1, 0($sp) # Load referrer. 194359028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic ld $t1, ART_METHOD_DEX_CACHE_METHODS_OFFSET_64($t1) # Load dex cache methods array. 194459028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic dsll $t0, $t0, POINTER_SIZE_SHIFT # Calculate offset. 194559028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic daddu $t0, $t1, $t0 # Add offset to base. 194659028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic ld $t0, 0($t0) # Load interface method. 194759028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic ld $a0, ART_METHOD_JNI_OFFSET_64($a0) # Load ImtConflictTable. 194859028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic 194959028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic.Limt_table_iterate: 195059028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic ld $t1, 0($a0) # Load next entry in ImtConflictTable. 195159028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic # Branch if found. 195259028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic beq $t1, $t0, .Limt_table_found 195359028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic nop 195459028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic # If the entry is null, the interface method is not in the ImtConflictTable. 195559028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic beqzc $t1, .Lconflict_trampoline 195659028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic # Iterate over the entries of the ImtConflictTable. 195759028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic daddiu $a0, $a0, 2 * __SIZEOF_POINTER__ # Iterate to the next entry. 195859028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic bc .Limt_table_iterate 195959028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic 196059028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic.Limt_table_found: 196159028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic # We successfully hit an entry in the table. Load the target method and jump to it. 196259028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic ld $a0, __SIZEOF_POINTER__($a0) 196359028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic ld $t9, ART_METHOD_QUICK_CODE_OFFSET_64($a0) 196459028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic jr $t9 196559028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic .cpreturn # Restore gp from t8 in branch delay slot. 196659028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic 196759028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic.Lconflict_trampoline: 196859028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic # Call the runtime stub to populate the ImtConflictTable and jump to the resolved method. 19693031c8da0c5009183f770b005c245f9bf2a4d01bAndreas Gampe INVOKE_TRAMPOLINE_BODY artInvokeInterfaceTrampoline 19706ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_imt_conflict_trampoline 1971cc7c39d747f5802282adcc51ffe44405f116f84bAndreas Gampe 1972cc7c39d747f5802282adcc51ffe44405f116f84bAndreas Gampe .extern artQuickResolutionTrampoline 1973cc7c39d747f5802282adcc51ffe44405f116f84bAndreas GampeENTRY art_quick_resolution_trampoline 1974fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_AND_ARGS_FRAME 1975cc7c39d747f5802282adcc51ffe44405f116f84bAndreas Gampe move $a2, rSELF # pass Thread::Current 1976cc7c39d747f5802282adcc51ffe44405f116f84bAndreas Gampe jal artQuickResolutionTrampoline # (Method* called, receiver, Thread*, SP) 1977cc7c39d747f5802282adcc51ffe44405f116f84bAndreas Gampe move $a3, $sp # pass $sp 1978cc7c39d747f5802282adcc51ffe44405f116f84bAndreas Gampe beq $v0, $zero, 1f 1979e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier ld $a0, 0($sp) # load resolved method in $a0 1980cc7c39d747f5802282adcc51ffe44405f116f84bAndreas Gampe # artQuickResolutionTrampoline puts resolved method in *SP 1981fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko RESTORE_SAVE_REFS_AND_ARGS_FRAME 1982cc7c39d747f5802282adcc51ffe44405f116f84bAndreas Gampe move $t9, $v0 # code pointer must be in $t9 to generate the global pointer 1983cc7c39d747f5802282adcc51ffe44405f116f84bAndreas Gampe jalr $zero, $t9 # tail call to method 1984cc7c39d747f5802282adcc51ffe44405f116f84bAndreas Gampe nop 1985cc7c39d747f5802282adcc51ffe44405f116f84bAndreas Gampe1: 1986fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko RESTORE_SAVE_REFS_AND_ARGS_FRAME 1987cc7c39d747f5802282adcc51ffe44405f116f84bAndreas Gampe DELIVER_PENDING_EXCEPTION 1988cc7c39d747f5802282adcc51ffe44405f116f84bAndreas GampeEND art_quick_resolution_trampoline 19891a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 19901a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .extern artQuickGenericJniTrampoline 19911a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .extern artQuickGenericJniEndTrampoline 19921a5c40672783fac98aca5a04ac798a0a0014de65Andreas GampeENTRY art_quick_generic_jni_trampoline 1993fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_AND_ARGS_FRAME_WITH_METHOD_IN_A0 19941a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $s8, $sp # save $sp 19951a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 19961a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # prepare for call to artQuickGenericJniTrampoline(Thread*, SP) 19971a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $a0, rSELF # pass Thread::Current 19981a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $a1, $sp # pass $sp 19991a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jal artQuickGenericJniTrampoline # (Thread*, SP) 20001a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $sp, $sp, -5120 # reserve space on the stack 20011a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 20021a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # The C call will have registered the complete save-frame on success. 20031a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # The result of the call is: 20041a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # v0: ptr to native code, 0 on error. 20051a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # v1: ptr to the bottom of the used area of the alloca, can restore stack till here. 20061a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe beq $v0, $zero, 1f # check entry error 20071a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $t9, $v0 # save the code ptr 20081a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $sp, $v1 # release part of the alloca 20091a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 20101a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # Load parameters from stack into registers 20111a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a0, 0($sp) 20121a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a1, 8($sp) 20131a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a2, 16($sp) 20141a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a3, 24($sp) 20151a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a4, 32($sp) 20161a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a5, 40($sp) 20171a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a6, 48($sp) 20181a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a7, 56($sp) 20191a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # Load FPRs the same as GPRs. Look at BuildNativeCallFrameStateMachine. 20201a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f12, 0($sp) 20211a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f13, 8($sp) 20221a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f14, 16($sp) 20231a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f15, 24($sp) 20241a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f16, 32($sp) 20251a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f17, 40($sp) 20261a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f18, 48($sp) 20271a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f19, 56($sp) 20281a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jalr $t9 # native call 20291a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $sp, $sp, 64 20301a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 20311a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # result sign extension is handled in C code 20321a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # prepare for call to artQuickGenericJniEndTrampoline(Thread*, result, result_f) 20331a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $a0, rSELF # pass Thread::Current 20341a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $a1, $v0 20351a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jal artQuickGenericJniEndTrampoline 20361a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe dmfc1 $a2, $f0 20371a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 20381a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ 2039126d65952a03b3e44d5021208673c01920a982a4Nicolas Geoffray bne $t0, $zero, 1f # check for pending exceptions 20401a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $sp, $s8 # tear down the alloca 20411a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 20421a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # tear dpown the callee-save frame 2043fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko RESTORE_SAVE_REFS_AND_ARGS_FRAME 20441a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 20451a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jalr $zero, $ra 20461a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe dmtc1 $v0, $f0 # place return value to FP return value 20471a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 20481a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe1: 2049126d65952a03b3e44d5021208673c01920a982a4Nicolas Geoffray ld $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF) 2050126d65952a03b3e44d5021208673c01920a982a4Nicolas Geoffray # This will create a new save-all frame, required by the runtime. 20511a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe DELIVER_PENDING_EXCEPTION 20521a5c40672783fac98aca5a04ac798a0a0014de65Andreas GampeEND art_quick_generic_jni_trampoline 20531a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 20541a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .extern artQuickToInterpreterBridge 20551a5c40672783fac98aca5a04ac798a0a0014de65Andreas GampeENTRY art_quick_to_interpreter_bridge 2056fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_AND_ARGS_FRAME 20571a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $a1, rSELF # pass Thread::Current 20581a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jal artQuickToInterpreterBridge # (Method* method, Thread*, SP) 20591a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $a2, $sp # pass $sp 20601a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ 20611a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $sp, $sp, REFS_AND_ARGS_MINUS_REFS_SIZE # skip a0-a7 and f12-f19 2062fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko RESTORE_SAVE_REFS_ONLY_FRAME 20631a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe bne $t0, $zero, 1f 20641a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe dmtc1 $v0, $f0 # place return value to FP return value 20651a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jalr $zero, $ra 20661a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe dmtc1 $v1, $f1 # place return value to FP return value 20671a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe1: 20681a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe DELIVER_PENDING_EXCEPTION 20691a5c40672783fac98aca5a04ac798a0a0014de65Andreas GampeEND art_quick_to_interpreter_bridge 20701a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 20711a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe /* 20721a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * Routine that intercepts method calls and returns. 20731a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe */ 20741a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .extern artInstrumentationMethodEntryFromCode 20751a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .extern artInstrumentationMethodExitFromCode 20761a5c40672783fac98aca5a04ac798a0a0014de65Andreas GampeENTRY art_quick_instrumentation_entry 2077fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_AND_ARGS_FRAME 20781a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $sp, $sp, -16 # space for saving arg0 20791a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_adjust_cfa_offset 16 20801a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $a0, 0($sp) # save arg0 20811a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $a3, $ra # pass $ra 20821a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jal artInstrumentationMethodEntryFromCode # (Method*, Object*, Thread*, RA) 20831a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $a2, rSELF # pass Thread::Current 20841a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $t9, $v0 # $t9 holds reference to code 20851a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a0, 0($sp) # restore arg0 20861a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $sp, $sp, 16 # remove args 20871a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_adjust_cfa_offset -16 2088fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko RESTORE_SAVE_REFS_AND_ARGS_FRAME 20891a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jalr $t9 # call method 20901a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe nop 20911a5c40672783fac98aca5a04ac798a0a0014de65Andreas GampeEND art_quick_instrumentation_entry 20921a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe /* intentional fallthrough */ 20931a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .global art_quick_instrumentation_exit 20941a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampeart_quick_instrumentation_exit: 20951a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_startproc 209604568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic SETUP_GP 20971a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $ra, $zero # link register is to here, so clobber with 0 for later checks 2098fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME 20991a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $t0, $sp # remember bottom of caller's frame 21001a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $sp, $sp, -16 # save return values and set up args 21011a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_adjust_cfa_offset 16 21021a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $v0, 0($sp) 21031a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 2, 0 21041a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe s.d $f0, 8($sp) 21051a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe mov.d $f15, $f0 # pass fpr result 21061a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $a2, $v0 # pass gpr result 21071a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $a1, $t0 # pass $sp 21081a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $a0, rSELF # pass Thread::Current 210904568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic jal artInstrumentationMethodExitFromCode # (Thread*, SP, gpr_res, fpr_res) 211004568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic .cpreturn # Restore gp from t8 in branch delay slot. gp is not used anymore, 211104568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic # and t8 may be clobbered in artInstrumentationMethodExitFromCode. 211204568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic 2113f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung move $t9, $v0 # set aside returned link register 21141a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $ra, $v1 # set link register for deoptimization 21151a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $v0, 0($sp) # restore return values 21161a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f0, 8($sp) 2117f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung jalr $zero, $t9 # return 2118fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko # restore stack, 16 bytes of saved values + ref_only callee save frame 2119fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko daddiu $sp, $sp, 16+FRAME_SIZE_SAVE_REFS_ONLY 2120fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko .cfi_adjust_cfa_offset -(16+FRAME_SIZE_SAVE_REFS_ONLY) 21211a5c40672783fac98aca5a04ac798a0a0014de65Andreas GampeEND art_quick_instrumentation_exit 21221a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 21236ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 21246ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Instrumentation has requested that we deoptimize into the interpreter. The deoptimization 21256ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * will long jump to the upcall with a special exception of -1. 21266ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 21276ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artDeoptimize 21286ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artEnterInterpreterFromDeoptimize 21296ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_deoptimize 2130fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_ALL_CALLEE_SAVES_FRAME 21316ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artDeoptimize # artDeoptimize(Thread*, SP) 21326ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic # Returns caller method's frame size. 21336ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a0, rSELF # pass Thread::current 21346ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_deoptimize 21356ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 21360747466fca310eedea5fc49e37d54f240a0b3c0fSebastien Hertz /* 21370747466fca310eedea5fc49e37d54f240a0b3c0fSebastien Hertz * Compiled code has requested that we deoptimize into the interpreter. The deoptimization 21380747466fca310eedea5fc49e37d54f240a0b3c0fSebastien Hertz * will long jump to the upcall with a special exception of -1. 21390747466fca310eedea5fc49e37d54f240a0b3c0fSebastien Hertz */ 21400747466fca310eedea5fc49e37d54f240a0b3c0fSebastien Hertz .extern artDeoptimizeFromCompiledCode 2141239d6eaff0cbb5c4c0139f7053a012758799f186Vladimir MarkoENTRY_NO_GP art_quick_deoptimize_from_compiled_code 2142239d6eaff0cbb5c4c0139f7053a012758799f186Vladimir Marko SETUP_SAVE_EVERYTHING_FRAME 21430747466fca310eedea5fc49e37d54f240a0b3c0fSebastien Hertz jal artDeoptimizeFromCompiledCode # artDeoptimizeFromCompiledCode(Thread*, SP) 21440747466fca310eedea5fc49e37d54f240a0b3c0fSebastien Hertz # Returns caller method's frame size. 21450747466fca310eedea5fc49e37d54f240a0b3c0fSebastien Hertz move $a0, rSELF # pass Thread::current 21460747466fca310eedea5fc49e37d54f240a0b3c0fSebastien HertzEND art_quick_deoptimize_from_compiled_code 21470747466fca310eedea5fc49e37d54f240a0b3c0fSebastien Hertz 21489701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen .set push 21499701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen .set noat 21509701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen/* java.lang.String.compareTo(String anotherString) */ 21519701c2ee2dde033e2269dcfc592a09f21151e97eChris LarsenENTRY_NO_GP art_quick_string_compareto 21529701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen/* $a0 holds address of "this" */ 21539701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen/* $a1 holds address of "anotherString" */ 21549701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen beq $a0,$a1,9f # this and anotherString are the same object 21559701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen move $v0,$zero 21569701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen 21579701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen lw $a2,MIRROR_STRING_COUNT_OFFSET($a0) # this.length() 21589701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen lw $a3,MIRROR_STRING_COUNT_OFFSET($a1) # anotherString.length() 2159cf283daf579e9eda586f312c3fc89444601e2525Chris Larsen MINu $t2, $a2, $a3 2160cf283daf579e9eda586f312c3fc89444601e2525Chris Larsen# $t2 now holds min(this.length(),anotherString.length()) 21619701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen 21629701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen beqz $t2,9f # while min(this.length(),anotherString.length())-i != 0 21639701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen subu $v0,$a2,$a3 # if $t2==0 return 21649701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen # (this.length() - anotherString.length()) 21659701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen1: 21669701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen lhu $t0,MIRROR_STRING_VALUE_OFFSET($a0) # while this.charAt(i) == anotherString.charAt(i) 21679701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen lhu $t1,MIRROR_STRING_VALUE_OFFSET($a1) 21689701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen bne $t0,$t1,9f # if this.charAt(i) != anotherString.charAt(i) 21699701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen subu $v0,$t0,$t1 # return (this.charAt(i) - anotherString.charAt(i)) 21709701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen daddiu $a0,$a0,2 # point at this.charAt(i++) 21719701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen subu $t2,$t2,1 # new value of 21729701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen # min(this.length(),anotherString.length())-i 21739701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen bnez $t2,1b 21749701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen daddiu $a1,$a1,2 # point at anotherString.charAt(i++) 21759701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen subu $v0,$a2,$a3 21769701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen 21779701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen9: 21789701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen j $ra 21799701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen nop 21809701c2ee2dde033e2269dcfc592a09f21151e97eChris LarsenEND art_quick_string_compareto 21819701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen 21829701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen/* java.lang.String.indexOf(int ch, int fromIndex=0) */ 21839701c2ee2dde033e2269dcfc592a09f21151e97eChris LarsenENTRY_NO_GP art_quick_indexof 21849701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen/* $a0 holds address of "this" */ 2185cf283daf579e9eda586f312c3fc89444601e2525Chris Larsen/* $a1 holds "ch" */ 2186cf283daf579e9eda586f312c3fc89444601e2525Chris Larsen/* $a2 holds "fromIndex" */ 21879701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen lw $t0,MIRROR_STRING_COUNT_OFFSET($a0) # this.length() 2188cf283daf579e9eda586f312c3fc89444601e2525Chris Larsen slt $at, $a2, $zero # if fromIndex < 0 2189cf283daf579e9eda586f312c3fc89444601e2525Chris Larsen seleqz $a2, $a2, $at # fromIndex = 0; 2190cf283daf579e9eda586f312c3fc89444601e2525Chris Larsen subu $t0,$t0,$a2 # this.length() - fromIndex 2191cf283daf579e9eda586f312c3fc89444601e2525Chris Larsen blez $t0,6f # if this.length()-fromIndex <= 0 21929701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen li $v0,-1 # return -1; 21939701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen 21949701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen sll $v0,$a2,1 # $a0 += $a2 * 2 21959701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen daddu $a0,$a0,$v0 # " " " " " 2196cf283daf579e9eda586f312c3fc89444601e2525Chris Larsen move $v0,$a2 # Set i to fromIndex. 21979701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen 21989701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen1: 21999701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen lhu $t3,MIRROR_STRING_VALUE_OFFSET($a0) # if this.charAt(i) == ch 22009701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen beq $t3,$a1,6f # return i; 22019701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen daddu $a0,$a0,2 # i++ 22029701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen subu $t0,$t0,1 # this.length() - i 22039701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen bnez $t0,1b # while this.length() - i > 0 22049701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen addu $v0,$v0,1 # i++ 22059701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen 22069701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen li $v0,-1 # if this.length() - i <= 0 22079701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen # return -1; 22089701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen 22099701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen6: 22109701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen j $ra 22119701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen nop 22129701c2ee2dde033e2269dcfc592a09f21151e97eChris LarsenEND art_quick_indexof 22139701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen 22149701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen .set pop 2215