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