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