Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/compiler/aarch64/codegen/J9TreeEvaluator.hpp
6004 views
1
/*******************************************************************************
2
* Copyright (c) 2019, 2021 IBM Corp. and others
3
*
4
* This program and the accompanying materials are made available under
5
* the terms of the Eclipse Public License 2.0 which accompanies this
6
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
7
* or the Apache License, Version 2.0 which accompanies this distribution and
8
* is available at https://www.apache.org/licenses/LICENSE-2.0.
9
*
10
* This Source Code may also be made available under the following
11
* Secondary Licenses when the conditions for such availability set
12
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
13
* General Public License, version 2 with the GNU Classpath
14
* Exception [1] and GNU General Public License, version 2 with the
15
* OpenJDK Assembly Exception [2].
16
*
17
* [1] https://www.gnu.org/software/classpath/license.html
18
* [2] http://openjdk.java.net/legal/assembly-exception.html
19
*
20
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
21
*******************************************************************************/
22
23
#ifndef J9_ARM64_TREE_EVALUATOR_INCL
24
#define J9_ARM64_TREE_EVALUATOR_INCL
25
26
/*
27
* The following #define and typedef must appear before any #includes in this file
28
*/
29
#ifndef J9_TREE_EVALUATOR_CONNECTOR
30
#define J9_TREE_EVALUATOR_CONNECTOR
31
namespace J9 { namespace ARM64 { class TreeEvaluator; } }
32
namespace J9 { typedef J9::ARM64::TreeEvaluator TreeEvaluatorConnector; }
33
#else
34
#error J9::ARM64::TreeEvaluator expected to be a primary connector, but a J9 connector is already defined
35
#endif
36
37
38
#include "compiler/codegen/J9TreeEvaluator.hpp" // include parent
39
#include "il/LabelSymbol.hpp"
40
41
namespace J9
42
{
43
44
namespace ARM64
45
{
46
47
class OMR_EXTENSIBLE TreeEvaluator: public J9::TreeEvaluator
48
{
49
public:
50
51
static TR::Register *awrtbarEvaluator(TR::Node *node, TR::CodeGenerator *cg);
52
static TR::Register *awrtbariEvaluator(TR::Node *node, TR::CodeGenerator *cg);
53
54
static TR::Register *irdbarEvaluator(TR::Node *node, TR::CodeGenerator *cg);
55
static TR::Register *irdbariEvaluator(TR::Node *node, TR::CodeGenerator *cg);
56
static TR::Register *ardbarEvaluator(TR::Node *node, TR::CodeGenerator *cg);
57
static TR::Register *ardbariEvaluator(TR::Node *node, TR::CodeGenerator *cg);
58
static TR::Register *fwrtbarEvaluator(TR::Node *node, TR::CodeGenerator *cg);
59
static TR::Register *fwrtbariEvaluator(TR::Node *node, TR::CodeGenerator *cg);
60
static TR::Register *dwrtbarEvaluator(TR::Node *node, TR::CodeGenerator *cg);
61
static TR::Register *dwrtbariEvaluator(TR::Node *node, TR::CodeGenerator *cg);
62
63
static TR::Register *DIVCHKEvaluator(TR::Node *node, TR::CodeGenerator *cg);
64
65
static TR::Register *flushEvaluator(TR::Node *node, TR::CodeGenerator *cg);
66
static TR::Register *BNDCHKEvaluator(TR::Node *node, TR::CodeGenerator *cg);
67
static TR::Register *conditionalHelperEvaluator(TR::Node *node, TR::CodeGenerator *cg);
68
/*
69
* Generates instructions to fill in the J9JITWatchedStaticFieldData.fieldAddress, J9JITWatchedStaticFieldData.fieldClass for static fields,
70
* and J9JITWatchedInstanceFieldData.offset for instance fields at runtime. Used for fieldwatch support.
71
* @param dataSnippetRegister: Optional, can be used to pass the address of the snippet inside the register.
72
*/
73
static void generateFillInDataBlockSequenceForUnresolvedField (TR::CodeGenerator *cg, TR::Node *node, TR::Snippet *dataSnippet, bool isWrite, TR::Register *sideEffectRegister, TR::Register *dataSnippetRegister);
74
75
/*
76
* Generate instructions for static/instance field access report.
77
* @param dataSnippetRegister: Optional, can be used to pass the address of the snippet inside the register.
78
*/
79
static void generateTestAndReportFieldWatchInstructions(TR::CodeGenerator *cg, TR::Node *node, TR::Snippet *dataSnippet, bool isWrite, TR::Register *sideEffectRegister, TR::Register *valueReg, TR::Register *dataSnippetRegister);
80
81
/**
82
* @brief Generates instructions for inlining new/newarray/anewarray
83
*
84
* @param[in] node: node
85
* @param[in] cg: code generator
86
*
87
* @return register containing allocated object, NULL if inlining is not possible
88
*/
89
static TR::Register *VMnewEvaluator(TR::Node *node, TR::CodeGenerator *cg);
90
91
static TR::Register *monexitEvaluator(TR::Node *node, TR::CodeGenerator *cg);
92
93
static TR::Register *instanceofEvaluator(TR::Node *node, TR::CodeGenerator *cg);
94
95
/**
96
* @brief Generates instructions for inlining instanceof
97
*
98
* @param[in] node: node
99
* @param[in] cg: code generator
100
*
101
* @return register containing the result of instanceof
102
*/
103
static TR::Register *VMinstanceofEvaluator(TR::Node *node, TR::CodeGenerator *cg);
104
105
/**
106
* @brief Generates instructions for inlining checkcast
107
*
108
* @param[in] node: node
109
* @param[in] cg: code generator
110
*
111
* @return register whcih is always NULL
112
*/
113
static TR::Register *VMcheckcastEvaluator(TR::Node *node, TR::CodeGenerator *cg);
114
115
static TR::Register *checkcastAndNULLCHKEvaluator(TR::Node *node, TR::CodeGenerator *cg);
116
117
static TR::Register *checkcastEvaluator(TR::Node *node, TR::CodeGenerator *cg);
118
119
static TR::Register *newObjectEvaluator(TR::Node *node, TR::CodeGenerator *cg);
120
121
static TR::Register *newArrayEvaluator(TR::Node *node, TR::CodeGenerator *cg);
122
123
static TR::Register *anewArrayEvaluator(TR::Node *node, TR::CodeGenerator *cg);
124
125
static TR::Register *monentEvaluator(TR::Node *node, TR::CodeGenerator *cg);
126
127
static TR::Register *arraylengthEvaluator(TR::Node *node, TR::CodeGenerator *cg);
128
129
static TR::Register *multianewArrayEvaluator(TR::Node *node, TR::CodeGenerator *cg);
130
131
static TR::Register *asynccheckEvaluator(TR::Node *node, TR::CodeGenerator *cg);
132
133
static TR::Register *ArrayStoreCHKEvaluator(TR::Node *node, TR::CodeGenerator *cg);
134
135
static TR::Register *ArrayCHKEvaluator(TR::Node *node, TR::CodeGenerator *cg);
136
137
static TR::Register *arraycopyEvaluator(TR::Node *node, TR::CodeGenerator *cg);
138
139
static TR::Register *ZEROCHKEvaluator(TR::Node *node, TR::CodeGenerator *cg);
140
141
static TR::Instruction *generateVFTMaskInstruction(TR::CodeGenerator *cg, TR::Node *node, TR::Register *dstReg, TR::Register *srcReg, TR::Instruction *preced=NULL);
142
static TR::Instruction *generateVFTMaskInstruction(TR::CodeGenerator *cg, TR::Node *node, TR::Register *reg, TR::Instruction *preced=NULL);
143
144
static TR::Register *loadaddrEvaluator(TR::Node *node, TR::CodeGenerator *cg);
145
146
/*
147
* @brief Calls helper function for float/double remainder
148
* @param[in] node : node
149
* @param[in] cg : CodeGenerator
150
* @param[in] isSinglePrecision : true if type is single precision float
151
*/
152
static TR::Register *fremHelper(TR::Node *node, TR::CodeGenerator *cg, bool isSinglePrecision);
153
static TR::Register *fremEvaluator(TR::Node *node, TR::CodeGenerator *cg);
154
static TR::Register *dremEvaluator(TR::Node *node, TR::CodeGenerator *cg);
155
static TR::Register *NULLCHKEvaluator(TR::Node *node, TR::CodeGenerator *cg);
156
static TR::Register *resolveAndNULLCHKEvaluator(TR::Node *node, TR::CodeGenerator *cg);
157
static TR::Register *evaluateNULLCHKWithPossibleResolve(TR::Node *node, bool needResolution, TR::CodeGenerator *cg);
158
159
static TR::Register *BNDCHKwithSpineCHKEvaluator(TR::Node *node, TR::CodeGenerator *cg);
160
161
/**
162
* @brief Handles direct call nodes
163
* @param[in] node : node
164
* @param[in] cg : CodeGenerator
165
* @return register containing result
166
*/
167
static TR::Register *directCallEvaluator(TR::Node *node, TR::CodeGenerator *cg);
168
169
/**
170
* @brief Generates the sequence to handle cases where the monitor object is value type
171
* @param[in] node : the monitor enter/exit node
172
* @param[in] mergeLabel : the label to return from OOL code
173
* @param[in] helperCallLabel : the label for OOL code calling VM monitor enter/exit helpers. If null, an OOL code section is created.
174
* @param[in] objReg : register for the monitor object
175
* @param[in] temp1Reg : temporary register 1
176
* @param[in] temp2Reg : temporary register 2
177
* @param[in] cg : CodeGenerator
178
* @param[in] classFlag : class flag
179
*/
180
static void generateCheckForValueMonitorEnterOrExit(TR::Node *node, TR::LabelSymbol *mergeLabel, TR::LabelSymbol *helperCallLabel, TR::Register *objReg, TR::Register *temp1Reg, TR::Register *temp2Reg, TR::CodeGenerator *cg, int32_t classFlag);
181
182
/**
183
* @brief Generates array copy code with array store check
184
* @param[in] node : node
185
* @param[in] cg : CodeGenerator
186
*/
187
static void genArrayCopyWithArrayStoreCHK(TR::Node *node, TR::CodeGenerator *cg);
188
189
/**
190
* @brief Generates write barrier code for array copy
191
* @param[in] node : node
192
* @param[in] srcObjReg : register for the source object
193
* @param[in] dstObjReg : register for the destination object
194
* @param[in] cg : CodeGenerator
195
*/
196
static void genWrtbarForArrayCopy(TR::Node *node, TR::Register *srcObjReg, TR::Register *dstObjReg, TR::CodeGenerator *cg);
197
};
198
199
} // ARM64
200
201
} // J9
202
203
#endif
204
205