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 .text 18 19/* 20 * Interpreter entry point. 21 * On entry: 22 * x0 Thread* self/ 23 * x1 code_item 24 * x2 ShadowFrame 25 * x3 JValue* result_register 26 * 27 */ 28 .global ExecuteMterpImpl 29 .type ExecuteMterpImpl, %function 30 .balign 16 31 32ExecuteMterpImpl: 33 .cfi_startproc 34 stp xPROFILE, x27, [sp, #-80]! 35 stp xIBASE, xREFS, [sp, #16] 36 stp xSELF, xINST, [sp, #32] 37 stp xPC, xFP, [sp, #48] 38 stp fp, lr, [sp, #64] 39 add fp, sp, #64 40 41 /* Remember the return register */ 42 str x3, [x2, #SHADOWFRAME_RESULT_REGISTER_OFFSET] 43 44 /* Remember the code_item */ 45 str x1, [x2, #SHADOWFRAME_CODE_ITEM_OFFSET] 46 47 /* set up "named" registers */ 48 mov xSELF, x0 49 ldr w0, [x2, #SHADOWFRAME_NUMBER_OF_VREGS_OFFSET] 50 add xFP, x2, #SHADOWFRAME_VREGS_OFFSET // point to vregs. 51 add xREFS, xFP, w0, lsl #2 // point to reference array in shadow frame 52 ldr w0, [x2, #SHADOWFRAME_DEX_PC_OFFSET] // Get starting dex_pc. 53 add xPC, x1, #CODEITEM_INSNS_OFFSET // Point to base of insns[] 54 add xPC, xPC, w0, lsl #1 // Create direct pointer to 1st dex opcode 55 EXPORT_PC 56 57 /* Starting ibase */ 58 ldr xIBASE, [xSELF, #THREAD_CURRENT_IBASE_OFFSET] 59 60 /* Set up for backwards branches & osr profiling */ 61 ldr x0, [xFP, #OFF_FP_METHOD] 62 add x1, xFP, #OFF_FP_SHADOWFRAME 63 bl MterpSetUpHotnessCountdown 64 mov wPROFILE, w0 // Starting hotness countdown to xPROFILE 65 66 /* start executing the instruction at rPC */ 67 FETCH_INST // load wINST from rPC 68 GET_INST_OPCODE ip // extract opcode from wINST 69 GOTO_OPCODE ip // jump to next instruction 70 /* NOTE: no fallthrough */ 71