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 23/* 24 * On entry: 25 * r0 Thread* self/ 26 * r1 insns_ 27 * r2 ShadowFrame 28 * r3 JValue* result_register 29 * 30 */ 31 32ENTRY ExecuteMterpImpl 33 stmfd sp!, {r3-r10,fp,lr} @ save 10 regs, (r3 just to align 64) 34 .cfi_adjust_cfa_offset 40 35 .cfi_rel_offset r3, 0 36 .cfi_rel_offset r4, 4 37 .cfi_rel_offset r5, 8 38 .cfi_rel_offset r6, 12 39 .cfi_rel_offset r7, 16 40 .cfi_rel_offset r8, 20 41 .cfi_rel_offset r9, 24 42 .cfi_rel_offset r10, 28 43 .cfi_rel_offset fp, 32 44 .cfi_rel_offset lr, 36 45 46 /* Remember the return register */ 47 str r3, [r2, #SHADOWFRAME_RESULT_REGISTER_OFFSET] 48 49 /* Remember the dex instruction pointer */ 50 str r1, [r2, #SHADOWFRAME_DEX_INSTRUCTIONS_OFFSET] 51 52 /* set up "named" registers */ 53 mov rSELF, r0 54 ldr r0, [r2, #SHADOWFRAME_NUMBER_OF_VREGS_OFFSET] 55 add rFP, r2, #SHADOWFRAME_VREGS_OFFSET @ point to vregs. 56 VREG_INDEX_TO_ADDR rREFS, r0 @ point to reference array in shadow frame 57 ldr r0, [r2, #SHADOWFRAME_DEX_PC_OFFSET] @ Get starting dex_pc. 58 add rPC, r1, r0, lsl #1 @ Create direct pointer to 1st dex opcode 59 CFI_DEFINE_DEX_PC_WITH_OFFSET(CFI_TMP, CFI_DEX, 0) 60 EXPORT_PC 61 62 /* Starting ibase */ 63 ldr rIBASE, [rSELF, #THREAD_CURRENT_IBASE_OFFSET] 64 65 /* Set up for backwards branches & osr profiling */ 66 ldr r0, [rFP, #OFF_FP_METHOD] 67 add r1, rFP, #OFF_FP_SHADOWFRAME 68 mov r2, rSELF 69 bl MterpSetUpHotnessCountdown 70 mov rPROFILE, r0 @ Starting hotness countdown to rPROFILE 71 72 /* start executing the instruction at rPC */ 73 FETCH_INST @ load rINST from rPC 74 GET_INST_OPCODE ip @ extract opcode from rINST 75 GOTO_OPCODE ip @ jump to next instruction 76 /* NOTE: no fallthrough */ 77