quick_entrypoints_mips.S revision a4e0e67611f54180694e0807d6599c1132269b6c
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) 821d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers THIS_LOAD_REQUIRES_READ_BARRIER 834af77b7636fe98aae443b46a241fd9a29f16e291Douglas Leung lw $t0, RUNTIME_SAVE_ALL_CALLEE_SAVE_FRAME_OFFSET($t0) 841d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers sw $t0, 0($sp) # Place Method* at bottom of stack. 851d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers sw $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF) # Place sp in Thread::Current()->top_quick_frame. 86735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, -ARG_SLOT_SIZE # reserve argument slots on the stack 87735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_adjust_cfa_offset ARG_SLOT_SIZE 885bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee.endm 895bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 905bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 915bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Macro that sets up the callee save frame to conform with 925bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Runtime::CreateCalleeSaveMethod(kRefsOnly). Restoration assumes non-moving GC. 935bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Does not include rSUSPEND or rSELF 94735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * callee-save: $s2-$s8 + $gp + $ra, 9 total + 2 words padding + 1 word to hold Method* 95735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * Clobbers $t0 and $sp 96735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * Allocates ARG_SLOT_SIZE bytes at the bottom of the stack for arg slots. 97735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * Reserves FRAME_SIZE_REFS_ONLY_CALLEE_SAVE + ARG_SLOT_SIZE bytes on the stack 985bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 991d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers.macro SETUP_REFS_ONLY_CALLEE_SAVE_FRAME 100735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, -48 101735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_adjust_cfa_offset 48 1025c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe 1035c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe // Ugly compile-time check, but we only have the preprocessor. 104735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung#if (FRAME_SIZE_REFS_ONLY_CALLEE_SAVE != 48) 1055c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe#error "REFS_ONLY_CALLEE_SAVE_FRAME(MIPS) size not as expected." 1065c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe#endif 1075c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe 108735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung sw $ra, 44($sp) 109735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_rel_offset 31, 44 110735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung sw $s8, 40($sp) 111735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_rel_offset 30, 40 112735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung sw $gp, 36($sp) 113735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_rel_offset 28, 36 114735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung sw $s7, 32($sp) 115735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_rel_offset 23, 32 116735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung sw $s6, 28($sp) 117735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_rel_offset 22, 28 118735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung sw $s5, 24($sp) 119735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_rel_offset 21, 24 120735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung sw $s4, 20($sp) 121735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_rel_offset 20, 20 122735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung sw $s3, 16($sp) 123735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_rel_offset 19, 16 124735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung sw $s2, 12($sp) 125735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_rel_offset 18, 12 126735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung # 2 words for alignment and bottom word will hold Method* 1271d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers 1284af77b7636fe98aae443b46a241fd9a29f16e291Douglas Leung lw $t0, %got(_ZN3art7Runtime9instance_E)($gp) 1294af77b7636fe98aae443b46a241fd9a29f16e291Douglas Leung lw $t0, 0($t0) 1301d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers THIS_LOAD_REQUIRES_READ_BARRIER 1314af77b7636fe98aae443b46a241fd9a29f16e291Douglas Leung lw $t0, RUNTIME_REFS_ONLY_CALLEE_SAVE_FRAME_OFFSET($t0) 1321d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers sw $t0, 0($sp) # Place Method* at bottom of stack. 1331d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers sw $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF) # Place sp in Thread::Current()->top_quick_frame. 134735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, -ARG_SLOT_SIZE # reserve argument slots on the stack 135735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_adjust_cfa_offset ARG_SLOT_SIZE 1365bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee.endm 1375bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 1381d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers.macro RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME 139735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, ARG_SLOT_SIZE # remove argument slots on the stack 140735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_adjust_cfa_offset -ARG_SLOT_SIZE 141735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $ra, 44($sp) 142bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 31 143735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $s8, 40($sp) 144bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 30 145735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $gp, 36($sp) 146bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 28 147735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $s7, 32($sp) 148bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 23 149735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $s6, 28($sp) 150bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 22 151735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $s5, 24($sp) 152bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 21 153735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $s4, 20($sp) 154bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 20 155735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $s3, 16($sp) 156bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 19 157735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $s2, 12($sp) 158bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 18 159735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, 48 160735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_adjust_cfa_offset -48 1615bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee.endm 1625bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 1631d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers.macro RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME_AND_RETURN 164735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME 1658d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $ra 166735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung nop 1675bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee.endm 1685bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 1695bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 1705bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Macro that sets up the callee save frame to conform with 171735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * Runtime::CreateCalleeSaveMethod(kRefsAndArgs). 1721f3bc2f0f9366594379249027622ab63673b0d3bJeff Hao * callee-save: $a1-$a3, $s2-$s8 + $gp + $ra, 12 total + 3 words padding + method* 1735bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 174735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung.macro SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME_REGISTERS_ONLY 1751f3bc2f0f9366594379249027622ab63673b0d3bJeff Hao addiu $sp, $sp, -64 1761f3bc2f0f9366594379249027622ab63673b0d3bJeff Hao .cfi_adjust_cfa_offset 64 1775c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe 1785c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe // Ugly compile-time check, but we only have the preprocessor. 1795c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe#if (FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE != 64) 1805c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe#error "REFS_AND_ARGS_CALLEE_SAVE_FRAME(MIPS) size not as expected." 1815c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe#endif 1825c1e4352614d61fed6868567e58b96682828cb4dAndreas Gampe 1831f3bc2f0f9366594379249027622ab63673b0d3bJeff Hao sw $ra, 60($sp) 1841f3bc2f0f9366594379249027622ab63673b0d3bJeff Hao .cfi_rel_offset 31, 60 1851f3bc2f0f9366594379249027622ab63673b0d3bJeff Hao sw $s8, 56($sp) 1861f3bc2f0f9366594379249027622ab63673b0d3bJeff Hao .cfi_rel_offset 30, 56 1871f3bc2f0f9366594379249027622ab63673b0d3bJeff Hao sw $gp, 52($sp) 1881f3bc2f0f9366594379249027622ab63673b0d3bJeff Hao .cfi_rel_offset 28, 52 1891f3bc2f0f9366594379249027622ab63673b0d3bJeff Hao sw $s7, 48($sp) 1901f3bc2f0f9366594379249027622ab63673b0d3bJeff Hao .cfi_rel_offset 23, 48 1911f3bc2f0f9366594379249027622ab63673b0d3bJeff Hao sw $s6, 44($sp) 1921f3bc2f0f9366594379249027622ab63673b0d3bJeff Hao .cfi_rel_offset 22, 44 1931f3bc2f0f9366594379249027622ab63673b0d3bJeff Hao sw $s5, 40($sp) 1941f3bc2f0f9366594379249027622ab63673b0d3bJeff Hao .cfi_rel_offset 21, 40 1951f3bc2f0f9366594379249027622ab63673b0d3bJeff Hao sw $s4, 36($sp) 1961f3bc2f0f9366594379249027622ab63673b0d3bJeff Hao .cfi_rel_offset 20, 36 1971f3bc2f0f9366594379249027622ab63673b0d3bJeff Hao sw $s3, 32($sp) 1981f3bc2f0f9366594379249027622ab63673b0d3bJeff Hao .cfi_rel_offset 19, 32 1991f3bc2f0f9366594379249027622ab63673b0d3bJeff Hao sw $s2, 28($sp) 2001f3bc2f0f9366594379249027622ab63673b0d3bJeff Hao .cfi_rel_offset 18, 28 201c6d86725521841637bdd9564e71be3d9691db20fDouglas Leung sw $a3, 24($sp) 202c6d86725521841637bdd9564e71be3d9691db20fDouglas Leung .cfi_rel_offset 7, 24 203c6d86725521841637bdd9564e71be3d9691db20fDouglas Leung sw $a2, 20($sp) 204c6d86725521841637bdd9564e71be3d9691db20fDouglas Leung .cfi_rel_offset 6, 20 205c6d86725521841637bdd9564e71be3d9691db20fDouglas Leung sw $a1, 16($sp) 206c6d86725521841637bdd9564e71be3d9691db20fDouglas Leung .cfi_rel_offset 5, 16 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. 213735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * callee-save: $a1-$a3, $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) 2221d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers THIS_LOAD_REQUIRES_READ_BARRIER 2234af77b7636fe98aae443b46a241fd9a29f16e291Douglas Leung lw $t0, RUNTIME_REFS_AND_ARGS_CALLEE_SAVE_FRAME_OFFSET($t0) 2241d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers sw $t0, 0($sp) # Place Method* at bottom of stack. 2251d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers sw $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF) # Place sp in Thread::Current()->top_quick_frame. 226735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, -ARG_SLOT_SIZE # reserve argument slots on the stack 227735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_adjust_cfa_offset ARG_SLOT_SIZE 228735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung.endm 229735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung 230735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung /* 231735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * Macro that sets up the callee save frame to conform with 232735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * Runtime::CreateCalleeSaveMethod(kRefsAndArgs). Restoration assumes non-moving GC. 233735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * callee-save: $a1-$a3, $s2-$s8 + $gp + $ra, 12 total + 3 words padding + method* 234735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * Clobbers $sp 235735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * Use $a0 as the Method* and loads it into bottom of stack. 236735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * Allocates ARG_SLOT_SIZE bytes at the bottom of the stack for arg slots. 237735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung * Reserves FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE + ARG_SLOT_SIZE bytes on the stack 238735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung */ 239735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung.macro SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME_WITH_METHOD_IN_A0 240735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME_REGISTERS_ONLY 241735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung sw $a0, 0($sp) # Place Method* at bottom of stack. 242735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung sw $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF) # Place sp in Thread::Current()->top_quick_frame. 243735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, -ARG_SLOT_SIZE # reserve argument slots on the stack 244735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_adjust_cfa_offset ARG_SLOT_SIZE 2455bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee.endm 2465bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 2471d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers.macro RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME 248735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, ARG_SLOT_SIZE # remove argument slots on the stack 249735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_adjust_cfa_offset -ARG_SLOT_SIZE 2502a6c7b7c21adcd4493542604305585b852ccf554Mathieu Chartier lw $ra, 60($sp) 251bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 31 2522a6c7b7c21adcd4493542604305585b852ccf554Mathieu Chartier lw $s8, 56($sp) 253bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 30 2542a6c7b7c21adcd4493542604305585b852ccf554Mathieu Chartier lw $gp, 52($sp) 255bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 28 2562a6c7b7c21adcd4493542604305585b852ccf554Mathieu Chartier lw $s7, 48($sp) 257bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 23 2582a6c7b7c21adcd4493542604305585b852ccf554Mathieu Chartier lw $s6, 44($sp) 259bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 22 2602a6c7b7c21adcd4493542604305585b852ccf554Mathieu Chartier lw $s5, 40($sp) 261bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 21 2622a6c7b7c21adcd4493542604305585b852ccf554Mathieu Chartier lw $s4, 36($sp) 263bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 20 2642a6c7b7c21adcd4493542604305585b852ccf554Mathieu Chartier lw $s3, 32($sp) 265bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 19 2662a6c7b7c21adcd4493542604305585b852ccf554Mathieu Chartier lw $s2, 28($sp) 267bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 18 268c6d86725521841637bdd9564e71be3d9691db20fDouglas Leung lw $a3, 24($sp) 269bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 7 270c6d86725521841637bdd9564e71be3d9691db20fDouglas Leung lw $a2, 20($sp) 271bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 6 272c6d86725521841637bdd9564e71be3d9691db20fDouglas Leung lw $a1, 16($sp) 273bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 5 274468532ea115657709bc32ee498e701a4c71762d4Ian Rogers addiu $sp, $sp, 64 # pop frame 2751f3bc2f0f9366594379249027622ab63673b0d3bJeff Hao .cfi_adjust_cfa_offset -64 2765bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee.endm 2775bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 2785bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 2795bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Macro that set calls through to artDeliverPendingExceptionFromCode, where the pending 2805bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * exception is Thread::Current()->exception_ 2815bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 2825bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee.macro DELIVER_PENDING_EXCEPTION 2838161c0336b97e11e02c000af357f8f40de2e23e4jeffhao SETUP_SAVE_ALL_CALLEE_SAVE_FRAME # save callee saves for throw 2848161c0336b97e11e02c000af357f8f40de2e23e4jeffhao la $t9, artDeliverPendingExceptionFromCode 2858d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $t9 # artDeliverPendingExceptionFromCode(Thread*) 2861d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers move $a0, rSELF # pass Thread::Current 2875bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee.endm 2885bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 2895bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee.macro RETURN_IF_NO_EXCEPTION 2907fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ 2911d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME 2928161c0336b97e11e02c000af357f8f40de2e23e4jeffhao bnez $t0, 1f # success if no exception is pending 2935bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee nop 2948d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $ra 2955bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee nop 2965bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee1: 2975bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee DELIVER_PENDING_EXCEPTION 2985bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee.endm 2995bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 3005bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee.macro RETURN_IF_ZERO 3011d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME 3027fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao bnez $v0, 1f # success? 3035bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee nop 3048d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $ra # return on success 3055bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee nop 3065bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee1: 3075bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee DELIVER_PENDING_EXCEPTION 3085bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee.endm 3095bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 3101cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe.macro RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 3111d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME 3127fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao beqz $v0, 1f # success? 3135bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee nop 3148d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $ra # return on success 3155bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee nop 3165bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee1: 3175bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee DELIVER_PENDING_EXCEPTION 3185bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee.endm 3195bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 3205bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 3217fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao * On entry $a0 is uint32_t* gprs_ and $a1 is uint32_t* fprs_ 3225bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * FIXME: just guessing about the shape of the jmpbuf. Where will pc be? 3235bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 324d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff HaoENTRY art_quick_do_long_jump 325e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f0, $f1, 0*8, $a1, $t1 326e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f2, $f3, 1*8, $a1, $t1 327e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f4, $f5, 2*8, $a1, $t1 328e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f6, $f7, 3*8, $a1, $t1 329e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f8, $f9, 4*8, $a1, $t1 330e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f10, $f11, 5*8, $a1, $t1 331e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f12, $f13, 6*8, $a1, $t1 332e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f14, $f15, 7*8, $a1, $t1 333e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f16, $f17, 8*8, $a1, $t1 334e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f18, $f19, 9*8, $a1, $t1 335e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f20, $f21, 10*8, $a1, $t1 336e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f22, $f23, 11*8, $a1, $t1 337e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f24, $f25, 12*8, $a1, $t1 338e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f26, $f27, 13*8, $a1, $t1 339e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f28, $f29, 14*8, $a1, $t1 340e34652f15f32666323052a6718a63248244f1e66Duane Sand LDu $f30, $f31, 15*8, $a1, $t1 341e34652f15f32666323052a6718a63248244f1e66Duane Sand 342748dd957eecbce2f379a3182ce95c19be308a54eChris Dearman .set push 343748dd957eecbce2f379a3182ce95c19be308a54eChris Dearman .set nomacro 344748dd957eecbce2f379a3182ce95c19be308a54eChris Dearman .set noat 3457fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $at, 4($a0) 346748dd957eecbce2f379a3182ce95c19be308a54eChris Dearman .set pop 3477fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $v0, 8($a0) 3487fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $v1, 12($a0) 3497fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $a1, 20($a0) 3507fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $a2, 24($a0) 3517fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $a3, 28($a0) 3527fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $t0, 32($a0) 3537fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $t1, 36($a0) 3547fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $t2, 40($a0) 3557fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $t3, 44($a0) 3567fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $t4, 48($a0) 3577fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $t5, 52($a0) 3587fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $t6, 56($a0) 3597fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $t7, 60($a0) 3607fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $s0, 64($a0) 3617fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $s1, 68($a0) 3627fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $s2, 72($a0) 3637fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $s3, 76($a0) 3647fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $s4, 80($a0) 3657fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $s5, 84($a0) 3667fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $s6, 88($a0) 3677fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $s7, 92($a0) 3687fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $t8, 96($a0) 3697fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $t9, 100($a0) 3707fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $gp, 112($a0) 3717fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $sp, 116($a0) 3727fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $fp, 120($a0) 3737fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $ra, 124($a0) 3747fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $a0, 16($a0) 3757fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao move $v0, $zero # clear result registers r0 and r1 3768d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $ra # do long jump 3777fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao move $v1, $zero 378d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff HaoEND art_quick_do_long_jump 3795bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 3805bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 3815bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Called by managed code, saves most registers (forms basis of long jump context) and passes 3825bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * the bottom of the stack. artDeliverExceptionFromCode will place the callee save Method* at 3835bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * the bottom of the thread. On entry r0 holds Throwable* 3845bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 385468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_deliver_exception 38657b86d47b66322693a070185fadfb43cb9c12eabIan Rogers SETUP_SAVE_ALL_CALLEE_SAVE_FRAME 3878161c0336b97e11e02c000af357f8f40de2e23e4jeffhao la $t9, artDeliverExceptionFromCode 3888d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $t9 # artDeliverExceptionFromCode(Throwable*, Thread*) 3891d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers move $a1, rSELF # pass Thread::Current 390468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_deliver_exception 3915bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 3925bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 3935bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Called by managed code to create and deliver a NullPointerException 3945bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 395d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artThrowNullPointerExceptionFromCode 396468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_throw_null_pointer_exception 39757b86d47b66322693a070185fadfb43cb9c12eabIan Rogers SETUP_SAVE_ALL_CALLEE_SAVE_FRAME 3988161c0336b97e11e02c000af357f8f40de2e23e4jeffhao la $t9, artThrowNullPointerExceptionFromCode 3998d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $t9 # artThrowNullPointerExceptionFromCode(Thread*) 4001d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers move $a0, rSELF # pass Thread::Current 401468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_throw_null_pointer_exception 4025bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 4035bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 4045bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Called by managed code to create and deliver an ArithmeticException 4055bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 406d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artThrowDivZeroFromCode 407468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_throw_div_zero 40857b86d47b66322693a070185fadfb43cb9c12eabIan Rogers SETUP_SAVE_ALL_CALLEE_SAVE_FRAME 4098161c0336b97e11e02c000af357f8f40de2e23e4jeffhao la $t9, artThrowDivZeroFromCode 4108d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $t9 # artThrowDivZeroFromCode(Thread*) 4111d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers move $a0, rSELF # pass Thread::Current 412468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_throw_div_zero 4135bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 4145bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 4155bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Called by managed code to create and deliver an ArrayIndexOutOfBoundsException 4165bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 417d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artThrowArrayBoundsFromCode 418468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_throw_array_bounds 41957b86d47b66322693a070185fadfb43cb9c12eabIan Rogers SETUP_SAVE_ALL_CALLEE_SAVE_FRAME 4208161c0336b97e11e02c000af357f8f40de2e23e4jeffhao la $t9, artThrowArrayBoundsFromCode 4218d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $t9 # artThrowArrayBoundsFromCode(index, limit, Thread*) 4221d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers move $a2, rSELF # pass Thread::Current 423468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_throw_array_bounds 4245bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 42557b86d47b66322693a070185fadfb43cb9c12eabIan Rogers /* 42657b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Called by managed code to create and deliver a StackOverflowError. 42757b86d47b66322693a070185fadfb43cb9c12eabIan Rogers */ 428d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artThrowStackOverflowFromCode 429468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_throw_stack_overflow 43057b86d47b66322693a070185fadfb43cb9c12eabIan Rogers SETUP_SAVE_ALL_CALLEE_SAVE_FRAME 4318161c0336b97e11e02c000af357f8f40de2e23e4jeffhao la $t9, artThrowStackOverflowFromCode 4328d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $t9 # artThrowStackOverflowFromCode(Thread*) 4331d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers move $a0, rSELF # pass Thread::Current 434468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_throw_stack_overflow 4355bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 43657b86d47b66322693a070185fadfb43cb9c12eabIan Rogers /* 43757b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Called by managed code to create and deliver a NoSuchMethodError. 43857b86d47b66322693a070185fadfb43cb9c12eabIan Rogers */ 439d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artThrowNoSuchMethodFromCode 440468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_throw_no_such_method 44157b86d47b66322693a070185fadfb43cb9c12eabIan Rogers SETUP_SAVE_ALL_CALLEE_SAVE_FRAME 4428161c0336b97e11e02c000af357f8f40de2e23e4jeffhao la $t9, artThrowNoSuchMethodFromCode 4438d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $t9 # artThrowNoSuchMethodFromCode(method_idx, Thread*) 4441d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers move $a1, rSELF # pass Thread::Current 445468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_throw_no_such_method 4465bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 4475bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 4485bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * All generated callsites for interface invokes and invocation slow paths will load arguments 4497fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao * as usual - except instead of loading arg0/$a0 with the target Method*, arg0/$a0 will contain 4507ea6a170486d81b127e69673cd1020c4db628c93Nicolas Geoffray * the method_idx. This wrapper will save arg1-arg3, and call the appropriate C helper. 4517fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao * NOTE: "this" is first visable argument of the target, and so can be found in arg1/$a1. 4525bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * 4537fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao * The helper will attempt to locate the target and return a 64-bit result in $v0/$v1 consisting 4547fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao * of the target Method* in $v0 and method->code_ in $v1. 4555bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * 4562cebb24bfc3247d3e9be138a3350106737455918Mathieu Chartier * If unsuccessful, the helper will return null/null. There will be a pending exception in the 4575bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * thread and we branch to another stub to deliver it. 4585bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * 4595bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * On success this wrapper will restore arguments and *jump* to the target, leaving the lr 4605bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * pointing back to the original caller. 4615bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 4625bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee.macro INVOKE_TRAMPOLINE c_name, cxx_name 4635bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee .extern \cxx_name 464d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff HaoENTRY \c_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 477d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff HaoEND \c_name 4785bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee.endm 4795bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 4808dbb708c7dc05c786329eb5c3fff3194ab6472acLogan ChienINVOKE_TRAMPOLINE art_quick_invoke_interface_trampoline, artInvokeInterfaceTrampoline 4818dbb708c7dc05c786329eb5c3fff3194ab6472acLogan ChienINVOKE_TRAMPOLINE art_quick_invoke_interface_trampoline_with_access_check, artInvokeInterfaceTrampolineWithAccessCheck 4825bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 4838dbb708c7dc05c786329eb5c3fff3194ab6472acLogan ChienINVOKE_TRAMPOLINE art_quick_invoke_static_trampoline_with_access_check, artInvokeStaticTrampolineWithAccessCheck 4848dbb708c7dc05c786329eb5c3fff3194ab6472acLogan ChienINVOKE_TRAMPOLINE art_quick_invoke_direct_trampoline_with_access_check, artInvokeDirectTrampolineWithAccessCheck 4858dbb708c7dc05c786329eb5c3fff3194ab6472acLogan ChienINVOKE_TRAMPOLINE art_quick_invoke_super_trampoline_with_access_check, artInvokeSuperTrampolineWithAccessCheck 4868dbb708c7dc05c786329eb5c3fff3194ab6472acLogan ChienINVOKE_TRAMPOLINE art_quick_invoke_virtual_trampoline_with_access_check, artInvokeVirtualTrampolineWithAccessCheck 4875bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 48879fe539587d4c09244172d0168eeed0ec9770466Jeff Hao /* 489ef7d42fca18c16fbaf103822ad16f23246e2905dIan Rogers * Invocation stub for quick code. 4905d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao * On entry: 4915d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao * a0 = method pointer 4922cebb24bfc3247d3e9be138a3350106737455918Mathieu Chartier * a1 = argument array or null for no argument methods 4935d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao * a2 = size of argument array in bytes 4945d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao * a3 = (managed) thread pointer 4956474d190d5604898354ebf767f1944b6e3e9b445Jeff Hao * [sp + 16] = JValue* result 4960177e53ea521ad58b70c305700dab32f1ac773b7Ian Rogers * [sp + 20] = shorty 4975d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao */ 4985d9173014c1ca09f7249a6b07629aa37778b5f8fJeff HaoENTRY art_quick_invoke_stub 4995d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao sw $a0, 0($sp) # save out a0 5005d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao addiu $sp, $sp, -16 # spill s0, s1, fp, ra 5015d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao .cfi_adjust_cfa_offset 16 5025d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao sw $ra, 12($sp) 5035d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao .cfi_rel_offset 31, 12 5045d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao sw $fp, 8($sp) 5055d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao .cfi_rel_offset 30, 8 5065d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao sw $s1, 4($sp) 5075d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao .cfi_rel_offset 17, 4 5085d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao sw $s0, 0($sp) 5095d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao .cfi_rel_offset 16, 0 5105d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao move $fp, $sp # save sp in fp 5115d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao .cfi_def_cfa_register 30 5125d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao move $s1, $a3 # move managed thread pointer into s1 5135d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao addiu $s0, $zero, SUSPEND_CHECK_INTERVAL # reset s0 to suspend check interval 514735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $t0, $a2, 4 # create space for method pointer in frame. 515735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung subu $t0, $sp, $t0 # reserve & align *stack* to 16 bytes: 516735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung srl $t0, $t0, 4 # native calling convention only aligns to 8B, 517735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung sll $sp, $t0, 4 # so we have to ensure ART 16B alignment ourselves. 5185d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao addiu $a0, $sp, 4 # pass stack pointer + method ptr as dest for memcpy 5195d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao jal memcpy # (dest, src, bytes) 5205d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao addiu $sp, $sp, -16 # make space for argument slots for memcpy 5215d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao addiu $sp, $sp, 16 # restore stack after memcpy 5225d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao lw $a0, 16($fp) # restore method* 5235d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao lw $a1, 4($sp) # copy arg value for a1 5245d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao lw $a2, 8($sp) # copy arg value for a2 5255d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao lw $a3, 12($sp) # copy arg value for a3 5262d7210188805292e463be4bcf7a133b654d7e0eaMathieu Chartier lw $t9, MIRROR_ART_METHOD_QUICK_CODE_OFFSET_32($a0) # get pointer to the code 5275d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao jalr $t9 # call the method 5282cebb24bfc3247d3e9be138a3350106737455918Mathieu Chartier sw $zero, 0($sp) # store null for method* at bottom of frame 5295d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao move $sp, $fp # restore the stack 5305d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao lw $s0, 0($sp) 531bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 16 5325d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao lw $s1, 4($sp) 533bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 17 5345d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao lw $fp, 8($sp) 535bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 30 5365d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao lw $ra, 12($sp) 537bbb32c277b800a8ee378c16a3645ab6d4d19aef1Dave Allison .cfi_restore 31 5385d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao addiu $sp, $sp, 16 5395d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao .cfi_adjust_cfa_offset -16 5405d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao lw $t0, 16($sp) # get result pointer 5410177e53ea521ad58b70c305700dab32f1ac773b7Ian Rogers lw $t1, 20($sp) # get shorty 5420177e53ea521ad58b70c305700dab32f1ac773b7Ian Rogers lb $t1, 0($t1) # get result type char 5436474d190d5604898354ebf767f1944b6e3e9b445Jeff Hao li $t2, 68 # put char 'D' into t2 5446474d190d5604898354ebf767f1944b6e3e9b445Jeff Hao beq $t1, $t2, 1f # branch if result type char == 'D' 5456474d190d5604898354ebf767f1944b6e3e9b445Jeff Hao li $t3, 70 # put char 'F' into t3 5466474d190d5604898354ebf767f1944b6e3e9b445Jeff Hao beq $t1, $t3, 1f # branch if result type char == 'F' 5475d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao sw $v0, 0($t0) # store the result 5488d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $ra 5495d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao sw $v1, 4($t0) # store the other half of the result 5506474d190d5604898354ebf767f1944b6e3e9b445Jeff Hao1: 551e34652f15f32666323052a6718a63248244f1e66Duane Sand SDu $f0, $f1, 0, $t0, $t1 # store floating point result 5528d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $ra 553e34652f15f32666323052a6718a63248244f1e66Duane Sand nop 5545d9173014c1ca09f7249a6b07629aa37778b5f8fJeff HaoEND art_quick_invoke_stub 5555d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao 5565d9173014c1ca09f7249a6b07629aa37778b5f8fJeff Hao /* 5575bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Entry from managed code that calls artHandleFillArrayDataFromCode and delivers exception on 5585bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * failure. 5595bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 560d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artHandleFillArrayDataFromCode 561468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_handle_fill_data 562735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a2, 0($sp) # pass referrer's Method* 563735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case exception allocation triggers GC 5641d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artHandleFillArrayDataFromCode # (payload offset, Array*, method, Thread*) 565832336b3c9eb892045a8de1bb12c9361112ca3c5Ian Rogers move $a3, rSELF # pass Thread::Current 566fc6a30e2fa8f0d44e6c95bbeb5deca4b499f67cejeffhao RETURN_IF_ZERO 567468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_handle_fill_data 5685bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 5695bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 57057b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Entry from managed code that calls artLockObjectFromCode, may block for GC. 5715bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 572d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artLockObjectFromCode 573468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_lock_object 57486bcdc251f5ae22fcedd18c096ea538b7dbfa8cbIan Rogers beqz $a0, .Lart_quick_throw_null_pointer_exception_gp_set 575a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers nop 576735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case we block 5771d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artLockObjectFromCode # (Object* obj, Thread*) 5787fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao move $a1, rSELF # pass Thread::Current 5796bcd163d322b867578fbcfe60e4e3b247c42974bIan Rogers RETURN_IF_ZERO 580468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_lock_object 5815bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 5825bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 5835bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Entry from managed code that calls artUnlockObjectFromCode and delivers exception on failure. 5845bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 585d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artUnlockObjectFromCode 586468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_unlock_object 58786bcdc251f5ae22fcedd18c096ea538b7dbfa8cbIan Rogers beqz $a0, .Lart_quick_throw_null_pointer_exception_gp_set 588a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers nop 589735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case exception allocation triggers GC 5901d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artUnlockObjectFromCode # (Object* obj, Thread*) 5917fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao move $a1, rSELF # pass Thread::Current 5925bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee RETURN_IF_ZERO 593468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_unlock_object 5945bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 5955bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 5965bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Entry from managed code that calls artCheckCastFromCode and delivers exception on failure. 5975bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 598a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers .extern artThrowClassCastException 599468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_check_cast 600a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers addiu $sp, $sp, -16 601a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers .cfi_adjust_cfa_offset 16 602a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers sw $ra, 12($sp) 603a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers .cfi_rel_offset 31, 12 604a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers sw $t9, 8($sp) 605a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers sw $a1, 4($sp) 606a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers sw $a0, 0($sp) 607a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers jal artIsAssignableFromCode 608735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, -16 # reserve argument slots on the stack 609735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, 16 61086bcdc251f5ae22fcedd18c096ea538b7dbfa8cbIan Rogers beqz $v0, .Lthrow_class_cast_exception 611a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers lw $ra, 12($sp) 6128d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $ra 613a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers addiu $sp, $sp, 16 614a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers .cfi_adjust_cfa_offset -16 61586bcdc251f5ae22fcedd18c096ea538b7dbfa8cbIan Rogers.Lthrow_class_cast_exception: 616a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers lw $t9, 8($sp) 617a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers lw $a1, 4($sp) 618a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers lw $a0, 0($sp) 619a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers addiu $sp, $sp, 16 620a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers .cfi_adjust_cfa_offset -16 621a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers SETUP_SAVE_ALL_CALLEE_SAVE_FRAME 622a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers la $t9, artThrowClassCastException 6238d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $t9 # artThrowClassCastException (Class*, Class*, Thread*) 6241d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers move $a2, rSELF # pass Thread::Current 625468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_check_cast 6265bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 6275bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 628a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers * Entry from managed code for array put operations of objects where the value being stored 629a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers * needs to be checked for compatibility. 630a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers * a0 = array, a1 = index, a2 = value 6315bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 632a9a8254c920ce8e22210abfc16c9842ce0aea28fIan RogersENTRY art_quick_aput_obj_with_null_and_bound_check 63386bcdc251f5ae22fcedd18c096ea538b7dbfa8cbIan Rogers bnez $a0, .Lart_quick_aput_obj_with_bound_check_gp_set 634a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers nop 63586bcdc251f5ae22fcedd18c096ea538b7dbfa8cbIan Rogers b .Lart_quick_throw_null_pointer_exception_gp_set 636a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers nop 637a9a8254c920ce8e22210abfc16c9842ce0aea28fIan RogersEND art_quick_aput_obj_with_null_and_bound_check 638a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers 639a9a8254c920ce8e22210abfc16c9842ce0aea28fIan RogersENTRY art_quick_aput_obj_with_bound_check 6401d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers lw $t0, MIRROR_ARRAY_LENGTH_OFFSET($a0) 641a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers sltu $t1, $a1, $t0 64286bcdc251f5ae22fcedd18c096ea538b7dbfa8cbIan Rogers bnez $t1, .Lart_quick_aput_obj_gp_set 643a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers nop 644a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers move $a0, $a1 64586bcdc251f5ae22fcedd18c096ea538b7dbfa8cbIan Rogers b .Lart_quick_throw_array_bounds_gp_set 646a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers move $a1, $t0 647a9a8254c920ce8e22210abfc16c9842ce0aea28fIan RogersEND art_quick_aput_obj_with_bound_check 648a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers 649a9a8254c920ce8e22210abfc16c9842ce0aea28fIan RogersENTRY art_quick_aput_obj 65086bcdc251f5ae22fcedd18c096ea538b7dbfa8cbIan Rogers beqz $a2, .Ldo_aput_null 651a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers nop 6521d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers lw $t0, MIRROR_OBJECT_CLASS_OFFSET($a0) 6531d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers lw $t1, MIRROR_OBJECT_CLASS_OFFSET($a2) 6541d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers lw $t0, MIRROR_CLASS_COMPONENT_TYPE_OFFSET($t0) 65586bcdc251f5ae22fcedd18c096ea538b7dbfa8cbIan Rogers bne $t1, $t0, .Lcheck_assignability # value's type == array's component type - trivial assignability 656a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers nop 65786bcdc251f5ae22fcedd18c096ea538b7dbfa8cbIan Rogers.Ldo_aput: 658a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers sll $a1, $a1, 2 659a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers add $t0, $a0, $a1 6601d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers sw $a2, MIRROR_OBJECT_ARRAY_DATA_OFFSET($t0) 661a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers lw $t0, THREAD_CARD_TABLE_OFFSET(rSELF) 662a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers srl $t1, $a0, 7 663a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers add $t1, $t1, $t0 664a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers sb $t0, ($t1) 6658d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $ra 666a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers nop 66786bcdc251f5ae22fcedd18c096ea538b7dbfa8cbIan Rogers.Ldo_aput_null: 668a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers sll $a1, $a1, 2 669a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers add $t0, $a0, $a1 6701d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers sw $a2, MIRROR_OBJECT_ARRAY_DATA_OFFSET($t0) 6718d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $ra 672a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers nop 67386bcdc251f5ae22fcedd18c096ea538b7dbfa8cbIan Rogers.Lcheck_assignability: 674a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers addiu $sp, $sp, -32 675a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers .cfi_adjust_cfa_offset 32 676a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers sw $ra, 28($sp) 677a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers .cfi_rel_offset 31, 28 678a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers sw $t9, 12($sp) 679a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers sw $a2, 8($sp) 680a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers sw $a1, 4($sp) 681a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers sw $a0, 0($sp) 682a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers move $a1, $t1 683a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers move $a0, $t0 684a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers jal artIsAssignableFromCode # (Class*, Class*) 685735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, -16 # reserve argument slots on the stack 686735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, 16 687a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers lw $ra, 28($sp) 688a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers lw $t9, 12($sp) 689a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers lw $a2, 8($sp) 690a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers lw $a1, 4($sp) 691a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers lw $a0, 0($sp) 692e34652f15f32666323052a6718a63248244f1e66Duane Sand addiu $sp, 32 693a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers .cfi_adjust_cfa_offset -32 69486bcdc251f5ae22fcedd18c096ea538b7dbfa8cbIan Rogers bnez $v0, .Ldo_aput 695a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers nop 696a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers SETUP_SAVE_ALL_CALLEE_SAVE_FRAME 697a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers move $a1, $a2 698a9a8254c920ce8e22210abfc16c9842ce0aea28fIan Rogers la $t9, artThrowArrayStoreException 6998d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $t9 # artThrowArrayStoreException(Class*, Class*, Thread*) 7001d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers move $a2, rSELF # pass Thread::Current 701a9a8254c920ce8e22210abfc16c9842ce0aea28fIan RogersEND art_quick_aput_obj 7025bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 7035bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 70437f05ef45e0393de812d51261dc293240c17294dFred Shih * Called by managed code to resolve a static field and load a boolean primitive value. 70537f05ef45e0393de812d51261dc293240c17294dFred Shih */ 70637f05ef45e0393de812d51261dc293240c17294dFred Shih .extern artGetBooleanStaticFromCode 70737f05ef45e0393de812d51261dc293240c17294dFred ShihENTRY art_quick_get_boolean_static 708735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a1, 0($sp) # pass referrer's Method* 709735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 7101d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artGetBooleanStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) 71137f05ef45e0393de812d51261dc293240c17294dFred Shih move $a2, rSELF # pass Thread::Current 71237f05ef45e0393de812d51261dc293240c17294dFred Shih RETURN_IF_NO_EXCEPTION 71337f05ef45e0393de812d51261dc293240c17294dFred ShihEND art_quick_get_boolean_static 71437f05ef45e0393de812d51261dc293240c17294dFred Shih /* 71537f05ef45e0393de812d51261dc293240c17294dFred Shih * Called by managed code to resolve a static field and load a byte primitive value. 71637f05ef45e0393de812d51261dc293240c17294dFred Shih */ 71737f05ef45e0393de812d51261dc293240c17294dFred Shih .extern artGetByteStaticFromCode 71837f05ef45e0393de812d51261dc293240c17294dFred ShihENTRY art_quick_get_byte_static 719735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a1, 0($sp) # pass referrer's Method* 720735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 7211d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artGetByteStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) 72237f05ef45e0393de812d51261dc293240c17294dFred Shih move $a2, rSELF # pass Thread::Current 72337f05ef45e0393de812d51261dc293240c17294dFred Shih RETURN_IF_NO_EXCEPTION 72437f05ef45e0393de812d51261dc293240c17294dFred ShihEND art_quick_get_byte_static 72537f05ef45e0393de812d51261dc293240c17294dFred Shih 72637f05ef45e0393de812d51261dc293240c17294dFred Shih /* 72737f05ef45e0393de812d51261dc293240c17294dFred Shih * Called by managed code to resolve a static field and load a char primitive value. 72837f05ef45e0393de812d51261dc293240c17294dFred Shih */ 72937f05ef45e0393de812d51261dc293240c17294dFred Shih .extern artGetCharStaticFromCode 73037f05ef45e0393de812d51261dc293240c17294dFred ShihENTRY art_quick_get_char_static 731735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a1, 0($sp) # pass referrer's Method* 732735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 7331d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artGetCharStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) 73437f05ef45e0393de812d51261dc293240c17294dFred Shih move $a2, rSELF # pass Thread::Current 73537f05ef45e0393de812d51261dc293240c17294dFred Shih RETURN_IF_NO_EXCEPTION 73637f05ef45e0393de812d51261dc293240c17294dFred ShihEND art_quick_get_char_static 73737f05ef45e0393de812d51261dc293240c17294dFred Shih /* 73837f05ef45e0393de812d51261dc293240c17294dFred Shih * Called by managed code to resolve a static field and load a short primitive value. 73937f05ef45e0393de812d51261dc293240c17294dFred Shih */ 74037f05ef45e0393de812d51261dc293240c17294dFred Shih .extern artGetShortStaticFromCode 74137f05ef45e0393de812d51261dc293240c17294dFred ShihENTRY art_quick_get_short_static 742735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a1, 0($sp) # pass referrer's Method* 743735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 7441d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artGetShortStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) 74537f05ef45e0393de812d51261dc293240c17294dFred Shih move $a2, rSELF # pass Thread::Current 74637f05ef45e0393de812d51261dc293240c17294dFred Shih RETURN_IF_NO_EXCEPTION 74737f05ef45e0393de812d51261dc293240c17294dFred ShihEND art_quick_get_short_static 7485bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 7495bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 75057b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Called by managed code to resolve a static field and load a 32-bit primitive value. 7515bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 752d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artGet32StaticFromCode 753468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_get32_static 754735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a1, 0($sp) # pass referrer's Method* 755735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 7561d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artGet32StaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) 7577fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao move $a2, rSELF # pass Thread::Current 7585bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee RETURN_IF_NO_EXCEPTION 759468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_get32_static 7605bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 7615bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 76257b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Called by managed code to resolve a static field and load a 64-bit primitive value. 7635bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 764d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artGet64StaticFromCode 765468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_get64_static 766735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a1, 0($sp) # pass referrer's Method* 767735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 7681d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artGet64StaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) 7697fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao move $a2, rSELF # pass Thread::Current 7705bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee RETURN_IF_NO_EXCEPTION 771468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_get64_static 7725bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 7735bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 77457b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Called by managed code to resolve a static field and load an object reference. 7755bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 776d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artGetObjStaticFromCode 777468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_get_obj_static 778735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a1, 0($sp) # pass referrer's Method* 779735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 7801d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artGetObjStaticFromCode # (uint32_t field_idx, const Method* referrer, Thread*) 7817fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao move $a2, rSELF # pass Thread::Current 7825bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee RETURN_IF_NO_EXCEPTION 783468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_get_obj_static 7845bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 7855bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 78637f05ef45e0393de812d51261dc293240c17294dFred Shih * Called by managed code to resolve an instance field and load a boolean primitive value. 78737f05ef45e0393de812d51261dc293240c17294dFred Shih */ 78837f05ef45e0393de812d51261dc293240c17294dFred Shih .extern artGetBooleanInstanceFromCode 78937f05ef45e0393de812d51261dc293240c17294dFred ShihENTRY art_quick_get_boolean_instance 790735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a2, 0($sp) # pass referrer's Method* 791735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 7921d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artGetBooleanInstanceFromCode # (field_idx, Object*, referrer, Thread*) 79337f05ef45e0393de812d51261dc293240c17294dFred Shih move $a3, rSELF # pass Thread::Current 79437f05ef45e0393de812d51261dc293240c17294dFred Shih RETURN_IF_NO_EXCEPTION 79537f05ef45e0393de812d51261dc293240c17294dFred ShihEND art_quick_get_boolean_instance 79637f05ef45e0393de812d51261dc293240c17294dFred Shih /* 79737f05ef45e0393de812d51261dc293240c17294dFred Shih * Called by managed code to resolve an instance field and load a byte primitive value. 79837f05ef45e0393de812d51261dc293240c17294dFred Shih */ 79937f05ef45e0393de812d51261dc293240c17294dFred Shih .extern artGetByteInstanceFromCode 80037f05ef45e0393de812d51261dc293240c17294dFred ShihENTRY art_quick_get_byte_instance 801735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a2, 0($sp) # pass referrer's Method* 802735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 8031d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artGetByteInstanceFromCode # (field_idx, Object*, referrer, Thread*) 80437f05ef45e0393de812d51261dc293240c17294dFred Shih move $a3, rSELF # pass Thread::Current 80537f05ef45e0393de812d51261dc293240c17294dFred Shih RETURN_IF_NO_EXCEPTION 80637f05ef45e0393de812d51261dc293240c17294dFred ShihEND art_quick_get_byte_instance 80737f05ef45e0393de812d51261dc293240c17294dFred Shih 80837f05ef45e0393de812d51261dc293240c17294dFred Shih /* 80937f05ef45e0393de812d51261dc293240c17294dFred Shih * Called by managed code to resolve an instance field and load a char primitive value. 81037f05ef45e0393de812d51261dc293240c17294dFred Shih */ 81137f05ef45e0393de812d51261dc293240c17294dFred Shih .extern artGetCharInstanceFromCode 81237f05ef45e0393de812d51261dc293240c17294dFred ShihENTRY art_quick_get_char_instance 813735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a2, 0($sp) # pass referrer's Method* 814735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 8151d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artGetCharInstanceFromCode # (field_idx, Object*, referrer, Thread*) 81637f05ef45e0393de812d51261dc293240c17294dFred Shih move $a3, rSELF # pass Thread::Current 81737f05ef45e0393de812d51261dc293240c17294dFred Shih RETURN_IF_NO_EXCEPTION 81837f05ef45e0393de812d51261dc293240c17294dFred ShihEND art_quick_get_char_instance 81937f05ef45e0393de812d51261dc293240c17294dFred Shih /* 82037f05ef45e0393de812d51261dc293240c17294dFred Shih * Called by managed code to resolve an instance field and load a short primitive value. 82137f05ef45e0393de812d51261dc293240c17294dFred Shih */ 82237f05ef45e0393de812d51261dc293240c17294dFred Shih .extern artGetShortInstanceFromCode 82337f05ef45e0393de812d51261dc293240c17294dFred ShihENTRY art_quick_get_short_instance 824735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a2, 0($sp) # pass referrer's Method* 825735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 826735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung jal artGetShortInstanceFromCode # (field_idx, Object*, referrer, Thread*) 82737f05ef45e0393de812d51261dc293240c17294dFred Shih move $a3, rSELF # pass Thread::Current 82837f05ef45e0393de812d51261dc293240c17294dFred Shih RETURN_IF_NO_EXCEPTION 82937f05ef45e0393de812d51261dc293240c17294dFred ShihEND art_quick_get_short_instance 83037f05ef45e0393de812d51261dc293240c17294dFred Shih 83137f05ef45e0393de812d51261dc293240c17294dFred Shih /* 83257b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Called by managed code to resolve an instance field and load a 32-bit primitive value. 8335bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 834d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artGet32InstanceFromCode 835468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_get32_instance 836735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a2, 0($sp) # pass referrer's Method* 837735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 838735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung jal artGet32InstanceFromCode # (field_idx, Object*, referrer, Thread*) 8397fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao move $a3, rSELF # pass Thread::Current 8405bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee RETURN_IF_NO_EXCEPTION 841468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_get32_instance 8425bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 8435bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 84457b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Called by managed code to resolve an instance field and load a 64-bit primitive value. 8455bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 846d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artGet64InstanceFromCode 847468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_get64_instance 848735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a2, 0($sp) # pass referrer's Method* 849735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 850735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung jal artGet64InstanceFromCode # (field_idx, Object*, referrer, Thread*) 8517fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao move $a3, rSELF # pass Thread::Current 8525bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee RETURN_IF_NO_EXCEPTION 853468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_get64_instance 8545bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 8555bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 85657b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Called by managed code to resolve an instance field and load an object reference. 8575bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 858d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artGetObjInstanceFromCode 859468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_get_obj_instance 860735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a2, 0($sp) # pass referrer's Method* 861735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 8621d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artGetObjInstanceFromCode # (field_idx, Object*, referrer, Thread*) 8637fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao move $a3, rSELF # pass Thread::Current 8645bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee RETURN_IF_NO_EXCEPTION 865468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_get_obj_instance 8665bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 8675bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 86837f05ef45e0393de812d51261dc293240c17294dFred Shih * Called by managed code to resolve a static field and store a 8-bit primitive value. 86937f05ef45e0393de812d51261dc293240c17294dFred Shih */ 87037f05ef45e0393de812d51261dc293240c17294dFred Shih .extern artSet8StaticFromCode 87137f05ef45e0393de812d51261dc293240c17294dFred ShihENTRY art_quick_set8_static 872735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a2, 0($sp) # pass referrer's Method* 873735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 8741d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artSet8StaticFromCode # (field_idx, new_val, referrer, Thread*) 87537f05ef45e0393de812d51261dc293240c17294dFred Shih move $a3, rSELF # pass Thread::Current 87637f05ef45e0393de812d51261dc293240c17294dFred Shih RETURN_IF_ZERO 87737f05ef45e0393de812d51261dc293240c17294dFred ShihEND art_quick_set8_static 87837f05ef45e0393de812d51261dc293240c17294dFred Shih 87937f05ef45e0393de812d51261dc293240c17294dFred Shih /* 88037f05ef45e0393de812d51261dc293240c17294dFred Shih * Called by managed code to resolve a static field and store a 16-bit primitive value. 88137f05ef45e0393de812d51261dc293240c17294dFred Shih */ 88237f05ef45e0393de812d51261dc293240c17294dFred Shih .extern artSet16StaticFromCode 88337f05ef45e0393de812d51261dc293240c17294dFred ShihENTRY art_quick_set16_static 884735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a2, 0($sp) # pass referrer's Method* 885735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 88637f05ef45e0393de812d51261dc293240c17294dFred Shih jal artSet16StaticFromCode # (field_idx, new_val, referrer, Thread*, $sp) 8871d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers move $a3, rSELF # pass Thread::Current 88837f05ef45e0393de812d51261dc293240c17294dFred Shih RETURN_IF_ZERO 88937f05ef45e0393de812d51261dc293240c17294dFred ShihEND art_quick_set16_static 89037f05ef45e0393de812d51261dc293240c17294dFred Shih 89137f05ef45e0393de812d51261dc293240c17294dFred Shih /* 89257b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Called by managed code to resolve a static field and store a 32-bit primitive value. 8935bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 894d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artSet32StaticFromCode 895468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_set32_static 896735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a2, 0($sp) # pass referrer's Method* 897735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 8981d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artSet32StaticFromCode # (field_idx, new_val, referrer, Thread*) 8997fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao move $a3, rSELF # pass Thread::Current 9005bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee RETURN_IF_ZERO 901468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_set32_static 9025bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 9035bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 90457b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Called by managed code to resolve a static field and store a 64-bit primitive value. 9055bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 90637f05ef45e0393de812d51261dc293240c17294dFred Shih .extern artSet64StaticFromCode 907468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_set64_static 908735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a1, 0($sp) # pass referrer's Method* 9098d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe # 64 bit new_val is in a2:a3 pair 910735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 9111d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artSet64StaticFromCode # (field_idx, referrer, new_val, Thread*) 912fa147e22a73c6df166b08a2f71f9c9b52b09d17cjeffhao sw rSELF, 16($sp) # pass Thread::Current 9135bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee RETURN_IF_ZERO 914468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_set64_static 9155bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 9165bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 91757b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Called by managed code to resolve a static field and store an object reference. 9185bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 919d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artSetObjStaticFromCode 920468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_set_obj_static 921735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a2, 0($sp) # pass referrer's Method* 922735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 9237fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao move $a3, rSELF # pass Thread::Current 924735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung jal artSetObjStaticFromCode # (field_idx, new_val, referrer, Thread*) 9255bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee RETURN_IF_ZERO 926468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_set_obj_static 9275bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 9285bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 92937f05ef45e0393de812d51261dc293240c17294dFred Shih * Called by managed code to resolve an instance field and store a 8-bit primitive value. 93037f05ef45e0393de812d51261dc293240c17294dFred Shih */ 93137f05ef45e0393de812d51261dc293240c17294dFred Shih .extern artSet8InstanceFromCode 93237f05ef45e0393de812d51261dc293240c17294dFred ShihENTRY art_quick_set8_instance 933735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a3, 0($sp) # pass referrer's Method* 934735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 935735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung jal artSet8InstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*) 93637f05ef45e0393de812d51261dc293240c17294dFred Shih sw rSELF, 16($sp) # pass Thread::Current 93737f05ef45e0393de812d51261dc293240c17294dFred Shih RETURN_IF_ZERO 93837f05ef45e0393de812d51261dc293240c17294dFred ShihEND art_quick_set8_instance 93937f05ef45e0393de812d51261dc293240c17294dFred Shih 94037f05ef45e0393de812d51261dc293240c17294dFred Shih /* 94137f05ef45e0393de812d51261dc293240c17294dFred Shih * Called by managed code to resolve an instance field and store a 16-bit primitive value. 94237f05ef45e0393de812d51261dc293240c17294dFred Shih */ 94337f05ef45e0393de812d51261dc293240c17294dFred Shih .extern artSet16InstanceFromCode 94437f05ef45e0393de812d51261dc293240c17294dFred ShihENTRY art_quick_set16_instance 945735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a3, 0($sp) # pass referrer's Method* 946735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 9471d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artSet16InstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*) 94837f05ef45e0393de812d51261dc293240c17294dFred Shih sw rSELF, 16($sp) # pass Thread::Current 94937f05ef45e0393de812d51261dc293240c17294dFred Shih RETURN_IF_ZERO 95037f05ef45e0393de812d51261dc293240c17294dFred ShihEND art_quick_set16_instance 95137f05ef45e0393de812d51261dc293240c17294dFred Shih 95237f05ef45e0393de812d51261dc293240c17294dFred Shih /* 95357b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Called by managed code to resolve an instance field and store a 32-bit primitive value. 9545bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 955d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artSet32InstanceFromCode 956468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_set32_instance 957735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a3, 0($sp) # pass referrer's Method* 958735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 9591d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artSet32InstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*) 960fa147e22a73c6df166b08a2f71f9c9b52b09d17cjeffhao sw rSELF, 16($sp) # pass Thread::Current 9615bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee RETURN_IF_ZERO 962468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_set32_instance 9635bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 9645bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 96557b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Called by managed code to resolve an instance field and store a 64-bit primitive value. 9665bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 96737f05ef45e0393de812d51261dc293240c17294dFred Shih .extern artSet64InstanceFromCode 968468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_set64_instance 969735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $t1, 0($sp) # load referrer's Method* 9708d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe # 64 bit new_val is in a2:a3 pair 971735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 9721d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers sw rSELF, 20($sp) # pass Thread::Current 9731d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artSet64InstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*) 974735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung sw $t1, 16($sp) # pass referrer's Method* 9755bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee RETURN_IF_ZERO 976468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_set64_instance 9775bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 9785bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 97957b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Called by managed code to resolve an instance field and store an object reference. 9805bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 981d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artSetObjInstanceFromCode 982468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_set_obj_instance 983735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a3, 0($sp) # pass referrer's Method* 984735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 9851d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artSetObjInstanceFromCode # (field_idx, Object*, new_val, referrer, Thread*) 986fa147e22a73c6df166b08a2f71f9c9b52b09d17cjeffhao sw rSELF, 16($sp) # pass Thread::Current 9875bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee RETURN_IF_ZERO 988468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_set_obj_instance 9895bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 990a3c382738bc54f464a57e2b51b51ad305eb03dd2Vladimir Marko// Macro to facilitate adding new allocation entrypoints. 9915ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko.macro ONE_ARG_DOWNCALL name, entrypoint, return 9925ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko .extern \entrypoint 9935ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir MarkoENTRY \name 9945ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 9955ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko jal \entrypoint 9965ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko move $a1, rSELF # pass Thread::Current 9975ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko \return 9985ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir MarkoEND \name 9995ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko.endm 10005ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko 1001cbb2d20bea2861f244da2e2318d8c088300a3710Mathieu Chartier.macro TWO_ARG_DOWNCALL name, entrypoint, return 1002cbb2d20bea2861f244da2e2318d8c088300a3710Mathieu Chartier .extern \entrypoint 1003cbb2d20bea2861f244da2e2318d8c088300a3710Mathieu ChartierENTRY \name 1004735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 1005cbb2d20bea2861f244da2e2318d8c088300a3710Mathieu Chartier jal \entrypoint 10061d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers move $a2, rSELF # pass Thread::Current 1007cbb2d20bea2861f244da2e2318d8c088300a3710Mathieu Chartier \return 1008cbb2d20bea2861f244da2e2318d8c088300a3710Mathieu ChartierEND \name 1009cbb2d20bea2861f244da2e2318d8c088300a3710Mathieu Chartier.endm 10105bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 1011cbb2d20bea2861f244da2e2318d8c088300a3710Mathieu Chartier.macro THREE_ARG_DOWNCALL name, entrypoint, return 1012cbb2d20bea2861f244da2e2318d8c088300a3710Mathieu Chartier .extern \entrypoint 1013cbb2d20bea2861f244da2e2318d8c088300a3710Mathieu ChartierENTRY \name 1014735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 1015cbb2d20bea2861f244da2e2318d8c088300a3710Mathieu Chartier jal \entrypoint 10161d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers move $a3, rSELF # pass Thread::Current 1017cbb2d20bea2861f244da2e2318d8c088300a3710Mathieu Chartier \return 1018cbb2d20bea2861f244da2e2318d8c088300a3710Mathieu ChartierEND \name 1019cbb2d20bea2861f244da2e2318d8c088300a3710Mathieu Chartier.endm 10205bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 1021848f70a3d73833fc1bf3032a9ff6812e429661d9Jeff Hao.macro FOUR_ARG_DOWNCALL name, entrypoint, return 1022848f70a3d73833fc1bf3032a9ff6812e429661d9Jeff Hao .extern \entrypoint 1023848f70a3d73833fc1bf3032a9ff6812e429661d9Jeff HaoENTRY \name 1024a3c382738bc54f464a57e2b51b51ad305eb03dd2Vladimir Marko SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves in case of GC 1025848f70a3d73833fc1bf3032a9ff6812e429661d9Jeff Hao jal \entrypoint 1026a3c382738bc54f464a57e2b51b51ad305eb03dd2Vladimir Marko sw rSELF, 16($sp) # pass Thread::Current 1027848f70a3d73833fc1bf3032a9ff6812e429661d9Jeff Hao \return 1028848f70a3d73833fc1bf3032a9ff6812e429661d9Jeff HaoEND \name 1029848f70a3d73833fc1bf3032a9ff6812e429661d9Jeff Hao.endm 1030848f70a3d73833fc1bf3032a9ff6812e429661d9Jeff Hao 10317410f29b4dae223befac036ea567d7f33351dad1Mathieu Chartier// Generate the allocation entrypoints for each allocator. 10327410f29b4dae223befac036ea567d7f33351dad1Mathieu ChartierGENERATE_ALL_ALLOC_ENTRYPOINTS 10333b4c18933c24b8a33f38573c2ebcdb9aa16efeb5Hiroshi Yamauchi 10345bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 10351cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe * Entry from managed code to resolve a string, this stub will allocate a String and deliver an 10365ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko * exception on error. On success the String is returned. A0 holds the string index. The fast 10375ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir Marko * path check for hit in strings cache has already been performed. 10381cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe */ 10395ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir MarkoONE_ARG_DOWNCALL art_quick_resolve_string, artResolveStringFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 10401cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe 10411cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe /* 10421cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe * Entry from managed code when uninitialized static storage, this stub will run the class 10431cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe * initializer and deliver the exception on error. On success the static storage base is 10441cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe * returned. 10451cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe */ 10465ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir MarkoONE_ARG_DOWNCALL art_quick_initialize_static_storage, artInitializeStaticStorageFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 10471cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe 10481cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe /* 10491cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe * Entry from managed code when dex cache misses for a type_idx. 10501cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe */ 10515ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir MarkoONE_ARG_DOWNCALL art_quick_initialize_type, artInitializeTypeFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 10521cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe 10531cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe /* 10541cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe * Entry from managed code when type_idx needs to be checked for access and dex cache may also 10551cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe * miss. 10561cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe */ 10575ea536aa4a6414db01beaf6f8bd8cb9adc5cfc92Vladimir MarkoONE_ARG_DOWNCALL art_quick_initialize_type_and_verify_access, artInitializeTypeAndVerifyAccessFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 10581cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe 10591cc7dbabd03e0a6c09d68161417a21bd6f9df371Andreas Gampe /* 106057b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * Called by managed code when the value in rSUSPEND has been decremented to 0. 10615bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 1062d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artTestSuspendFromCode 1063d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff HaoENTRY art_quick_test_suspend 1064474b6da273c7ce6df50a4e51eb9929a77e1611c3Ian Rogers lh $a0, THREAD_FLAGS_OFFSET(rSELF) 10657fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao bnez $a0, 1f 1066e34652f15f32666323052a6718a63248244f1e66Duane Sand addiu rSUSPEND, $zero, SUSPEND_CHECK_INTERVAL # reset rSUSPEND to SUSPEND_CHECK_INTERVAL 10678d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $ra 10685bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee nop 10695bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee1: 10701d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers SETUP_REFS_ONLY_CALLEE_SAVE_FRAME # save callee saves for stack crawl 10711d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artTestSuspendFromCode # (Thread*) 10727fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao move $a0, rSELF 10731d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers RESTORE_REFS_ONLY_CALLEE_SAVE_FRAME_AND_RETURN 1074d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff HaoEND art_quick_test_suspend 10755bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 10765bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 10775bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Called by managed code that is attempting to call a method on a proxy class. On entry 107857b86d47b66322693a070185fadfb43cb9c12eabIan Rogers * r0 holds the proxy method; r1, r2 and r3 may contain arguments. 10795bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 10805fa60c3db4208df407113b5a69d295a9c93d53b1Jeff Hao .extern artQuickProxyInvokeHandler 1081d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff HaoENTRY art_quick_proxy_invoke_handler 1082735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME_WITH_METHOD_IN_A0 1083735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung move $a2, rSELF # pass Thread::Current 10845fa60c3db4208df407113b5a69d295a9c93d53b1Jeff Hao jal artQuickProxyInvokeHandler # (Method* proxy method, receiver, Thread*, SP) 1085735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $a3, $sp, ARG_SLOT_SIZE # pass $sp (remove arg slots) 10867fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao lw $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ 1087735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME 10887fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao bnez $t0, 1f 1089e34652f15f32666323052a6718a63248244f1e66Duane Sand # don't care if $v0 and/or $v1 are modified, when exception branch taken 1090e34652f15f32666323052a6718a63248244f1e66Duane Sand MTD $v0, $v1, $f0, $f1 # move float value to return value 10918d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $ra 1092e34652f15f32666323052a6718a63248244f1e66Duane Sand nop 10935bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee1: 10945bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee DELIVER_PENDING_EXCEPTION 1095d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff HaoEND art_quick_proxy_invoke_handler 10965bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 109788474b416eb257078e590bf9bc7957cee604a186Jeff Hao /* 109888474b416eb257078e590bf9bc7957cee604a186Jeff Hao * Called to resolve an imt conflict. t0 is a hidden argument that holds the target method's 109988474b416eb257078e590bf9bc7957cee604a186Jeff Hao * dex method index. 110088474b416eb257078e590bf9bc7957cee604a186Jeff Hao */ 110113738bf7c769638b7922cb2477471ad382632bc2Douglas LeungENTRY art_quick_imt_conflict_trampoline 110288474b416eb257078e590bf9bc7957cee604a186Jeff Hao la $t9, art_quick_invoke_interface_trampoline 11038d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $t9 11048ea18d0f066f63fa4e5d154f14327468bf288e2bNicolas Geoffray move $a0, $t0 110588474b416eb257078e590bf9bc7957cee604a186Jeff HaoEND art_quick_imt_conflict_trampoline 110688474b416eb257078e590bf9bc7957cee604a186Jeff Hao 1107468532ea115657709bc32ee498e701a4c71762d4Ian Rogers .extern artQuickResolutionTrampoline 1108468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_resolution_trampoline 11091d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME 1110735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung move $a2, rSELF # pass Thread::Current 111165d1b22d0b02fb0111f69013163c8170e68392f1Ian Rogers jal artQuickResolutionTrampoline # (Method* called, receiver, Thread*, SP) 1112735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $a3, $sp, ARG_SLOT_SIZE # pass $sp (remove arg slots) 1113468532ea115657709bc32ee498e701a4c71762d4Ian Rogers beqz $v0, 1f 1114735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a0, ARG_SLOT_SIZE($sp) # load resolved method to $a0 11151d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME 111665d1b22d0b02fb0111f69013163c8170e68392f1Ian Rogers move $t9, $v0 # code pointer must be in $t9 to generate the global pointer 1117f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung jalr $zero, $t9 # tail call to method 11181984152ac92aad244ae15184d12f9ceade686b7bMathieu Chartier nop 1119468532ea115657709bc32ee498e701a4c71762d4Ian Rogers1: 11201d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME 1121468532ea115657709bc32ee498e701a4c71762d4Ian Rogers DELIVER_PENDING_EXCEPTION 1122468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_resolution_trampoline 1123468532ea115657709bc32ee498e701a4c71762d4Ian Rogers 1124735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .extern artQuickGenericJniTrampoline 1125735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .extern artQuickGenericJniEndTrampoline 1126735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas LeungENTRY art_quick_generic_jni_trampoline 1127735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME_WITH_METHOD_IN_A0 1128735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung move $s8, $sp # save $sp to $s8 1129735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung move $s3, $gp # save $gp to $s3 1130735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung 1131735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung # prepare for call to artQuickGenericJniTrampoline(Thread*, SP) 1132735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung move $a0, rSELF # pass Thread::Current 1133735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $a1, $sp, ARG_SLOT_SIZE # save $sp (remove arg slots) 1134735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung jal artQuickGenericJniTrampoline # (Thread*, SP) 1135735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, -5120 # reserve space on the stack 1136735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung 1137735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung # The C call will have registered the complete save-frame on success. 1138735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung # The result of the call is: 1139735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung # v0: ptr to native code, 0 on error. 1140735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung # v1: ptr to the bottom of the used area of the alloca, can restore stack till here. 1141735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung beq $v0, $zero, 1f # check entry error 1142735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung move $t9, $v0 # save the code ptr 1143735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung move $sp, $v1 # release part of the alloca 1144735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung 1145735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung # Load parameters from stack into registers 1146735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a0, 0($sp) 1147735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a1, 4($sp) 1148735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a2, 8($sp) 1149735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung 1150735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung # Load FPRs the same as GPRs. Look at BuildNativeCallFrameStateMachine. 1151735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung jalr $t9 # native call 1152735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a3, 12($sp) 1153735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, 16 # remove arg slots 1154735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung 1155735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung move $gp, $s3 # restore $gp from $s3 1156735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung 1157735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung # result sign extension is handled in C code 1158735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung # prepare for call to artQuickGenericJniEndTrampoline(Thread*, result, result_f) 1159735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung move $a0, rSELF # pass Thread::Current 1160735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung move $a2, $v0 # pass result 1161735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung move $a3, $v1 1162735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, -24 # reserve arg slots 1163735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung jal artQuickGenericJniEndTrampoline 1164735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung s.d $f0, 16($sp) # pass result_f 1165735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung 1166735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ 1167126d65952a03b3e44d5021208673c01920a982a4Nicolas Geoffray bne $t0, $zero, 1f # check for pending exceptions 1168126d65952a03b3e44d5021208673c01920a982a4Nicolas Geoffray 1169735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung move $sp, $s8 # tear down the alloca 1170735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung 1171735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung # tear dpown the callee-save frame 1172735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME 1173735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung 1174e34652f15f32666323052a6718a63248244f1e66Duane Sand MTD $v0, $v1, $f0, $f1 # move float value to return value 11758d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $ra 1176e34652f15f32666323052a6718a63248244f1e66Duane Sand nop 1177735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung 1178735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung1: 1179126d65952a03b3e44d5021208673c01920a982a4Nicolas Geoffray lw $sp, THREAD_TOP_QUICK_FRAME_OFFSET(rSELF) 1180126d65952a03b3e44d5021208673c01920a982a4Nicolas Geoffray # This will create a new save-all frame, required by the runtime. 1181735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung DELIVER_PENDING_EXCEPTION 1182735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas LeungEND art_quick_generic_jni_trampoline 11832da882315a61072664f7ce3c212307342e907207Andreas Gampe 1184468532ea115657709bc32ee498e701a4c71762d4Ian Rogers .extern artQuickToInterpreterBridge 1185468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_to_interpreter_bridge 11861d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME 1187735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung move $a1, rSELF # pass Thread::Current 1188735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung jal artQuickToInterpreterBridge # (Method* method, Thread*, SP) 1189735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $a2, $sp, ARG_SLOT_SIZE # pass $sp (remove arg slots) 11907db619bb2a4e01e8532a04b613745d4926b205d7Ian Rogers lw $t0, THREAD_EXCEPTION_OFFSET(rSELF) # load Thread::Current()->exception_ 1191735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME 11927db619bb2a4e01e8532a04b613745d4926b205d7Ian Rogers bnez $t0, 1f 1193e34652f15f32666323052a6718a63248244f1e66Duane Sand # don't care if $v0 and/or $v1 are modified, when exception branch taken 1194e34652f15f32666323052a6718a63248244f1e66Duane Sand MTD $v0, $v1, $f0, $f1 # move float value to return value 11958d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe jalr $zero, $ra 1196e34652f15f32666323052a6718a63248244f1e66Duane Sand nop 11977db619bb2a4e01e8532a04b613745d4926b205d7Ian Rogers1: 11987db619bb2a4e01e8532a04b613745d4926b205d7Ian Rogers DELIVER_PENDING_EXCEPTION 1199468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_to_interpreter_bridge 12007db619bb2a4e01e8532a04b613745d4926b205d7Ian Rogers 12015bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 1202725a957985171d712d5c048cc3d00ff14968784bjeffhao * Routine that intercepts method calls and returns. 12035bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 1204d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artInstrumentationMethodEntryFromCode 1205d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artInstrumentationMethodExitFromCode 1206468532ea115657709bc32ee498e701a4c71762d4Ian RogersENTRY art_quick_instrumentation_entry 12071d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers SETUP_REFS_AND_ARGS_CALLEE_SAVE_FRAME 1208735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung sw $a0, 28($sp) # save arg0 in free arg slot 12091d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers move $a3, $ra # pass $ra 12101d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artInstrumentationMethodEntryFromCode # (Method*, Object*, Thread*, LR) 121162d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers move $a2, rSELF # pass Thread::Current 12128161c0336b97e11e02c000af357f8f40de2e23e4jeffhao move $t9, $v0 # $t9 holds reference to code 1213735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung lw $a0, 28($sp) # restore arg0 from free arg slot 12141d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers RESTORE_REFS_AND_ARGS_CALLEE_SAVE_FRAME 12158161c0336b97e11e02c000af357f8f40de2e23e4jeffhao jalr $t9 # call method 121662d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers nop 1217468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_instrumentation_entry 12185bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* intentional fallthrough */ 1219468532ea115657709bc32ee498e701a4c71762d4Ian Rogers .global art_quick_instrumentation_exit 1220468532ea115657709bc32ee498e701a4c71762d4Ian Rogersart_quick_instrumentation_exit: 1221d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .cfi_startproc 122212051ea86ec27703b07b3d5c2cd4604b20f71810jeffhao addiu $t9, $ra, 4 # put current address into $t9 to rebuild $gp 12231d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers .cpload $t9 1224c3d131e1ec030b4ff5c44fe2a45d5fb45b3295afDouglas Leung move $ra, $zero # link register is to here, so clobber with 0 for later checks 1225735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung 1226f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung SETUP_REFS_ONLY_CALLEE_SAVE_FRAME 1227735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung addiu $sp, $sp, -16 # allocate temp storage on the stack 1228735b8559d6dd26c610d4b97d72f25a092d9c8947Douglas Leung .cfi_adjust_cfa_offset 16 1229f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung sw $v0, ARG_SLOT_SIZE+12($sp) 1230f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung .cfi_rel_offset 2, ARG_SLOT_SIZE+12 1231f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung sw $v1, ARG_SLOT_SIZE+8($sp) 1232f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung .cfi_rel_offset 3, ARG_SLOT_SIZE+8 1233f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung s.d $f0, ARG_SLOT_SIZE($sp) 1234e34652f15f32666323052a6718a63248244f1e66Duane Sand s.d $f0, 16($sp) # pass fpr result 123562d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers move $a2, $v0 # pass gpr result 123662d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers move $a3, $v1 1237f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung addiu $a1, $sp, ARG_SLOT_SIZE+16 # pass $sp (remove arg slots and temp storage) 123862d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers jal artInstrumentationMethodExitFromCode # (Thread*, SP, gpr_res, fpr_res) 123912051ea86ec27703b07b3d5c2cd4604b20f71810jeffhao move $a0, rSELF # pass Thread::Current 1240f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung move $t9, $v0 # set aside returned link register 124112051ea86ec27703b07b3d5c2cd4604b20f71810jeffhao move $ra, $v1 # set link register for deoptimization 1242f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung lw $v0, ARG_SLOT_SIZE+12($sp) # restore return values 1243f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung lw $v1, ARG_SLOT_SIZE+8($sp) 1244f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung l.d $f0, ARG_SLOT_SIZE($sp) 1245f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung jalr $zero, $t9 # return 1246f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung addiu $sp, $sp, ARG_SLOT_SIZE+FRAME_SIZE_REFS_ONLY_CALLEE_SAVE+16 # restore stack 1247f96e8bdf47cfcbecd8ad8ebceb765e5a257ca143Douglas Leung .cfi_adjust_cfa_offset -(ARG_SLOT_SIZE+FRAME_SIZE_REFS_ONLY_CALLEE_SAVE+16) 1248468532ea115657709bc32ee498e701a4c71762d4Ian RogersEND art_quick_instrumentation_exit 12495bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 125012051ea86ec27703b07b3d5c2cd4604b20f71810jeffhao /* 125162d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers * Instrumentation has requested that we deoptimize into the interpreter. The deoptimization 125262d6c772205b8859f0ebf7ad105402ec4c3e2e01Ian Rogers * will long jump to the upcall with a special exception of -1. 125312051ea86ec27703b07b3d5c2cd4604b20f71810jeffhao */ 1254d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff Hao .extern artDeoptimize 1255d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff HaoENTRY art_quick_deoptimize 125614dd5a82ad85a28612bf86e755ff929d767cea4cJeff Hao SETUP_SAVE_ALL_CALLEE_SAVE_FRAME 12571d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers jal artDeoptimize # artDeoptimize(Thread*) 125812051ea86ec27703b07b3d5c2cd4604b20f71810jeffhao # Returns caller method's frame size. 12591d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian Rogers move $a0, rSELF # pass Thread::current 1260d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff HaoEND art_quick_deoptimize 126112051ea86ec27703b07b3d5c2cd4604b20f71810jeffhao 12625bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 12635bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Long integer shift. This is different from the generic 32/64-bit 12645bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * binary operations because vAA/vBB are 64-bit but vCC (the shift 12655bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low 12665bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * 6 bits. 12675bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * On entry: 12687fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao * $a0: low word 12697fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao * $a1: high word 12707fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao * $a2: shift count 12715bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 12721d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian RogersENTRY_NO_GP art_quick_shl_long 12735bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* shl-long vAA, vBB, vCC */ 12747fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao sll $v0, $a0, $a2 # rlo<- alo << (shift&31) 12757fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao not $v1, $a2 # rhi<- 31-shift (shift is 5b) 12767fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao srl $a0, 1 12777fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao srl $a0, $v1 # alo<- alo >> (32-(shift&31)) 12787fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao sll $v1, $a1, $a2 # rhi<- ahi << (shift&31) 12797fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao andi $a2, 0x20 # shift< shift & 0x20 1280e34652f15f32666323052a6718a63248244f1e66Duane Sand beqz $a2, 1f 1281e34652f15f32666323052a6718a63248244f1e66Duane Sand or $v1, $a0 # rhi<- rhi | alo 1282e34652f15f32666323052a6718a63248244f1e66Duane Sand 1283e34652f15f32666323052a6718a63248244f1e66Duane Sand move $v1, $v0 # rhi<- rlo (if shift&0x20) 1284e34652f15f32666323052a6718a63248244f1e66Duane Sand move $v0, $zero # rlo<- 0 (if shift&0x20) 1285e34652f15f32666323052a6718a63248244f1e66Duane Sand 12868d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe1: jalr $zero, $ra 1287e34652f15f32666323052a6718a63248244f1e66Duane Sand nop 1288d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff HaoEND art_quick_shl_long 12895bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 12905bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 12915bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Long integer shift. This is different from the generic 32/64-bit 12925bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * binary operations because vAA/vBB are 64-bit but vCC (the shift 12935bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low 12945bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * 6 bits. 12955bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * On entry: 12967fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao * $a0: low word 12977fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao * $a1: high word 12987fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao * $a2: shift count 12995bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 13001d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian RogersENTRY_NO_GP art_quick_shr_long 13017fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao sra $v1, $a1, $a2 # rhi<- ahi >> (shift&31) 13027fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao srl $v0, $a0, $a2 # rlo<- alo >> (shift&31) 13037fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao sra $a3, $a1, 31 # $a3<- sign(ah) 13047fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao not $a0, $a2 # alo<- 31-shift (shift is 5b) 13057fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao sll $a1, 1 13067fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao sll $a1, $a0 # ahi<- ahi << (32-(shift&31)) 13077fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao andi $a2, 0x20 # shift & 0x20 1308475cfd8ff9dcc73d1a7502c9310efe0f1a30337fDouglas Leung beqz $a2, 1f 1309e34652f15f32666323052a6718a63248244f1e66Duane Sand or $v0, $a1 # rlo<- rlo | ahi 1310e34652f15f32666323052a6718a63248244f1e66Duane Sand 1311e34652f15f32666323052a6718a63248244f1e66Duane Sand move $v0, $v1 # rlo<- rhi (if shift&0x20) 1312e34652f15f32666323052a6718a63248244f1e66Duane Sand move $v1, $a3 # rhi<- sign(ahi) (if shift&0x20) 1313e34652f15f32666323052a6718a63248244f1e66Duane Sand 13148d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe1: jalr $zero, $ra 1315e34652f15f32666323052a6718a63248244f1e66Duane Sand nop 1316d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff HaoEND art_quick_shr_long 13175bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee 13185bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* 13195bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * Long integer shift. This is different from the generic 32/64-bit 13205bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * binary operations because vAA/vBB are 64-bit but vCC (the shift 13215bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low 13225bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * 6 bits. 13235bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * On entry: 13245bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * r0: low word 13255bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * r1: high word 13265bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee * r2: shift count 13275bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee */ 13285bc5a7b9d9adcfb50e18bd3776d3875ad7a4ae8cbuzbee /* ushr-long vAA, vBB, vCC */ 13291d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian RogersENTRY_NO_GP art_quick_ushr_long 1330fc6a30e2fa8f0d44e6c95bbeb5deca4b499f67cejeffhao srl $v1, $a1, $a2 # rhi<- ahi >> (shift&31) 13317fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao srl $v0, $a0, $a2 # rlo<- alo >> (shift&31) 13327fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao not $a0, $a2 # alo<- 31-shift (shift is 5b) 13337fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao sll $a1, 1 13347fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao sll $a1, $a0 # ahi<- ahi << (32-(shift&31)) 13357fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao andi $a2, 0x20 # shift & 0x20 1336e34652f15f32666323052a6718a63248244f1e66Duane Sand beqz $a2, 1f 1337e34652f15f32666323052a6718a63248244f1e66Duane Sand or $v0, $a1 # rlo<- rlo | ahi 1338e34652f15f32666323052a6718a63248244f1e66Duane Sand 1339e34652f15f32666323052a6718a63248244f1e66Duane Sand move $v0, $v1 # rlo<- rhi (if shift&0x20) 1340e34652f15f32666323052a6718a63248244f1e66Duane Sand move $v1, $zero # rhi<- 0 (if shift&0x20) 1341e34652f15f32666323052a6718a63248244f1e66Duane Sand 13428d36591d93920e7b7830c3ffee3759b561f5339eAndreas Gampe1: jalr $zero, $ra 1343e34652f15f32666323052a6718a63248244f1e66Duane Sand nop 1344d4c3f7d4e850049b3c1019e451b18b05443b0f28Jeff HaoEND art_quick_ushr_long 13457fbee0731b14b5bf392a4254f5cd84685ab517dajeffhao 13461d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian RogersUNIMPLEMENTED art_quick_indexof 13471d8cdbc5202378a5f1a4b3a1fba610675ed4dcd5Ian RogersUNIMPLEMENTED art_quick_string_compareto 1348