Debian Codegraph @

runtime/interpreter/mterp/riscv64/main.S

raw
1 %def header():
2 /*
3 * Copyright (C) 2023 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18 /*
19 * This is a #include, not a %include, because we want the C pre-processor
20 * to expand the macros into assembler assignment statements.
21 */
22 #include "asm_support.h"
23 #include "arch/riscv64/asm_support_riscv64.S"
24
25 // An assembly entry that has a OatQuickMethodHeader prefix.
26 .macro OAT_ENTRY name, end
27 .type \name, @function
28 .hidden \name
29 .global \name
30 .balign 16
31 // Padding of 3 * 4 bytes to get 16 bytes alignment of code entry.
32 .4byte 0, 0, 0
33 // OatQuickMethodHeader `data_` field. Note that the top two bits must be clear.
34 .4byte (\end - \name)
35 \name:
36 .endm
37
38 .macro SIZE name
39 .size \name, .-\name
40 .endm
41
42 // Similar to ENTRY but without the CFI directives.
43 .macro NAME_START name
44 .type \name, @function
45 .hidden \name // Hide this as a global symbol, so we do not incur plt calls.
46 .global \name
47 /* XXX Cache alignment for function entry */
48 .balign 16
49 \name:
50 .endm
51
52 .macro NAME_END name
53 SIZE \name
54 .endm
55
56 %def entry():
57 /*
58 * ArtMethod entry point.
59 *
60 * On entry:
61 * XXX ArtMethod* callee
62 * rest method parameters
63 */
64
65 OAT_ENTRY ExecuteNterpWithClinitImpl, EndExecuteNterpWithClinitImpl
66 // For simplicity, we don't do a read barrier here, but instead rely
67 // on art_quick_resolution_trampoline to always have a suspend point before
68 // calling back here.
69 unimp
70 EndExecuteNterpWithClinitImpl:
71
72 OAT_ENTRY ExecuteNterpImpl, EndExecuteNterpImpl
73 .cfi_startproc
74 unimp
75
76 %def fetch_from_thread_cache(dest_reg, miss_label):
77
78 %def footer():
79 /*
80 * ===========================================================================
81 * Common subroutines and data
82 * ===========================================================================
83 */
84
85 .text
86 .align 2
87
88
89 // Enclose all code below in a symbol (which gets printed in backtraces).
90 NAME_START nterp_helper
91 // This is the logical end of ExecuteNterpImpl, where the frame info applies.
92 // EndExecuteNterpImpl includes the methods below as we want the runtime to
93 // see them as part of the Nterp PCs.
94 .cfi_endproc
95 NAME_END nterp_helper
96
97 // This is the end of PCs contained by the OatQuickMethodHeader created for the interpreter
98 // entry point.
99 .type EndExecuteNterpImpl, @function
100 .hidden EndExecuteNterpImpl
101 .global EndExecuteNterpImpl
102 EndExecuteNterpImpl:
103
104 // gen_mterp.py will inline the following definitions
105 // within [ExecuteNterpImpl, EndExecuteNterpImpl).
106 %def instruction_start():
107 .type artNterpAsmInstructionStart, @function
108 .hidden artNterpAsmInstructionStart
109 .global artNterpAsmInstructionStart
110 artNterpAsmInstructionStart = .L_op_nop
111 .text
112
113 %def instruction_end():
114 .type artNterpAsmInstructionEnd, @function
115 .hidden artNterpAsmInstructionEnd
116 .global artNterpAsmInstructionEnd
117 artNterpAsmInstructionEnd:
118 unimp
119
120 %def opcode_pre():
121 % pass
122 %def opcode_name_prefix():
123 % return "nterp_"
124 %def opcode_start():
125 NAME_START nterp_${opcode}
126 %def opcode_end():
127 NAME_END nterp_${opcode}
128 unimp
129 %def opcode_slow_path_start(name):
130 NAME_START ${name}
131 %def opcode_slow_path_end(name):
132 NAME_END ${name}