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 dex_instructions 29 * a2 ShadowFrame 30 * a3 JValue* result_register 31 * 32 */ 33 34ExecuteMterpImpl: 35 .cfi_startproc 36 .set noreorder 37 .cpload t9 38 .set reorder 39/* Save to the stack. Frame size = STACK_SIZE */ 40 STACK_STORE_FULL() 41/* This directive will make sure all subsequent jal restore gp at a known offset */ 42 .cprestore STACK_OFFSET_GP 43 44 /* Remember the return register */ 45 sw a3, SHADOWFRAME_RESULT_REGISTER_OFFSET(a2) 46 47 /* Remember the dex instruction pointer */ 48 sw a1, SHADOWFRAME_DEX_INSTRUCTIONS_OFFSET(a2) 49 50 /* set up "named" registers */ 51 move rSELF, a0 52 lw a0, SHADOWFRAME_NUMBER_OF_VREGS_OFFSET(a2) 53 addu rFP, a2, SHADOWFRAME_VREGS_OFFSET # point to vregs. 54 EAS2(rREFS, rFP, a0) # point to reference array in shadow frame 55 lw a0, SHADOWFRAME_DEX_PC_OFFSET(a2) # Get starting dex_pc 56 EAS1(rPC, a1, a0) # Create direct pointer to 1st dex opcode 57 CFI_DEFINE_DEX_PC_WITH_OFFSET(CFI_TMP, CFI_DEX, 0) 58 59 EXPORT_PC() 60 61 /* Starting ibase */ 62 lw rIBASE, THREAD_CURRENT_IBASE_OFFSET(rSELF) 63 64 /* Set up for backwards branches & osr profiling */ 65 lw a0, OFF_FP_METHOD(rFP) 66 addu a1, rFP, OFF_FP_SHADOWFRAME 67 move a2, rSELF 68 JAL(MterpSetUpHotnessCountdown) # (method, shadow_frame, self) 69 move rPROFILE, v0 # Starting hotness countdown to rPROFILE 70 71 /* start executing the instruction at rPC */ 72 FETCH_INST() # load rINST from rPC 73 GET_INST_OPCODE(t0) # extract opcode from rINST 74 GOTO_OPCODE(t0) # jump to next instruction 75 /* NOTE: no fallthrough */ 76