quick_entrypoints_mips.S revision 0747466fca310eedea5fc49e37d54f240a0b3c0f
10f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes/* 20f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes * Copyright (C) 2012 The Android Open Source Project 30f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes * 40f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes * Licensed under the Apache License, Version 2.0 (the "License"); 50f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes * you may not use this file except in compliance with the License. 60f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes * You may obtain a copy of the License at 70f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes * 80f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes * http://www.apache.org/licenses/LICENSE-2.0 90f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes * 100f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes * Unless required by applicable law or agreed to in writing, software 110f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes * distributed under the License is distributed on an "AS IS" BASIS, 120f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 130f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes * See the License for the specific language governing permissions and 140f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes * limitations under the License. 150f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes */ 160f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes 177655f29fabc0a12765de828914a18314382e5a35Ian Rogers#include "asm_support_mips.S" 185bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 197410f29b4dae223befac036ea567d7f33351dad1Mathieu Chartier#include "arch/quick_alloc_entrypoints.S" 207410f29b4dae223befac036ea567d7f33351dad1Mathieu Chartier 210703060875166106af3d490c6c264611aea67ec8jeffhao .set noreorder 225bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee .balign 4 235bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 245bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* Deliver the given exception */ 255bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee .extern artDeliverExceptionFromCode 265bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* Deliver an exception pending on a thread */ 278161c0336b97e11e02c000af357f8f40de2e23e4jeffhao .extern artDeliverPendingExceptionFromCode 285bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 29735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung#define ARG_SLOT_SIZE 32 // space for a0-a3 plus 4 more words 30735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung 315bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 325bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Macro that sets up the callee save frame to conform with 335bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Runtime::CreateCalleeSaveMethod(kSaveAll) 34735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * Callee-save: $s0-$s8 + $gp + $ra, 11 total + 1 word for Method* 35735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * Clobbers $t0 and $sp 36735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * Allocates ARG_SLOT_SIZE bytes at the bottom of the stack for arg slots. 37735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * Reserves FRAME_SIZE_SAVE_ALL_CALLEE_SAVE + ARG_SLOT_SIZE bytes on the stack 385bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 3957b86d47b66322693a070185fadfb43cb9c12eabIan Rogers.macro SETUP_SAVE_ALL_CALLEE_SAVE_FRAME 40a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe addiu $sp, $sp, -96 41a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe .cfi_adjust_cfa_offset 96 425c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe 435c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe // Ugly compile-time check, but we only have the preprocessor. 44a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe#if (FRAME_SIZE_SAVE_ALL_CALLEE_SAVE != 96) 455c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe#error "SAVE_ALL_CALLEE_SAVE_FRAME(MIPS) size not as expected." 465c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe#endif 475c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe 48a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe sw $ra, 92($sp) 49a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe .cfi_rel_offset 31, 92 50a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe sw $s8, 88($sp) 51a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe .cfi_rel_offset 30, 88 52a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe sw $gp, 84($sp) 53a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe .cfi_rel_offset 28, 84 54a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe sw $s7, 80($sp) 55a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe .cfi_rel_offset 23, 80 56a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe sw $s6, 76($sp) 57a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe .cfi_rel_offset 22, 76 58a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe sw $s5, 72($sp) 59a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe .cfi_rel_offset 21, 72 60a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe sw $s4, 68($sp) 61a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe .cfi_rel_offset 20, 68 62a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe sw $s3, 64($sp) 63a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe .cfi_rel_offset 19, 64 64a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe sw $s2, 60($sp) 65a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe .cfi_rel_offset 18, 60 66a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe sw $s1, 56($sp) 67a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe .cfi_rel_offset 17, 56 68a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe sw $s0, 52($sp) 69a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe .cfi_rel_offset 16, 52 70a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe 71a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe SDu $f30, $f31, 44, $sp, $t1 72a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe SDu $f28, $f29, 36, $sp, $t1 73a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe SDu $f26, $f27, 28, $sp, $t1 74a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe SDu $f24, $f25, 20, $sp, $t1 75a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe SDu $f22, $f23, 12, $sp, $t1 76a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe SDu $f20, $f21, 4, $sp, $t1 77a4e0e67611f54180694e0807d6599c1132269b6cAndreas Gampe 78735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung # 1 word for holding Method* 791d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers 804af77b7636fe98aae443b46a241fd9a29f16e291Douglas Leung lw $t0, %got(_ZN3art7Runtime9instance_E)($gp) 814af77b7636fe98aae443b46a241fd9a29f16e291Douglas Leung lw $t0, 0($t0) 824af77b7636fe98aae443b46a241fd9a29f16e291Douglas Leung lw $t0, RUNTIME_SAVE_ALL_CALLEE_SAVE_FRAME_OFFSET($t0) 831d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers sw $t0, 0($sp) # Place Method* at bottom of stack. 841d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers sw $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF) # Place sp in Thread::Current()->top_quick_frame. 85735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, -ARG_SLOT_SIZE # reserve argument slots on the stack 86735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_adjust_cfa_offset ARG_SLOT_SIZE 875bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee.endm 885bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 895bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 905bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Macro that sets up the callee save frame to conform with 915bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Runtime::CreateCalleeSaveMethod(kRefsOnly). Restoration assumes non-moving GC. 925bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Does not include rSUSPEND or rSELF 93735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * callee-save: $s2-$s8 + $gp + $ra, 9 total + 2 words padding + 1 word to hold Method* 94735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * Clobbers $t0 and $sp 95735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * Allocates ARG_SLOT_SIZE bytes at the bottom of the stack for arg slots. 96735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * Reserves FRAME_SIZE_REFS_ONLY_CALLEE_SAVE + ARG_SLOT_SIZE bytes on the stack 975bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 981d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers.macro SETUP_REFS_ONLY_CALLEE_SAVE_FRAME 99735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, -48 100735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_adjust_cfa_offset 48 1015c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe 1025c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe // Ugly compile-time check, but we only have the preprocessor. 103735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung#if (FRAME_SIZE_REFS_ONLY_CALLEE_SAVE != 48) 1045c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe#error "REFS_ONLY_CALLEE_SAVE_FRAME(MIPS) size not as expected." 1055c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe#endif 1065c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe 107735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung sw $ra, 44($sp) 108735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_rel_offset 31, 44 109735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung sw $s8, 40($sp) 110735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_rel_offset 30, 40 111735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung sw $gp, 36($sp) 112735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_rel_offset 28, 36 113735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung sw $s7, 32($sp) 114735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_rel_offset 23, 32 115735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung sw $s6, 28($sp) 116735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_rel_offset 22, 28 117735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung sw $s5, 24($sp) 118735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_rel_offset 21, 24 119735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung sw $s4, 20($sp) 120735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_rel_offset 20, 20 121735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung sw $s3, 16($sp) 122735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_rel_offset 19, 16 123735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung sw $s2, 12($sp) 124735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_rel_offset 18, 12 125735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung # 2 words for alignment and bottom word will hold Method* 1261d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers 1274af77b7636fe98aae443b46a241fd9a29f16e291Douglas Leung lw $t0, %got(_ZN3art7Runtime9instance_E)($gp) 1284af77b7636fe98aae443b46a241fd9a29f16e291Douglas Leung lw $t0, 0($t0) 1294af77b7636fe98aae443b46a241fd9a29f16e291Douglas Leung lw $t0, RUNTIME_REFS_ONLY_CALLEE_SAVE_FRAME_OFFSET($t0) 1301d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers sw $t0, 0($sp) # Place Method* at bottom of stack. 1311d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers sw $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF) # Place sp in Thread::Current()->top_quick_frame. 132735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, -ARG_SLOT_SIZE # reserve argument slots on the stack 133735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_adjust_cfa_offset ARG_SLOT_SIZE 1345bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee.endm 1355bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 1361d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers.macro RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME 137735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, ARG_SLOT_SIZE # remove argument slots on the stack 138735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_adjust_cfa_offset -ARG_SLOT_SIZE 139735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $ra, 44($sp) 140bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 31 141735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $s8, 40($sp) 142bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 30 143735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $gp, 36($sp) 144bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 28 145735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $s7, 32($sp) 146bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 23 147735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $s6, 28($sp) 148bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 22 149735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $s5, 24($sp) 150bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 21 151735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $s4, 20($sp) 152bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 20 153735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $s3, 16($sp) 154bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 19 155735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $s2, 12($sp) 156bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 18 157735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, 48 158735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_adjust_cfa_offset -48 1595bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee.endm 1605bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 1611d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers.macro RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME_AND_RETURN 162735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME 1638d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $ra 164735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung nop 1655bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee.endm 1665bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 1675bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 1685bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Macro that sets up the callee save frame to conform with 169735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * Runtime::CreateCalleeSaveMethod(kRefsAndArgs). 1701f3bc2f0f9366594379249027622ab63673b0d3bJeff Hao * callee-save: $a1-$a3, $s2-$s8 + $gp + $ra, 12 total + 3 words padding + method* 1715bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 172735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung.macro SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME_REGISTERS_ONLY 173ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $sp, $sp, -80 174ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic .cfi_adjust_cfa_offset 80 1755c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe 1765c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe // Ugly compile-time check, but we only have the preprocessor. 177ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic#if (FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE != 80) 1785c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe#error "REFS_AND_ARGS_CALLEE_SAVE_FRAME(MIPS) size not as expected." 1795c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe#endif 1805c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe 181ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic sw $ra, 76($sp) 182ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic .cfi_rel_offset 31, 76 183ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic sw $s8, 72($sp) 184ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic .cfi_rel_offset 30, 72 185ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic sw $gp, 68($sp) 186ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic .cfi_rel_offset 28, 68 187ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic sw $s7, 64($sp) 188ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic .cfi_rel_offset 23, 64 189ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic sw $s6, 60($sp) 190ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic .cfi_rel_offset 22, 60 191ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic sw $s5, 56($sp) 192ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic .cfi_rel_offset 21, 56 193ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic sw $s4, 52($sp) 194ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic .cfi_rel_offset 20, 52 195ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic sw $s3, 48($sp) 196ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic .cfi_rel_offset 19, 48 197ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic sw $s2, 44($sp) 198ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic .cfi_rel_offset 18, 44 199ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic sw $a3, 40($sp) 200ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic .cfi_rel_offset 7, 40 201ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic sw $a2, 36($sp) 202ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic .cfi_rel_offset 6, 36 203ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic sw $a1, 32($sp) 204ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic .cfi_rel_offset 5, 32 205ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic SDu $f14, $f15, 24, $sp, $t0 206ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic SDu $f12, $f13, 16, $sp, $t0 207fa147e22a73c6df166b08a2f71f9c9b52b09d17cjeffhao # bottom will hold Method* 208735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung.endm 2091d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers 210735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung /* 211735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * Macro that sets up the callee save frame to conform with 212735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * Runtime::CreateCalleeSaveMethod(kRefsAndArgs). Restoration assumes non-moving GC. 213ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic * callee-save: $a1-$a3, $f12-$f15, $s2-$s8 + $gp + $ra, 12 total + 3 words padding + method* 214735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * Clobbers $t0 and $sp 215735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * Allocates ARG_SLOT_SIZE bytes at the bottom of the stack for arg slots. 216735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * Reserves FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE + ARG_SLOT_SIZE bytes on the stack 217735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung */ 218735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung.macro SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME 219735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME_REGISTERS_ONLY 2204af77b7636fe98aae443b46a241fd9a29f16e291Douglas Leung lw $t0, %got(_ZN3art7Runtime9instance_E)($gp) 2214af77b7636fe98aae443b46a241fd9a29f16e291Douglas Leung lw $t0, 0($t0) 2224af77b7636fe98aae443b46a241fd9a29f16e291Douglas Leung lw $t0, RUNTIME_REFS_AND_ARGS_CALLEE_SAVE_FRAME_OFFSET($t0) 2231d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers sw $t0, 0($sp) # Place Method* at bottom of stack. 2241d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers sw $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF) # Place sp in Thread::Current()->top_quick_frame. 225735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, -ARG_SLOT_SIZE # reserve argument slots on the stack 226735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_adjust_cfa_offset ARG_SLOT_SIZE 227735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung.endm 228735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung 229735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung /* 230735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * Macro that sets up the callee save frame to conform with 231735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * Runtime::CreateCalleeSaveMethod(kRefsAndArgs). Restoration assumes non-moving GC. 232ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic * callee-save: $a1-$a3, $f12-$f15, $s2-$s8 + $gp + $ra, 12 total + 3 words padding + method* 233735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * Clobbers $sp 234735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * Use $a0 as the Method* and loads it into bottom of stack. 235735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * Allocates ARG_SLOT_SIZE bytes at the bottom of the stack for arg slots. 236735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * Reserves FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE + ARG_SLOT_SIZE bytes on the stack 237735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung */ 238735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung.macro SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME_WITH_METHOD_IN_A0 239735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME_REGISTERS_ONLY 240735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung sw $a0, 0($sp) # Place Method* at bottom of stack. 241735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung sw $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF) # Place sp in Thread::Current()->top_quick_frame. 242735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, -ARG_SLOT_SIZE # reserve argument slots on the stack 243735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_adjust_cfa_offset ARG_SLOT_SIZE 2445bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee.endm 2455bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 2461d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers.macro RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME 247735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, ARG_SLOT_SIZE # remove argument slots on the stack 248735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_adjust_cfa_offset -ARG_SLOT_SIZE 249ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lw $ra, 76($sp) 250bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 31 251ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lw $s8, 72($sp) 252bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 30 253ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lw $gp, 68($sp) 254bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 28 255ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lw $s7, 64($sp) 256bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 23 257ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lw $s6, 60($sp) 258bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 22 259ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lw $s5, 56($sp) 260bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 21 261ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lw $s4, 52($sp) 262bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 20 263ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lw $s3, 48($sp) 264bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 19 265ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lw $s2, 44($sp) 266bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 18 267ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lw $a3, 40($sp) 268bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 7 269ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lw $a2, 36($sp) 270bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 6 271ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lw $a1, 32($sp) 272bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 5 273ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic LDu $f14, $f15, 24, $sp, $t1 274ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic LDu $f12, $f13, 16, $sp, $t1 275ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $sp, $sp, 80 # pop frame 276ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic .cfi_adjust_cfa_offset -80 2775bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee.endm 2785bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 2795bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 2805bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Macro that set calls through to artDeliverPendingExceptionFromCode, where the pending 2815bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * exception is Thread::Current()->exception_ 2825bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 2835bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee.macro DELIVER_PENDING_EXCEPTION 2848161c0336b97e11e02c000af357f8f40de2e23e4jeffhao SETUP_SAVE_ALL_CALLEE_SAVE_FRAME # save callee saves for throw 2858161c0336b97e11e02c000af357f8f40de2e23e4jeffhao la $t9, artDeliverPendingExceptionFromCode 2868d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $t9 # artDeliverPendingExceptionFromCode(Thread*) 2871d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers move $a0, rSELF # pass Thread::Current 2885bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee.endm 2895bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 2905bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee.macro RETURN_IF_NO_EXCEPTION 2917fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ 2921d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME 2938161c0336b97e11e02c000af357f8f40de2e23e4jeffhao bnez $t0, 1f # success if no exception is pending 2945bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee nop 2958d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $ra 2965bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee nop 2975bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee1: 2985bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee DELIVER_PENDING_EXCEPTION 2995bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee.endm 3005bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 3015bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee.macro RETURN_IF_ZERO 3021d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME 3037fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao bnez $v0, 1f # success? 3045bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee nop 3058d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $ra # return on success 3065bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee nop 3075bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee1: 3085bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee DELIVER_PENDING_EXCEPTION 3095bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee.endm 3105bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 3111cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe.macro RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 3121d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME 3137fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao beqz $v0, 1f # success? 3145bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee nop 3158d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $ra # return on success 3165bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee nop 3175bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee1: 3185bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee DELIVER_PENDING_EXCEPTION 3195bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee.endm 3205bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 3215bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 3227fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao * On entry $a0 is uint32_t* gprs_ and $a1 is uint32_t* fprs_ 3235bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * FIXME: just guessing about the shape of the jmpbuf. Where will pc be? 3245bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 325d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff HaoENTRY art_quick_do_long_jump 326e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f0, $f1, 0*8, $a1, $t1 327e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f2, $f3, 1*8, $a1, $t1 328e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f4, $f5, 2*8, $a1, $t1 329e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f6, $f7, 3*8, $a1, $t1 330e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f8, $f9, 4*8, $a1, $t1 331e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f10, $f11, 5*8, $a1, $t1 332e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f12, $f13, 6*8, $a1, $t1 333e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f14, $f15, 7*8, $a1, $t1 334e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f16, $f17, 8*8, $a1, $t1 335e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f18, $f19, 9*8, $a1, $t1 336e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f20, $f21, 10*8, $a1, $t1 337e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f22, $f23, 11*8, $a1, $t1 338e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f24, $f25, 12*8, $a1, $t1 339e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f26, $f27, 13*8, $a1, $t1 340e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f28, $f29, 14*8, $a1, $t1 341e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f30, $f31, 15*8, $a1, $t1 342e34652f15f32666323052a6718a63248244f1e66Duane Sand 343748dd957eecbce2f379a3182ce95c19be308a54eChris Dearman .set push 344748dd957eecbce2f379a3182ce95c19be308a54eChris Dearman .set nomacro 345748dd957eecbce2f379a3182ce95c19be308a54eChris Dearman .set noat 3467fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $at, 4($a0) 347748dd957eecbce2f379a3182ce95c19be308a54eChris Dearman .set pop 3487fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $v0, 8($a0) 3497fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $v1, 12($a0) 3507fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $a1, 20($a0) 3517fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $a2, 24($a0) 3527fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $a3, 28($a0) 3537fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $t0, 32($a0) 3547fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $t1, 36($a0) 3557fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $t2, 40($a0) 3567fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $t3, 44($a0) 3577fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $t4, 48($a0) 3587fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $t5, 52($a0) 3597fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $t6, 56($a0) 3607fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $t7, 60($a0) 3617fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $s0, 64($a0) 3627fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $s1, 68($a0) 3637fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $s2, 72($a0) 3647fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $s3, 76($a0) 3657fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $s4, 80($a0) 3667fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $s5, 84($a0) 3677fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $s6, 88($a0) 3687fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $s7, 92($a0) 3697fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $t8, 96($a0) 3707fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $t9, 100($a0) 3717fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $gp, 112($a0) 3727fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $sp, 116($a0) 3737fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $fp, 120($a0) 3747fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $ra, 124($a0) 3757fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $a0, 16($a0) 3767fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao move $v0, $zero # clear result registers r0 and r1 3778d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $ra # do long jump 3787fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao move $v1, $zero 379d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff HaoEND art_quick_do_long_jump 3805bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 3815bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 3825bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Called by managed code, saves most registers (forms basis of long jump context) and passes 3835bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * the bottom of the stack. artDeliverExceptionFromCode will place the callee save Method* at 38484bc06e30ba12c3ff07e577c52b63b9df162af7eLazar Trsic * the bottom of the thread. On entry a0 holds Throwable* 3855bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 386468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_deliver_exception 38757b86d47b66322693a070185fadfb43cb9c12eabIan Rogers SETUP_SAVE_ALL_CALLEE_SAVE_FRAME 3888161c0336b97e11e02c000af357f8f40de2e23e4jeffhao la $t9, artDeliverExceptionFromCode 3898d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $t9 # artDeliverExceptionFromCode(Throwable*, Thread*) 3901d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers move $a1, rSELF # pass Thread::Current 391468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_deliver_exception 3925bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 3935bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 3945bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Called by managed code to create and deliver a NullPointerException 3955bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 396d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artThrowNullPointerExceptionFromCode 397468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_throw_null_pointer_exception 39857b86d47b66322693a070185fadfb43cb9c12eabIan Rogers SETUP_SAVE_ALL_CALLEE_SAVE_FRAME 3998161c0336b97e11e02c000af357f8f40de2e23e4jeffhao la $t9, artThrowNullPointerExceptionFromCode 4008d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $t9 # artThrowNullPointerExceptionFromCode(Thread*) 4011d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers move $a0, rSELF # pass Thread::Current 402468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_throw_null_pointer_exception 4035bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 4045bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 4055bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Called by managed code to create and deliver an ArithmeticException 4065bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 407d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artThrowDivZeroFromCode 408468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_throw_div_zero 40957b86d47b66322693a070185fadfb43cb9c12eabIan Rogers SETUP_SAVE_ALL_CALLEE_SAVE_FRAME 4108161c0336b97e11e02c000af357f8f40de2e23e4jeffhao la $t9, artThrowDivZeroFromCode 4118d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $t9 # artThrowDivZeroFromCode(Thread*) 4121d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers move $a0, rSELF # pass Thread::Current 413468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_throw_div_zero 4145bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 4155bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 4165bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Called by managed code to create and deliver an ArrayIndexOutOfBoundsException 4175bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 418d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artThrowArrayBoundsFromCode 419468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_throw_array_bounds 42057b86d47b66322693a070185fadfb43cb9c12eabIan Rogers SETUP_SAVE_ALL_CALLEE_SAVE_FRAME 4218161c0336b97e11e02c000af357f8f40de2e23e4jeffhao la $t9, artThrowArrayBoundsFromCode 4228d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $t9 # artThrowArrayBoundsFromCode(index, limit, Thread*) 4231d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers move $a2, rSELF # pass Thread::Current 424468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_throw_array_bounds 4255bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 42657b86d47b66322693a070185fadfb43cb9c12eabIan Rogers /* 42757b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Called by managed code to create and deliver a StackOverflowError. 42857b86d47b66322693a070185fadfb43cb9c12eabIan Rogers */ 429d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artThrowStackOverflowFromCode 430468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_throw_stack_overflow 43157b86d47b66322693a070185fadfb43cb9c12eabIan Rogers SETUP_SAVE_ALL_CALLEE_SAVE_FRAME 4328161c0336b97e11e02c000af357f8f40de2e23e4jeffhao la $t9, artThrowStackOverflowFromCode 4338d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $t9 # artThrowStackOverflowFromCode(Thread*) 4341d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers move $a0, rSELF # pass Thread::Current 435468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_throw_stack_overflow 4365bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 43757b86d47b66322693a070185fadfb43cb9c12eabIan Rogers /* 43857b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Called by managed code to create and deliver a NoSuchMethodError. 43957b86d47b66322693a070185fadfb43cb9c12eabIan Rogers */ 440d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artThrowNoSuchMethodFromCode 441468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_throw_no_such_method 44257b86d47b66322693a070185fadfb43cb9c12eabIan Rogers SETUP_SAVE_ALL_CALLEE_SAVE_FRAME 4438161c0336b97e11e02c000af357f8f40de2e23e4jeffhao la $t9, artThrowNoSuchMethodFromCode 4448d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $t9 # artThrowNoSuchMethodFromCode(method_idx, Thread*) 4451d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers move $a1, rSELF # pass Thread::Current 446468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_throw_no_such_method 4475bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 4485bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 4495bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * All generated callsites for interface invokes and invocation slow paths will load arguments 4507fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao * as usual - except instead of loading arg0/$a0 with the target Method*, arg0/$a0 will contain 4517ea6a170486d81b127e69673cd1020c4db628c93Nicolas Geoffray * the method_idx. This wrapper will save arg1-arg3, and call the appropriate C helper. 4527fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao * NOTE: "this" is first visable argument of the target, and so can be found in arg1/$a1. 4535bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * 4547fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao * The helper will attempt to locate the target and return a 64-bit result in $v0/$v1 consisting 4557fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao * of the target Method* in $v0 and method->code_ in $v1. 4565bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * 4572cebb24bfc3247d3e9be138a3350106737455918Mathieu Chartier * If unsuccessful, the helper will return null/null. There will be a pending exception in the 4585bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * thread and we branch to another stub to deliver it. 4595bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * 4605bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * On success this wrapper will restore arguments and *jump* to the target, leaving the lr 4615bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * pointing back to the original caller. 4625bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 4633031c8da0c5009183f770b005c245f9bf2a4d01bAndreas Gampe.macro INVOKE_TRAMPOLINE_BODY cxx_name 4645bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee .extern \cxx_name 4651d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME # save callee saves in case allocation triggers GC 4667ea6a170486d81b127e69673cd1020c4db628c93Nicolas Geoffray move $a2, rSELF # pass Thread::Current 4677ea6a170486d81b127e69673cd1020c4db628c93Nicolas Geoffray jal \cxx_name # (method_idx, this, Thread*, $sp) 4687ea6a170486d81b127e69673cd1020c4db628c93Nicolas Geoffray addiu $a3, $sp, ARG_SLOT_SIZE # pass $sp (remove arg slots) 4697ea6a170486d81b127e69673cd1020c4db628c93Nicolas Geoffray move $a0, $v0 # save target Method* 4701d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME 471fa147e22a73c6df166b08a2f71f9c9b52b09d17cjeffhao beqz $v0, 1f 4727ea6a170486d81b127e69673cd1020c4db628c93Nicolas Geoffray move $t9, $v1 # save $v0->code_ 4738d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $t9 4745bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee nop 4755bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee1: 4765bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee DELIVER_PENDING_EXCEPTION 4773031c8da0c5009183f770b005c245f9bf2a4d01bAndreas Gampe.endm 4783031c8da0c5009183f770b005c245f9bf2a4d01bAndreas Gampe.macro INVOKE_TRAMPOLINE c_name, cxx_name 4793031c8da0c5009183f770b005c245f9bf2a4d01bAndreas GampeENTRY \c_name 4803031c8da0c5009183f770b005c245f9bf2a4d01bAndreas Gampe INVOKE_TRAMPOLINE_BODY \cxx_name 481d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff HaoEND \c_name 4825bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee.endm 4835bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 4848dbb708c7dc05c786329eb5c3fff3194ab6472acLogan ChienINVOKE_TRAMPOLINE art_quick_invoke_interface_trampoline_with_access_check, artInvokeInterfaceTrampolineWithAccessCheck 4855bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 4868dbb708c7dc05c786329eb5c3fff3194ab6472acLogan ChienINVOKE_TRAMPOLINE art_quick_invoke_static_trampoline_with_access_check, artInvokeStaticTrampolineWithAccessCheck 4878dbb708c7dc05c786329eb5c3fff3194ab6472acLogan ChienINVOKE_TRAMPOLINE art_quick_invoke_direct_trampoline_with_access_check, artInvokeDirectTrampolineWithAccessCheck 4888dbb708c7dc05c786329eb5c3fff3194ab6472acLogan ChienINVOKE_TRAMPOLINE art_quick_invoke_super_trampoline_with_access_check, artInvokeSuperTrampolineWithAccessCheck 4898dbb708c7dc05c786329eb5c3fff3194ab6472acLogan ChienINVOKE_TRAMPOLINE art_quick_invoke_virtual_trampoline_with_access_check, artInvokeVirtualTrampolineWithAccessCheck 4905bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 491ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic.macro LOAD_WORD_TO_REG reg, next_arg, index, label 492ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lw $\reg, -4($\next_arg) # next_arg points to argument after the current one (offset is 4) 493ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic b \label 494ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $\index, 1 495ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic.endm 496ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic 497ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic.macro LOAD_LONG_TO_REG reg1, reg2, next_arg, index, label 498ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lw $\reg1, -8($\next_arg) # next_arg points to argument after the current one (offset is 8) 499ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lw $\reg2, -4($\next_arg) 500ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic b \label 501ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic li $\index, 4 # long can be loaded only to a2_a3 pair so index will be always 4 502ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic.endm 503ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic 504ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic.macro LOAD_FLOAT_TO_REG reg, next_arg, index, label 505ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lwc1 $\reg, -4($\next_arg) # next_arg points to argument after the current one (offset is 4) 506ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic b \label 507ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $\index, 1 508ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic.endm 509ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic 510ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic.macro LOAD_DOUBLE_TO_REG reg1, reg2, next_arg, index, tmp, label 511ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic LDu $\reg1, $\reg2, -8, $\next_arg, $\tmp # next_arg points to argument after the current one 512ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic # (offset is 8) 513ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic b \label 514ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $\index, 1 515ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic.endm 516ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic 51779fe539587d4c09244172d0168eeed0ec9770466Jeff Hao /* 518ef7d42fca18c16fbaf103822ad16f23246e2905dIan Rogers * Invocation stub for quick code. 5195d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao * On entry: 5205d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao * a0 = method pointer 5212cebb24bfc3247d3e9be138a3350106737455918Mathieu Chartier * a1 = argument array or null for no argument methods 5225d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao * a2 = size of argument array in bytes 5235d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao * a3 = (managed) thread pointer 5246474d190d5604898354ebf767f1944b6e3e9b445Jeff Hao * [sp + 16] = JValue* result 5250177e53ea521ad58b70c305700dab32f1ac773b7Ian Rogers * [sp + 20] = shorty 5265d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao */ 5275d9173014c1ca09f7249a6b07629aa37778b5f8fJeff HaoENTRY art_quick_invoke_stub 5285d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao sw $a0, 0($sp) # save out a0 5295d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao addiu $sp, $sp, -16 # spill s0, s1, fp, ra 5305d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao .cfi_adjust_cfa_offset 16 5315d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao sw $ra, 12($sp) 5325d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao .cfi_rel_offset 31, 12 5335d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao sw $fp, 8($sp) 5345d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao .cfi_rel_offset 30, 8 5355d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao sw $s1, 4($sp) 5365d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao .cfi_rel_offset 17, 4 5375d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao sw $s0, 0($sp) 5385d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao .cfi_rel_offset 16, 0 5395d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao move $fp, $sp # save sp in fp 5405d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao .cfi_def_cfa_register 30 5415d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao move $s1, $a3 # move managed thread pointer into s1 5425d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao addiu $s0, $zero, SUSPEND_CHECK_INTERVAL # reset s0 to suspend check interval 543ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $t0, $a2, 4 # create space for ArtMethod* in frame. 544735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung subu $t0, $sp, $t0 # reserve & align *stack* to 16 bytes: 545ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic srl $t0, $t0, 4 # native calling convention only aligns to 8B, 546ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic sll $sp, $t0, 4 # so we have to ensure ART 16B alignment ourselves. 547ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $a0, $sp, 4 # pass stack pointer + ArtMethod* as dest for memcpy 5485d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao jal memcpy # (dest, src, bytes) 5495d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao addiu $sp, $sp, -16 # make space for argument slots for memcpy 5505d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao addiu $sp, $sp, 16 # restore stack after memcpy 551ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lw $a0, 16($fp) # restore ArtMethod* 552ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lw $a1, 4($sp) # a1 = this* 553ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $t0, $sp, 8 # t0 = pointer to the current argument (skip ArtMethod* and this*) 554ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic li $t3, 2 # t3 = gpr_index = 2 (skip A0 and A1) 555ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic move $t4, $zero # t4 = fp_index = 0 556ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lw $t1, 20+16($fp) # get shorty (20 is offset from the $sp on entry + 16 as the $fp is 557ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic # 16 bytes below the $sp on entry) 558ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $t1, 1 # t1 = shorty + 1 (skip 1 for return type) 559ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevicloop: 560ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lbu $t2, 0($t1) # t2 = shorty[i] 561ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic beqz $t2, loopEnd # finish getting args when shorty[i] == '\0' 562ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $t1, 1 563ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic 564ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic li $t9, 'J' # put char 'J' into t9 565ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic beq $t9, $t2, isLong # branch if result type char == 'J' 566ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic li $t9, 'D' # put char 'D' into t9 567ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic beq $t9, $t2, isDouble # branch if result type char == 'D' 568ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic li $t9, 'F' # put char 'F' into t9 569ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic beq $t9, $t2, isSingle # branch if result type char == 'F' 570ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $t0, 4 # next_arg = curr_arg + 4 (in branch delay slot, 571ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic # for both, int and single) 572ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic 573ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic li $t5, 2 # skip a0 and a1 (ArtMethod* and this*) 574ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic bne $t5, $t3, 1f # if (gpr_index == 2) 575ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $t5, 1 576ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic LOAD_WORD_TO_REG a2, t0, t3, loop # a2 = current argument, gpr_index++ 577ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic1: bne $t5, $t3, loop # else if (gpr_index == 3) 578ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic nop 579ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic LOAD_WORD_TO_REG a3, t0, t3, loop # a3 = current argument, gpr_index++ 580ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic 581ff73498a5539d87424a964265e43765e788aec44Goran JakovljevicisLong: 582ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $t0, 8 # next_arg = curr_arg + 8 583ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic slti $t5, $t3, 3 584ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic beqz $t5, 2f # if (gpr_index < 3) 585ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic nop 586ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic LOAD_LONG_TO_REG a2, a3, t0, t3, loop # a2_a3 = curr_arg, gpr_index = 4 587ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic2: b loop # else 588ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic li $t3, 4 # gpr_index = 4 589ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic 590ff73498a5539d87424a964265e43765e788aec44Goran JakovljevicisDouble: 591ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $t0, 8 # next_arg = curr_arg + 8 592ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic li $t5, 0 593ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic bne $t5, $t4, 3f # if (fp_index == 0) 594ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $t5, 1 595ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic LOAD_DOUBLE_TO_REG f12, f13, t0, t4, t9, loop # f12_f13 = curr_arg, fp_index++ 596ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic3: bne $t5, $t4, loop # else if (fp_index == 1) 597ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic nop 598ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic LOAD_DOUBLE_TO_REG f14, f15, t0, t4, t9, loop # f14_f15 = curr_arg, fp_index++ 599ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic 600ff73498a5539d87424a964265e43765e788aec44Goran JakovljevicisSingle: 601ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic li $t5, 0 602ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic bne $t5, $t4, 4f # if (fp_index == 0) 603ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $t5, 1 604ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic LOAD_FLOAT_TO_REG f12, t0, t4, loop # f12 = curr_arg, fp_index++ 605ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic4: bne $t5, $t4, loop # else if (fp_index == 1) 606ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic nop 607ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic LOAD_FLOAT_TO_REG f14, t0, t4, loop # f14 = curr_arg, fp_index++ 608ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic 609ff73498a5539d87424a964265e43765e788aec44Goran JakovljevicloopEnd: 610e401d146407d61eeb99f8d6176b2ac13c4df1e33Mathieu Chartier lw $t9, ART_METHOD_QUICK_CODE_OFFSET_32($a0) # get pointer to the code 6115d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao jalr $t9 # call the method 612ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic sw $zero, 0($sp) # store null for ArtMethod* at bottom of frame 6135d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao move $sp, $fp # restore the stack 6145d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao lw $s0, 0($sp) 615bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 16 6165d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao lw $s1, 4($sp) 617bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 17 6185d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao lw $fp, 8($sp) 619bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 30 6205d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao lw $ra, 12($sp) 621bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 31 6225d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao addiu $sp, $sp, 16 6235d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao .cfi_adjust_cfa_offset -16 6245d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao lw $t0, 16($sp) # get result pointer 6250177e53ea521ad58b70c305700dab32f1ac773b7Ian Rogers lw $t1, 20($sp) # get shorty 6260177e53ea521ad58b70c305700dab32f1ac773b7Ian Rogers lb $t1, 0($t1) # get result type char 627ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic li $t2, 'D' # put char 'D' into t2 628ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic beq $t1, $t2, 5f # branch if result type char == 'D' 629ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic li $t3, 'F' # put char 'F' into t3 630ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic beq $t1, $t3, 5f # branch if result type char == 'F' 6315d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao sw $v0, 0($t0) # store the result 6328d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $ra 6335d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao sw $v1, 4($t0) # store the other half of the result 634ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic5: 635e34652f15f32666323052a6718a63248244f1e66Duane Sand SDu $f0, $f1, 0, $t0, $t1 # store floating point result 6368d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $ra 637e34652f15f32666323052a6718a63248244f1e66Duane Sand nop 6385d9173014c1ca09f7249a6b07629aa37778b5f8fJeff HaoEND art_quick_invoke_stub 6395d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao 6405d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao /* 641ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic * Invocation static stub for quick code. 642ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic * On entry: 643ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic * a0 = method pointer 644ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic * a1 = argument array or null for no argument methods 645ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic * a2 = size of argument array in bytes 646ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic * a3 = (managed) thread pointer 647ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic * [sp + 16] = JValue* result 648ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic * [sp + 20] = shorty 649ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic */ 650ff73498a5539d87424a964265e43765e788aec44Goran JakovljevicENTRY art_quick_invoke_static_stub 651ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic sw $a0, 0($sp) # save out a0 652ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $sp, $sp, -16 # spill s0, s1, fp, ra 653ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic .cfi_adjust_cfa_offset 16 654ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic sw $ra, 12($sp) 655ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic .cfi_rel_offset 31, 12 656ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic sw $fp, 8($sp) 657ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic .cfi_rel_offset 30, 8 658ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic sw $s1, 4($sp) 659ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic .cfi_rel_offset 17, 4 660ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic sw $s0, 0($sp) 661ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic .cfi_rel_offset 16, 0 662ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic move $fp, $sp # save sp in fp 663ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic .cfi_def_cfa_register 30 664ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic move $s1, $a3 # move managed thread pointer into s1 665ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $s0, $zero, SUSPEND_CHECK_INTERVAL # reset s0 to suspend check interval 666ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $t0, $a2, 4 # create space for ArtMethod* in frame. 667ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic subu $t0, $sp, $t0 # reserve & align *stack* to 16 bytes: 668ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic srl $t0, $t0, 4 # native calling convention only aligns to 8B, 669ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic sll $sp, $t0, 4 # so we have to ensure ART 16B alignment ourselves. 670ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $a0, $sp, 4 # pass stack pointer + ArtMethod* as dest for memcpy 671ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic jal memcpy # (dest, src, bytes) 672ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $sp, $sp, -16 # make space for argument slots for memcpy 673ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $sp, $sp, 16 # restore stack after memcpy 674ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lw $a0, 16($fp) # restore ArtMethod* 675ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $t0, $sp, 4 # t0 = pointer to the current argument (skip ArtMethod*) 676ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic li $t3, 1 # t3 = gpr_index = 1 (skip A0) 677ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic move $t4, $zero # t4 = fp_index = 0 678ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lw $t1, 20+16($fp) # get shorty (20 is offset from the $sp on entry + 16 as the $fp is 679ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic # 16 bytes below the $sp on entry) 680ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $t1, 1 # t1 = shorty + 1 (skip 1 for return type) 681ff73498a5539d87424a964265e43765e788aec44Goran JakovljevicloopS: 682ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lbu $t2, 0($t1) # t2 = shorty[i] 683ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic beqz $t2, loopEndS # finish getting args when shorty[i] == '\0' 684ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $t1, 1 685ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic 686ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic li $t9, 'J' # put char 'J' into t9 687ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic beq $t9, $t2, isLongS # branch if result type char == 'J' 688ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic li $t9, 'D' # put char 'D' into t9 689ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic beq $t9, $t2, isDoubleS # branch if result type char == 'D' 690ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic li $t9, 'F' # put char 'F' into t9 691ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic beq $t9, $t2, isSingleS # branch if result type char == 'F' 692ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $t0, 4 # next_arg = curr_arg + 4 (in branch delay slot, 693ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic # for both, int and single) 694ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic 695ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic li $t5, 1 # skip a0 (ArtMethod*) 696ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic bne $t5, $t3, 1f # if (gpr_index == 1) 697ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $t5, 1 698ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic LOAD_WORD_TO_REG a1, t0, t3, loopS # a1 = current argument, gpr_index++ 699ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic1: bne $t5, $t3, 2f # else if (gpr_index == 2) 700ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $t5, 1 701ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic LOAD_WORD_TO_REG a2, t0, t3, loopS # a2 = current argument, gpr_index++ 702ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic2: bne $t5, $t3, loopS # else if (gpr_index == 3) 703ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic nop 704ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic LOAD_WORD_TO_REG a3, t0, t3, loopS # a3 = current argument, gpr_index++ 705ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic 706ff73498a5539d87424a964265e43765e788aec44Goran JakovljevicisLongS: 707ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $t0, 8 # next_arg = curr_arg + 8 708ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic slti $t5, $t3, 3 709ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic beqz $t5, 3f # if (gpr_index < 3) 710ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic nop 711ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic LOAD_LONG_TO_REG a2, a3, t0, t3, loopS # a2_a3 = curr_arg, gpr_index = 4 712ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic3: b loopS # else 713ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic li $t3, 4 # gpr_index = 4 714ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic 715ff73498a5539d87424a964265e43765e788aec44Goran JakovljevicisDoubleS: 716ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $t0, 8 # next_arg = curr_arg + 8 717ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic li $t5, 0 718ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic bne $t5, $t4, 4f # if (fp_index == 0) 719ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $t5, 1 720ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic LOAD_DOUBLE_TO_REG f12, f13, t0, t4, t9, loopS # f12_f13 = curr_arg, fp_index++ 721ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic4: bne $t5, $t4, loopS # else if (fp_index == 1) 722ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic nop 723ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic LOAD_DOUBLE_TO_REG f14, f15, t0, t4, t9, loopS # f14_f15 = curr_arg, fp_index++ 724ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic 725ff73498a5539d87424a964265e43765e788aec44Goran JakovljevicisSingleS: 726ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic li $t5, 0 727ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic bne $t5, $t4, 5f # if (fp_index == 0) 728ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $t5, 1 729ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic LOAD_FLOAT_TO_REG f12, t0, t4, loopS # f12 = curr_arg, fp_index++ 730ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic5: bne $t5, $t4, loopS # else if (fp_index == 1) 731ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic nop 732ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic LOAD_FLOAT_TO_REG f14, t0, t4, loopS # f14 = curr_arg, fp_index++ 733ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic 734ff73498a5539d87424a964265e43765e788aec44Goran JakovljevicloopEndS: 735ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lw $t9, ART_METHOD_QUICK_CODE_OFFSET_32($a0) # get pointer to the code 736ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic jalr $t9 # call the method 737ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic sw $zero, 0($sp) # store null for ArtMethod* at bottom of frame 738ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic move $sp, $fp # restore the stack 739ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lw $s0, 0($sp) 740ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic .cfi_restore 16 741ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lw $s1, 4($sp) 742ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic .cfi_restore 17 743ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lw $fp, 8($sp) 744ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic .cfi_restore 30 745ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lw $ra, 12($sp) 746ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic .cfi_restore 31 747ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic addiu $sp, $sp, 16 748ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic .cfi_adjust_cfa_offset -16 749ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lw $t0, 16($sp) # get result pointer 750ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lw $t1, 20($sp) # get shorty 751ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic lb $t1, 0($t1) # get result type char 752ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic li $t2, 'D' # put char 'D' into t2 753ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic beq $t1, $t2, 6f # branch if result type char == 'D' 754ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic li $t3, 'F' # put char 'F' into t3 755ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic beq $t1, $t3, 6f # branch if result type char == 'F' 756ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic sw $v0, 0($t0) # store the result 757ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic jalr $zero, $ra 758ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic sw $v1, 4($t0) # store the other half of the result 759ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic6: 760ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic SDu $f0, $f1, 0, $t0, $t1 # store floating point result 761ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic jalr $zero, $ra 762ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic nop 763ff73498a5539d87424a964265e43765e788aec44Goran JakovljevicEND art_quick_invoke_static_stub 764ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic 765ff73498a5539d87424a964265e43765e788aec44Goran Jakovljevic /* 7665bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Entry from managed code that calls artHandleFillArrayDataFromCode and delivers exception on 7675bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * failure. 7685bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 769d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artHandleFillArrayDataFromCode 770468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_handle_fill_data 771735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a2, 0($sp) # pass referrer's Method* 772735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case exception allocation triggers GC 7731d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artHandleFillArrayDataFromCode # (payload offset, Array*, method, Thread*) 774832336b3c9eb892045a8de1bb12c9361112ca3c5Ian Rogers move $a3, rSELF # pass Thread::Current 775fc6a30e2fa8f0d44e6c95bbeb5deca4b499f67cejeffhao RETURN_IF_ZERO 776468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_handle_fill_data 7775bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 7785bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 77957b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Entry from managed code that calls artLockObjectFromCode, may block for GC. 7805bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 781d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artLockObjectFromCode 782468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_lock_object 78386bcdc251f5ae22fcedd18c096ea538b7dbfa8cbIan Rogers beqz $a0, .Lart_quick_throw_null_pointer_exception_gp_set 784a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers nop 785735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case we block 7861d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artLockObjectFromCode # (Object* obj, Thread*) 7877fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao move $a1, rSELF # pass Thread::Current 7886bcd163d322b867578fbcfe60e4e3b247c42974bIan Rogers RETURN_IF_ZERO 789468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_lock_object 7905bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 7915bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 7925bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Entry from managed code that calls artUnlockObjectFromCode and delivers exception on failure. 7935bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 794d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artUnlockObjectFromCode 795468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_unlock_object 79686bcdc251f5ae22fcedd18c096ea538b7dbfa8cbIan Rogers beqz $a0, .Lart_quick_throw_null_pointer_exception_gp_set 797a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers nop 798735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case exception allocation triggers GC 7991d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artUnlockObjectFromCode # (Object* obj, Thread*) 8007fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao move $a1, rSELF # pass Thread::Current 8015bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee RETURN_IF_ZERO 802468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_unlock_object 8035bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 8045bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 8055bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Entry from managed code that calls artCheckCastFromCode and delivers exception on failure. 8065bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 807a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers .extern artThrowClassCastException 808468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_check_cast 809a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers addiu $sp, $sp, -16 810a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers .cfi_adjust_cfa_offset 16 811a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers sw $ra, 12($sp) 812a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers .cfi_rel_offset 31, 12 813a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers sw $t9, 8($sp) 814a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers sw $a1, 4($sp) 815a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers sw $a0, 0($sp) 816a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers jal artIsAssignableFromCode 817735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, -16 # reserve argument slots on the stack 818735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, 16 81986bcdc251f5ae22fcedd18c096ea538b7dbfa8cbIan Rogers beqz $v0, .Lthrow_class_cast_exception 820a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers lw $ra, 12($sp) 8218d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $ra 822a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers addiu $sp, $sp, 16 823a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers .cfi_adjust_cfa_offset -16 82486bcdc251f5ae22fcedd18c096ea538b7dbfa8cbIan Rogers.Lthrow_class_cast_exception: 825a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers lw $t9, 8($sp) 826a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers lw $a1, 4($sp) 827a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers lw $a0, 0($sp) 828a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers addiu $sp, $sp, 16 829a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers .cfi_adjust_cfa_offset -16 830a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers SETUP_SAVE_ALL_CALLEE_SAVE_FRAME 831a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers la $t9, artThrowClassCastException 8328d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $t9 # artThrowClassCastException (Class*, Class*, Thread*) 8331d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers move $a2, rSELF # pass Thread::Current 834468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_check_cast 8355bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 8365bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 8371aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao * Restore rReg's value from offset($sp) if rReg is not the same as rExclude. 8381aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao * nReg is the register number for rReg. 8391aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao */ 8401aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao.macro POP_REG_NE rReg, nReg, offset, rExclude 8411aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .ifnc \rReg, \rExclude 8421aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao lw \rReg, \offset($sp) # restore rReg 8431aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_restore \nReg 8441aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .endif 8451aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao.endm 8461aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao 8471aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao /* 8481aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao * Macro to insert read barrier, only used in art_quick_aput_obj. 8491aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao * rObj and rDest are registers, offset is a defined literal such as MIRROR_OBJECT_CLASS_OFFSET. 8501aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao * TODO: When read barrier has a fast path, add heap unpoisoning support for the fast path. 8511aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao */ 8521aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao.macro READ_BARRIER rDest, rObj, offset 8531aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao#ifdef USE_READ_BARRIER 8541aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao # saved registers used in art_quick_aput_obj: a0-a2, t0-t1, t9, ra. 8 words for 16B alignment. 8551aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao addiu $sp, $sp, -32 8561aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_adjust_cfa_offset 32 8571aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao sw $ra, 28($sp) 8581aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_rel_offset 31, 28 8591aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao sw $t9, 24($sp) 8601aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_rel_offset 25, 24 8611aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao sw $t1, 20($sp) 8621aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_rel_offset 9, 20 8631aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao sw $t0, 16($sp) 8641aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_rel_offset 8, 16 8651aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao sw $a2, 8($sp) # padding slot at offset 12 (padding can be any slot in the 32B) 8661aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_rel_offset 6, 8 8671aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao sw $a1, 4($sp) 8681aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_rel_offset 5, 4 8691aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao sw $a0, 0($sp) 8701aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_rel_offset 4, 0 8711aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao 8721aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao # move $a0, $a0 # pass ref in a0 (no-op for now since parameter ref is unused) 8731aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .ifnc \rObj, $a1 8741aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao move $a1, \rObj # pass rObj 8751aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .endif 8761aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao addiu $a2, $zero, \offset # pass offset 8771aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao jal artReadBarrierSlow # artReadBarrierSlow(ref, rObj, offset) 8781aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao addiu $sp, $sp, -16 # Use branch delay slot to reserve argument slots on the stack 8791aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao # before the call to artReadBarrierSlow. 8801aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao addiu $sp, $sp, 16 # restore stack after call to artReadBarrierSlow 8811aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao # No need to unpoison return value in v0, artReadBarrierSlow() would do the unpoisoning. 8821aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao move \rDest, $v0 # save return value in rDest 8831aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao # (rDest cannot be v0 in art_quick_aput_obj) 8841aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao 8851aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao lw $a0, 0($sp) # restore registers except rDest 8861aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao # (rDest can only be t0 or t1 in art_quick_aput_obj) 8871aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_restore 4 8881aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao lw $a1, 4($sp) 8891aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_restore 5 8901aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao lw $a2, 8($sp) 8911aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_restore 6 8921aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao POP_REG_NE $t0, 8, 16, \rDest 8931aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao POP_REG_NE $t1, 9, 20, \rDest 8941aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao lw $t9, 24($sp) 8951aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_restore 25 8961aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao lw $ra, 28($sp) # restore $ra 8971aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_restore 31 8981aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao addiu $sp, $sp, 32 8991aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .cfi_adjust_cfa_offset -32 9001aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao#else 9011aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao lw \rDest, \offset(\rObj) 9021aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao UNPOISON_HEAP_REF \rDest 9031aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao#endif // USE_READ_BARRIER 9041aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao.endm 9051aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao 9061aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao /* 907a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers * Entry from managed code for array put operations of objects where the value being stored 908a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers * needs to be checked for compatibility. 909a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers * a0 = array, a1 = index, a2 = value 9105bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 911a9a8254c920ce8e22210abfc16c9842ce0aea28fIan RogersENTRY art_quick_aput_obj_with_null_and_bound_check 91286bcdc251f5ae22fcedd18c096ea538b7dbfa8cbIan Rogers bnez $a0, .Lart_quick_aput_obj_with_bound_check_gp_set 913a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers nop 91486bcdc251f5ae22fcedd18c096ea538b7dbfa8cbIan Rogers b .Lart_quick_throw_null_pointer_exception_gp_set 915a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers nop 916a9a8254c920ce8e22210abfc16c9842ce0aea28fIan RogersEND art_quick_aput_obj_with_null_and_bound_check 917a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers 918a9a8254c920ce8e22210abfc16c9842ce0aea28fIan RogersENTRY art_quick_aput_obj_with_bound_check 9191d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers lw $t0, MIRROR_ARRAY_LENGTH_OFFSET($a0) 920a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers sltu $t1, $a1, $t0 92186bcdc251f5ae22fcedd18c096ea538b7dbfa8cbIan Rogers bnez $t1, .Lart_quick_aput_obj_gp_set 922a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers nop 923a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers move $a0, $a1 92486bcdc251f5ae22fcedd18c096ea538b7dbfa8cbIan Rogers b .Lart_quick_throw_array_bounds_gp_set 925a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers move $a1, $t0 926a9a8254c920ce8e22210abfc16c9842ce0aea28fIan RogersEND art_quick_aput_obj_with_bound_check 927a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers 9281aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao#ifdef USE_READ_BARRIER 9291aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao .extern artReadBarrierSlow 9301aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao#endif 931a9a8254c920ce8e22210abfc16c9842ce0aea28fIan RogersENTRY art_quick_aput_obj 93286bcdc251f5ae22fcedd18c096ea538b7dbfa8cbIan Rogers beqz $a2, .Ldo_aput_null 933a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers nop 9341aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao READ_BARRIER $t0, $a0, MIRROR_OBJECT_CLASS_OFFSET 9351aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao READ_BARRIER $t1, $a2, MIRROR_OBJECT_CLASS_OFFSET 9361aee900d5a0b3a8d78725a7551356bda0d8554e1Man Cao READ_BARRIER $t0, $t0, MIRROR_CLASS_COMPONENT_TYPE_OFFSET 93786bcdc251f5ae22fcedd18c096ea538b7dbfa8cbIan Rogers bne $t1, $t0, .Lcheck_assignability # value's type == array's component type - trivial assignability 938a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers nop 93986bcdc251f5ae22fcedd18c096ea538b7dbfa8cbIan Rogers.Ldo_aput: 940a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers sll $a1, $a1, 2 941a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers add $t0, $a0, $a1 942bfa5eb6e8d15ea73a36f8df449630f285a91e995Hiroshi Yamauchi POISON_HEAP_REF $a2 9431d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers sw $a2, MIRROR_OBJECT_ARRAY_DATA_OFFSET($t0) 944a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers lw $t0, THREAD_CARD_TABLE_OFFSET(rSELF) 945a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers srl $t1, $a0, 7 946a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers add $t1, $t1, $t0 947a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers sb $t0, ($t1) 9488d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $ra 949a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers nop 95086bcdc251f5ae22fcedd18c096ea538b7dbfa8cbIan Rogers.Ldo_aput_null: 951a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers sll $a1, $a1, 2 952a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers add $t0, $a0, $a1 9531d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers sw $a2, MIRROR_OBJECT_ARRAY_DATA_OFFSET($t0) 9548d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $ra 955a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers nop 95686bcdc251f5ae22fcedd18c096ea538b7dbfa8cbIan Rogers.Lcheck_assignability: 957a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers addiu $sp, $sp, -32 958a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers .cfi_adjust_cfa_offset 32 959a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers sw $ra, 28($sp) 960a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers .cfi_rel_offset 31, 28 961a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers sw $t9, 12($sp) 962a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers sw $a2, 8($sp) 963a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers sw $a1, 4($sp) 964a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers sw $a0, 0($sp) 965a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers move $a1, $t1 966a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers move $a0, $t0 967a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers jal artIsAssignableFromCode # (Class*, Class*) 968735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, -16 # reserve argument slots on the stack 969735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, 16 970a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers lw $ra, 28($sp) 971a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers lw $t9, 12($sp) 972a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers lw $a2, 8($sp) 973a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers lw $a1, 4($sp) 974a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers lw $a0, 0($sp) 975e34652f15f32666323052a6718a63248244f1e66Duane Sand addiu $sp, 32 976a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers .cfi_adjust_cfa_offset -32 97786bcdc251f5ae22fcedd18c096ea538b7dbfa8cbIan Rogers bnez $v0, .Ldo_aput 978a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers nop 979a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers SETUP_SAVE_ALL_CALLEE_SAVE_FRAME 980a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers move $a1, $a2 981a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers la $t9, artThrowArrayStoreException 9828d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $t9 # artThrowArrayStoreException(Class*, Class*, Thread*) 9831d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers move $a2, rSELF # pass Thread::Current 984a9a8254c920ce8e22210abfc16c9842ce0aea28fIan RogersEND art_quick_aput_obj 9855bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 9865bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 98737f05ef45e0393de812d51261dc293240c17294dFred Shih * Called by managed code to resolve a static field and load a boolean primitive value. 98837f05ef45e0393de812d51261dc293240c17294dFred Shih */ 98937f05ef45e0393de812d51261dc293240c17294dFred Shih .extern artGetBooleanStaticFromCode 99037f05ef45e0393de812d51261dc293240c17294dFred ShihENTRY art_quick_get_boolean_static 991735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a1, 0($sp) # pass referrer's Method* 992735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 9931d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artGetBooleanStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) 99437f05ef45e0393de812d51261dc293240c17294dFred Shih move $a2, rSELF # pass Thread::Current 99537f05ef45e0393de812d51261dc293240c17294dFred Shih RETURN_IF_NO_EXCEPTION 99637f05ef45e0393de812d51261dc293240c17294dFred ShihEND art_quick_get_boolean_static 99737f05ef45e0393de812d51261dc293240c17294dFred Shih /* 99837f05ef45e0393de812d51261dc293240c17294dFred Shih * Called by managed code to resolve a static field and load a byte primitive value. 99937f05ef45e0393de812d51261dc293240c17294dFred Shih */ 100037f05ef45e0393de812d51261dc293240c17294dFred Shih .extern artGetByteStaticFromCode 100137f05ef45e0393de812d51261dc293240c17294dFred ShihENTRY art_quick_get_byte_static 1002735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a1, 0($sp) # pass referrer's Method* 1003735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 10041d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artGetByteStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) 100537f05ef45e0393de812d51261dc293240c17294dFred Shih move $a2, rSELF # pass Thread::Current 100637f05ef45e0393de812d51261dc293240c17294dFred Shih RETURN_IF_NO_EXCEPTION 100737f05ef45e0393de812d51261dc293240c17294dFred ShihEND art_quick_get_byte_static 100837f05ef45e0393de812d51261dc293240c17294dFred Shih 100937f05ef45e0393de812d51261dc293240c17294dFred Shih /* 101037f05ef45e0393de812d51261dc293240c17294dFred Shih * Called by managed code to resolve a static field and load a char primitive value. 101137f05ef45e0393de812d51261dc293240c17294dFred Shih */ 101237f05ef45e0393de812d51261dc293240c17294dFred Shih .extern artGetCharStaticFromCode 101337f05ef45e0393de812d51261dc293240c17294dFred ShihENTRY art_quick_get_char_static 1014735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a1, 0($sp) # pass referrer's Method* 1015735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 10161d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artGetCharStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) 101737f05ef45e0393de812d51261dc293240c17294dFred Shih move $a2, rSELF # pass Thread::Current 101837f05ef45e0393de812d51261dc293240c17294dFred Shih RETURN_IF_NO_EXCEPTION 101937f05ef45e0393de812d51261dc293240c17294dFred ShihEND art_quick_get_char_static 102037f05ef45e0393de812d51261dc293240c17294dFred Shih /* 102137f05ef45e0393de812d51261dc293240c17294dFred Shih * Called by managed code to resolve a static field and load a short primitive value. 102237f05ef45e0393de812d51261dc293240c17294dFred Shih */ 102337f05ef45e0393de812d51261dc293240c17294dFred Shih .extern artGetShortStaticFromCode 102437f05ef45e0393de812d51261dc293240c17294dFred ShihENTRY art_quick_get_short_static 1025735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a1, 0($sp) # pass referrer's Method* 1026735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 10271d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artGetShortStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) 102837f05ef45e0393de812d51261dc293240c17294dFred Shih move $a2, rSELF # pass Thread::Current 102937f05ef45e0393de812d51261dc293240c17294dFred Shih RETURN_IF_NO_EXCEPTION 103037f05ef45e0393de812d51261dc293240c17294dFred ShihEND art_quick_get_short_static 10315bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 10325bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 103357b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Called by managed code to resolve a static field and load a 32-bit primitive value. 10345bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 1035d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artGet32StaticFromCode 1036468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_get32_static 1037735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a1, 0($sp) # pass referrer's Method* 1038735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 10391d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artGet32StaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) 10407fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao move $a2, rSELF # pass Thread::Current 10415bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee RETURN_IF_NO_EXCEPTION 1042468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_get32_static 10435bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 10445bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 104557b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Called by managed code to resolve a static field and load a 64-bit primitive value. 10465bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 1047d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artGet64StaticFromCode 1048468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_get64_static 1049735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a1, 0($sp) # pass referrer's Method* 1050735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 10511d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artGet64StaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) 10527fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao move $a2, rSELF # pass Thread::Current 10535bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee RETURN_IF_NO_EXCEPTION 1054468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_get64_static 10555bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 10565bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 105757b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Called by managed code to resolve a static field and load an object reference. 10585bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 1059d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artGetObjStaticFromCode 1060468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_get_obj_static 1061735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a1, 0($sp) # pass referrer's Method* 1062735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 10631d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artGetObjStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) 10647fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao move $a2, rSELF # pass Thread::Current 10655bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee RETURN_IF_NO_EXCEPTION 1066468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_get_obj_static 10675bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 10685bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 106937f05ef45e0393de812d51261dc293240c17294dFred Shih * Called by managed code to resolve an instance field and load a boolean primitive value. 107037f05ef45e0393de812d51261dc293240c17294dFred Shih */ 107137f05ef45e0393de812d51261dc293240c17294dFred Shih .extern artGetBooleanInstanceFromCode 107237f05ef45e0393de812d51261dc293240c17294dFred ShihENTRY art_quick_get_boolean_instance 1073735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a2, 0($sp) # pass referrer's Method* 1074735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 10751d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artGetBooleanInstanceFromCode # (field_idx, Object*, referrer, Thread*) 107637f05ef45e0393de812d51261dc293240c17294dFred Shih move $a3, rSELF # pass Thread::Current 107737f05ef45e0393de812d51261dc293240c17294dFred Shih RETURN_IF_NO_EXCEPTION 107837f05ef45e0393de812d51261dc293240c17294dFred ShihEND art_quick_get_boolean_instance 107937f05ef45e0393de812d51261dc293240c17294dFred Shih /* 108037f05ef45e0393de812d51261dc293240c17294dFred Shih * Called by managed code to resolve an instance field and load a byte primitive value. 108137f05ef45e0393de812d51261dc293240c17294dFred Shih */ 108237f05ef45e0393de812d51261dc293240c17294dFred Shih .extern artGetByteInstanceFromCode 108337f05ef45e0393de812d51261dc293240c17294dFred ShihENTRY art_quick_get_byte_instance 1084735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a2, 0($sp) # pass referrer's Method* 1085735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 10861d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artGetByteInstanceFromCode # (field_idx, Object*, referrer, Thread*) 108737f05ef45e0393de812d51261dc293240c17294dFred Shih move $a3, rSELF # pass Thread::Current 108837f05ef45e0393de812d51261dc293240c17294dFred Shih RETURN_IF_NO_EXCEPTION 108937f05ef45e0393de812d51261dc293240c17294dFred ShihEND art_quick_get_byte_instance 109037f05ef45e0393de812d51261dc293240c17294dFred Shih 109137f05ef45e0393de812d51261dc293240c17294dFred Shih /* 109237f05ef45e0393de812d51261dc293240c17294dFred Shih * Called by managed code to resolve an instance field and load a char primitive value. 109337f05ef45e0393de812d51261dc293240c17294dFred Shih */ 109437f05ef45e0393de812d51261dc293240c17294dFred Shih .extern artGetCharInstanceFromCode 109537f05ef45e0393de812d51261dc293240c17294dFred ShihENTRY art_quick_get_char_instance 1096735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a2, 0($sp) # pass referrer's Method* 1097735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 10981d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artGetCharInstanceFromCode # (field_idx, Object*, referrer, Thread*) 109937f05ef45e0393de812d51261dc293240c17294dFred Shih move $a3, rSELF # pass Thread::Current 110037f05ef45e0393de812d51261dc293240c17294dFred Shih RETURN_IF_NO_EXCEPTION 110137f05ef45e0393de812d51261dc293240c17294dFred ShihEND art_quick_get_char_instance 110237f05ef45e0393de812d51261dc293240c17294dFred Shih /* 110337f05ef45e0393de812d51261dc293240c17294dFred Shih * Called by managed code to resolve an instance field and load a short primitive value. 110437f05ef45e0393de812d51261dc293240c17294dFred Shih */ 110537f05ef45e0393de812d51261dc293240c17294dFred Shih .extern artGetShortInstanceFromCode 110637f05ef45e0393de812d51261dc293240c17294dFred ShihENTRY art_quick_get_short_instance 1107735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a2, 0($sp) # pass referrer's Method* 1108735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 1109735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung jal artGetShortInstanceFromCode # (field_idx, Object*, referrer, Thread*) 111037f05ef45e0393de812d51261dc293240c17294dFred Shih move $a3, rSELF # pass Thread::Current 111137f05ef45e0393de812d51261dc293240c17294dFred Shih RETURN_IF_NO_EXCEPTION 111237f05ef45e0393de812d51261dc293240c17294dFred ShihEND art_quick_get_short_instance 111337f05ef45e0393de812d51261dc293240c17294dFred Shih 111437f05ef45e0393de812d51261dc293240c17294dFred Shih /* 111557b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Called by managed code to resolve an instance field and load a 32-bit primitive value. 11165bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 1117d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artGet32InstanceFromCode 1118468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_get32_instance 1119735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a2, 0($sp) # pass referrer's Method* 1120735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 1121735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung jal artGet32InstanceFromCode # (field_idx, Object*, referrer, Thread*) 11227fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao move $a3, rSELF # pass Thread::Current 11235bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee RETURN_IF_NO_EXCEPTION 1124468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_get32_instance 11255bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 11265bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 112757b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Called by managed code to resolve an instance field and load a 64-bit primitive value. 11285bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 1129d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artGet64InstanceFromCode 1130468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_get64_instance 1131735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a2, 0($sp) # pass referrer's Method* 1132735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 1133735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung jal artGet64InstanceFromCode # (field_idx, Object*, referrer, Thread*) 11347fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao move $a3, rSELF # pass Thread::Current 11355bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee RETURN_IF_NO_EXCEPTION 1136468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_get64_instance 11375bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 11385bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 113957b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Called by managed code to resolve an instance field and load an object reference. 11405bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 1141d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artGetObjInstanceFromCode 1142468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_get_obj_instance 1143735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a2, 0($sp) # pass referrer's Method* 1144735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 11451d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artGetObjInstanceFromCode # (field_idx, Object*, referrer, Thread*) 11467fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao move $a3, rSELF # pass Thread::Current 11475bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee RETURN_IF_NO_EXCEPTION 1148468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_get_obj_instance 11495bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 11505bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 115137f05ef45e0393de812d51261dc293240c17294dFred Shih * Called by managed code to resolve a static field and store a 8-bit primitive value. 115237f05ef45e0393de812d51261dc293240c17294dFred Shih */ 115337f05ef45e0393de812d51261dc293240c17294dFred Shih .extern artSet8StaticFromCode 115437f05ef45e0393de812d51261dc293240c17294dFred ShihENTRY art_quick_set8_static 1155735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a2, 0($sp) # pass referrer's Method* 1156735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 11571d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artSet8StaticFromCode # (field_idx, new_val, referrer, Thread*) 115837f05ef45e0393de812d51261dc293240c17294dFred Shih move $a3, rSELF # pass Thread::Current 115937f05ef45e0393de812d51261dc293240c17294dFred Shih RETURN_IF_ZERO 116037f05ef45e0393de812d51261dc293240c17294dFred ShihEND art_quick_set8_static 116137f05ef45e0393de812d51261dc293240c17294dFred Shih 116237f05ef45e0393de812d51261dc293240c17294dFred Shih /* 116337f05ef45e0393de812d51261dc293240c17294dFred Shih * Called by managed code to resolve a static field and store a 16-bit primitive value. 116437f05ef45e0393de812d51261dc293240c17294dFred Shih */ 116537f05ef45e0393de812d51261dc293240c17294dFred Shih .extern artSet16StaticFromCode 116637f05ef45e0393de812d51261dc293240c17294dFred ShihENTRY art_quick_set16_static 1167735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a2, 0($sp) # pass referrer's Method* 1168735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 116937f05ef45e0393de812d51261dc293240c17294dFred Shih jal artSet16StaticFromCode # (field_idx, new_val, referrer, Thread*, $sp) 11701d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers move $a3, rSELF # pass Thread::Current 117137f05ef45e0393de812d51261dc293240c17294dFred Shih RETURN_IF_ZERO 117237f05ef45e0393de812d51261dc293240c17294dFred ShihEND art_quick_set16_static 117337f05ef45e0393de812d51261dc293240c17294dFred Shih 117437f05ef45e0393de812d51261dc293240c17294dFred Shih /* 117557b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Called by managed code to resolve a static field and store a 32-bit primitive value. 11765bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 1177d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artSet32StaticFromCode 1178468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_set32_static 1179735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a2, 0($sp) # pass referrer's Method* 1180735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 11811d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artSet32StaticFromCode # (field_idx, new_val, referrer, Thread*) 11827fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao move $a3, rSELF # pass Thread::Current 11835bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee RETURN_IF_ZERO 1184468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_set32_static 11855bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 11865bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 118757b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Called by managed code to resolve a static field and store a 64-bit primitive value. 11885bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 118937f05ef45e0393de812d51261dc293240c17294dFred Shih .extern artSet64StaticFromCode 1190468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_set64_static 1191735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a1, 0($sp) # pass referrer's Method* 11928d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe # 64 bit new_val is in a2:a3 pair 1193735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 11941d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artSet64StaticFromCode # (field_idx, referrer, new_val, Thread*) 1195fa147e22a73c6df166b08a2f71f9c9b52b09d17cjeffhao sw rSELF, 16($sp) # pass Thread::Current 11965bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee RETURN_IF_ZERO 1197468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_set64_static 11985bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 11995bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 120057b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Called by managed code to resolve a static field and store an object reference. 12015bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 1202d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artSetObjStaticFromCode 1203468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_set_obj_static 1204735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a2, 0($sp) # pass referrer's Method* 1205735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 12067fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao move $a3, rSELF # pass Thread::Current 1207735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung jal artSetObjStaticFromCode # (field_idx, new_val, referrer, Thread*) 12085bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee RETURN_IF_ZERO 1209468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_set_obj_static 12105bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 12115bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 121237f05ef45e0393de812d51261dc293240c17294dFred Shih * Called by managed code to resolve an instance field and store a 8-bit primitive value. 121337f05ef45e0393de812d51261dc293240c17294dFred Shih */ 121437f05ef45e0393de812d51261dc293240c17294dFred Shih .extern artSet8InstanceFromCode 121537f05ef45e0393de812d51261dc293240c17294dFred ShihENTRY art_quick_set8_instance 1216735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a3, 0($sp) # pass referrer's Method* 1217735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 1218735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung jal artSet8InstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*) 121937f05ef45e0393de812d51261dc293240c17294dFred Shih sw rSELF, 16($sp) # pass Thread::Current 122037f05ef45e0393de812d51261dc293240c17294dFred Shih RETURN_IF_ZERO 122137f05ef45e0393de812d51261dc293240c17294dFred ShihEND art_quick_set8_instance 122237f05ef45e0393de812d51261dc293240c17294dFred Shih 122337f05ef45e0393de812d51261dc293240c17294dFred Shih /* 122437f05ef45e0393de812d51261dc293240c17294dFred Shih * Called by managed code to resolve an instance field and store a 16-bit primitive value. 122537f05ef45e0393de812d51261dc293240c17294dFred Shih */ 122637f05ef45e0393de812d51261dc293240c17294dFred Shih .extern artSet16InstanceFromCode 122737f05ef45e0393de812d51261dc293240c17294dFred ShihENTRY art_quick_set16_instance 1228735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a3, 0($sp) # pass referrer's Method* 1229735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 12301d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artSet16InstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*) 123137f05ef45e0393de812d51261dc293240c17294dFred Shih sw rSELF, 16($sp) # pass Thread::Current 123237f05ef45e0393de812d51261dc293240c17294dFred Shih RETURN_IF_ZERO 123337f05ef45e0393de812d51261dc293240c17294dFred ShihEND art_quick_set16_instance 123437f05ef45e0393de812d51261dc293240c17294dFred Shih 123537f05ef45e0393de812d51261dc293240c17294dFred Shih /* 123657b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Called by managed code to resolve an instance field and store a 32-bit primitive value. 12375bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 1238d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artSet32InstanceFromCode 1239468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_set32_instance 1240735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a3, 0($sp) # pass referrer's Method* 1241735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 12421d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artSet32InstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*) 1243fa147e22a73c6df166b08a2f71f9c9b52b09d17cjeffhao sw rSELF, 16($sp) # pass Thread::Current 12445bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee RETURN_IF_ZERO 1245468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_set32_instance 12465bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 12475bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 124857b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Called by managed code to resolve an instance field and store a 64-bit primitive value. 12495bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 125037f05ef45e0393de812d51261dc293240c17294dFred Shih .extern artSet64InstanceFromCode 1251468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_set64_instance 1252735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $t1, 0($sp) # load referrer's Method* 12538d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe # 64 bit new_val is in a2:a3 pair 1254735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 12551d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers sw rSELF, 20($sp) # pass Thread::Current 12561d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artSet64InstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*) 1257735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung sw $t1, 16($sp) # pass referrer's Method* 12585bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee RETURN_IF_ZERO 1259468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_set64_instance 12605bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 12615bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 126257b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Called by managed code to resolve an instance field and store an object reference. 12635bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 1264d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artSetObjInstanceFromCode 1265468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_set_obj_instance 1266735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a3, 0($sp) # pass referrer's Method* 1267735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 12681d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artSetObjInstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*) 1269fa147e22a73c6df166b08a2f71f9c9b52b09d17cjeffhao sw rSELF, 16($sp) # pass Thread::Current 12705bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee RETURN_IF_ZERO 1271468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_set_obj_instance 12725bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 1273a3c382738bc54f464a57e2b51b51ad305eb03dd2Vladimir Marko// Macro to facilitate adding new allocation entrypoints. 12745ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko.macro ONE_ARG_DOWNCALL name, entrypoint, return 12755ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko .extern \entrypoint 12765ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir MarkoENTRY \name 12775ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 12785ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko jal \entrypoint 12795ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko move $a1, rSELF # pass Thread::Current 12805ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko \return 12815ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir MarkoEND \name 12825ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko.endm 12835ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko 1284cbb2d20bea2861f244da2e2318d8c088300a3710Mathieu Chartier.macro TWO_ARG_DOWNCALL name, entrypoint, return 1285cbb2d20bea2861f244da2e2318d8c088300a3710Mathieu Chartier .extern \entrypoint 1286cbb2d20bea2861f244da2e2318d8c088300a3710Mathieu ChartierENTRY \name 1287735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 1288cbb2d20bea2861f244da2e2318d8c088300a3710Mathieu Chartier jal \entrypoint 12891d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers move $a2, rSELF # pass Thread::Current 1290cbb2d20bea2861f244da2e2318d8c088300a3710Mathieu Chartier \return 1291cbb2d20bea2861f244da2e2318d8c088300a3710Mathieu ChartierEND \name 1292cbb2d20bea2861f244da2e2318d8c088300a3710Mathieu Chartier.endm 12935bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 1294cbb2d20bea2861f244da2e2318d8c088300a3710Mathieu Chartier.macro THREE_ARG_DOWNCALL name, entrypoint, return 1295cbb2d20bea2861f244da2e2318d8c088300a3710Mathieu Chartier .extern \entrypoint 1296cbb2d20bea2861f244da2e2318d8c088300a3710Mathieu ChartierENTRY \name 1297735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 1298cbb2d20bea2861f244da2e2318d8c088300a3710Mathieu Chartier jal \entrypoint 12991d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers move $a3, rSELF # pass Thread::Current 1300cbb2d20bea2861f244da2e2318d8c088300a3710Mathieu Chartier \return 1301cbb2d20bea2861f244da2e2318d8c088300a3710Mathieu ChartierEND \name 1302cbb2d20bea2861f244da2e2318d8c088300a3710Mathieu Chartier.endm 13035bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 1304848f70a3d73833fc1bf3032a9ff6812e429661d9Jeff Hao.macro FOUR_ARG_DOWNCALL name, entrypoint, return 1305848f70a3d73833fc1bf3032a9ff6812e429661d9Jeff Hao .extern \entrypoint 1306848f70a3d73833fc1bf3032a9ff6812e429661d9Jeff HaoENTRY \name 1307a3c382738bc54f464a57e2b51b51ad305eb03dd2Vladimir Marko SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 1308848f70a3d73833fc1bf3032a9ff6812e429661d9Jeff Hao jal \entrypoint 1309a3c382738bc54f464a57e2b51b51ad305eb03dd2Vladimir Marko sw rSELF, 16($sp) # pass Thread::Current 1310848f70a3d73833fc1bf3032a9ff6812e429661d9Jeff Hao \return 1311848f70a3d73833fc1bf3032a9ff6812e429661d9Jeff HaoEND \name 1312848f70a3d73833fc1bf3032a9ff6812e429661d9Jeff Hao.endm 1313848f70a3d73833fc1bf3032a9ff6812e429661d9Jeff Hao 13147410f29b4dae223befac036ea567d7f33351dad1Mathieu Chartier// Generate the allocation entrypoints for each allocator. 13157410f29b4dae223befac036ea567d7f33351dad1Mathieu ChartierGENERATE_ALL_ALLOC_ENTRYPOINTS 13163b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi 13175bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 13181cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe * Entry from managed code to resolve a string, this stub will allocate a String and deliver an 13195ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko * exception on error. On success the String is returned. A0 holds the string index. The fast 13205ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko * path check for hit in strings cache has already been performed. 13211cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe */ 13225ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir MarkoONE_ARG_DOWNCALL art_quick_resolve_string, artResolveStringFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 13231cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe 13241cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe /* 13251cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe * Entry from managed code when uninitialized static storage, this stub will run the class 13261cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe * initializer and deliver the exception on error. On success the static storage base is 13271cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe * returned. 13281cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe */ 13295ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir MarkoONE_ARG_DOWNCALL art_quick_initialize_static_storage, artInitializeStaticStorageFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 13301cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe 13311cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe /* 13321cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe * Entry from managed code when dex cache misses for a type_idx. 13331cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe */ 13345ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir MarkoONE_ARG_DOWNCALL art_quick_initialize_type, artInitializeTypeFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 13351cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe 13361cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe /* 13371cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe * Entry from managed code when type_idx needs to be checked for access and dex cache may also 13381cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe * miss. 13391cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe */ 13405ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir MarkoONE_ARG_DOWNCALL art_quick_initialize_type_and_verify_access, artInitializeTypeAndVerifyAccessFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 13411cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe 13421cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe /* 134357b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Called by managed code when the value in rSUSPEND has been decremented to 0. 13445bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 1345d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artTestSuspendFromCode 1346d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff HaoENTRY art_quick_test_suspend 1347474b6da273c7ce6df50a4e51eb9929a77e1611c3Ian Rogers lh $a0, THREAD_FLAGS_OFFSET(rSELF) 13487fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao bnez $a0, 1f 1349e34652f15f32666323052a6718a63248244f1e66Duane Sand addiu rSUSPEND, $zero, SUSPEND_CHECK_INTERVAL # reset rSUSPEND to SUSPEND_CHECK_INTERVAL 13508d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $ra 13515bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee nop 13525bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee1: 13531d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves for stack crawl 13541d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artTestSuspendFromCode # (Thread*) 13557fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao move $a0, rSELF 13561d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME_AND_RETURN 1357d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff HaoEND art_quick_test_suspend 13585bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 13595bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 13605bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Called by managed code that is attempting to call a method on a proxy class. On entry 136157b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * r0 holds the proxy method; r1, r2 and r3 may contain arguments. 13625bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 13635fa60c3db4208df407113b5a69d295a9c93d53b1Jeff Hao .extern artQuickProxyInvokeHandler 1364d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff HaoENTRY art_quick_proxy_invoke_handler 1365735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME_WITH_METHOD_IN_A0 1366735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung move $a2, rSELF # pass Thread::Current 13675fa60c3db4208df407113b5a69d295a9c93d53b1Jeff Hao jal artQuickProxyInvokeHandler # (Method* proxy method, receiver, Thread*, SP) 1368735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $a3, $sp, ARG_SLOT_SIZE # pass $sp (remove arg slots) 13697fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ 1370735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME 13717fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao bnez $t0, 1f 1372e34652f15f32666323052a6718a63248244f1e66Duane Sand # don't care if $v0 and/or $v1 are modified, when exception branch taken 1373e34652f15f32666323052a6718a63248244f1e66Duane Sand MTD $v0, $v1, $f0, $f1 # move float value to return value 13748d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $ra 1375e34652f15f32666323052a6718a63248244f1e66Duane Sand nop 13765bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee1: 13775bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee DELIVER_PENDING_EXCEPTION 1378d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff HaoEND art_quick_proxy_invoke_handler 13795bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 138088474b416eb257078e590bf9bc7957cee604a186Jeff Hao /* 138188474b416eb257078e590bf9bc7957cee604a186Jeff Hao * Called to resolve an imt conflict. t0 is a hidden argument that holds the target method's 138288474b416eb257078e590bf9bc7957cee604a186Jeff Hao * dex method index. 138388474b416eb257078e590bf9bc7957cee604a186Jeff Hao */ 138413738bf7c769638b7922cb2477471ad382632bc2Douglas LeungENTRY art_quick_imt_conflict_trampoline 13858ea18d0f066f63fa4e5d154f14327468bf288e2bNicolas Geoffray move $a0, $t0 13863031c8da0c5009183f770b005c245f9bf2a4d01bAndreas Gampe INVOKE_TRAMPOLINE_BODY artInvokeInterfaceTrampoline 138788474b416eb257078e590bf9bc7957cee604a186Jeff HaoEND art_quick_imt_conflict_trampoline 138888474b416eb257078e590bf9bc7957cee604a186Jeff Hao 1389468532ea115657709bc32ee498e701a4c71762d4Ian Rogers .extern artQuickResolutionTrampoline 1390468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_resolution_trampoline 13911d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME 1392735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung move $a2, rSELF # pass Thread::Current 139365d1b22d0b02fb0111f69013163c8170e68392f1Ian Rogers jal artQuickResolutionTrampoline # (Method* called, receiver, Thread*, SP) 1394735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $a3, $sp, ARG_SLOT_SIZE # pass $sp (remove arg slots) 1395468532ea115657709bc32ee498e701a4c71762d4Ian Rogers beqz $v0, 1f 1396735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a0, ARG_SLOT_SIZE($sp) # load resolved method to $a0 13971d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME 139865d1b22d0b02fb0111f69013163c8170e68392f1Ian Rogers move $t9, $v0 # code pointer must be in $t9 to generate the global pointer 1399f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung jalr $zero, $t9 # tail call to method 14001984152ac92aad244ae15184d12f9ceade686b7bMathieu Chartier nop 1401468532ea115657709bc32ee498e701a4c71762d4Ian Rogers1: 14021d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME 1403468532ea115657709bc32ee498e701a4c71762d4Ian Rogers DELIVER_PENDING_EXCEPTION 1404468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_resolution_trampoline 1405468532ea115657709bc32ee498e701a4c71762d4Ian Rogers 1406735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .extern artQuickGenericJniTrampoline 1407735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .extern artQuickGenericJniEndTrampoline 1408735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas LeungENTRY art_quick_generic_jni_trampoline 1409735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME_WITH_METHOD_IN_A0 1410735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung move $s8, $sp # save $sp to $s8 1411735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung move $s3, $gp # save $gp to $s3 1412735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung 1413735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung # prepare for call to artQuickGenericJniTrampoline(Thread*, SP) 1414735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung move $a0, rSELF # pass Thread::Current 1415735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $a1, $sp, ARG_SLOT_SIZE # save $sp (remove arg slots) 1416735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung jal artQuickGenericJniTrampoline # (Thread*, SP) 1417735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, -5120 # reserve space on the stack 1418735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung 1419735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung # The C call will have registered the complete save-frame on success. 1420735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung # The result of the call is: 1421735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung # v0: ptr to native code, 0 on error. 1422735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung # v1: ptr to the bottom of the used area of the alloca, can restore stack till here. 1423735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung beq $v0, $zero, 1f # check entry error 1424735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung move $t9, $v0 # save the code ptr 1425735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung move $sp, $v1 # release part of the alloca 1426735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung 1427735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung # Load parameters from stack into registers 1428735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a0, 0($sp) 1429735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a1, 4($sp) 1430735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a2, 8($sp) 1431735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung 1432735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung # Load FPRs the same as GPRs. Look at BuildNativeCallFrameStateMachine. 1433735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung jalr $t9 # native call 1434735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a3, 12($sp) 1435735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, 16 # remove arg slots 1436735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung 1437735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung move $gp, $s3 # restore $gp from $s3 1438735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung 1439735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung # result sign extension is handled in C code 1440735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung # prepare for call to artQuickGenericJniEndTrampoline(Thread*, result, result_f) 1441735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung move $a0, rSELF # pass Thread::Current 1442735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung move $a2, $v0 # pass result 1443735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung move $a3, $v1 1444735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, -24 # reserve arg slots 1445735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung jal artQuickGenericJniEndTrampoline 1446735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung s.d $f0, 16($sp) # pass result_f 1447735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung 1448735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ 1449126d65952a03b3e44d5021208673c01920a982a4Nicolas Geoffray bne $t0, $zero, 1f # check for pending exceptions 1450126d65952a03b3e44d5021208673c01920a982a4Nicolas Geoffray 1451735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung move $sp, $s8 # tear down the alloca 1452735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung 1453735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung # tear dpown the callee-save frame 1454735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME 1455735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung 1456e34652f15f32666323052a6718a63248244f1e66Duane Sand MTD $v0, $v1, $f0, $f1 # move float value to return value 14578d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $ra 1458e34652f15f32666323052a6718a63248244f1e66Duane Sand nop 1459735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung 1460735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung1: 1461126d65952a03b3e44d5021208673c01920a982a4Nicolas Geoffray lw $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF) 1462126d65952a03b3e44d5021208673c01920a982a4Nicolas Geoffray # This will create a new save-all frame, required by the runtime. 1463735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung DELIVER_PENDING_EXCEPTION 1464735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas LeungEND art_quick_generic_jni_trampoline 14652da882315a61072664f7ce3c212307342e907207Andreas Gampe 1466468532ea115657709bc32ee498e701a4c71762d4Ian Rogers .extern artQuickToInterpreterBridge 1467468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_to_interpreter_bridge 14681d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME 1469735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung move $a1, rSELF # pass Thread::Current 1470735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung jal artQuickToInterpreterBridge # (Method* method, Thread*, SP) 1471735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $a2, $sp, ARG_SLOT_SIZE # pass $sp (remove arg slots) 14727db619bb2a4e01e8532a04b613745d4926b205d7Ian Rogers lw $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ 1473735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME 14747db619bb2a4e01e8532a04b613745d4926b205d7Ian Rogers bnez $t0, 1f 1475e34652f15f32666323052a6718a63248244f1e66Duane Sand # don't care if $v0 and/or $v1 are modified, when exception branch taken 1476e34652f15f32666323052a6718a63248244f1e66Duane Sand MTD $v0, $v1, $f0, $f1 # move float value to return value 14778d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $ra 1478e34652f15f32666323052a6718a63248244f1e66Duane Sand nop 14797db619bb2a4e01e8532a04b613745d4926b205d7Ian Rogers1: 14807db619bb2a4e01e8532a04b613745d4926b205d7Ian Rogers DELIVER_PENDING_EXCEPTION 1481468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_to_interpreter_bridge 14827db619bb2a4e01e8532a04b613745d4926b205d7Ian Rogers 14835bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 1484725a957985171d712d5c048cc3d00ff14968784bjeffhao * Routine that intercepts method calls and returns. 14855bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 1486d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artInstrumentationMethodEntryFromCode 1487d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artInstrumentationMethodExitFromCode 1488468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_instrumentation_entry 14891d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME 1490735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung sw $a0, 28($sp) # save arg0 in free arg slot 14911d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers move $a3, $ra # pass $ra 14921d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artInstrumentationMethodEntryFromCode # (Method*, Object*, Thread*, LR) 149362d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers move $a2, rSELF # pass Thread::Current 14948161c0336b97e11e02c000af357f8f40de2e23e4jeffhao move $t9, $v0 # $t9 holds reference to code 1495735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a0, 28($sp) # restore arg0 from free arg slot 14961d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME 14978161c0336b97e11e02c000af357f8f40de2e23e4jeffhao jalr $t9 # call method 149862d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers nop 1499468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_instrumentation_entry 15005bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* intentional fallthrough */ 1501468532ea115657709bc32ee498e701a4c71762d4Ian Rogers .global art_quick_instrumentation_exit 1502468532ea115657709bc32ee498e701a4c71762d4Ian Rogersart_quick_instrumentation_exit: 1503d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .cfi_startproc 150412051ea86ec27703b07b3d5c2cd4604b20f71810jeffhao addiu $t9, $ra, 4 # put current address into $t9 to rebuild $gp 15051d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers .cpload $t9 1506c3d131e1ec030b4ff5c44fe2a45d5fb45b3295afDouglas Leung move $ra, $zero # link register is to here, so clobber with 0 for later checks 1507735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung 1508f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME 1509735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, -16 # allocate temp storage on the stack 1510735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_adjust_cfa_offset 16 1511f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung sw $v0, ARG_SLOT_SIZE+12($sp) 1512f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung .cfi_rel_offset 2, ARG_SLOT_SIZE+12 1513f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung sw $v1, ARG_SLOT_SIZE+8($sp) 1514f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung .cfi_rel_offset 3, ARG_SLOT_SIZE+8 1515f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung s.d $f0, ARG_SLOT_SIZE($sp) 1516e34652f15f32666323052a6718a63248244f1e66Duane Sand s.d $f0, 16($sp) # pass fpr result 151762d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers move $a2, $v0 # pass gpr result 151862d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers move $a3, $v1 1519f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung addiu $a1, $sp, ARG_SLOT_SIZE+16 # pass $sp (remove arg slots and temp storage) 152062d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers jal artInstrumentationMethodExitFromCode # (Thread*, SP, gpr_res, fpr_res) 152112051ea86ec27703b07b3d5c2cd4604b20f71810jeffhao move $a0, rSELF # pass Thread::Current 1522f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung move $t9, $v0 # set aside returned link register 152312051ea86ec27703b07b3d5c2cd4604b20f71810jeffhao move $ra, $v1 # set link register for deoptimization 1524f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung lw $v0, ARG_SLOT_SIZE+12($sp) # restore return values 1525f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung lw $v1, ARG_SLOT_SIZE+8($sp) 1526f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung l.d $f0, ARG_SLOT_SIZE($sp) 1527f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung jalr $zero, $t9 # return 1528f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung addiu $sp, $sp, ARG_SLOT_SIZE+FRAME_SIZE_REFS_ONLY_CALLEE_SAVE+16 # restore stack 1529f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung .cfi_adjust_cfa_offset -(ARG_SLOT_SIZE+FRAME_SIZE_REFS_ONLY_CALLEE_SAVE+16) 1530468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_instrumentation_exit 15315bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 153212051ea86ec27703b07b3d5c2cd4604b20f71810jeffhao /* 153362d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers * Instrumentation has requested that we deoptimize into the interpreter. The deoptimization 153462d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers * will long jump to the upcall with a special exception of -1. 153512051ea86ec27703b07b3d5c2cd4604b20f71810jeffhao */ 1536d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artDeoptimize 1537d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff HaoENTRY art_quick_deoptimize 153814dd5a82ad85a28612bf86e755ff929d767cea4cJeff Hao SETUP_SAVE_ALL_CALLEE_SAVE_FRAME 15391d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artDeoptimize # artDeoptimize(Thread*) 154012051ea86ec27703b07b3d5c2cd4604b20f71810jeffhao # Returns caller method's frame size. 15411d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers move $a0, rSELF # pass Thread::current 1542d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff HaoEND art_quick_deoptimize 154312051ea86ec27703b07b3d5c2cd4604b20f71810jeffhao 15445bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 15450747466fca310eedea5fc49e37d54f240a0b3c0fSebastien Hertz * Compiled code has requested that we deoptimize into the interpreter. The deoptimization 15460747466fca310eedea5fc49e37d54f240a0b3c0fSebastien Hertz * will long jump to the upcall with a special exception of -1. 15470747466fca310eedea5fc49e37d54f240a0b3c0fSebastien Hertz */ 15480747466fca310eedea5fc49e37d54f240a0b3c0fSebastien Hertz .extern artDeoptimizeFromCompiledCode 15490747466fca310eedea5fc49e37d54f240a0b3c0fSebastien HertzENTRY art_quick_deoptimize_from_compiled_code 15500747466fca310eedea5fc49e37d54f240a0b3c0fSebastien Hertz SETUP_SAVE_ALL_CALLEE_SAVE_FRAME 15510747466fca310eedea5fc49e37d54f240a0b3c0fSebastien Hertz jal artDeoptimizeFromCompiledCode # artDeoptimizeFromCompiledCode(Thread*) 15520747466fca310eedea5fc49e37d54f240a0b3c0fSebastien Hertz # Returns caller method's frame size. 15530747466fca310eedea5fc49e37d54f240a0b3c0fSebastien Hertz move $a0, rSELF # pass Thread::current 15540747466fca310eedea5fc49e37d54f240a0b3c0fSebastien HertzEND art_quick_deoptimize_from_compiled_code 15550747466fca310eedea5fc49e37d54f240a0b3c0fSebastien Hertz 15560747466fca310eedea5fc49e37d54f240a0b3c0fSebastien Hertz /* 15575bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Long integer shift. This is different from the generic 32/64-bit 15585bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * binary operations because vAA/vBB are 64-bit but vCC (the shift 15595bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low 15605bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * 6 bits. 15615bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * On entry: 15627fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao * $a0: low word 15637fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao * $a1: high word 15647fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao * $a2: shift count 15655bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 15661d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian RogersENTRY_NO_GP art_quick_shl_long 15675bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* shl-long vAA, vBB, vCC */ 15687fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao sll $v0, $a0, $a2 # rlo<- alo << (shift&31) 15697fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao not $v1, $a2 # rhi<- 31-shift (shift is 5b) 15707fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao srl $a0, 1 15717fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao srl $a0, $v1 # alo<- alo >> (32-(shift&31)) 15727fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao sll $v1, $a1, $a2 # rhi<- ahi << (shift&31) 15737fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao andi $a2, 0x20 # shift< shift & 0x20 1574e34652f15f32666323052a6718a63248244f1e66Duane Sand beqz $a2, 1f 1575e34652f15f32666323052a6718a63248244f1e66Duane Sand or $v1, $a0 # rhi<- rhi | alo 1576e34652f15f32666323052a6718a63248244f1e66Duane Sand 1577e34652f15f32666323052a6718a63248244f1e66Duane Sand move $v1, $v0 # rhi<- rlo (if shift&0x20) 1578e34652f15f32666323052a6718a63248244f1e66Duane Sand move $v0, $zero # rlo<- 0 (if shift&0x20) 1579e34652f15f32666323052a6718a63248244f1e66Duane Sand 15808d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe1: jalr $zero, $ra 1581e34652f15f32666323052a6718a63248244f1e66Duane Sand nop 1582d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff HaoEND art_quick_shl_long 15835bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 15845bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 15855bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Long integer shift. This is different from the generic 32/64-bit 15865bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * binary operations because vAA/vBB are 64-bit but vCC (the shift 15875bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low 15885bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * 6 bits. 15895bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * On entry: 15907fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao * $a0: low word 15917fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao * $a1: high word 15927fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao * $a2: shift count 15935bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 15941d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian RogersENTRY_NO_GP art_quick_shr_long 15957fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao sra $v1, $a1, $a2 # rhi<- ahi >> (shift&31) 15967fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao srl $v0, $a0, $a2 # rlo<- alo >> (shift&31) 15977fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao sra $a3, $a1, 31 # $a3<- sign(ah) 15987fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao not $a0, $a2 # alo<- 31-shift (shift is 5b) 15997fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao sll $a1, 1 16007fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao sll $a1, $a0 # ahi<- ahi << (32-(shift&31)) 16017fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao andi $a2, 0x20 # shift & 0x20 1602475cfd8ff9dcc73d1a7502c9310efe0f1a30337fDouglas Leung beqz $a2, 1f 1603e34652f15f32666323052a6718a63248244f1e66Duane Sand or $v0, $a1 # rlo<- rlo | ahi 1604e34652f15f32666323052a6718a63248244f1e66Duane Sand 1605e34652f15f32666323052a6718a63248244f1e66Duane Sand move $v0, $v1 # rlo<- rhi (if shift&0x20) 1606e34652f15f32666323052a6718a63248244f1e66Duane Sand move $v1, $a3 # rhi<- sign(ahi) (if shift&0x20) 1607e34652f15f32666323052a6718a63248244f1e66Duane Sand 16088d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe1: jalr $zero, $ra 1609e34652f15f32666323052a6718a63248244f1e66Duane Sand nop 1610d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff HaoEND art_quick_shr_long 16115bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 16125bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 16135bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Long integer shift. This is different from the generic 32/64-bit 16145bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * binary operations because vAA/vBB are 64-bit but vCC (the shift 16155bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low 16165bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * 6 bits. 16175bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * On entry: 16185bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * r0: low word 16195bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * r1: high word 16205bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * r2: shift count 16215bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 16225bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* ushr-long vAA, vBB, vCC */ 16231d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian RogersENTRY_NO_GP art_quick_ushr_long 1624fc6a30e2fa8f0d44e6c95bbeb5deca4b499f67cejeffhao srl $v1, $a1, $a2 # rhi<- ahi >> (shift&31) 16257fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao srl $v0, $a0, $a2 # rlo<- alo >> (shift&31) 16267fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao not $a0, $a2 # alo<- 31-shift (shift is 5b) 16277fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao sll $a1, 1 16287fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao sll $a1, $a0 # ahi<- ahi << (32-(shift&31)) 16297fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao andi $a2, 0x20 # shift & 0x20 1630e34652f15f32666323052a6718a63248244f1e66Duane Sand beqz $a2, 1f 1631e34652f15f32666323052a6718a63248244f1e66Duane Sand or $v0, $a1 # rlo<- rlo | ahi 1632e34652f15f32666323052a6718a63248244f1e66Duane Sand 1633e34652f15f32666323052a6718a63248244f1e66Duane Sand move $v0, $v1 # rlo<- rhi (if shift&0x20) 1634e34652f15f32666323052a6718a63248244f1e66Duane Sand move $v1, $zero # rhi<- 0 (if shift&0x20) 1635e34652f15f32666323052a6718a63248244f1e66Duane Sand 16368d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe1: jalr $zero, $ra 1637e34652f15f32666323052a6718a63248244f1e66Duane Sand nop 1638d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff HaoEND art_quick_ushr_long 16397fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao 16401d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian RogersUNIMPLEMENTED art_quick_indexof 16411d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian RogersUNIMPLEMENTED art_quick_string_compareto 1642