blob: cc48d45298128b6df68ac69416ec39481a0cdf92 [file] [log] [blame]
Alexey Frunze00b53b72016-02-02 20:25:45 -08001/*
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/*
18 * Interpreter entry point.
19 */
20
21 .set reorder
22
23 .text
24 .global ExecuteMterpImpl
25 .type ExecuteMterpImpl, %function
26 .balign 16
27/*
28 * On entry:
29 * a0 Thread* self
30 * a1 code_item
31 * a2 ShadowFrame
32 * a3 JValue* result_register
33 *
34 */
35ExecuteMterpImpl:
36 .cfi_startproc
37 .cpsetup t9, t8, ExecuteMterpImpl
38
39 .cfi_def_cfa sp, 0
40 daddu sp, sp, -STACK_SIZE
41 .cfi_adjust_cfa_offset STACK_SIZE
42
43 sd t8, STACK_OFFSET_GP(sp)
44 .cfi_rel_offset 28, STACK_OFFSET_GP
45 sd ra, STACK_OFFSET_RA(sp)
46 .cfi_rel_offset 31, STACK_OFFSET_RA
47
48 sd s0, STACK_OFFSET_S0(sp)
49 .cfi_rel_offset 16, STACK_OFFSET_S0
50 sd s1, STACK_OFFSET_S1(sp)
51 .cfi_rel_offset 17, STACK_OFFSET_S1
52 sd s2, STACK_OFFSET_S2(sp)
53 .cfi_rel_offset 18, STACK_OFFSET_S2
54 sd s3, STACK_OFFSET_S3(sp)
55 .cfi_rel_offset 19, STACK_OFFSET_S3
56 sd s4, STACK_OFFSET_S4(sp)
57 .cfi_rel_offset 20, STACK_OFFSET_S4
58 sd s5, STACK_OFFSET_S5(sp)
59 .cfi_rel_offset 21, STACK_OFFSET_S5
Douglas Leung020b18a2016-06-03 18:05:35 -070060 sd s6, STACK_OFFSET_S6(sp)
61 .cfi_rel_offset 22, STACK_OFFSET_S6
Alexey Frunze00b53b72016-02-02 20:25:45 -080062
63 /* Remember the return register */
64 sd a3, SHADOWFRAME_RESULT_REGISTER_OFFSET(a2)
65
66 /* Remember the code_item */
67 sd a1, SHADOWFRAME_CODE_ITEM_OFFSET(a2)
68
69 /* set up "named" registers */
70 move rSELF, a0
71 daddu rFP, a2, SHADOWFRAME_VREGS_OFFSET
72 lw v0, SHADOWFRAME_NUMBER_OF_VREGS_OFFSET(a2)
73 dlsa rREFS, v0, rFP, 2
74 daddu rPC, a1, CODEITEM_INSNS_OFFSET
75 lw v0, SHADOWFRAME_DEX_PC_OFFSET(a2)
76 dlsa rPC, v0, rPC, 1
77 EXPORT_PC
78
79 /* Starting ibase */
80 REFRESH_IBASE
81
Douglas Leung020b18a2016-06-03 18:05:35 -070082 /* Set up for backwards branches & osr profiling */
83 ld a0, OFF_FP_METHOD(rFP)
84 daddu a1, rFP, OFF_FP_SHADOWFRAME
85 jal MterpSetUpHotnessCountdown
86 move rPROFILE, v0 # Starting hotness countdown to rPROFILE
87
Alexey Frunze00b53b72016-02-02 20:25:45 -080088 /* start executing the instruction at rPC */
89 FETCH_INST
90 GET_INST_OPCODE v0
91 GOTO_OPCODE v0
92
93 /* NOTE: no fallthrough */