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). 3193b7537bfc5a6b7ccb18b3970d8edf14b72464af7Vladimir Marko * when the $sp has already been decremented by FRAME_SIZE_SAVE_EVERYTHING. 320952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko * callee-save: $at + $v0-$v1 + $a0-$a7 + $t0-$t3 + $s0-$s7 + $t8-$t9 + $gp + $s8 + $ra + $s8, 321952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko * $f0-$f31; 28(GPR)+ 32(FPR) + 1x8 bytes padding + method* 322952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko * This macro sets up $gp; entrypoints using it should start with ENTRY_NO_GP. 323952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko */ 3243b7537bfc5a6b7ccb18b3970d8edf14b72464af7Vladimir Marko.macro SETUP_SAVE_EVERYTHING_FRAME_DECREMENTED_SP 325952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko // Ugly compile-time check, but we only have the preprocessor. 326fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko#if (FRAME_SIZE_SAVE_EVERYTHING != 496) 327fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko#error "FRAME_SIZE_SAVE_EVERYTHING(MIPS64) size not as expected." 328952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko#endif 329952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko 330952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko // Save core registers. 331952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $ra, 488($sp) 332952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 31, 488 333952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $s8, 480($sp) 334952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 30, 480 335952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $t9, 464($sp) 336952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 25, 464 337952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $t8, 456($sp) 338952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 24, 456 339952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $s7, 448($sp) 340952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 23, 448 341952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $s6, 440($sp) 342952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 22, 440 343952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $s5, 432($sp) 344952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 21, 432 345952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $s4, 424($sp) 346952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 20, 424 347952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $s3, 416($sp) 348952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 19, 416 349952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $s2, 408($sp) 350952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 18, 408 351952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $s1, 400($sp) 352952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 17, 400 353952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $s0, 392($sp) 354952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 16, 392 355952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $t3, 384($sp) 356952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 15, 384 357952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $t2, 376($sp) 358952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 14, 376 359952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $t1, 368($sp) 360952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 13, 368 361952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $t0, 360($sp) 362952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 12, 360 363952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $a7, 352($sp) 364952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 11, 352 365952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $a6, 344($sp) 366952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 10, 344 367952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $a5, 336($sp) 368952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 9, 336 369952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $a4, 328($sp) 370952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 8, 328 371952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $a3, 320($sp) 372952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 7, 320 373952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $a2, 312($sp) 374952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 6, 312 375952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $a1, 304($sp) 376952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 5, 304 377952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $a0, 296($sp) 378952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 4, 296 379952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $v1, 288($sp) 380952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 3, 288 381952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $v0, 280($sp) 382952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 2, 280 383952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko 384952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko // Set up $gp, clobbering $ra and using the branch delay slot for a useful instruction. 385952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko bal 1f 3862e42cf12e7bd62c5455a9c5ac0fc072de0f31884Goran Jakovljevic .set push 3872e42cf12e7bd62c5455a9c5ac0fc072de0f31884Goran Jakovljevic .set noat 388952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $at, 272($sp) 389952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_rel_offset 1, 272 3902e42cf12e7bd62c5455a9c5ac0fc072de0f31884Goran Jakovljevic .set pop 391952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko1: 3922e42cf12e7bd62c5455a9c5ac0fc072de0f31884Goran Jakovljevic .cpsetup $ra, 472, 1b 393952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko 394952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko // Save FP registers. 395952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f31, 264($sp) 396952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f30, 256($sp) 397952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f29, 248($sp) 398952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f28, 240($sp) 399952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f27, 232($sp) 400952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f26, 224($sp) 401952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f25, 216($sp) 402952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f24, 208($sp) 403952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f23, 200($sp) 404952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f22, 192($sp) 405952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f21, 184($sp) 406952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f20, 176($sp) 407952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f19, 168($sp) 408952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f18, 160($sp) 409952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f17, 152($sp) 410952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f16, 144($sp) 411952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f15, 136($sp) 412952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f14, 128($sp) 413952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f13, 120($sp) 414952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f12, 112($sp) 415952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f11, 104($sp) 416952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f10, 96($sp) 417952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f9, 88($sp) 418952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f8, 80($sp) 419952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f7, 72($sp) 420952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f6, 64($sp) 421952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f5, 56($sp) 422952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f4, 48($sp) 423952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f3, 40($sp) 424952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f2, 32($sp) 425952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f1, 24($sp) 426952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko s.d $f0, 16($sp) 427952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko 428952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko # load appropriate callee-save-method 429952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $t1, %got(_ZN3art7Runtime9instance_E)($gp) 430952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $t1, 0($t1) 431fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $t1, RUNTIME_SAVE_EVERYTHING_METHOD_OFFSET($t1) 432952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $t1, 0($sp) # Place ArtMethod* at bottom of stack. 433952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko # Place sp in Thread::Current()->top_quick_frame. 434952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko sd $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF) 435952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko.endm 436952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko 4373b7537bfc5a6b7ccb18b3970d8edf14b72464af7Vladimir Marko /* 4383b7537bfc5a6b7ccb18b3970d8edf14b72464af7Vladimir Marko * Macro that sets up the callee save frame to conform with 4393b7537bfc5a6b7ccb18b3970d8edf14b72464af7Vladimir Marko * Runtime::CreateCalleeSaveMethod(kSaveEverything). 4403b7537bfc5a6b7ccb18b3970d8edf14b72464af7Vladimir Marko * callee-save: $at + $v0-$v1 + $a0-$a7 + $t0-$t3 + $s0-$s7 + $t8-$t9 + $gp + $s8 + $ra + $s8, 4413b7537bfc5a6b7ccb18b3970d8edf14b72464af7Vladimir Marko * $f0-$f31; 28(GPR)+ 32(FPR) + 1x8 bytes padding + method* 4423b7537bfc5a6b7ccb18b3970d8edf14b72464af7Vladimir Marko * This macro sets up $gp; entrypoints using it should start with ENTRY_NO_GP. 4433b7537bfc5a6b7ccb18b3970d8edf14b72464af7Vladimir Marko */ 4443b7537bfc5a6b7ccb18b3970d8edf14b72464af7Vladimir Marko.macro SETUP_SAVE_EVERYTHING_FRAME 4453b7537bfc5a6b7ccb18b3970d8edf14b72464af7Vladimir Marko daddiu $sp, $sp, -(FRAME_SIZE_SAVE_EVERYTHING) 4463b7537bfc5a6b7ccb18b3970d8edf14b72464af7Vladimir Marko .cfi_adjust_cfa_offset (FRAME_SIZE_SAVE_EVERYTHING) 4473b7537bfc5a6b7ccb18b3970d8edf14b72464af7Vladimir Marko SETUP_SAVE_EVERYTHING_FRAME_DECREMENTED_SP 4483b7537bfc5a6b7ccb18b3970d8edf14b72464af7Vladimir Marko.endm 4493b7537bfc5a6b7ccb18b3970d8edf14b72464af7Vladimir Marko 450fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko.macro RESTORE_SAVE_EVERYTHING_FRAME 451952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko // Restore FP registers. 452952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f31, 264($sp) 453952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f30, 256($sp) 454952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f29, 248($sp) 455952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f28, 240($sp) 456952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f27, 232($sp) 457952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f26, 224($sp) 458952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f25, 216($sp) 459952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f24, 208($sp) 460952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f23, 200($sp) 461952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f22, 192($sp) 462952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f21, 184($sp) 463952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f20, 176($sp) 464952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f19, 168($sp) 465952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f18, 160($sp) 466952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f17, 152($sp) 467952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f16, 144($sp) 468952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f15, 136($sp) 469952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f14, 128($sp) 470952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f13, 120($sp) 471952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f12, 112($sp) 472952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f11, 104($sp) 473952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f10, 96($sp) 474952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f9, 88($sp) 475952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f8, 80($sp) 476952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f7, 72($sp) 477952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f6, 64($sp) 478952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f5, 56($sp) 479952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f4, 48($sp) 480952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f3, 40($sp) 481952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f2, 32($sp) 482952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f1, 24($sp) 483952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko l.d $f0, 16($sp) 484952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko 485952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko // Restore core registers. 4862e42cf12e7bd62c5455a9c5ac0fc072de0f31884Goran Jakovljevic .cpreturn 487952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $ra, 488($sp) 488952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 31 489952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $s8, 480($sp) 490952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 30 491952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $t9, 464($sp) 492952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 25 493952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $t8, 456($sp) 494952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 24 495952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $s7, 448($sp) 496952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 23 497952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $s6, 440($sp) 498952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 22 499952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $s5, 432($sp) 500952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 21 501952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $s4, 424($sp) 502952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 20 503952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $s3, 416($sp) 504952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 19 505952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $s2, 408($sp) 506952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 18 507952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $s1, 400($sp) 508952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 17 509952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $s0, 392($sp) 510952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 16 511952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $t3, 384($sp) 512952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 15 513952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $t2, 376($sp) 514952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 14 515952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $t1, 368($sp) 516952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 13 517952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $t0, 360($sp) 518952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 12 519952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $a7, 352($sp) 520952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 11 521952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $a6, 344($sp) 522952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 10 523952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $a5, 336($sp) 524952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 9 525952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $a4, 328($sp) 526952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 8 527952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $a3, 320($sp) 528952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 7 529952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $a2, 312($sp) 530952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 6 531952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $a1, 304($sp) 532952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 5 533952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $a0, 296($sp) 534952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 4 535952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $v1, 288($sp) 536952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 3 537952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $v0, 280($sp) 538952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 2 5392e42cf12e7bd62c5455a9c5ac0fc072de0f31884Goran Jakovljevic .set push 5402e42cf12e7bd62c5455a9c5ac0fc072de0f31884Goran Jakovljevic .set noat 541952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko ld $at, 272($sp) 542952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_restore 1 5432e42cf12e7bd62c5455a9c5ac0fc072de0f31884Goran Jakovljevic .set pop 544952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko 545952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko daddiu $sp, $sp, 496 546952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko .cfi_adjust_cfa_offset -496 547952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko.endm 548952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko 549952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko /* 5501a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * Macro that set calls through to artDeliverPendingExceptionFromCode, 5511a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * where the pending 5521a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * exception is Thread::Current()->exception_ 5531a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe */ 5541a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.macro DELIVER_PENDING_EXCEPTION 55504568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic SETUP_GP 556fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_ALL_CALLEE_SAVES_FRAME # save callee saves for throw 5571a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe dla $t9, artDeliverPendingExceptionFromCode 5581a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jalr $zero, $t9 # artDeliverPendingExceptionFromCode(Thread*) 5591a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $a0, rSELF # pass Thread::Current 5601a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.endm 5611a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 5621a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.macro RETURN_IF_NO_EXCEPTION 5631a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ 564fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko RESTORE_SAVE_REFS_ONLY_FRAME 5651a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe bne $t0, $zero, 1f # success if no exception is pending 5661a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe nop 5671a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jalr $zero, $ra 5681a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe nop 5691a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe1: 5701a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe DELIVER_PENDING_EXCEPTION 5711a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.endm 5721a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 5731a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.macro RETURN_IF_ZERO 574fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko RESTORE_SAVE_REFS_ONLY_FRAME 5751a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe bne $v0, $zero, 1f # success? 5761a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe nop 5771a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jalr $zero, $ra # return on success 5781a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe nop 5791a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe1: 5801a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe DELIVER_PENDING_EXCEPTION 5811a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.endm 5821a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 5831a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.macro RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 584fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko RESTORE_SAVE_REFS_ONLY_FRAME 5851a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe beq $v0, $zero, 1f # success? 5861a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe nop 5871a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jalr $zero, $ra # return on success 5881a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe nop 5891a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe1: 5901a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe DELIVER_PENDING_EXCEPTION 5911a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.endm 5921a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 5931a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe /* 5943bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic * On stack replacement stub. 5953bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic * On entry: 5963bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic * a0 = stack to copy 5973bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic * a1 = size of stack 5983bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic * a2 = pc to call 5993bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic * a3 = JValue* result 6003bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic * a4 = shorty 6013bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic * a5 = thread 6023bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic */ 6033bc13817a19e36f3833bb44624ef86800892eaadGoran JakovljevicENTRY art_quick_osr_stub 6043bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic move $t0, $sp # save stack pointer 6053bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic daddiu $t1, $sp, -112 # reserve stack space 6063bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic dsrl $t1, $t1, 4 # enforce 16 byte stack alignment 6073bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic dsll $sp, $t1, 4 # update stack pointer 6083bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic 6093bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic // Save callee general purpose registers, SP, T8(GP), RA, A3, and A4 (8x14 bytes) 6103bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sd $ra, 104($sp) 6113bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_rel_offset 31, 104 6123bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sd $s8, 96($sp) 6133bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_rel_offset 30, 96 6143bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sd $t0, 88($sp) # save original stack pointer stored in t0 6153bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_rel_offset 29, 88 6163bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sd $t8, 80($sp) # t8 holds caller's gp, now save it to the stack. 6173bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_rel_offset 28, 80 # Value from gp is pushed, so set the cfi offset accordingly. 6183bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sd $s7, 72($sp) 6193bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_rel_offset 23, 72 6203bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sd $s6, 64($sp) 6213bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_rel_offset 22, 64 6223bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sd $s5, 56($sp) 6233bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_rel_offset 21, 56 6243bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sd $s4, 48($sp) 6253bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_rel_offset 20, 48 6263bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sd $s3, 40($sp) 6273bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_rel_offset 19, 40 6283bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sd $s2, 32($sp) 6293bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_rel_offset 18, 32 6303bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sd $s1, 24($sp) 6313bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_rel_offset 17, 24 6323bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sd $s0, 16($sp) 6333bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_rel_offset 16, 16 6343bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sd $a4, 8($sp) 6353bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_rel_offset 8, 8 6363bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sd $a3, 0($sp) 6373bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_rel_offset 7, 0 6383bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic move rSELF, $a5 # Save managed thread pointer into rSELF 6393bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic 6403bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic daddiu $sp, $sp, -16 6413bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic jal .Losr_entry 6423bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sd $zero, 0($sp) # Store null for ArtMethod* at bottom of frame 6433bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic daddiu $sp, $sp, 16 6443bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic 6453bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic // Restore return value address and shorty address 6463bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic ld $a4, 8($sp) # shorty address 6473bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_restore 8 6483bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic ld $a3, 0($sp) # result value address 6493bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_restore 7 6503bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic 6513bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic lbu $t1, 0($a4) # load return type 6523bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic li $t2, 'D' # put char 'D' into t2 6533bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic beq $t1, $t2, .Losr_fp_result # branch if result type char == 'D' 6543bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic li $t2, 'F' # put char 'F' into t2 6553bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic beq $t1, $t2, .Losr_fp_result # branch if result type char == 'F' 6563bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic nop 6573bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic b .Losr_exit 6583bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic dsrl $v1, $v0, 32 # put high half of result in v1 6593bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic.Losr_fp_result: 6603bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic mfc1 $v0, $f0 6613bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic mfhc1 $v1, $f0 # put high half of FP result in v1 6623bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic.Losr_exit: 6633bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sw $v0, 0($a3) # store low half of result 6643bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sw $v1, 4($a3) # store high half of result 6653bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic 6663bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic // Restore callee registers 6673bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic ld $ra, 104($sp) 6683bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_restore 31 6693bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic ld $s8, 96($sp) 6703bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_restore 30 6713bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic ld $t0, 88($sp) # save SP into t0 for now 6723bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_restore 29 6733bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic ld $t8, 80($sp) # Restore gp back to it's temp storage. 6743bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_restore 28 6753bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic ld $s7, 72($sp) 6763bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_restore 23 6773bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic ld $s6, 64($sp) 6783bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_restore 22 6793bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic ld $s5, 56($sp) 6803bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_restore 21 6813bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic ld $s4, 48($sp) 6823bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_restore 20 6833bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic ld $s3, 40($sp) 6843bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_restore 19 6853bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic ld $s2, 32($sp) 6863bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_restore 18 6873bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic ld $s1, 24($sp) 6883bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_restore 17 6893bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic ld $s0, 16($sp) 6903bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic .cfi_restore 16 6913bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic jalr $zero, $ra 6923bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic move $sp, $t0 6933bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic 6943bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic.Losr_entry: 6953bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic dsubu $sp, $sp, $a1 # Reserve space for callee stack 6963bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic daddiu $a1, $a1, -8 6973bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic daddu $t0, $a1, $sp 6983bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sw $ra, 0($t0) # Store low half of RA per compiler ABI 6993bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic dsrl $t1, $ra, 32 7003bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sw $t1, 4($t0) # Store high half of RA per compiler ABI 7013bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic 7023bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic // Copy arguments into callee stack 7033bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic // Use simple copy routine for now. 7043bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic // 4 bytes per slot. 7053bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic // a0 = source address 7063bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic // a1 = args length in bytes (does not include 8 bytes for RA) 7073bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic // sp = destination address 7083bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic beqz $a1, .Losr_loop_exit 7093bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic daddiu $a1, $a1, -4 7103bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic daddu $t1, $a0, $a1 7113bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic daddu $t2, $sp, $a1 7123bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic.Losr_loop_entry: 7133bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic lw $t0, 0($t1) 7143bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic daddiu $t1, $t1, -4 7153bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic sw $t0, 0($t2) 7163bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic bne $sp, $t2, .Losr_loop_entry 7173bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic daddiu $t2, $t2, -4 7183bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic 7193bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic.Losr_loop_exit: 7203bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic move $t9, $a2 7213bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic jalr $zero, $t9 # Jump to the OSR entry point. 7223bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic nop 7233bc13817a19e36f3833bb44624ef86800892eaadGoran JakovljevicEND art_quick_osr_stub 7243bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic 7253bc13817a19e36f3833bb44624ef86800892eaadGoran Jakovljevic /* 7261a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * On entry $a0 is uint32_t* gprs_ and $a1 is uint32_t* fprs_ 7271a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * FIXME: just guessing about the shape of the jmpbuf. Where will pc be? 7281a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe */ 72904568815cbfa18f0fa8b8d751fb83a1089909660Goran JakovljevicENTRY_NO_GP art_quick_do_long_jump 7301a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f0, 0($a1) 7311a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f1, 8($a1) 7321a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f2, 16($a1) 7331a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f3, 24($a1) 7341a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f4, 32($a1) 7351a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f5, 40($a1) 7361a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f6, 48($a1) 7371a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f7, 56($a1) 7381a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f8, 64($a1) 7391a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f9, 72($a1) 7401a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f10, 80($a1) 7411a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f11, 88($a1) 7421a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f12, 96($a1) 7431a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f13, 104($a1) 7441a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f14, 112($a1) 7451a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f15, 120($a1) 7461a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f16, 128($a1) 7471a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f17, 136($a1) 7481a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f18, 144($a1) 7491a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f19, 152($a1) 7501a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f20, 160($a1) 7511a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f21, 168($a1) 7521a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f22, 176($a1) 7531a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f23, 184($a1) 7541a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f24, 192($a1) 7551a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f25, 200($a1) 7561a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f26, 208($a1) 7571a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f27, 216($a1) 7581a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f28, 224($a1) 7591a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f29, 232($a1) 7601a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f30, 240($a1) 7611a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f31, 248($a1) 7621a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .set push 7631a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .set nomacro 7641a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .set noat 7651a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe# no need to load zero 7661a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $at, 8($a0) 7671a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .set pop 7681a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $v0, 16($a0) 7691a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $v1, 24($a0) 7701a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe# a0 has to be loaded last 7711a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a1, 40($a0) 7721a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a2, 48($a0) 7731a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a3, 56($a0) 7741a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a4, 64($a0) 7751a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a5, 72($a0) 7761a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a6, 80($a0) 7771a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a7, 88($a0) 7781a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $t0, 96($a0) 7791a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $t1, 104($a0) 7801a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $t2, 112($a0) 7811a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $t3, 120($a0) 7821a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s0, 128($a0) 7831a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s1, 136($a0) 7841a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s2, 144($a0) 7851a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s3, 152($a0) 7861a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s4, 160($a0) 7871a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s5, 168($a0) 7881a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s6, 176($a0) 7891a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s7, 184($a0) 7901a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $t8, 192($a0) 7911a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $t9, 200($a0) 7921a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe# no need to load k0, k1 7931a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $gp, 224($a0) 7941a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $sp, 232($a0) 7951a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s8, 240($a0) 7961a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $ra, 248($a0) 7971a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a0, 32($a0) 7981a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $v0, $zero # clear result registers v0 and v1 799dbf056d38dddda10c5f409e3155c7b4211183f63Andreas Gampe jalr $zero, $t9 # do long jump (do not use ra, it must not be clobbered) 8001a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $v1, $zero 8011a5c40672783fac98aca5a04ac798a0a0014de65Andreas GampeEND art_quick_do_long_jump 8021a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 8036ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 8046ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code, saves most registers (forms basis of long jump 8056ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * context) and passes the bottom of the stack. 8066ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * artDeliverExceptionFromCode will place the callee save Method* at 80784bc06e30ba12c3ff07e577c52b63b9df162af7eLazar Trsic * the bottom of the thread. On entry a0 holds Throwable* 8086ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 8096ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_deliver_exception 810fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_ALL_CALLEE_SAVES_FRAME 8116ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic dla $t9, artDeliverExceptionFromCode 8126ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jalr $zero, $t9 # artDeliverExceptionFromCode(Throwable*, Thread*) 8136ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a1, rSELF # pass Thread::Current 8146ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_deliver_exception 8156ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 8166ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 8176ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to create and deliver a NullPointerException 8186ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 8196ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artThrowNullPointerExceptionFromCode 820804b03ffb9b9dc6cc3153e004c2cd38667508b13Vladimir MarkoENTRY_NO_GP art_quick_throw_null_pointer_exception 821804b03ffb9b9dc6cc3153e004c2cd38667508b13Vladimir Marko // Note that setting up $gp does not rely on $t9 here, so branching here directly is OK, 822804b03ffb9b9dc6cc3153e004c2cd38667508b13Vladimir Marko // even after clobbering any registers we don't need to preserve, such as $gp or $t0. 823804b03ffb9b9dc6cc3153e004c2cd38667508b13Vladimir Marko SETUP_SAVE_EVERYTHING_FRAME 8246ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic dla $t9, artThrowNullPointerExceptionFromCode 8256ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jalr $zero, $t9 # artThrowNullPointerExceptionFromCode(Thread*) 8266ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a0, rSELF # pass Thread::Current 8276ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_throw_null_pointer_exception 8281a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 8296ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 830e8e1127da3f154fae8d2eb16a94203544a182159Nicolas Geoffray * Call installed by a signal handler to create and deliver a NullPointerException 831e8e1127da3f154fae8d2eb16a94203544a182159Nicolas Geoffray */ 832e8e1127da3f154fae8d2eb16a94203544a182159Nicolas Geoffray .extern artThrowNullPointerExceptionFromSignal 8333b7537bfc5a6b7ccb18b3970d8edf14b72464af7Vladimir MarkoENTRY_NO_GP_CUSTOM_CFA art_quick_throw_null_pointer_exception_from_signal, FRAME_SIZE_SAVE_EVERYTHING 8343b7537bfc5a6b7ccb18b3970d8edf14b72464af7Vladimir Marko SETUP_SAVE_EVERYTHING_FRAME_DECREMENTED_SP 8353b7537bfc5a6b7ccb18b3970d8edf14b72464af7Vladimir Marko # Retrieve the fault address from the padding where the signal handler stores it. 8363b7537bfc5a6b7ccb18b3970d8edf14b72464af7Vladimir Marko ld $a0, (__SIZEOF_POINTER__)($sp) 837e8e1127da3f154fae8d2eb16a94203544a182159Nicolas Geoffray dla $t9, artThrowNullPointerExceptionFromSignal 838e8e1127da3f154fae8d2eb16a94203544a182159Nicolas Geoffray jalr $zero, $t9 # artThrowNullPointerExceptionFromSignal(uinptr_t, Thread*) 839e8e1127da3f154fae8d2eb16a94203544a182159Nicolas Geoffray move $a1, rSELF # pass Thread::Current 840e8e1127da3f154fae8d2eb16a94203544a182159Nicolas GeoffrayEND art_quick_throw_null_pointer_exception 841e8e1127da3f154fae8d2eb16a94203544a182159Nicolas Geoffray 842e8e1127da3f154fae8d2eb16a94203544a182159Nicolas Geoffray /* 8436ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to create and deliver an ArithmeticException 8446ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 8456ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artThrowDivZeroFromCode 846804b03ffb9b9dc6cc3153e004c2cd38667508b13Vladimir MarkoENTRY_NO_GP art_quick_throw_div_zero 847804b03ffb9b9dc6cc3153e004c2cd38667508b13Vladimir Marko SETUP_SAVE_EVERYTHING_FRAME 8486ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic dla $t9, artThrowDivZeroFromCode 8496ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jalr $zero, $t9 # artThrowDivZeroFromCode(Thread*) 8506ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a0, rSELF # pass Thread::Current 8516ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_throw_div_zero 8521a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 8536ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 8546ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to create and deliver an 8556ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * ArrayIndexOutOfBoundsException 8566ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 8576ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artThrowArrayBoundsFromCode 858804b03ffb9b9dc6cc3153e004c2cd38667508b13Vladimir MarkoENTRY_NO_GP art_quick_throw_array_bounds 859804b03ffb9b9dc6cc3153e004c2cd38667508b13Vladimir Marko // Note that setting up $gp does not rely on $t9 here, so branching here directly is OK, 860804b03ffb9b9dc6cc3153e004c2cd38667508b13Vladimir Marko // even after clobbering any registers we don't need to preserve, such as $gp or $t0. 861804b03ffb9b9dc6cc3153e004c2cd38667508b13Vladimir Marko SETUP_SAVE_EVERYTHING_FRAME 8626ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic dla $t9, artThrowArrayBoundsFromCode 8636ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jalr $zero, $t9 # artThrowArrayBoundsFromCode(index, limit, Thread*) 8646ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a2, rSELF # pass Thread::Current 8656ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_throw_array_bounds 8666ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 8676ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 86887f3fcbd0db352157fc59148e94647ef21b73bceVladimir Marko * Called by managed code to create and deliver a StringIndexOutOfBoundsException 86987f3fcbd0db352157fc59148e94647ef21b73bceVladimir Marko * as if thrown from a call to String.charAt(). 87087f3fcbd0db352157fc59148e94647ef21b73bceVladimir Marko */ 87187f3fcbd0db352157fc59148e94647ef21b73bceVladimir Marko .extern artThrowStringBoundsFromCode 872804b03ffb9b9dc6cc3153e004c2cd38667508b13Vladimir MarkoENTRY_NO_GP art_quick_throw_string_bounds 873804b03ffb9b9dc6cc3153e004c2cd38667508b13Vladimir Marko SETUP_SAVE_EVERYTHING_FRAME 87487f3fcbd0db352157fc59148e94647ef21b73bceVladimir Marko dla $t9, artThrowStringBoundsFromCode 87587f3fcbd0db352157fc59148e94647ef21b73bceVladimir Marko jalr $zero, $t9 # artThrowStringBoundsFromCode(index, limit, Thread*) 87687f3fcbd0db352157fc59148e94647ef21b73bceVladimir Marko move $a2, rSELF # pass Thread::Current 87787f3fcbd0db352157fc59148e94647ef21b73bceVladimir MarkoEND art_quick_throw_string_bounds 87887f3fcbd0db352157fc59148e94647ef21b73bceVladimir Marko 87987f3fcbd0db352157fc59148e94647ef21b73bceVladimir Marko /* 8806ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code to create and deliver a StackOverflowError. 8816ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 8826ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artThrowStackOverflowFromCode 8836ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_throw_stack_overflow 884fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_ALL_CALLEE_SAVES_FRAME 8856ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic dla $t9, artThrowStackOverflowFromCode 8866ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jalr $zero, $t9 # artThrowStackOverflowFromCode(Thread*) 8876ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a0, rSELF # pass Thread::Current 8886ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_throw_stack_overflow 8896ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 8906ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 8916ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * All generated callsites for interface invokes and invocation slow paths will load arguments 8926ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * as usual - except instead of loading arg0/$a0 with the target Method*, arg0/$a0 will contain 8936ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * the method_idx. This wrapper will save arg1-arg3, load the caller's Method*, align the 8946ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * stack and call the appropriate C helper. 8956ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * NOTE: "this" is first visable argument of the target, and so can be found in arg1/$a1. 8966ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * 8976ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * The helper will attempt to locate the target and return a 128-bit result in $v0/$v1 consisting 8986ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * of the target Method* in $v0 and method->code_ in $v1. 8996ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * 9002cebb24bfc3247d3e9be138a3350106737455918Mathieu Chartier * If unsuccessful, the helper will return null/null. There will be a pending exception in the 9016ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * thread and we branch to another stub to deliver it. 9026ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * 9036ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * On success this wrapper will restore arguments and *jump* to the target, leaving the ra 9046ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * pointing back to the original caller. 9056ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 9063031c8da0c5009183f770b005c245f9bf2a4d01bAndreas Gampe.macro INVOKE_TRAMPOLINE_BODY cxx_name 9076ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern \cxx_name 908fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_AND_ARGS_FRAME # save callee saves in case allocation triggers GC 9097ea6a170486d81b127e69673cd1020c4db628c93Nicolas Geoffray move $a2, rSELF # pass Thread::Current 9107ea6a170486d81b127e69673cd1020c4db628c93Nicolas Geoffray jal \cxx_name # (method_idx, this, Thread*, $sp) 9117ea6a170486d81b127e69673cd1020c4db628c93Nicolas Geoffray move $a3, $sp # pass $sp 9126ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a0, $v0 # save target Method* 9136ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $t9, $v1 # save $v0->code_ 914fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko RESTORE_SAVE_REFS_AND_ARGS_FRAME 9156ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic beq $v0, $zero, 1f 9166ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic nop 9176ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jalr $zero, $t9 9186ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic nop 9196ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic1: 9206ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic DELIVER_PENDING_EXCEPTION 9213031c8da0c5009183f770b005c245f9bf2a4d01bAndreas Gampe.endm 9223031c8da0c5009183f770b005c245f9bf2a4d01bAndreas Gampe.macro INVOKE_TRAMPOLINE c_name, cxx_name 9233031c8da0c5009183f770b005c245f9bf2a4d01bAndreas GampeENTRY \c_name 9243031c8da0c5009183f770b005c245f9bf2a4d01bAndreas Gampe INVOKE_TRAMPOLINE_BODY \cxx_name 9256ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND \c_name 9266ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic.endm 9276ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 9286ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicINVOKE_TRAMPOLINE art_quick_invoke_interface_trampoline_with_access_check, artInvokeInterfaceTrampolineWithAccessCheck 9296ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 9306ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicINVOKE_TRAMPOLINE art_quick_invoke_static_trampoline_with_access_check, artInvokeStaticTrampolineWithAccessCheck 9316ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicINVOKE_TRAMPOLINE art_quick_invoke_direct_trampoline_with_access_check, artInvokeDirectTrampolineWithAccessCheck 9326ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicINVOKE_TRAMPOLINE art_quick_invoke_super_trampoline_with_access_check, artInvokeSuperTrampolineWithAccessCheck 9336ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicINVOKE_TRAMPOLINE art_quick_invoke_virtual_trampoline_with_access_check, artInvokeVirtualTrampolineWithAccessCheck 9341a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 9351a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # On entry: 9361a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # t0 = shorty 9371a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # t1 = ptr to arg_array 9381a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # t2 = number of argument bytes remain 9391a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # v0 = ptr to stack frame where to copy arg_array 9401a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # This macro modifies t3, t9 and v0 9411a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.macro LOOP_OVER_SHORTY_LOADING_REG gpu, fpu, label 9421a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe lbu $t3, 0($t0) # get argument type from shorty 9431a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe beqz $t3, \label 9441a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t0, 1 9451a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe li $t9, 68 # put char 'D' into t9 9461a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe beq $t9, $t3, 1f # branch if result type char == 'D' 9471a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe li $t9, 70 # put char 'F' into t9 9481a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe beq $t9, $t3, 2f # branch if result type char == 'F' 9491a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe li $t9, 74 # put char 'J' into t9 9501a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe beq $t9, $t3, 3f # branch if result type char == 'J' 9511a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe nop 9526ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic lw $\gpu, 0($t1) 9531a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $\gpu, 0($v0) 9541a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $v0, 4 9551a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t1, 4 9561a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe b 4f 9571a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t2, -4 # delay slot 9581a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 9591a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe1: # found double 9601a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe lwu $t3, 0($t1) 9611a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe mtc1 $t3, $\fpu 9621a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $t3, 0($v0) 9631a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe lwu $t3, 4($t1) 9641a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe mthc1 $t3, $\fpu 9651a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $t3, 4($v0) 9661a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $v0, 8 9671a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t1, 8 9681a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe b 4f 9691a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t2, -8 # delay slot 9701a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 9711a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe2: # found float 9721a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe lwu $t3, 0($t1) 9731a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe mtc1 $t3, $\fpu 9741a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $t3, 0($v0) 9751a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $v0, 4 9761a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t1, 4 9771a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe b 4f 9781a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t2, -4 # delay slot 9791a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 9801a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe3: # found long (8 bytes) 9811a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe lwu $t3, 0($t1) 9821a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $t3, 0($v0) 9831a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe lwu $t9, 4($t1) 9841a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $t9, 4($v0) 9851a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe dsll $t9, $t9, 32 9861a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe or $\gpu, $t9, $t3 9871a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $v0, 8 9881a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t1, 8 9891a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t2, -8 9901a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe4: 9911a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.endm 9921a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 9931a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe /* 9941a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * Invocation stub for quick code. 9951a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * On entry: 9961a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * a0 = method pointer 9971a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * a1 = argument array that must at least contain the this ptr. 9981a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * a2 = size of argument array in bytes 9991a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * a3 = (managed) thread pointer 10001a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * a4 = JValue* result 10011a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * a5 = shorty 10021a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe */ 100304568815cbfa18f0fa8b8d751fb83a1089909660Goran JakovljevicENTRY_NO_GP art_quick_invoke_stub 10041a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # push a4, a5, s0(rSUSPEND), s1(rSELF), s8, ra onto the stack 10051a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $sp, $sp, -48 10061a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_adjust_cfa_offset 48 10071a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $ra, 40($sp) 10081a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 31, 40 10091a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s8, 32($sp) 10101a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 30, 32 10111a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s1, 24($sp) 10121a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 17, 24 10131a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s0, 16($sp) 10141a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 16, 16 10151a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $a5, 8($sp) 10161a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 9, 8 10171a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $a4, 0($sp) 10181a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 8, 0 10191a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 10201a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $s0, $zero, SUSPEND_CHECK_INTERVAL # reset rSUSPEND to SUSPEND_CHECK_INTERVAL 10211a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $s1, $a3 # move managed thread pointer into s1 (rSELF) 10221a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $s8, $sp # save sp in s8 (fp) 10231a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 1024e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier daddiu $t3, $a2, 24 # add 8 for ArtMethod* and 16 for stack alignment 10251a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe dsrl $t3, $t3, 4 # shift the frame size right 4 10261a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe dsll $t3, $t3, 4 # shift the frame size left 4 to align to 16 bytes 10271a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe dsubu $sp, $sp, $t3 # reserve stack space for argument array 10281a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 10291a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t0, $a5, 1 # t0 = shorty[1] (skip 1 for return type) 10301a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t1, $a1, 4 # t1 = ptr to arg_array[4] (skip this ptr) 10311a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t2, $a2, -4 # t2 = number of argument bytes remain (skip this ptr) 103280f7a57e2aec7515c7a54c4b5c9e703a66623feaNikola Veljkovic daddiu $v0, $sp, 12 # v0 points to where to copy arg_array 10331a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe LOOP_OVER_SHORTY_LOADING_REG a2, f14, call_fn 10341a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe LOOP_OVER_SHORTY_LOADING_REG a3, f15, call_fn 10351a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe LOOP_OVER_SHORTY_LOADING_REG a4, f16, call_fn 10361a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe LOOP_OVER_SHORTY_LOADING_REG a5, f17, call_fn 10371a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe LOOP_OVER_SHORTY_LOADING_REG a6, f18, call_fn 10381a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe LOOP_OVER_SHORTY_LOADING_REG a7, f19, call_fn 10391a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 10401a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # copy arguments onto stack (t2 should be multiples of 4) 10411a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ble $t2, $zero, call_fn # t2 = number of argument bytes remain 10421a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe1: 10431a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe lw $t3, 0($t1) # load from argument array 10441a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t1, $t1, 4 10451a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $t3, 0($v0) # save to stack 10461a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t2, -4 10471a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe bgt $t2, $zero, 1b # t2 = number of argument bytes remain 10481a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $v0, $v0, 4 10491a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 10501a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampecall_fn: 10511a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # call method (a0 and a1 have been untouched) 10521a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe lwu $a1, 0($a1) # make a1 = this ptr 1053e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier sw $a1, 8($sp) # copy this ptr (skip 8 bytes for ArtMethod*) 1054e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier sd $zero, 0($sp) # store null for ArtMethod* at bottom of frame 1055e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier ld $t9, ART_METHOD_QUICK_CODE_OFFSET_64($a0) # get pointer to the code 10561a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jalr $t9 # call the method 10571a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe nop 10581a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $sp, $s8 # restore sp 10591a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 10601a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # pop a4, a5, s1(rSELF), s8, ra off of the stack 10611a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a4, 0($sp) 10621a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 8 10631a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a5, 8($sp) 10641a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 9 10651a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s0, 16($sp) 10661a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 16 10671a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s1, 24($sp) 10681a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 17 10691a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s8, 32($sp) 10701a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 30 10711a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $ra, 40($sp) 10721a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 31 10731a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $sp, $sp, 48 10741a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_adjust_cfa_offset -48 10751a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 10761a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # a4 = JValue* result 10771a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # a5 = shorty string 10781a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe lbu $t1, 0($a5) # get result type from shorty 10791a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe li $t2, 68 # put char 'D' into t2 10801a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe beq $t1, $t2, 1f # branch if result type char == 'D' 10811a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe li $t3, 70 # put char 'F' into t3 10821a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe beq $t1, $t3, 1f # branch if result type char == 'F' 10831a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $v0, 0($a4) # store the result 10841a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe dsrl $v1, $v0, 32 10851a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jalr $zero, $ra 10861a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $v1, 4($a4) # store the other half of the result 10871a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe1: 10881a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe mfc1 $v0, $f0 10891a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe mfhc1 $v1, $f0 10901a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $v0, 0($a4) # store the result 10911a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jalr $zero, $ra 10921a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $v1, 4($a4) # store the other half of the result 10931a5c40672783fac98aca5a04ac798a0a0014de65Andreas GampeEND art_quick_invoke_stub 10941a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 10951a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe /* 10961a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * Invocation static stub for quick code. 10971a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * On entry: 10981a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * a0 = method pointer 10991a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * a1 = argument array that must at least contain the this ptr. 11001a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * a2 = size of argument array in bytes 11011a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * a3 = (managed) thread pointer 11021a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * a4 = JValue* result 11031a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * a5 = shorty 11041a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe */ 110504568815cbfa18f0fa8b8d751fb83a1089909660Goran JakovljevicENTRY_NO_GP art_quick_invoke_static_stub 11061a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 11071a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # push a4, a5, s0(rSUSPEND), s1(rSELF), s8, ra, onto the stack 11081a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $sp, $sp, -48 11091a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_adjust_cfa_offset 48 11101a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $ra, 40($sp) 11111a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 31, 40 11121a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s8, 32($sp) 11131a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 30, 32 11141a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s1, 24($sp) 11151a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 17, 24 11161a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $s0, 16($sp) 11171a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 16, 16 11181a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $a5, 8($sp) 11191a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 9, 8 11201a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $a4, 0($sp) 11211a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 8, 0 11221a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 11231a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $s0, $zero, SUSPEND_CHECK_INTERVAL # reset rSUSPEND to SUSPEND_CHECK_INTERVAL 11241a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $s1, $a3 # move managed thread pointer into s1 (rSELF) 11251a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $s8, $sp # save sp in s8 (fp) 11261a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 1127e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier daddiu $t3, $a2, 24 # add 8 for ArtMethod* and 16 for stack alignment 11281a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe dsrl $t3, $t3, 4 # shift the frame size right 4 11291a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe dsll $t3, $t3, 4 # shift the frame size left 4 to align to 16 bytes 11301a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe dsubu $sp, $sp, $t3 # reserve stack space for argument array 11311a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 11321a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t0, $a5, 1 # t0 = shorty[1] (skip 1 for return type) 11331a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $t1, $a1 # t1 = arg_array 11341a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $t2, $a2 # t2 = number of argument bytes remain 1135e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier daddiu $v0, $sp, 8 # v0 points to where to copy arg_array 11361a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe LOOP_OVER_SHORTY_LOADING_REG a1, f13, call_sfn 11371a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe LOOP_OVER_SHORTY_LOADING_REG a2, f14, call_sfn 11381a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe LOOP_OVER_SHORTY_LOADING_REG a3, f15, call_sfn 11391a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe LOOP_OVER_SHORTY_LOADING_REG a4, f16, call_sfn 11401a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe LOOP_OVER_SHORTY_LOADING_REG a5, f17, call_sfn 11411a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe LOOP_OVER_SHORTY_LOADING_REG a6, f18, call_sfn 11421a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe LOOP_OVER_SHORTY_LOADING_REG a7, f19, call_sfn 11431a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 11441a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # copy arguments onto stack (t2 should be multiples of 4) 11451a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ble $t2, $zero, call_sfn # t2 = number of argument bytes remain 11461a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe1: 11471a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe lw $t3, 0($t1) # load from argument array 11481a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t1, $t1, 4 11491a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $t3, 0($v0) # save to stack 11501a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $t2, -4 11511a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe bgt $t2, $zero, 1b # t2 = number of argument bytes remain 11521a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $v0, $v0, 4 11531a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 11541a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampecall_sfn: 11551a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # call method (a0 has been untouched) 1156e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier sd $zero, 0($sp) # store null for ArtMethod* at bottom of frame 1157e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier ld $t9, ART_METHOD_QUICK_CODE_OFFSET_64($a0) # get pointer to the code 11581a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jalr $t9 # call the method 11591a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe nop 11601a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $sp, $s8 # restore sp 11611a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 11621a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # pop a4, a5, s0(rSUSPEND), s1(rSELF), s8, ra off of the stack 11631a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a4, 0($sp) 11641a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 8 11651a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a5, 8($sp) 11661a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 9 11671a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s0, 16($sp) 11681a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 16 11691a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s1, 24($sp) 11701a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 17 11711a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $s8, 32($sp) 11721a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 30 11731a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $ra, 40($sp) 11741a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_restore 31 11751a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $sp, $sp, 48 11761a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_adjust_cfa_offset -48 11771a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 11781a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # a4 = JValue* result 11791a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # a5 = shorty string 11801a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe lbu $t1, 0($a5) # get result type from shorty 11811a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe li $t2, 68 # put char 'D' into t2 11821a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe beq $t1, $t2, 1f # branch if result type char == 'D' 11831a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe li $t3, 70 # put char 'F' into t3 11841a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe beq $t1, $t3, 1f # branch if result type char == 'F' 11851a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $v0, 0($a4) # store the result 11861a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe dsrl $v1, $v0, 32 11871a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jalr $zero, $ra 11881a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $v1, 4($a4) # store the other half of the result 11891a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe1: 11901a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe mfc1 $v0, $f0 11911a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe mfhc1 $v1, $f0 11921a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $v0, 0($a4) # store the result 11931a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jalr $zero, $ra 11941a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sw $v1, 4($a4) # store the other half of the result 11951a5c40672783fac98aca5a04ac798a0a0014de65Andreas GampeEND art_quick_invoke_static_stub 11961a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 11976ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 11986ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Entry from managed code that calls artHandleFillArrayDataFromCode and 11996ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * delivers exception on failure. 12006ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 12016ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artHandleFillArrayDataFromCode 12026ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_handle_fill_data 1203fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case exception allocation triggers GC 1204fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko ld $a2, FRAME_SIZE_SAVE_REFS_ONLY($sp) # pass referrer's Method* 12056ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artHandleFillArrayDataFromCode # (payload offset, Array*, method, Thread*) 12066ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a3, rSELF # pass Thread::Current 12076ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic RETURN_IF_ZERO 12086ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_handle_fill_data 12096ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 12106ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 12116ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Entry from managed code that calls artLockObjectFromCode, may block for GC. 12126ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 12136ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artLockObjectFromCode 1214804b03ffb9b9dc6cc3153e004c2cd38667508b13Vladimir MarkoENTRY_NO_GP art_quick_lock_object 1215804b03ffb9b9dc6cc3153e004c2cd38667508b13Vladimir Marko beq $a0, $zero, art_quick_throw_null_pointer_exception 12166ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic nop 1217804b03ffb9b9dc6cc3153e004c2cd38667508b13Vladimir Marko .cpsetup $t9, $t8, art_quick_lock_object 1218fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case we block 12196ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artLockObjectFromCode # (Object* obj, Thread*) 12206ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a1, rSELF # pass Thread::Current 12216ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic RETURN_IF_ZERO 12226ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_lock_object 12236ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 1224804b03ffb9b9dc6cc3153e004c2cd38667508b13Vladimir MarkoENTRY_NO_GP art_quick_lock_object_no_inline 1225804b03ffb9b9dc6cc3153e004c2cd38667508b13Vladimir Marko beq $a0, $zero, art_quick_throw_null_pointer_exception 1226c7ed09bd5d6f2c7af3bcba1c39b3f9185af68796Andreas Gampe nop 1227804b03ffb9b9dc6cc3153e004c2cd38667508b13Vladimir Marko .cpsetup $t9, $t8, art_quick_lock_object_no_inline 1228fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case we block 1229c7ed09bd5d6f2c7af3bcba1c39b3f9185af68796Andreas Gampe jal artLockObjectFromCode # (Object* obj, Thread*) 1230c7ed09bd5d6f2c7af3bcba1c39b3f9185af68796Andreas Gampe move $a1, rSELF # pass Thread::Current 1231c7ed09bd5d6f2c7af3bcba1c39b3f9185af68796Andreas Gampe RETURN_IF_ZERO 1232c7ed09bd5d6f2c7af3bcba1c39b3f9185af68796Andreas GampeEND art_quick_lock_object_no_inline 1233c7ed09bd5d6f2c7af3bcba1c39b3f9185af68796Andreas Gampe 12346ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 12356ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Entry from managed code that calls artUnlockObjectFromCode and delivers exception on failure. 12366ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 12376ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artUnlockObjectFromCode 1238804b03ffb9b9dc6cc3153e004c2cd38667508b13Vladimir MarkoENTRY_NO_GP art_quick_unlock_object 1239804b03ffb9b9dc6cc3153e004c2cd38667508b13Vladimir Marko beq $a0, $zero, art_quick_throw_null_pointer_exception 12406ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic nop 1241804b03ffb9b9dc6cc3153e004c2cd38667508b13Vladimir Marko .cpsetup $t9, $t8, art_quick_unlock_object 1242fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case exception allocation triggers GC 12436ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artUnlockObjectFromCode # (Object* obj, Thread*) 12446ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a1, rSELF # pass Thread::Current 12456ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic RETURN_IF_ZERO 12466ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_unlock_object 12476ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 1248804b03ffb9b9dc6cc3153e004c2cd38667508b13Vladimir MarkoENTRY_NO_GP art_quick_unlock_object_no_inline 1249804b03ffb9b9dc6cc3153e004c2cd38667508b13Vladimir Marko beq $a0, $zero, art_quick_throw_null_pointer_exception 1250c7ed09bd5d6f2c7af3bcba1c39b3f9185af68796Andreas Gampe nop 1251804b03ffb9b9dc6cc3153e004c2cd38667508b13Vladimir Marko .cpsetup $t9, $t8, art_quick_unlock_object_no_inline 1252fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case exception allocation triggers GC 1253c7ed09bd5d6f2c7af3bcba1c39b3f9185af68796Andreas Gampe jal artUnlockObjectFromCode # (Object* obj, Thread*) 1254c7ed09bd5d6f2c7af3bcba1c39b3f9185af68796Andreas Gampe move $a1, rSELF # pass Thread::Current 1255c7ed09bd5d6f2c7af3bcba1c39b3f9185af68796Andreas Gampe RETURN_IF_ZERO 1256c7ed09bd5d6f2c7af3bcba1c39b3f9185af68796Andreas GampeEND art_quick_unlock_object_no_inline 1257c7ed09bd5d6f2c7af3bcba1c39b3f9185af68796Andreas Gampe 12586ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 1259b99f4d6463e7cb5654af3893ed7b3113665df658Mathieu Chartier * Entry from managed code that calls artInstanceOfFromCode and delivers exception on failure. 12606ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 1261b99f4d6463e7cb5654af3893ed7b3113665df658Mathieu Chartier .extern artInstanceOfFromCode 1262b99f4d6463e7cb5654af3893ed7b3113665df658Mathieu Chartier .extern artThrowClassCastExceptionForObject 1263b99f4d6463e7cb5654af3893ed7b3113665df658Mathieu ChartierENTRY art_quick_check_instance_of 12646ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic daddiu $sp, $sp, -32 12656ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .cfi_adjust_cfa_offset 32 12666ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic sd $ra, 24($sp) 12676ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .cfi_rel_offset 31, 24 12686ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic sd $t9, 16($sp) 12696ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic sd $a1, 8($sp) 12706ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic sd $a0, 0($sp) 1271b99f4d6463e7cb5654af3893ed7b3113665df658Mathieu Chartier jal artInstanceOfFromCode 127204568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic .cpreturn # Restore gp from t8 in branch delay slot. 127304568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic # t8 may be clobbered in artIsAssignableFromCode. 12746ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic beq $v0, $zero, .Lthrow_class_cast_exception 12756ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ld $ra, 24($sp) 12766ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jalr $zero, $ra 12776ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic daddiu $sp, $sp, 32 12786ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .cfi_adjust_cfa_offset -32 12796ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic.Lthrow_class_cast_exception: 12806ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ld $t9, 16($sp) 12816ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ld $a1, 8($sp) 12826ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ld $a0, 0($sp) 12836ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic daddiu $sp, $sp, 32 12846ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .cfi_adjust_cfa_offset -32 128504568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic SETUP_GP 1286fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_ALL_CALLEE_SAVES_FRAME 1287b99f4d6463e7cb5654af3893ed7b3113665df658Mathieu Chartier dla $t9, artThrowClassCastExceptionForObject 1288b99f4d6463e7cb5654af3893ed7b3113665df658Mathieu Chartier jalr $zero, $t9 # artThrowClassCastException (Object*, Class*, Thread*) 12896ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a2, rSELF # pass Thread::Current 1290b99f4d6463e7cb5654af3893ed7b3113665df658Mathieu ChartierEND art_quick_check_instance_of 12916ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 12921aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao 12931aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao /* 12941aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao * Restore rReg's value from offset($sp) if rReg is not the same as rExclude. 12951aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao * nReg is the register number for rReg. 12961aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao */ 12971aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao.macro POP_REG_NE rReg, nReg, offset, rExclude 12981aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .ifnc \rReg, \rExclude 12991aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao ld \rReg, \offset($sp) # restore rReg 13001aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_restore \nReg 13011aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .endif 13021aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao.endm 13031aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao 13041aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao /* 13051aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao * Macro to insert read barrier, only used in art_quick_aput_obj. 13061aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao * rObj and rDest are registers, offset is a defined literal such as MIRROR_OBJECT_CLASS_OFFSET. 13071aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao * TODO: When read barrier has a fast path, add heap unpoisoning support for the fast path. 13081aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao */ 13091aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao.macro READ_BARRIER rDest, rObj, offset 13101aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao#ifdef USE_READ_BARRIER 13111aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao # saved registers used in art_quick_aput_obj: a0-a2, t0-t1, t9, ra. 16B-aligned. 13121aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao daddiu $sp, $sp, -64 13131aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_adjust_cfa_offset 64 13141aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao sd $ra, 56($sp) 13151aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_rel_offset 31, 56 13161aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao sd $t9, 48($sp) 13171aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_rel_offset 25, 48 13181aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao sd $t1, 40($sp) 13191aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_rel_offset 13, 40 13201aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao sd $t0, 32($sp) 13211aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_rel_offset 12, 32 13221aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao sd $a2, 16($sp) # padding slot at offset 24 (padding can be any slot in the 64B) 13231aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_rel_offset 6, 16 13241aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao sd $a1, 8($sp) 13251aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_rel_offset 5, 8 13261aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao sd $a0, 0($sp) 13271aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_rel_offset 4, 0 13281aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao 13296306921722283d2b0f8aac01883ad83215d6e864Man Cao # move $a0, \rRef # pass ref in a0 (no-op for now since parameter ref is unused) 13301aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .ifnc \rObj, $a1 13311aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao move $a1, \rObj # pass rObj 13321aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .endif 13331aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao daddiu $a2, $zero, \offset # pass offset 13341aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao jal artReadBarrierSlow # artReadBarrierSlow(ref, rObj, offset) 13351aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cpreturn # Restore gp from t8 in branch delay slot. 13361aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao # t8 may be clobbered in artReadBarrierSlow. 13371aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao # No need to unpoison return value in v0, artReadBarrierSlow() would do the unpoisoning. 13381aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao move \rDest, $v0 # save return value in rDest 13391aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao # (rDest cannot be v0 in art_quick_aput_obj) 13401aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao 13411aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao ld $a0, 0($sp) # restore registers except rDest 13421aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao # (rDest can only be t0 or t1 in art_quick_aput_obj) 13431aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_restore 4 13441aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao ld $a1, 8($sp) 13451aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_restore 5 13461aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao ld $a2, 16($sp) 13471aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_restore 6 13481aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao POP_REG_NE $t0, 12, 32, \rDest 13491aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao POP_REG_NE $t1, 13, 40, \rDest 13501aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao ld $t9, 48($sp) 13511aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_restore 25 13521aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao ld $ra, 56($sp) # restore $ra 13531aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_restore 31 13541aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao daddiu $sp, $sp, 64 13551aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_adjust_cfa_offset -64 13561aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao SETUP_GP # set up gp because we are not returning 13571aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao#else 13581aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao lwu \rDest, \offset(\rObj) 13591aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao UNPOISON_HEAP_REF \rDest 13601aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao#endif // USE_READ_BARRIER 13611aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao.endm 13621aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao 13636ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_aput_obj 13646ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic beq $a2, $zero, .Ldo_aput_null 13656ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic nop 13661aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao READ_BARRIER $t0, $a0, MIRROR_OBJECT_CLASS_OFFSET 13671aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao READ_BARRIER $t1, $a2, MIRROR_OBJECT_CLASS_OFFSET 13681aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao READ_BARRIER $t0, $t0, MIRROR_CLASS_COMPONENT_TYPE_OFFSET 13696ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic bne $t1, $t0, .Lcheck_assignability # value's type == array's component type - trivial assignability 13706ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic nop 13716ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic.Ldo_aput: 13726ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic dsll $a1, $a1, 2 13736ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic daddu $t0, $a0, $a1 1374bfa5eb6e8d15ea73a36f8df449630f285a91e995Hiroshi Yamauchi POISON_HEAP_REF $a2 13756ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic sw $a2, MIRROR_OBJECT_ARRAY_DATA_OFFSET($t0) 13766ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ld $t0, THREAD_CARD_TABLE_OFFSET(rSELF) 13776ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic dsrl $t1, $a0, 7 13786ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic daddu $t1, $t1, $t0 13796ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic sb $t0, ($t1) 13806ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jalr $zero, $ra 138104568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic .cpreturn # Restore gp from t8 in branch delay slot. 13826ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic.Ldo_aput_null: 13836ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic dsll $a1, $a1, 2 13846ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic daddu $t0, $a0, $a1 13856ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic sw $a2, MIRROR_OBJECT_ARRAY_DATA_OFFSET($t0) 13866ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jalr $zero, $ra 138704568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic .cpreturn # Restore gp from t8 in branch delay slot. 13886ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic.Lcheck_assignability: 13896ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic daddiu $sp, $sp, -64 13906ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .cfi_adjust_cfa_offset 64 13916ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic sd $ra, 56($sp) 13926ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .cfi_rel_offset 31, 56 13936ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic sd $t9, 24($sp) 13946ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic sd $a2, 16($sp) 13956ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic sd $a1, 8($sp) 13966ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic sd $a0, 0($sp) 13976ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a1, $t1 13986ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a0, $t0 13996ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artIsAssignableFromCode # (Class*, Class*) 140004568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic .cpreturn # Restore gp from t8 in branch delay slot. 140104568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic # t8 may be clobbered in artIsAssignableFromCode. 14026ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ld $ra, 56($sp) 14036ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ld $t9, 24($sp) 14046ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ld $a2, 16($sp) 14056ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ld $a1, 8($sp) 14066ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ld $a0, 0($sp) 14076ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic daddiu $sp, $sp, 64 14086ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .cfi_adjust_cfa_offset -64 140904568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic SETUP_GP 14106ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic bne $v0, $zero, .Ldo_aput 14116ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic nop 1412fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_ALL_CALLEE_SAVES_FRAME 14136ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a1, $a2 14146ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic dla $t9, artThrowArrayStoreException 14156ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jalr $zero, $t9 # artThrowArrayStoreException(Class*, Class*, Thread*) 14166ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a2, rSELF # pass Thread::Current 14176ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_aput_obj 14186ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 14190cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze// Macros taking opportunity of code similarities for downcalls. 14200cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze.macro ONE_ARG_REF_DOWNCALL name, entrypoint, return, extend=0 14210cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze .extern \entrypoint 14220cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey FrunzeENTRY \name 14230cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 14240cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze dla $t9, \entrypoint 14250cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze jalr $t9 # (field_idx, Thread*) 14260cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze move $a1, rSELF # pass Thread::Current 14270cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze .if \extend 14280cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze sll $v0, $v0, 0 # sign-extend 32-bit result 14290cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze .endif 14300cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze \return # RETURN_IF_NO_EXCEPTION or RETURN_IF_ZERO 14310cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey FrunzeEND \name 14320cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze.endm 14336ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 14340cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze.macro TWO_ARG_REF_DOWNCALL name, entrypoint, return, extend=0 14350cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze .extern \entrypoint 14360cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey FrunzeENTRY \name 14370cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 14380cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze dla $t9, \entrypoint 14390cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze jalr $t9 # (field_idx, Object*, Thread*) or 14400cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze # (field_idx, new_val, Thread*) 14410cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze move $a2, rSELF # pass Thread::Current 14420cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze .if \extend 14430cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze sll $v0, $v0, 0 # sign-extend 32-bit result 14440cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze .endif 14450cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze \return # RETURN_IF_NO_EXCEPTION or RETURN_IF_ZERO 14460cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey FrunzeEND \name 14470cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze.endm 14486ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 14490cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze.macro THREE_ARG_REF_DOWNCALL name, entrypoint, return, extend=0 14500cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze .extern \entrypoint 14510cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey FrunzeENTRY \name 14520cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 14530cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze dla $t9, \entrypoint 14540cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze jalr $t9 # (field_idx, Object*, new_val, Thread*) 14550cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze move $a3, rSELF # pass Thread::Current 14560cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze .if \extend 14570cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze sll $v0, $v0, 0 # sign-extend 32-bit result 14580cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze .endif 14590cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze \return # RETURN_IF_NO_EXCEPTION or RETURN_IF_ZERO 14600cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey FrunzeEND \name 14610cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze.endm 14626ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 14636ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 14640cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey Frunze * Called by managed code to resolve a static/instance field and load/store a value. 14656ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 14660cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey FrunzeONE_ARG_REF_DOWNCALL art_quick_get_byte_static, artGetByteStaticFromCompiledCode, RETURN_IF_NO_EXCEPTION 14670cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey FrunzeONE_ARG_REF_DOWNCALL art_quick_get_boolean_static, artGetBooleanStaticFromCompiledCode, RETURN_IF_NO_EXCEPTION 14680cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey FrunzeONE_ARG_REF_DOWNCALL art_quick_get_short_static, artGetShortStaticFromCompiledCode, RETURN_IF_NO_EXCEPTION 14690cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey FrunzeONE_ARG_REF_DOWNCALL art_quick_get_char_static, artGetCharStaticFromCompiledCode, RETURN_IF_NO_EXCEPTION 14700cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey FrunzeONE_ARG_REF_DOWNCALL art_quick_get32_static, artGet32StaticFromCompiledCode, RETURN_IF_NO_EXCEPTION, 1 14710cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey FrunzeONE_ARG_REF_DOWNCALL art_quick_get_obj_static, artGetObjStaticFromCompiledCode, RETURN_IF_NO_EXCEPTION 14720cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey FrunzeONE_ARG_REF_DOWNCALL art_quick_get64_static, artGet64StaticFromCompiledCode, RETURN_IF_NO_EXCEPTION 14730cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey FrunzeTWO_ARG_REF_DOWNCALL art_quick_get_byte_instance, artGetByteInstanceFromCompiledCode, RETURN_IF_NO_EXCEPTION 14740cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey FrunzeTWO_ARG_REF_DOWNCALL art_quick_get_boolean_instance, artGetBooleanInstanceFromCompiledCode, RETURN_IF_NO_EXCEPTION 14750cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey FrunzeTWO_ARG_REF_DOWNCALL art_quick_get_short_instance, artGetShortInstanceFromCompiledCode, RETURN_IF_NO_EXCEPTION 14760cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey FrunzeTWO_ARG_REF_DOWNCALL art_quick_get_char_instance, artGetCharInstanceFromCompiledCode, RETURN_IF_NO_EXCEPTION 14770cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey FrunzeTWO_ARG_REF_DOWNCALL art_quick_get32_instance, artGet32InstanceFromCompiledCode, RETURN_IF_NO_EXCEPTION, 1 14780cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey FrunzeTWO_ARG_REF_DOWNCALL art_quick_get_obj_instance, artGetObjInstanceFromCompiledCode, RETURN_IF_NO_EXCEPTION 14790cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey FrunzeTWO_ARG_REF_DOWNCALL art_quick_get64_instance, artGet64InstanceFromCompiledCode, RETURN_IF_NO_EXCEPTION 14800cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey FrunzeTWO_ARG_REF_DOWNCALL art_quick_set8_static, artSet8StaticFromCompiledCode, RETURN_IF_ZERO 14810cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey FrunzeTWO_ARG_REF_DOWNCALL art_quick_set16_static, artSet16StaticFromCompiledCode, RETURN_IF_ZERO 14820cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey FrunzeTWO_ARG_REF_DOWNCALL art_quick_set32_static, artSet32StaticFromCompiledCode, RETURN_IF_ZERO 14830cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey FrunzeTWO_ARG_REF_DOWNCALL art_quick_set_obj_static, artSetObjStaticFromCompiledCode, RETURN_IF_ZERO 14840cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey FrunzeTWO_ARG_REF_DOWNCALL art_quick_set64_static, artSet64StaticFromCompiledCode, RETURN_IF_ZERO 14850cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey FrunzeTHREE_ARG_REF_DOWNCALL art_quick_set8_instance, artSet8InstanceFromCompiledCode, RETURN_IF_ZERO 14860cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey FrunzeTHREE_ARG_REF_DOWNCALL art_quick_set16_instance, artSet16InstanceFromCompiledCode, RETURN_IF_ZERO 14870cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey FrunzeTHREE_ARG_REF_DOWNCALL art_quick_set32_instance, artSet32InstanceFromCompiledCode, RETURN_IF_ZERO 14880cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey FrunzeTHREE_ARG_REF_DOWNCALL art_quick_set_obj_instance, artSetObjInstanceFromCompiledCode, RETURN_IF_ZERO 14890cb124219e986a27c40001a1b22ea7ebd833a2d8Alexey FrunzeTHREE_ARG_REF_DOWNCALL art_quick_set64_instance, artSet64InstanceFromCompiledCode, RETURN_IF_ZERO 14906ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 14915ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko// Macro to facilitate adding new allocation entrypoints. 14925ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko.macro ONE_ARG_DOWNCALL name, entrypoint, return 14935ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko .extern \entrypoint 14945ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir MarkoENTRY \name 1495fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 14965ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko jal \entrypoint 14975ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko move $a1, rSELF # pass Thread::Current 14985ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko \return 14995ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir MarkoEND \name 15005ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko.endm 15011a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 15021a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe// Macro to facilitate adding new allocation entrypoints. 15031a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.macro TWO_ARG_DOWNCALL name, entrypoint, return 15046ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern \entrypoint 15051a5c40672783fac98aca5a04ac798a0a0014de65Andreas GampeENTRY \name 1506fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 15076ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal \entrypoint 15086ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a2, rSELF # pass Thread::Current 15096ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic \return 15101a5c40672783fac98aca5a04ac798a0a0014de65Andreas GampeEND \name 15111a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.endm 15121a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 15131a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.macro THREE_ARG_DOWNCALL name, entrypoint, return 15146ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern \entrypoint 15151a5c40672783fac98aca5a04ac798a0a0014de65Andreas GampeENTRY \name 1516fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 15176ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal \entrypoint 15186ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a3, rSELF # pass Thread::Current 15196ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic \return 15201a5c40672783fac98aca5a04ac798a0a0014de65Andreas GampeEND \name 15211a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe.endm 15221a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 1523e85e123a2dff7d4b20266183a0583f9364a8b824Vladimir Marko.macro FOUR_ARG_DOWNCALL name, entrypoint, return 1524e85e123a2dff7d4b20266183a0583f9364a8b824Vladimir Marko .extern \entrypoint 1525e85e123a2dff7d4b20266183a0583f9364a8b824Vladimir MarkoENTRY \name 1526fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME # save callee saves in case of GC 1527e85e123a2dff7d4b20266183a0583f9364a8b824Vladimir Marko jal \entrypoint 1528e85e123a2dff7d4b20266183a0583f9364a8b824Vladimir Marko move $a4, rSELF # pass Thread::Current 1529e85e123a2dff7d4b20266183a0583f9364a8b824Vladimir Marko \return 1530e85e123a2dff7d4b20266183a0583f9364a8b824Vladimir MarkoEND \name 1531e85e123a2dff7d4b20266183a0583f9364a8b824Vladimir Marko.endm 1532e85e123a2dff7d4b20266183a0583f9364a8b824Vladimir Marko 15331a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe// Generate the allocation entrypoints for each allocator. 1534982a9a818915a0a03a1b6ac6f05e01934d9d27e8Goran JakovljevicGENERATE_ALLOC_ENTRYPOINTS_FOR_EACH_ALLOCATOR 153510d4c08c0ea9df0a85a11e1c77974df24078c0ecHiroshi Yamauchi 15362449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic// A hand-written override for: 15372449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic// GENERATE_ALLOC_ENTRYPOINTS_ALLOC_OBJECT_RESOLVED(_rosalloc, RosAlloc) 15382449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic// GENERATE_ALLOC_ENTRYPOINTS_ALLOC_OBJECT_INITIALIZED(_rosalloc, RosAlloc) 15392449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic.macro ART_QUICK_ALLOC_OBJECT_ROSALLOC c_name, cxx_name 15402449e5c95b536791fc11344530365b36ae18e0dfGoran JakovljevicENTRY \c_name 15412449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic # Fast path rosalloc allocation 15422449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic # a0: type 15432449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic # s1: Thread::Current 15442449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic # ----------------------------- 15452449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic # t1: object size 15462449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic # t2: rosalloc run 15472449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic # t3: thread stack top offset 15482449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic # a4: thread stack bottom offset 15492449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic # v0: free list head 15502449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic # 15512449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic # a5, a6 : temps 15522449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic ld $t3, THREAD_LOCAL_ALLOC_STACK_TOP_OFFSET($s1) # Check if thread local allocation stack 15532449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic ld $a4, THREAD_LOCAL_ALLOC_STACK_END_OFFSET($s1) # has any room left. 15542449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic bgeuc $t3, $a4, .Lslow_path_\c_name 15552449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic 15562449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic lwu $t1, MIRROR_CLASS_OBJECT_SIZE_ALLOC_FAST_PATH_OFFSET($a0) # Load object size (t1). 15572449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic li $a5, ROSALLOC_MAX_THREAD_LOCAL_BRACKET_SIZE # Check if size is for a thread local 15582449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic # allocation. Also does the initialized 15592449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic # and finalizable checks. 15602449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic bltuc $a5, $t1, .Lslow_path_\c_name 15612449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic 15622449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic # Compute the rosalloc bracket index from the size. Since the size is already aligned we can 15632449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic # combine the two shifts together. 15642449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic dsrl $t1, $t1, (ROSALLOC_BRACKET_QUANTUM_SIZE_SHIFT - POINTER_SIZE_SHIFT) 15652449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic 15662449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic daddu $t2, $t1, $s1 15672449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic ld $t2, (THREAD_ROSALLOC_RUNS_OFFSET - __SIZEOF_POINTER__)($t2) # Load rosalloc run (t2). 15682449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic 15692449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic # Load the free list head (v0). 15702449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic # NOTE: this will be the return val. 15712449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic ld $v0, (ROSALLOC_RUN_FREE_LIST_OFFSET + ROSALLOC_RUN_FREE_LIST_HEAD_OFFSET)($t2) 15722449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic beqzc $v0, .Lslow_path_\c_name 15732449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic 15742449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic # Load the next pointer of the head and update the list head with the next pointer. 15752449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic ld $a5, ROSALLOC_SLOT_NEXT_OFFSET($v0) 15762449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic sd $a5, (ROSALLOC_RUN_FREE_LIST_OFFSET + ROSALLOC_RUN_FREE_LIST_HEAD_OFFSET)($t2) 15772449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic 15782449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic # Store the class pointer in the header. This also overwrites the first pointer. The offsets are 15792449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic # asserted to match. 15802449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic 15812449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic#if ROSALLOC_SLOT_NEXT_OFFSET != MIRROR_OBJECT_CLASS_OFFSET 15822449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic#error "Class pointer needs to overwrite next pointer." 15832449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic#endif 15842449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic 15852449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic POISON_HEAP_REF $a0 15862449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic sw $a0, MIRROR_OBJECT_CLASS_OFFSET($v0) 15872449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic 15882449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic # Push the new object onto the thread local allocation stack and increment the thread local 15892449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic # allocation stack top. 15902449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic sd $v0, 0($t3) 15912449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic daddiu $t3, $t3, COMPRESSED_REFERENCE_SIZE 15922449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic sd $t3, THREAD_LOCAL_ALLOC_STACK_TOP_OFFSET($s1) 15932449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic 15942449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic # Decrement the size of the free list. 15952449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic lw $a5, (ROSALLOC_RUN_FREE_LIST_OFFSET + ROSALLOC_RUN_FREE_LIST_SIZE_OFFSET)($t2) 15962449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic addiu $a5, $a5, -1 15972449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic sw $a5, (ROSALLOC_RUN_FREE_LIST_OFFSET + ROSALLOC_RUN_FREE_LIST_SIZE_OFFSET)($t2) 15982449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic 15992449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic sync # Fence. 16002449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic 16012449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic jalr $zero, $ra 16022449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic .cpreturn # Restore gp from t8 in branch delay slot. 16032449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic 16042449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic.Lslow_path_\c_name: 16052449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic SETUP_SAVE_REFS_ONLY_FRAME 16062449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic jal \cxx_name 16072449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic move $a1 ,$s1 # Pass self as argument. 16082449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 16092449e5c95b536791fc11344530365b36ae18e0dfGoran JakovljevicEND \c_name 16102449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic.endm 16112449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic 16122449e5c95b536791fc11344530365b36ae18e0dfGoran JakovljevicART_QUICK_ALLOC_OBJECT_ROSALLOC art_quick_alloc_object_resolved_rosalloc, artAllocObjectFromCodeResolvedRosAlloc 16132449e5c95b536791fc11344530365b36ae18e0dfGoran JakovljevicART_QUICK_ALLOC_OBJECT_ROSALLOC art_quick_alloc_object_initialized_rosalloc, artAllocObjectFromCodeInitializedRosAlloc 16142449e5c95b536791fc11344530365b36ae18e0dfGoran Jakovljevic 16150d3998b5ff619364acf47bec0b541e7a49bd6fe7Nicolas GeoffrayGENERATE_ALLOC_ENTRYPOINTS_ALLOC_OBJECT_RESOLVED(_tlab, TLAB) 16160d3998b5ff619364acf47bec0b541e7a49bd6fe7Nicolas GeoffrayGENERATE_ALLOC_ENTRYPOINTS_ALLOC_OBJECT_RESOLVED(_region_tlab, RegionTLAB) 161710d4c08c0ea9df0a85a11e1c77974df24078c0ecHiroshi Yamauchi 16186ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 16195ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko * Entry from managed code to resolve a string, this stub will allocate a String and deliver an 16205ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko * exception on error. On success the String is returned. A0 holds the string index. The fast 16215ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko * path check for hit in strings cache has already been performed. 16225ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko */ 16235ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir MarkoONE_ARG_DOWNCALL art_quick_resolve_string, artResolveStringFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 16245ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko 16255ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko /* 16265ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko * Entry from managed code when uninitialized static storage, this stub will run the class 16275ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko * initializer and deliver the exception on error. On success the static storage base is 16285ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko * returned. 16295ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko */ 16305ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir MarkoONE_ARG_DOWNCALL art_quick_initialize_static_storage, artInitializeStaticStorageFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 16315ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko 16325ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko /* 16335ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko * Entry from managed code when dex cache misses for a type_idx. 16345ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko */ 16355ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir MarkoONE_ARG_DOWNCALL art_quick_initialize_type, artInitializeTypeFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 16365ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko 16375ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko /* 16385ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko * Entry from managed code when type_idx needs to be checked for access and dex cache may also 16395ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko * miss. 16405ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko */ 16415ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir MarkoONE_ARG_DOWNCALL art_quick_initialize_type_and_verify_access, artInitializeTypeAndVerifyAccessFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 16425ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko 16435ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko /* 16446ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Called by managed code when the value in rSUSPEND has been decremented to 0. 16456ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 16466ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artTestSuspendFromCode 1647952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir MarkoENTRY_NO_GP art_quick_test_suspend 1648952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko lh rSUSPEND, THREAD_FLAGS_OFFSET(rSELF) 1649952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko bne rSUSPEND, $zero, 1f 16506ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic daddiu rSUSPEND, $zero, SUSPEND_CHECK_INTERVAL # reset rSUSPEND to SUSPEND_CHECK_INTERVAL 16516ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jalr $zero, $ra 1652952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko nop 16536ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic1: 1654fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_EVERYTHING_FRAME # save everything for stack crawl 16556ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic jal artTestSuspendFromCode # (Thread*) 16566ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a0, rSELF 1657fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko RESTORE_SAVE_EVERYTHING_FRAME 1658952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko jalr $zero, $ra 1659952dbb19cd094b8bfb01dbb33e0878db429e499aVladimir Marko nop 16606ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_test_suspend 16616461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung 16626461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung /* 16636461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung * Called by managed code that is attempting to call a method on a proxy class. On entry 16646461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung * r0 holds the proxy method; r1, r2 and r3 may contain arguments. 16656461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung */ 16666461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung .extern artQuickProxyInvokeHandler 16676461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas LeungENTRY art_quick_proxy_invoke_handler 1668fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_AND_ARGS_FRAME_WITH_METHOD_IN_A0 16696461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung move $a2, rSELF # pass Thread::Current 16706461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung jal artQuickProxyInvokeHandler # (Method* proxy method, receiver, Thread*, SP) 16716461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung move $a3, $sp # pass $sp 16726461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung ld $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ 16736461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung daddiu $sp, $sp, REFS_AND_ARGS_MINUS_REFS_SIZE # skip a0-a7 and f12-f19 1674fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko RESTORE_SAVE_REFS_ONLY_FRAME 16756461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung bne $t0, $zero, 1f 16766461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung dmtc1 $v0, $f0 # place return value to FP return value 16776461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung jalr $zero, $ra 16786461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung dmtc1 $v1, $f1 # place return value to FP return value 16796461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung1: 16806461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung DELIVER_PENDING_EXCEPTION 16816461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas LeungEND art_quick_proxy_invoke_handler 16826461d19fe1132ec25b92d008c1a7b57f5ecc134bDouglas Leung 16836ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 168459028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic * Called to resolve an imt conflict. 168559028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic * a0 is the conflict ArtMethod. 168659028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic * t0 is a hidden argument that holds the target interface method's dex method index. 168759028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic * 168859028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic * Mote that this stub writes to a0, t0 and t1. 16896ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 16906ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_imt_conflict_trampoline 169159028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic ld $t1, 0($sp) # Load referrer. 169259028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic ld $t1, ART_METHOD_DEX_CACHE_METHODS_OFFSET_64($t1) # Load dex cache methods array. 169359028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic dsll $t0, $t0, POINTER_SIZE_SHIFT # Calculate offset. 169459028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic daddu $t0, $t1, $t0 # Add offset to base. 169559028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic ld $t0, 0($t0) # Load interface method. 169659028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic ld $a0, ART_METHOD_JNI_OFFSET_64($a0) # Load ImtConflictTable. 169759028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic 169859028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic.Limt_table_iterate: 169959028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic ld $t1, 0($a0) # Load next entry in ImtConflictTable. 170059028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic # Branch if found. 170159028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic beq $t1, $t0, .Limt_table_found 170259028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic nop 170359028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic # If the entry is null, the interface method is not in the ImtConflictTable. 170459028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic beqzc $t1, .Lconflict_trampoline 170559028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic # Iterate over the entries of the ImtConflictTable. 170659028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic daddiu $a0, $a0, 2 * __SIZEOF_POINTER__ # Iterate to the next entry. 170759028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic bc .Limt_table_iterate 170859028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic 170959028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic.Limt_table_found: 171059028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic # We successfully hit an entry in the table. Load the target method and jump to it. 171159028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic ld $a0, __SIZEOF_POINTER__($a0) 171259028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic ld $t9, ART_METHOD_QUICK_CODE_OFFSET_64($a0) 171359028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic jr $t9 171459028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic .cpreturn # Restore gp from t8 in branch delay slot. 171559028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic 171659028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic.Lconflict_trampoline: 171759028d90d51a800bcea8be354d77d7be924da3a0Goran Jakovljevic # Call the runtime stub to populate the ImtConflictTable and jump to the resolved method. 17185667f56867383fc4113aa4a6551efdf9f48ee5e7Jeff Hao move $a0, $t0 # Load interface method. 17193031c8da0c5009183f770b005c245f9bf2a4d01bAndreas Gampe INVOKE_TRAMPOLINE_BODY artInvokeInterfaceTrampoline 17206ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_imt_conflict_trampoline 1721cc7c39d747f5802282adcc51ffe44405f116f84bAndreas Gampe 1722cc7c39d747f5802282adcc51ffe44405f116f84bAndreas Gampe .extern artQuickResolutionTrampoline 1723cc7c39d747f5802282adcc51ffe44405f116f84bAndreas GampeENTRY art_quick_resolution_trampoline 1724fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_AND_ARGS_FRAME 1725cc7c39d747f5802282adcc51ffe44405f116f84bAndreas Gampe move $a2, rSELF # pass Thread::Current 1726cc7c39d747f5802282adcc51ffe44405f116f84bAndreas Gampe jal artQuickResolutionTrampoline # (Method* called, receiver, Thread*, SP) 1727cc7c39d747f5802282adcc51ffe44405f116f84bAndreas Gampe move $a3, $sp # pass $sp 1728cc7c39d747f5802282adcc51ffe44405f116f84bAndreas Gampe beq $v0, $zero, 1f 1729e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier ld $a0, 0($sp) # load resolved method in $a0 1730cc7c39d747f5802282adcc51ffe44405f116f84bAndreas Gampe # artQuickResolutionTrampoline puts resolved method in *SP 1731fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko RESTORE_SAVE_REFS_AND_ARGS_FRAME 1732cc7c39d747f5802282adcc51ffe44405f116f84bAndreas Gampe move $t9, $v0 # code pointer must be in $t9 to generate the global pointer 1733cc7c39d747f5802282adcc51ffe44405f116f84bAndreas Gampe jalr $zero, $t9 # tail call to method 1734cc7c39d747f5802282adcc51ffe44405f116f84bAndreas Gampe nop 1735cc7c39d747f5802282adcc51ffe44405f116f84bAndreas Gampe1: 1736fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko RESTORE_SAVE_REFS_AND_ARGS_FRAME 1737cc7c39d747f5802282adcc51ffe44405f116f84bAndreas Gampe DELIVER_PENDING_EXCEPTION 1738cc7c39d747f5802282adcc51ffe44405f116f84bAndreas GampeEND art_quick_resolution_trampoline 17391a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 17401a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .extern artQuickGenericJniTrampoline 17411a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .extern artQuickGenericJniEndTrampoline 17421a5c40672783fac98aca5a04ac798a0a0014de65Andreas GampeENTRY art_quick_generic_jni_trampoline 1743fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_AND_ARGS_FRAME_WITH_METHOD_IN_A0 17441a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $s8, $sp # save $sp 17451a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 17461a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # prepare for call to artQuickGenericJniTrampoline(Thread*, SP) 17471a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $a0, rSELF # pass Thread::Current 17481a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $a1, $sp # pass $sp 17491a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jal artQuickGenericJniTrampoline # (Thread*, SP) 17501a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $sp, $sp, -5120 # reserve space on the stack 17511a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 17521a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # The C call will have registered the complete save-frame on success. 17531a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # The result of the call is: 17541a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # v0: ptr to native code, 0 on error. 17551a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # v1: ptr to the bottom of the used area of the alloca, can restore stack till here. 17561a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe beq $v0, $zero, 1f # check entry error 17571a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $t9, $v0 # save the code ptr 17581a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $sp, $v1 # release part of the alloca 17591a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 17601a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # Load parameters from stack into registers 17611a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a0, 0($sp) 17621a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a1, 8($sp) 17631a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a2, 16($sp) 17641a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a3, 24($sp) 17651a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a4, 32($sp) 17661a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a5, 40($sp) 17671a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a6, 48($sp) 17681a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a7, 56($sp) 17691a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # Load FPRs the same as GPRs. Look at BuildNativeCallFrameStateMachine. 17701a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f12, 0($sp) 17711a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f13, 8($sp) 17721a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f14, 16($sp) 17731a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f15, 24($sp) 17741a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f16, 32($sp) 17751a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f17, 40($sp) 17761a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f18, 48($sp) 17771a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f19, 56($sp) 17781a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jalr $t9 # native call 17791a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $sp, $sp, 64 17801a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 17811a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # result sign extension is handled in C code 17821a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # prepare for call to artQuickGenericJniEndTrampoline(Thread*, result, result_f) 17831a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $a0, rSELF # pass Thread::Current 17841a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $a1, $v0 17851a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jal artQuickGenericJniEndTrampoline 17861a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe dmfc1 $a2, $f0 17871a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 17881a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ 1789126d65952a03b3e44d5021208673c01920a982a4Nicolas Geoffray bne $t0, $zero, 1f # check for pending exceptions 17901a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $sp, $s8 # tear down the alloca 17911a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 17921a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe # tear dpown the callee-save frame 1793fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko RESTORE_SAVE_REFS_AND_ARGS_FRAME 17941a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 17951a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jalr $zero, $ra 17961a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe dmtc1 $v0, $f0 # place return value to FP return value 17971a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 17981a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe1: 1799126d65952a03b3e44d5021208673c01920a982a4Nicolas Geoffray ld $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF) 1800126d65952a03b3e44d5021208673c01920a982a4Nicolas Geoffray # This will create a new save-all frame, required by the runtime. 18011a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe DELIVER_PENDING_EXCEPTION 18021a5c40672783fac98aca5a04ac798a0a0014de65Andreas GampeEND art_quick_generic_jni_trampoline 18031a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 18041a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .extern artQuickToInterpreterBridge 18051a5c40672783fac98aca5a04ac798a0a0014de65Andreas GampeENTRY art_quick_to_interpreter_bridge 1806fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_AND_ARGS_FRAME 18071a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $a1, rSELF # pass Thread::Current 18081a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jal artQuickToInterpreterBridge # (Method* method, Thread*, SP) 18091a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $a2, $sp # pass $sp 18101a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ 18111a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $sp, $sp, REFS_AND_ARGS_MINUS_REFS_SIZE # skip a0-a7 and f12-f19 1812fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko RESTORE_SAVE_REFS_ONLY_FRAME 18131a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe bne $t0, $zero, 1f 18141a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe dmtc1 $v0, $f0 # place return value to FP return value 18151a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jalr $zero, $ra 18161a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe dmtc1 $v1, $f1 # place return value to FP return value 18171a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe1: 18181a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe DELIVER_PENDING_EXCEPTION 18191a5c40672783fac98aca5a04ac798a0a0014de65Andreas GampeEND art_quick_to_interpreter_bridge 18201a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 1821db01a091aefbd78b56777f4c2e8c5e3f2d8c2712Alex Light .extern artInvokeObsoleteMethod 1822db01a091aefbd78b56777f4c2e8c5e3f2d8c2712Alex LightENTRY art_invoke_obsolete_method_stub 1823db01a091aefbd78b56777f4c2e8c5e3f2d8c2712Alex Light SETUP_SAVE_ALL_CALLEE_SAVES_FRAME 1824db01a091aefbd78b56777f4c2e8c5e3f2d8c2712Alex Light jal artInvokeObsoleteMethod # (Method* method, Thread* self) 1825db01a091aefbd78b56777f4c2e8c5e3f2d8c2712Alex Light move $a1, rSELF # pass Thread::Current 1826db01a091aefbd78b56777f4c2e8c5e3f2d8c2712Alex LightEND art_invoke_obsolete_method_stub 1827db01a091aefbd78b56777f4c2e8c5e3f2d8c2712Alex Light 18281a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe /* 18291a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe * Routine that intercepts method calls and returns. 18301a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe */ 18311a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .extern artInstrumentationMethodEntryFromCode 18321a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .extern artInstrumentationMethodExitFromCode 18331a5c40672783fac98aca5a04ac798a0a0014de65Andreas GampeENTRY art_quick_instrumentation_entry 1834fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_AND_ARGS_FRAME 18351a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $sp, $sp, -16 # space for saving arg0 18361a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_adjust_cfa_offset 16 18371a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $a0, 0($sp) # save arg0 18381a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $a3, $ra # pass $ra 18391a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jal artInstrumentationMethodEntryFromCode # (Method*, Object*, Thread*, RA) 18401a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $a2, rSELF # pass Thread::Current 18411a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $t9, $v0 # $t9 holds reference to code 18421a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $a0, 0($sp) # restore arg0 18431a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $sp, $sp, 16 # remove args 18441a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_adjust_cfa_offset -16 1845fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko RESTORE_SAVE_REFS_AND_ARGS_FRAME 18461a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe jalr $t9 # call method 18471a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe nop 18481a5c40672783fac98aca5a04ac798a0a0014de65Andreas GampeEND art_quick_instrumentation_entry 18491a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe /* intentional fallthrough */ 18501a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .global art_quick_instrumentation_exit 18511a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampeart_quick_instrumentation_exit: 18521a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_startproc 185304568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic SETUP_GP 18541a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $ra, $zero # link register is to here, so clobber with 0 for later checks 1855fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_REFS_ONLY_FRAME 18561a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $t0, $sp # remember bottom of caller's frame 18571a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe daddiu $sp, $sp, -16 # save return values and set up args 18581a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_adjust_cfa_offset 16 18591a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe sd $v0, 0($sp) 18601a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe .cfi_rel_offset 2, 0 18611a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe s.d $f0, 8($sp) 18621a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe mov.d $f15, $f0 # pass fpr result 18631a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $a2, $v0 # pass gpr result 18641a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $a1, $t0 # pass $sp 18651a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $a0, rSELF # pass Thread::Current 186604568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic jal artInstrumentationMethodExitFromCode # (Thread*, SP, gpr_res, fpr_res) 186704568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic .cpreturn # Restore gp from t8 in branch delay slot. gp is not used anymore, 186804568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic # and t8 may be clobbered in artInstrumentationMethodExitFromCode. 186904568815cbfa18f0fa8b8d751fb83a1089909660Goran Jakovljevic 1870f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung move $t9, $v0 # set aside returned link register 18711a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe move $ra, $v1 # set link register for deoptimization 18721a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe ld $v0, 0($sp) # restore return values 18731a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe l.d $f0, 8($sp) 1874f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung jalr $zero, $t9 # return 1875fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko # restore stack, 16 bytes of saved values + ref_only callee save frame 1876fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko daddiu $sp, $sp, 16+FRAME_SIZE_SAVE_REFS_ONLY 1877fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko .cfi_adjust_cfa_offset -(16+FRAME_SIZE_SAVE_REFS_ONLY) 18781a5c40672783fac98aca5a04ac798a0a0014de65Andreas GampeEND art_quick_instrumentation_exit 18791a5c40672783fac98aca5a04ac798a0a0014de65Andreas Gampe 18806ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic /* 18816ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Instrumentation has requested that we deoptimize into the interpreter. The deoptimization 18826ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * will long jump to the upcall with a special exception of -1. 18836ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 18846ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artDeoptimize 18856ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic .extern artEnterInterpreterFromDeoptimize 18866ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicENTRY art_quick_deoptimize 1887fd36f1f927c138575184a1f4c7ea4e7abb3e2dbfVladimir Marko SETUP_SAVE_ALL_CALLEE_SAVES_FRAME 188879efadfdd861584f1c47654ade975eae6c43c360Nicolas Geoffray jal artDeoptimize # artDeoptimize(Thread*) 18896ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic move $a0, rSELF # pass Thread::current 18906ea651f0f4c7de4580beb2e887d86802c1ae0738Maja GagicEND art_quick_deoptimize 18916ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 18920747466fca310eedea5fc49e37d54f240a0b3c0fSebastien Hertz /* 18930747466fca310eedea5fc49e37d54f240a0b3c0fSebastien Hertz * Compiled code has requested that we deoptimize into the interpreter. The deoptimization 18940747466fca310eedea5fc49e37d54f240a0b3c0fSebastien Hertz * will long jump to the upcall with a special exception of -1. 18950747466fca310eedea5fc49e37d54f240a0b3c0fSebastien Hertz */ 18960747466fca310eedea5fc49e37d54f240a0b3c0fSebastien Hertz .extern artDeoptimizeFromCompiledCode 1897239d6eaff0cbb5c4c0139f7053a012758799f186Vladimir MarkoENTRY_NO_GP art_quick_deoptimize_from_compiled_code 1898239d6eaff0cbb5c4c0139f7053a012758799f186Vladimir Marko SETUP_SAVE_EVERYTHING_FRAME 189979efadfdd861584f1c47654ade975eae6c43c360Nicolas Geoffray jal artDeoptimizeFromCompiledCode # (DeoptimizationKind, Thread*) 190079efadfdd861584f1c47654ade975eae6c43c360Nicolas Geoffray move $a1, rSELF # pass Thread::current 19010747466fca310eedea5fc49e37d54f240a0b3c0fSebastien HertzEND art_quick_deoptimize_from_compiled_code 19020747466fca310eedea5fc49e37d54f240a0b3c0fSebastien Hertz 19039701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen .set push 19049701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen .set noat 19059701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen/* java.lang.String.compareTo(String anotherString) */ 19069701c2ee2dde033e2269dcfc592a09f21151e97eChris LarsenENTRY_NO_GP art_quick_string_compareto 19079701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen/* $a0 holds address of "this" */ 19089701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen/* $a1 holds address of "anotherString" */ 1909f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic move $a2, $zero 1910f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic beq $a0, $a1, .Lstring_compareto_length_diff # this and anotherString are the same object 1911f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic move $a3, $zero # return 0 (it returns a2 - a3) 1912f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic 1913f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic#if (STRING_COMPRESSION_FEATURE) 1914f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic lw $a4, MIRROR_STRING_COUNT_OFFSET($a0) # 'count' field of this 1915f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic lw $a5, MIRROR_STRING_COUNT_OFFSET($a1) # 'count' field of anotherString 1916f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic sra $a2, $a4, 1 # this.length() 1917f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic sra $a3, $a5, 1 # anotherString.length() 1918f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic#else 1919f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic lw $a2, MIRROR_STRING_COUNT_OFFSET($a0) # this.length() 1920f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic lw $a3, MIRROR_STRING_COUNT_OFFSET($a1) # anotherString.length() 1921f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic#endif 19229701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen 1923f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic MINu $t2, $a2, $a3 1924f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic # $t2 now holds min(this.length(),anotherString.length()) 19259701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen 1926f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic # while min(this.length(),anotherString.length())-i != 0 1927f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic beqzc $t2, .Lstring_compareto_length_diff # if $t2==0 1928f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic # return (this.length() - anotherString.length()) 1929f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic 1930f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic#if (STRING_COMPRESSION_FEATURE) 1931f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic # Differ cases: 1932f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic dext $a6, $a4, 0, 1 1933f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic beqz $a6, .Lstring_compareto_this_is_compressed 1934f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic dext $a6, $a5, 0, 1 # In branch delay slot. 1935f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic beqz $a6, .Lstring_compareto_that_is_compressed 1936f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic nop 1937f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic b .Lstring_compareto_both_not_compressed 1938f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic nop 1939f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic 1940f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic.Lstring_compareto_this_is_compressed: 1941f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic beqzc $a6, .Lstring_compareto_both_compressed 1942f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic /* If (this->IsCompressed() && that->IsCompressed() == false) */ 1943f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic.Lstring_compareto_loop_comparison_this_compressed: 1944f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic lbu $t0, MIRROR_STRING_VALUE_OFFSET($a0) 1945f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic lhu $t1, MIRROR_STRING_VALUE_OFFSET($a1) 1946f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic bnec $t0, $t1, .Lstring_compareto_char_diff 1947f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic daddiu $a0, $a0, 1 # point at this.charAt(i++) - compressed 1948f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic subu $t2, $t2, 1 # new value of min(this.length(),anotherString.length())-i 1949f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic bnez $t2, .Lstring_compareto_loop_comparison_this_compressed 1950f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic daddiu $a1, $a1, 2 # point at anotherString.charAt(i++) - uncompressed 1951f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic jalr $zero, $ra 1952f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic subu $v0, $a2, $a3 # return (this.length() - anotherString.length()) 1953f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic 1954f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic.Lstring_compareto_that_is_compressed: 1955f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic lhu $t0, MIRROR_STRING_VALUE_OFFSET($a0) 1956f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic lbu $t1, MIRROR_STRING_VALUE_OFFSET($a1) 1957f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic bnec $t0, $t1, .Lstring_compareto_char_diff 1958f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic daddiu $a0, $a0, 2 # point at this.charAt(i++) - uncompressed 1959f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic subu $t2, $t2, 1 # new value of min(this.length(),anotherString.length())-i 1960f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic bnez $t2, .Lstring_compareto_that_is_compressed 1961f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic daddiu $a1, $a1, 1 # point at anotherString.charAt(i++) - compressed 1962f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic jalr $zero, $ra 1963f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic subu $v0, $a2, $a3 # return (this.length() - anotherString.length()) 1964f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic 1965f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic.Lstring_compareto_both_compressed: 1966f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic lbu $t0, MIRROR_STRING_VALUE_OFFSET($a0) 1967f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic lbu $t1, MIRROR_STRING_VALUE_OFFSET($a1) 1968f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic bnec $t0, $t1, .Lstring_compareto_char_diff 1969f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic daddiu $a0, $a0, 1 # point at this.charAt(i++) - compressed 1970f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic subu $t2, $t2, 1 # new value of min(this.length(),anotherString.length())-i 1971f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic bnez $t2, .Lstring_compareto_both_compressed 1972f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic daddiu $a1, $a1, 1 # point at anotherString.charAt(i++) - compressed 1973f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic jalr $zero, $ra 1974f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic subu $v0, $a2, $a3 # return (this.length() - anotherString.length()) 1975f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic#endif 1976f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic 1977f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic.Lstring_compareto_both_not_compressed: 1978f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic lhu $t0, MIRROR_STRING_VALUE_OFFSET($a0) # while this.charAt(i) == anotherString.charAt(i) 1979f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic lhu $t1, MIRROR_STRING_VALUE_OFFSET($a1) 1980f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic bnec $t0, $t1, .Lstring_compareto_char_diff # if this.charAt(i) != anotherString.charAt(i) 1981f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic # return (this.charAt(i) - anotherString.charAt(i)) 1982f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic daddiu $a0, $a0, 2 # point at this.charAt(i++) 1983f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic subu $t2, $t2, 1 # new value of min(this.length(),anotherString.length())-i 1984f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic bnez $t2, .Lstring_compareto_both_not_compressed 1985f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic daddiu $a1, $a1, 2 # point at anotherString.charAt(i++) 1986f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic 1987f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic.Lstring_compareto_length_diff: 1988f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic jalr $zero, $ra 1989f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic subu $v0, $a2, $a3 # return (this.length() - anotherString.length()) 1990f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic 1991f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic.Lstring_compareto_char_diff: 1992f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic jalr $zero, $ra 1993f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic subu $v0, $t0, $t1 # return (this.charAt(i) - anotherString.charAt(i)) 19949701c2ee2dde033e2269dcfc592a09f21151e97eChris LarsenEND art_quick_string_compareto 19959701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen 19969701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen/* java.lang.String.indexOf(int ch, int fromIndex=0) */ 19979701c2ee2dde033e2269dcfc592a09f21151e97eChris LarsenENTRY_NO_GP art_quick_indexof 19989701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen/* $a0 holds address of "this" */ 1999cf283daf579e9eda586f312c3fc89444601e2525Chris Larsen/* $a1 holds "ch" */ 2000cf283daf579e9eda586f312c3fc89444601e2525Chris Larsen/* $a2 holds "fromIndex" */ 2001f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic#if (STRING_COMPRESSION_FEATURE) 2002f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic lw $a3, MIRROR_STRING_COUNT_OFFSET($a0) # 'count' field of this 2003f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic#else 2004f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic lw $t0, MIRROR_STRING_COUNT_OFFSET($a0) # this.length() 2005f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic#endif 2006f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic slt $at, $a2, $zero # if fromIndex < 0 2007f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic seleqz $a2, $a2, $at # fromIndex = 0; 2008f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic#if (STRING_COMPRESSION_FEATURE) 2009f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic srl $t0, $a3, 1 # $a3 holds count (with flag) and $t0 holds actual length 2010f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic#endif 2011f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic subu $t0, $t0, $a2 # this.length() - fromIndex 2012f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic blez $t0, 6f # if this.length()-fromIndex <= 0 2013f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic li $v0, -1 # return -1; 20149701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen 2015f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic#if (STRING_COMPRESSION_FEATURE) 2016f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic dext $a3, $a3, 0, 1 # Extract compression flag. 2017f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic beqzc $a3, .Lstring_indexof_compressed 2018f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic#endif 2019f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic 2020f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic sll $v0, $a2, 1 # $a0 += $a2 * 2 2021f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic daddu $a0, $a0, $v0 # " ditto " 2022f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic move $v0, $a2 # Set i to fromIndex. 20239701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen 20249701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen1: 2025f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic lhu $t3, MIRROR_STRING_VALUE_OFFSET($a0) # if this.charAt(i) == ch 2026f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic beq $t3, $a1, 6f # return i; 2027f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic daddu $a0, $a0, 2 # i++ 2028f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic subu $t0, $t0, 1 # this.length() - i 2029f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic bnez $t0, 1b # while this.length() - i > 0 2030f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic addu $v0, $v0, 1 # i++ 20319701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen 2032f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic li $v0, -1 # if this.length() - i <= 0 2033f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic # return -1; 20349701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen 20359701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen6: 2036f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic j $ra 2037f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic nop 2038f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic 2039f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic#if (STRING_COMPRESSION_FEATURE) 2040f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic.Lstring_indexof_compressed: 2041f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic move $a4, $a0 # Save a copy in $a4 to later compute result. 2042f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic daddu $a0, $a0, $a2 # $a0 += $a2 2043f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic 2044f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic.Lstring_indexof_compressed_loop: 2045f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic lbu $t3, MIRROR_STRING_VALUE_OFFSET($a0) 2046f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic beq $t3, $a1, .Lstring_indexof_compressed_matched 2047f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic subu $t0, $t0, 1 2048f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic bgtz $t0, .Lstring_indexof_compressed_loop 2049f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic daddu $a0, $a0, 1 2050f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic 2051f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic.Lstring_indexof_nomatch: 2052f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic jalr $zero, $ra 2053f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic li $v0, -1 # return -1; 2054f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic 2055f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic.Lstring_indexof_compressed_matched: 2056f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic jalr $zero, $ra 2057f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic dsubu $v0, $a0, $a4 # return (current - start); 2058f94fa81e20d00929ef52707cd577353b95d40284Goran Jakovljevic#endif 20599701c2ee2dde033e2269dcfc592a09f21151e97eChris LarsenEND art_quick_indexof 20609701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen 20611595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze /* 20621595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze * Create a function `name` calling the ReadBarrier::Mark routine, 20631595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze * getting its argument and returning its result through register 20641595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze * `reg`, saving and restoring all caller-save registers. 20651595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze */ 20661595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze.macro READ_BARRIER_MARK_REG name, reg 20671595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey FrunzeENTRY \name 20681595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze /* TODO: optimizations: mark bit, forwarding. */ 20691595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze daddiu $sp, $sp, -320 20701595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_adjust_cfa_offset 320 20711595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze 20721595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sd $ra, 312($sp) 20731595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_rel_offset 31, 312 20741595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sd $t8, 304($sp) # save t8 holding caller's gp 20751595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_rel_offset 24, 304 20761595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sd $t3, 296($sp) 20771595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_rel_offset 15, 296 20781595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sd $t2, 288($sp) 20791595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_rel_offset 14, 288 20801595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sd $t1, 280($sp) 20811595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_rel_offset 13, 280 20821595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sd $t0, 272($sp) 20831595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_rel_offset 12, 272 20841595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sd $a7, 264($sp) 20851595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_rel_offset 11, 264 20861595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sd $a6, 256($sp) 20871595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_rel_offset 10, 256 20881595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sd $a5, 248($sp) 20891595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_rel_offset 9, 248 20901595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sd $a4, 240($sp) 20911595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_rel_offset 8, 240 20921595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sd $a3, 232($sp) 20931595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_rel_offset 7, 232 20941595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sd $a2, 224($sp) 20951595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_rel_offset 6, 224 20961595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sd $a1, 216($sp) 20971595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_rel_offset 5, 216 20981595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sd $a0, 208($sp) 20991595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_rel_offset 4, 208 21001595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sd $v1, 200($sp) 21011595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_rel_offset 3, 200 21021595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sd $v0, 192($sp) 21031595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_rel_offset 2, 192 21041595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze 21051595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze dla $t9, artReadBarrierMark 21061595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze 21071595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sdc1 $f23, 184($sp) 21081595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sdc1 $f22, 176($sp) 21091595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sdc1 $f21, 168($sp) 21101595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sdc1 $f20, 160($sp) 21111595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sdc1 $f19, 152($sp) 21121595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sdc1 $f18, 144($sp) 21131595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sdc1 $f17, 136($sp) 21141595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sdc1 $f16, 128($sp) 21151595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sdc1 $f15, 120($sp) 21161595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sdc1 $f14, 112($sp) 21171595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sdc1 $f13, 104($sp) 21181595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sdc1 $f12, 96($sp) 21191595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sdc1 $f11, 88($sp) 21201595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sdc1 $f10, 80($sp) 21211595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sdc1 $f9, 72($sp) 21221595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sdc1 $f8, 64($sp) 21231595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sdc1 $f7, 56($sp) 21241595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sdc1 $f6, 48($sp) 21251595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sdc1 $f5, 40($sp) 21261595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sdc1 $f4, 32($sp) 21271595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sdc1 $f3, 24($sp) 21281595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sdc1 $f2, 16($sp) 21291595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sdc1 $f1, 8($sp) 21301595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze 21311595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .ifnc \reg, $a0 21321595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze move $a0, \reg # pass obj from `reg` in a0 21331595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .endif 21341595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze jalr $t9 # v0 <- artReadBarrierMark(obj) 21351595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze sdc1 $f0, 0($sp) # in delay slot 21361595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze 21371595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ld $ra, 312($sp) 21381595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_restore 31 21391595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ld $t8, 304($sp) # restore t8 holding caller's gp 21401595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_restore 24 21411595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ld $t3, 296($sp) 21421595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_restore 15 21431595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ld $t2, 288($sp) 21441595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_restore 14 21451595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ld $t1, 280($sp) 21461595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_restore 13 21471595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ld $t0, 272($sp) 21481595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_restore 12 21491595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ld $a7, 264($sp) 21501595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_restore 11 21511595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ld $a6, 256($sp) 21521595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_restore 10 21531595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ld $a5, 248($sp) 21541595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_restore 9 21551595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ld $a4, 240($sp) 21561595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_restore 8 21571595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ld $a3, 232($sp) 21581595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_restore 7 21591595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ld $a2, 224($sp) 21601595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_restore 6 21611595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ld $a1, 216($sp) 21621595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_restore 5 21631595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ld $a0, 208($sp) 21641595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_restore 4 21651595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ld $v1, 200($sp) 21661595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_restore 3 21671595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze 21681595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .ifnc \reg, $v0 21691595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze move \reg, $v0 # `reg` <- v0 21701595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ld $v0, 192($sp) 21711595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_restore 2 21721595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .endif 21731595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze 21741595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ldc1 $f23, 184($sp) 21751595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ldc1 $f22, 176($sp) 21761595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ldc1 $f21, 168($sp) 21771595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ldc1 $f20, 160($sp) 21781595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ldc1 $f19, 152($sp) 21791595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ldc1 $f18, 144($sp) 21801595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ldc1 $f17, 136($sp) 21811595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ldc1 $f16, 128($sp) 21821595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ldc1 $f15, 120($sp) 21831595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ldc1 $f14, 112($sp) 21841595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ldc1 $f13, 104($sp) 21851595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ldc1 $f12, 96($sp) 21861595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ldc1 $f11, 88($sp) 21871595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ldc1 $f10, 80($sp) 21881595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ldc1 $f9, 72($sp) 21891595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ldc1 $f8, 64($sp) 21901595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ldc1 $f7, 56($sp) 21911595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ldc1 $f6, 48($sp) 21921595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ldc1 $f5, 40($sp) 21931595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ldc1 $f4, 32($sp) 21941595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ldc1 $f3, 24($sp) 21951595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ldc1 $f2, 16($sp) 21961595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ldc1 $f1, 8($sp) 21971595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze ldc1 $f0, 0($sp) 21981595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze 21991595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cpreturn # restore caller's gp from t8 22001595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze jalr $zero, $ra 22011595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze daddiu $sp, $sp, 320 22021595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze .cfi_adjust_cfa_offset -320 22031595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey FrunzeEND \name 22041595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze.endm 22051595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze 22061595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze// Note that art_quick_read_barrier_mark_regXX corresponds to register XX+1. 22071595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze// ZERO (register 0) is reserved. 22081595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze// AT (register 1) is reserved as a temporary/scratch register. 22091595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey FrunzeREAD_BARRIER_MARK_REG art_quick_read_barrier_mark_reg01, $v0 22101595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey FrunzeREAD_BARRIER_MARK_REG art_quick_read_barrier_mark_reg02, $v1 22111595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey FrunzeREAD_BARRIER_MARK_REG art_quick_read_barrier_mark_reg03, $a0 22121595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey FrunzeREAD_BARRIER_MARK_REG art_quick_read_barrier_mark_reg04, $a1 22131595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey FrunzeREAD_BARRIER_MARK_REG art_quick_read_barrier_mark_reg05, $a2 22141595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey FrunzeREAD_BARRIER_MARK_REG art_quick_read_barrier_mark_reg06, $a3 22151595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey FrunzeREAD_BARRIER_MARK_REG art_quick_read_barrier_mark_reg07, $a4 22161595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey FrunzeREAD_BARRIER_MARK_REG art_quick_read_barrier_mark_reg08, $a5 22171595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey FrunzeREAD_BARRIER_MARK_REG art_quick_read_barrier_mark_reg09, $a6 22181595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey FrunzeREAD_BARRIER_MARK_REG art_quick_read_barrier_mark_reg10, $a7 22191595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey FrunzeREAD_BARRIER_MARK_REG art_quick_read_barrier_mark_reg11, $t0 22201595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey FrunzeREAD_BARRIER_MARK_REG art_quick_read_barrier_mark_reg12, $t1 22211595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey FrunzeREAD_BARRIER_MARK_REG art_quick_read_barrier_mark_reg13, $t2 22221595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze// T3 (register 15) is reserved as a temporary/scratch register. 22231595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze// S0 and S1 (registers 16 and 17) are reserved as suspended and thread registers. 22241595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey FrunzeREAD_BARRIER_MARK_REG art_quick_read_barrier_mark_reg17, $s2 22251595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey FrunzeREAD_BARRIER_MARK_REG art_quick_read_barrier_mark_reg18, $s3 22261595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey FrunzeREAD_BARRIER_MARK_REG art_quick_read_barrier_mark_reg19, $s4 22271595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey FrunzeREAD_BARRIER_MARK_REG art_quick_read_barrier_mark_reg20, $s5 22281595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey FrunzeREAD_BARRIER_MARK_REG art_quick_read_barrier_mark_reg21, $s6 22291595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey FrunzeREAD_BARRIER_MARK_REG art_quick_read_barrier_mark_reg22, $s7 22301595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze// T8 and T9 (registers 24 and 25) are reserved as temporary/scratch registers. 22311595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze// K0, K1, GP, SP (registers 26 - 29) are reserved. 22321595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey FrunzeREAD_BARRIER_MARK_REG art_quick_read_barrier_mark_reg29, $s8 22331595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze// RA (register 31) is reserved. 22341595815c2a914a78df7dfb6f0082f47d4e82bb36Alexey Frunze 2235ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson.extern artInvokePolymorphic 2236ac141397dc29189ad2b2df41f8d4312246beec60Orion HodsonENTRY art_quick_invoke_polymorphic 2237ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson SETUP_SAVE_REFS_AND_ARGS_FRAME 2238ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson move $a2, rSELF # Make $a2 an alias for the current Thread. 2239ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson move $a3, $sp # Make $a3 a pointer to the saved frame context. 2240ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson daddiu $sp, $sp, -8 # Reserve space for JValue result. 2241ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson .cfi_adjust_cfa_offset 8 2242ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson sd $zero, 0($sp) # Initialize JValue result. 2243ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson jal artInvokePolymorphic # (result, receiver, Thread*, context) 2244c480b9853ac7be67581cd26c49c2ed7426ae68a4Alexey Frunze move $a0, $sp # Make $a0 a pointer to the JValue result 2245ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson.macro MATCH_RETURN_TYPE c, handler 2246ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson li $t0, \c 2247ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson beq $v0, $t0, \handler 2248ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson.endm 2249ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson MATCH_RETURN_TYPE 'V', .Lcleanup_and_return 2250ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson MATCH_RETURN_TYPE 'L', .Lstore_ref_result 2251ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson MATCH_RETURN_TYPE 'I', .Lstore_long_result 2252ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson MATCH_RETURN_TYPE 'J', .Lstore_long_result 2253ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson MATCH_RETURN_TYPE 'B', .Lstore_long_result 2254ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson MATCH_RETURN_TYPE 'C', .Lstore_char_result 2255ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson MATCH_RETURN_TYPE 'D', .Lstore_double_result 2256ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson MATCH_RETURN_TYPE 'F', .Lstore_float_result 2257ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson MATCH_RETURN_TYPE 'S', .Lstore_long_result 2258c480b9853ac7be67581cd26c49c2ed7426ae68a4Alexey Frunze MATCH_RETURN_TYPE 'Z', .Lstore_boolean_result 2259ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson.purgem MATCH_RETURN_TYPE 2260ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson nop 2261ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson b .Lcleanup_and_return 2262ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson nop 2263ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson.Lstore_boolean_result: 2264ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson b .Lcleanup_and_return 2265c480b9853ac7be67581cd26c49c2ed7426ae68a4Alexey Frunze lbu $v0, 0($sp) # Move byte from JValue result to return value register. 2266ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson.Lstore_char_result: 2267ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson b .Lcleanup_and_return 2268c480b9853ac7be67581cd26c49c2ed7426ae68a4Alexey Frunze lhu $v0, 0($sp) # Move char from JValue result to return value register. 2269ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson.Lstore_double_result: 2270ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson.Lstore_float_result: 2271ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson b .Lcleanup_and_return 2272c480b9853ac7be67581cd26c49c2ed7426ae68a4Alexey Frunze l.d $f0, 0($sp) # Move double/float from JValue result to return value register. 2273ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson.Lstore_ref_result: 2274ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson b .Lcleanup_and_return 2275c480b9853ac7be67581cd26c49c2ed7426ae68a4Alexey Frunze lwu $v0, 0($sp) # Move zero extended lower 32-bits to return value register. 2276ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson.Lstore_long_result: 2277ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson ld $v0, 0($sp) # Move long from JValue result to return value register. 2278ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson // Fall-through to clean up and return. 2279ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson.Lcleanup_and_return: 2280ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson daddiu $sp, $sp, 8 # Remove space for JValue result. 2281ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson .cfi_adjust_cfa_offset -8 2282ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson ld $t0, THREAD_EXCEPTION_OFFSET(rSELF) # Load Thread::Current()->exception_ 2283ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson RESTORE_SAVE_REFS_AND_ARGS_FRAME 2284ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson bnez $t0, 1f # Success if no exception is pending. 2285ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson nop 2286ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson jalr $zero, $ra 2287ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson nop 2288ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson1: 2289ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson DELIVER_PENDING_EXCEPTION 2290ac141397dc29189ad2b2df41f8d4312246beec60Orion HodsonEND art_quick_invoke_polymorphic 2291ac141397dc29189ad2b2df41f8d4312246beec60Orion Hodson 22929701c2ee2dde033e2269dcfc592a09f21151e97eChris Larsen .set pop 2293