1/* 2 * Copyright (C) 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16/* 17 * Interpreter entry point. 18 */ 19 20 .text 21 .align 2 22 .global ExecuteMterpImpl 23 .ent ExecuteMterpImpl 24 .frame sp, STACK_SIZE, ra 25/* 26 * On entry: 27 * a0 Thread* self 28 * a1 code_item 29 * a2 ShadowFrame 30 * a3 JValue* result_register 31 * 32 */ 33 34ExecuteMterpImpl: 35 .set noreorder 36 .cpload t9 37 .set reorder 38/* Save to the stack. Frame size = STACK_SIZE */ 39 STACK_STORE_FULL() 40/* This directive will make sure all subsequent jal restore gp at a known offset */ 41 .cprestore STACK_OFFSET_GP 42 43 /* Remember the return register */ 44 sw a3, SHADOWFRAME_RESULT_REGISTER_OFFSET(a2) 45 46 /* Remember the code_item */ 47 sw a1, SHADOWFRAME_CODE_ITEM_OFFSET(a2) 48 49 /* set up "named" registers */ 50 move rSELF, a0 51 lw a0, SHADOWFRAME_NUMBER_OF_VREGS_OFFSET(a2) 52 addu rFP, a2, SHADOWFRAME_VREGS_OFFSET # point to vregs. 53 EAS2(rREFS, rFP, a0) # point to reference array in shadow frame 54 lw a0, SHADOWFRAME_DEX_PC_OFFSET(a2) # Get starting dex_pc 55 addu rPC, a1, CODEITEM_INSNS_OFFSET # Point to base of insns[] 56 EAS1(rPC, rPC, a0) # Create direct pointer to 1st dex opcode 57 58 EXPORT_PC() 59 60 /* Starting ibase */ 61 lw rIBASE, THREAD_CURRENT_IBASE_OFFSET(rSELF) 62 63 /* Set up for backwards branches & osr profiling */ 64 lw a0, OFF_FP_METHOD(rFP) 65 addu a1, rFP, OFF_FP_SHADOWFRAME 66 JAL(MterpSetUpHotnessCountdown) # (method, shadow_frame) 67 move rPROFILE, v0 # Starting hotness countdown to rPROFILE 68 69 /* start executing the instruction at rPC */ 70 FETCH_INST() # load rINST from rPC 71 GET_INST_OPCODE(t0) # extract opcode from rINST 72 GOTO_OPCODE(t0) # jump to next instruction 73 /* NOTE: no fallthrough */ 74