Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/share/opto/castnode.hpp
40930 views
1
/*
2
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*
23
*/
24
25
#ifndef SHARE_OPTO_CASTNODE_HPP
26
#define SHARE_OPTO_CASTNODE_HPP
27
28
#include "opto/node.hpp"
29
#include "opto/opcodes.hpp"
30
31
32
//------------------------------ConstraintCastNode-----------------------------
33
// cast to a different range
34
class ConstraintCastNode: public TypeNode {
35
protected:
36
// Can this node be removed post CCP or does it carry a required dependency?
37
const bool _carry_dependency;
38
virtual bool cmp( const Node &n ) const;
39
virtual uint size_of() const;
40
41
public:
42
ConstraintCastNode(Node *n, const Type *t, bool carry_dependency)
43
: TypeNode(t,2), _carry_dependency(carry_dependency) {
44
init_class_id(Class_ConstraintCast);
45
init_req(1, n);
46
}
47
virtual Node* Identity(PhaseGVN* phase);
48
virtual const Type* Value(PhaseGVN* phase) const;
49
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
50
virtual int Opcode() const;
51
virtual uint ideal_reg() const = 0;
52
virtual bool depends_only_on_test() const { return !_carry_dependency; }
53
bool carry_dependency() const { return _carry_dependency; }
54
TypeNode* dominating_cast(PhaseGVN* gvn, PhaseTransform* pt) const;
55
static Node* make_cast(int opcode, Node* c, Node *n, const Type *t, bool carry_dependency);
56
static Node* make(Node* c, Node *n, const Type *t, BasicType bt);
57
virtual bool operates_on(BasicType bt, bool signed_int) const {
58
assert(bt == T_INT || bt == T_LONG, "unsupported");
59
return false;
60
}
61
62
#ifndef PRODUCT
63
virtual void dump_spec(outputStream *st) const;
64
#endif
65
};
66
67
//------------------------------CastIINode-------------------------------------
68
// cast integer to integer (different range)
69
class CastIINode: public ConstraintCastNode {
70
protected:
71
// Is this node dependent on a range check?
72
const bool _range_check_dependency;
73
virtual bool cmp(const Node &n) const;
74
virtual uint size_of() const;
75
76
public:
77
CastIINode(Node* n, const Type* t, bool carry_dependency = false, bool range_check_dependency = false)
78
: ConstraintCastNode(n, t, carry_dependency), _range_check_dependency(range_check_dependency) {
79
init_class_id(Class_CastII);
80
}
81
virtual int Opcode() const;
82
virtual uint ideal_reg() const { return Op_RegI; }
83
virtual Node* Identity(PhaseGVN* phase);
84
virtual const Type* Value(PhaseGVN* phase) const;
85
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
86
const bool has_range_check() {
87
#ifdef _LP64
88
return _range_check_dependency;
89
#else
90
assert(!_range_check_dependency, "Should not have range check dependency");
91
return false;
92
#endif
93
}
94
virtual bool operates_on(BasicType bt, bool signed_int) const {
95
assert(bt == T_INT || bt == T_LONG, "unsupported");
96
return bt == T_INT;
97
}
98
99
#ifndef PRODUCT
100
virtual void dump_spec(outputStream* st) const;
101
#endif
102
};
103
104
class CastLLNode: public ConstraintCastNode {
105
public:
106
CastLLNode(Node* n, const Type* t, bool carry_dependency = false)
107
: ConstraintCastNode(n, t, carry_dependency){
108
init_class_id(Class_CastLL);
109
}
110
virtual bool operates_on(BasicType bt, bool signed_int) const {
111
assert(bt == T_INT || bt == T_LONG, "unsupported");
112
return bt == T_LONG;
113
}
114
virtual int Opcode() const;
115
virtual uint ideal_reg() const { return Op_RegL; }
116
};
117
118
class CastFFNode: public ConstraintCastNode {
119
public:
120
CastFFNode(Node* n, const Type* t, bool carry_dependency = false)
121
: ConstraintCastNode(n, t, carry_dependency){
122
init_class_id(Class_CastFF);
123
}
124
virtual int Opcode() const;
125
virtual uint ideal_reg() const { return Op_RegF; }
126
};
127
128
class CastDDNode: public ConstraintCastNode {
129
public:
130
CastDDNode(Node* n, const Type* t, bool carry_dependency = false)
131
: ConstraintCastNode(n, t, carry_dependency){
132
init_class_id(Class_CastDD);
133
}
134
virtual int Opcode() const;
135
virtual uint ideal_reg() const { return Op_RegD; }
136
};
137
138
class CastVVNode: public ConstraintCastNode {
139
public:
140
CastVVNode(Node* n, const Type* t, bool carry_dependency = false)
141
: ConstraintCastNode(n, t, carry_dependency){
142
init_class_id(Class_CastVV);
143
}
144
virtual int Opcode() const;
145
virtual uint ideal_reg() const { return in(1)->ideal_reg(); }
146
};
147
148
149
//------------------------------CastPPNode-------------------------------------
150
// cast pointer to pointer (different type)
151
class CastPPNode: public ConstraintCastNode {
152
public:
153
CastPPNode (Node *n, const Type *t, bool carry_dependency = false)
154
: ConstraintCastNode(n, t, carry_dependency) {
155
}
156
virtual int Opcode() const;
157
virtual uint ideal_reg() const { return Op_RegP; }
158
};
159
160
//------------------------------CheckCastPPNode--------------------------------
161
// for _checkcast, cast pointer to pointer (different type), without JOIN,
162
class CheckCastPPNode: public ConstraintCastNode {
163
public:
164
CheckCastPPNode(Node *c, Node *n, const Type *t, bool carry_dependency = false)
165
: ConstraintCastNode(n, t, carry_dependency) {
166
init_class_id(Class_CheckCastPP);
167
init_req(0, c);
168
}
169
170
virtual Node* Identity(PhaseGVN* phase);
171
virtual const Type* Value(PhaseGVN* phase) const;
172
virtual int Opcode() const;
173
virtual uint ideal_reg() const { return Op_RegP; }
174
bool depends_only_on_test() const { return !type()->isa_rawptr() && ConstraintCastNode::depends_only_on_test(); }
175
};
176
177
178
//------------------------------CastX2PNode-------------------------------------
179
// convert a machine-pointer-sized integer to a raw pointer
180
class CastX2PNode : public Node {
181
public:
182
CastX2PNode( Node *n ) : Node(NULL, n) {}
183
virtual int Opcode() const;
184
virtual const Type* Value(PhaseGVN* phase) const;
185
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
186
virtual Node* Identity(PhaseGVN* phase);
187
virtual uint ideal_reg() const { return Op_RegP; }
188
virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM; }
189
};
190
191
//------------------------------CastP2XNode-------------------------------------
192
// Used in both 32-bit and 64-bit land.
193
// Used for card-marks and unsafe pointer math.
194
class CastP2XNode : public Node {
195
public:
196
CastP2XNode( Node *ctrl, Node *n ) : Node(ctrl, n) {}
197
virtual int Opcode() const;
198
virtual const Type* Value(PhaseGVN* phase) const;
199
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
200
virtual Node* Identity(PhaseGVN* phase);
201
virtual uint ideal_reg() const { return Op_RegX; }
202
virtual const Type *bottom_type() const { return TypeX_X; }
203
// Return false to keep node from moving away from an associated card mark.
204
virtual bool depends_only_on_test() const { return false; }
205
};
206
207
208
209
#endif // SHARE_OPTO_CASTNODE_HPP
210
211