annotate src/share/vm/c1/c1_Instruction.hpp @ 1783:d5d065957597

6953144: Tiered compilation Summary: Infrastructure for tiered compilation support (interpreter + c1 + c2) for 32 and 64 bit. Simple tiered policy implementation. Reviewed-by: kvn, never, phh, twisti
author iveresov
date Fri, 03 Sep 2010 17:51:07 -0700
parents b812ff5abc73
children 3a294e483abc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1378
diff changeset
2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1378
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1378
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1378
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 // Predefined classes
a61af66fc99e Initial load
duke
parents:
diff changeset
26 class ciField;
a61af66fc99e Initial load
duke
parents:
diff changeset
27 class ValueStack;
a61af66fc99e Initial load
duke
parents:
diff changeset
28 class InstructionPrinter;
a61af66fc99e Initial load
duke
parents:
diff changeset
29 class IRScope;
a61af66fc99e Initial load
duke
parents:
diff changeset
30 class LIR_OprDesc;
a61af66fc99e Initial load
duke
parents:
diff changeset
31 typedef LIR_OprDesc* LIR_Opr;
a61af66fc99e Initial load
duke
parents:
diff changeset
32
a61af66fc99e Initial load
duke
parents:
diff changeset
33
a61af66fc99e Initial load
duke
parents:
diff changeset
34 // Instruction class hierarchy
a61af66fc99e Initial load
duke
parents:
diff changeset
35 //
a61af66fc99e Initial load
duke
parents:
diff changeset
36 // All leaf classes in the class hierarchy are concrete classes
a61af66fc99e Initial load
duke
parents:
diff changeset
37 // (i.e., are instantiated). All other classes are abstract and
a61af66fc99e Initial load
duke
parents:
diff changeset
38 // serve factoring.
a61af66fc99e Initial load
duke
parents:
diff changeset
39
a61af66fc99e Initial load
duke
parents:
diff changeset
40 class Instruction;
a61af66fc99e Initial load
duke
parents:
diff changeset
41 class HiWord;
a61af66fc99e Initial load
duke
parents:
diff changeset
42 class Phi;
a61af66fc99e Initial load
duke
parents:
diff changeset
43 class Local;
a61af66fc99e Initial load
duke
parents:
diff changeset
44 class Constant;
a61af66fc99e Initial load
duke
parents:
diff changeset
45 class AccessField;
a61af66fc99e Initial load
duke
parents:
diff changeset
46 class LoadField;
a61af66fc99e Initial load
duke
parents:
diff changeset
47 class StoreField;
a61af66fc99e Initial load
duke
parents:
diff changeset
48 class AccessArray;
a61af66fc99e Initial load
duke
parents:
diff changeset
49 class ArrayLength;
a61af66fc99e Initial load
duke
parents:
diff changeset
50 class AccessIndexed;
a61af66fc99e Initial load
duke
parents:
diff changeset
51 class LoadIndexed;
a61af66fc99e Initial load
duke
parents:
diff changeset
52 class StoreIndexed;
a61af66fc99e Initial load
duke
parents:
diff changeset
53 class NegateOp;
a61af66fc99e Initial load
duke
parents:
diff changeset
54 class Op2;
a61af66fc99e Initial load
duke
parents:
diff changeset
55 class ArithmeticOp;
a61af66fc99e Initial load
duke
parents:
diff changeset
56 class ShiftOp;
a61af66fc99e Initial load
duke
parents:
diff changeset
57 class LogicOp;
a61af66fc99e Initial load
duke
parents:
diff changeset
58 class CompareOp;
a61af66fc99e Initial load
duke
parents:
diff changeset
59 class IfOp;
a61af66fc99e Initial load
duke
parents:
diff changeset
60 class Convert;
a61af66fc99e Initial load
duke
parents:
diff changeset
61 class NullCheck;
a61af66fc99e Initial load
duke
parents:
diff changeset
62 class OsrEntry;
a61af66fc99e Initial load
duke
parents:
diff changeset
63 class ExceptionObject;
a61af66fc99e Initial load
duke
parents:
diff changeset
64 class StateSplit;
a61af66fc99e Initial load
duke
parents:
diff changeset
65 class Invoke;
a61af66fc99e Initial load
duke
parents:
diff changeset
66 class NewInstance;
a61af66fc99e Initial load
duke
parents:
diff changeset
67 class NewArray;
a61af66fc99e Initial load
duke
parents:
diff changeset
68 class NewTypeArray;
a61af66fc99e Initial load
duke
parents:
diff changeset
69 class NewObjectArray;
a61af66fc99e Initial load
duke
parents:
diff changeset
70 class NewMultiArray;
a61af66fc99e Initial load
duke
parents:
diff changeset
71 class TypeCheck;
a61af66fc99e Initial load
duke
parents:
diff changeset
72 class CheckCast;
a61af66fc99e Initial load
duke
parents:
diff changeset
73 class InstanceOf;
a61af66fc99e Initial load
duke
parents:
diff changeset
74 class AccessMonitor;
a61af66fc99e Initial load
duke
parents:
diff changeset
75 class MonitorEnter;
a61af66fc99e Initial load
duke
parents:
diff changeset
76 class MonitorExit;
a61af66fc99e Initial load
duke
parents:
diff changeset
77 class Intrinsic;
a61af66fc99e Initial load
duke
parents:
diff changeset
78 class BlockBegin;
a61af66fc99e Initial load
duke
parents:
diff changeset
79 class BlockEnd;
a61af66fc99e Initial load
duke
parents:
diff changeset
80 class Goto;
a61af66fc99e Initial load
duke
parents:
diff changeset
81 class If;
a61af66fc99e Initial load
duke
parents:
diff changeset
82 class IfInstanceOf;
a61af66fc99e Initial load
duke
parents:
diff changeset
83 class Switch;
a61af66fc99e Initial load
duke
parents:
diff changeset
84 class TableSwitch;
a61af66fc99e Initial load
duke
parents:
diff changeset
85 class LookupSwitch;
a61af66fc99e Initial load
duke
parents:
diff changeset
86 class Return;
a61af66fc99e Initial load
duke
parents:
diff changeset
87 class Throw;
a61af66fc99e Initial load
duke
parents:
diff changeset
88 class Base;
a61af66fc99e Initial load
duke
parents:
diff changeset
89 class RoundFP;
a61af66fc99e Initial load
duke
parents:
diff changeset
90 class UnsafeOp;
a61af66fc99e Initial load
duke
parents:
diff changeset
91 class UnsafeRawOp;
a61af66fc99e Initial load
duke
parents:
diff changeset
92 class UnsafeGetRaw;
a61af66fc99e Initial load
duke
parents:
diff changeset
93 class UnsafePutRaw;
a61af66fc99e Initial load
duke
parents:
diff changeset
94 class UnsafeObjectOp;
a61af66fc99e Initial load
duke
parents:
diff changeset
95 class UnsafeGetObject;
a61af66fc99e Initial load
duke
parents:
diff changeset
96 class UnsafePutObject;
a61af66fc99e Initial load
duke
parents:
diff changeset
97 class UnsafePrefetch;
a61af66fc99e Initial load
duke
parents:
diff changeset
98 class UnsafePrefetchRead;
a61af66fc99e Initial load
duke
parents:
diff changeset
99 class UnsafePrefetchWrite;
a61af66fc99e Initial load
duke
parents:
diff changeset
100 class ProfileCall;
1783
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
101 class ProfileInvoke;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
102
a61af66fc99e Initial load
duke
parents:
diff changeset
103 // A Value is a reference to the instruction creating the value
a61af66fc99e Initial load
duke
parents:
diff changeset
104 typedef Instruction* Value;
a61af66fc99e Initial load
duke
parents:
diff changeset
105 define_array(ValueArray, Value)
a61af66fc99e Initial load
duke
parents:
diff changeset
106 define_stack(Values, ValueArray)
a61af66fc99e Initial load
duke
parents:
diff changeset
107
a61af66fc99e Initial load
duke
parents:
diff changeset
108 define_array(ValueStackArray, ValueStack*)
a61af66fc99e Initial load
duke
parents:
diff changeset
109 define_stack(ValueStackStack, ValueStackArray)
a61af66fc99e Initial load
duke
parents:
diff changeset
110
a61af66fc99e Initial load
duke
parents:
diff changeset
111 // BlockClosure is the base class for block traversal/iteration.
a61af66fc99e Initial load
duke
parents:
diff changeset
112
a61af66fc99e Initial load
duke
parents:
diff changeset
113 class BlockClosure: public CompilationResourceObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
114 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
115 virtual void block_do(BlockBegin* block) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
116 };
a61af66fc99e Initial load
duke
parents:
diff changeset
117
a61af66fc99e Initial load
duke
parents:
diff changeset
118
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
119 // A simple closure class for visiting the values of an Instruction
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
120 class ValueVisitor: public StackObj {
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
121 public:
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
122 virtual void visit(Value* v) = 0;
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
123 };
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
124
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
125
0
a61af66fc99e Initial load
duke
parents:
diff changeset
126 // Some array and list classes
a61af66fc99e Initial load
duke
parents:
diff changeset
127 define_array(BlockBeginArray, BlockBegin*)
a61af66fc99e Initial load
duke
parents:
diff changeset
128 define_stack(_BlockList, BlockBeginArray)
a61af66fc99e Initial load
duke
parents:
diff changeset
129
a61af66fc99e Initial load
duke
parents:
diff changeset
130 class BlockList: public _BlockList {
a61af66fc99e Initial load
duke
parents:
diff changeset
131 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
132 BlockList(): _BlockList() {}
a61af66fc99e Initial load
duke
parents:
diff changeset
133 BlockList(const int size): _BlockList(size) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
134 BlockList(const int size, BlockBegin* init): _BlockList(size, init) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
135
a61af66fc99e Initial load
duke
parents:
diff changeset
136 void iterate_forward(BlockClosure* closure);
a61af66fc99e Initial load
duke
parents:
diff changeset
137 void iterate_backward(BlockClosure* closure);
a61af66fc99e Initial load
duke
parents:
diff changeset
138 void blocks_do(void f(BlockBegin*));
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
139 void values_do(ValueVisitor* f);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
140 void print(bool cfg_only = false, bool live_only = false) PRODUCT_RETURN;
a61af66fc99e Initial load
duke
parents:
diff changeset
141 };
a61af66fc99e Initial load
duke
parents:
diff changeset
142
a61af66fc99e Initial load
duke
parents:
diff changeset
143
a61af66fc99e Initial load
duke
parents:
diff changeset
144 // InstructionVisitors provide type-based dispatch for instructions.
a61af66fc99e Initial load
duke
parents:
diff changeset
145 // For each concrete Instruction class X, a virtual function do_X is
a61af66fc99e Initial load
duke
parents:
diff changeset
146 // provided. Functionality that needs to be implemented for all classes
a61af66fc99e Initial load
duke
parents:
diff changeset
147 // (e.g., printing, code generation) is factored out into a specialised
a61af66fc99e Initial load
duke
parents:
diff changeset
148 // visitor instead of added to the Instruction classes itself.
a61af66fc99e Initial load
duke
parents:
diff changeset
149
a61af66fc99e Initial load
duke
parents:
diff changeset
150 class InstructionVisitor: public StackObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
151 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
152 void do_HiWord (HiWord* x) { ShouldNotReachHere(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
153 virtual void do_Phi (Phi* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
154 virtual void do_Local (Local* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
155 virtual void do_Constant (Constant* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
156 virtual void do_LoadField (LoadField* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
157 virtual void do_StoreField (StoreField* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
158 virtual void do_ArrayLength (ArrayLength* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
159 virtual void do_LoadIndexed (LoadIndexed* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
160 virtual void do_StoreIndexed (StoreIndexed* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
161 virtual void do_NegateOp (NegateOp* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
162 virtual void do_ArithmeticOp (ArithmeticOp* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
163 virtual void do_ShiftOp (ShiftOp* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
164 virtual void do_LogicOp (LogicOp* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
165 virtual void do_CompareOp (CompareOp* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
166 virtual void do_IfOp (IfOp* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
167 virtual void do_Convert (Convert* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
168 virtual void do_NullCheck (NullCheck* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
169 virtual void do_Invoke (Invoke* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
170 virtual void do_NewInstance (NewInstance* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
171 virtual void do_NewTypeArray (NewTypeArray* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
172 virtual void do_NewObjectArray (NewObjectArray* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
173 virtual void do_NewMultiArray (NewMultiArray* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
174 virtual void do_CheckCast (CheckCast* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
175 virtual void do_InstanceOf (InstanceOf* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
176 virtual void do_MonitorEnter (MonitorEnter* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
177 virtual void do_MonitorExit (MonitorExit* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
178 virtual void do_Intrinsic (Intrinsic* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
179 virtual void do_BlockBegin (BlockBegin* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
180 virtual void do_Goto (Goto* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
181 virtual void do_If (If* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
182 virtual void do_IfInstanceOf (IfInstanceOf* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
183 virtual void do_TableSwitch (TableSwitch* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
184 virtual void do_LookupSwitch (LookupSwitch* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
185 virtual void do_Return (Return* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
186 virtual void do_Throw (Throw* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
187 virtual void do_Base (Base* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
188 virtual void do_OsrEntry (OsrEntry* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
189 virtual void do_ExceptionObject(ExceptionObject* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
190 virtual void do_RoundFP (RoundFP* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
191 virtual void do_UnsafeGetRaw (UnsafeGetRaw* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
192 virtual void do_UnsafePutRaw (UnsafePutRaw* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
193 virtual void do_UnsafeGetObject(UnsafeGetObject* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
194 virtual void do_UnsafePutObject(UnsafePutObject* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
195 virtual void do_UnsafePrefetchRead (UnsafePrefetchRead* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
196 virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
197 virtual void do_ProfileCall (ProfileCall* x) = 0;
1783
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
198 virtual void do_ProfileInvoke (ProfileInvoke* x) = 0;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
199 };
a61af66fc99e Initial load
duke
parents:
diff changeset
200
a61af66fc99e Initial load
duke
parents:
diff changeset
201
a61af66fc99e Initial load
duke
parents:
diff changeset
202 // Hashing support
a61af66fc99e Initial load
duke
parents:
diff changeset
203 //
a61af66fc99e Initial load
duke
parents:
diff changeset
204 // Note: This hash functions affect the performance
a61af66fc99e Initial load
duke
parents:
diff changeset
205 // of ValueMap - make changes carefully!
a61af66fc99e Initial load
duke
parents:
diff changeset
206
a61af66fc99e Initial load
duke
parents:
diff changeset
207 #define HASH1(x1 ) ((intx)(x1))
a61af66fc99e Initial load
duke
parents:
diff changeset
208 #define HASH2(x1, x2 ) ((HASH1(x1 ) << 7) ^ HASH1(x2))
a61af66fc99e Initial load
duke
parents:
diff changeset
209 #define HASH3(x1, x2, x3 ) ((HASH2(x1, x2 ) << 7) ^ HASH1(x3))
a61af66fc99e Initial load
duke
parents:
diff changeset
210 #define HASH4(x1, x2, x3, x4) ((HASH3(x1, x2, x3) << 7) ^ HASH1(x4))
a61af66fc99e Initial load
duke
parents:
diff changeset
211
a61af66fc99e Initial load
duke
parents:
diff changeset
212
a61af66fc99e Initial load
duke
parents:
diff changeset
213 // The following macros are used to implement instruction-specific hashing.
a61af66fc99e Initial load
duke
parents:
diff changeset
214 // By default, each instruction implements hash() and is_equal(Value), used
a61af66fc99e Initial load
duke
parents:
diff changeset
215 // for value numbering/common subexpression elimination. The default imple-
a61af66fc99e Initial load
duke
parents:
diff changeset
216 // mentation disables value numbering. Each instruction which can be value-
a61af66fc99e Initial load
duke
parents:
diff changeset
217 // numbered, should define corresponding hash() and is_equal(Value) functions
a61af66fc99e Initial load
duke
parents:
diff changeset
218 // via the macros below. The f arguments specify all the values/op codes, etc.
a61af66fc99e Initial load
duke
parents:
diff changeset
219 // that need to be identical for two instructions to be identical.
a61af66fc99e Initial load
duke
parents:
diff changeset
220 //
a61af66fc99e Initial load
duke
parents:
diff changeset
221 // Note: The default implementation of hash() returns 0 in order to indicate
a61af66fc99e Initial load
duke
parents:
diff changeset
222 // that the instruction should not be considered for value numbering.
a61af66fc99e Initial load
duke
parents:
diff changeset
223 // The currently used hash functions do not guarantee that never a 0
a61af66fc99e Initial load
duke
parents:
diff changeset
224 // is produced. While this is still correct, it may be a performance
a61af66fc99e Initial load
duke
parents:
diff changeset
225 // bug (no value numbering for that node). However, this situation is
a61af66fc99e Initial load
duke
parents:
diff changeset
226 // so unlikely, that we are not going to handle it specially.
a61af66fc99e Initial load
duke
parents:
diff changeset
227
a61af66fc99e Initial load
duke
parents:
diff changeset
228 #define HASHING1(class_name, enabled, f1) \
a61af66fc99e Initial load
duke
parents:
diff changeset
229 virtual intx hash() const { \
a61af66fc99e Initial load
duke
parents:
diff changeset
230 return (enabled) ? HASH2(name(), f1) : 0; \
a61af66fc99e Initial load
duke
parents:
diff changeset
231 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
232 virtual bool is_equal(Value v) const { \
a61af66fc99e Initial load
duke
parents:
diff changeset
233 if (!(enabled) ) return false; \
a61af66fc99e Initial load
duke
parents:
diff changeset
234 class_name* _v = v->as_##class_name(); \
a61af66fc99e Initial load
duke
parents:
diff changeset
235 if (_v == NULL ) return false; \
a61af66fc99e Initial load
duke
parents:
diff changeset
236 if (f1 != _v->f1) return false; \
a61af66fc99e Initial load
duke
parents:
diff changeset
237 return true; \
a61af66fc99e Initial load
duke
parents:
diff changeset
238 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
239
a61af66fc99e Initial load
duke
parents:
diff changeset
240
a61af66fc99e Initial load
duke
parents:
diff changeset
241 #define HASHING2(class_name, enabled, f1, f2) \
a61af66fc99e Initial load
duke
parents:
diff changeset
242 virtual intx hash() const { \
a61af66fc99e Initial load
duke
parents:
diff changeset
243 return (enabled) ? HASH3(name(), f1, f2) : 0; \
a61af66fc99e Initial load
duke
parents:
diff changeset
244 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
245 virtual bool is_equal(Value v) const { \
a61af66fc99e Initial load
duke
parents:
diff changeset
246 if (!(enabled) ) return false; \
a61af66fc99e Initial load
duke
parents:
diff changeset
247 class_name* _v = v->as_##class_name(); \
a61af66fc99e Initial load
duke
parents:
diff changeset
248 if (_v == NULL ) return false; \
a61af66fc99e Initial load
duke
parents:
diff changeset
249 if (f1 != _v->f1) return false; \
a61af66fc99e Initial load
duke
parents:
diff changeset
250 if (f2 != _v->f2) return false; \
a61af66fc99e Initial load
duke
parents:
diff changeset
251 return true; \
a61af66fc99e Initial load
duke
parents:
diff changeset
252 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
253
a61af66fc99e Initial load
duke
parents:
diff changeset
254
a61af66fc99e Initial load
duke
parents:
diff changeset
255 #define HASHING3(class_name, enabled, f1, f2, f3) \
a61af66fc99e Initial load
duke
parents:
diff changeset
256 virtual intx hash() const { \
a61af66fc99e Initial load
duke
parents:
diff changeset
257 return (enabled) ? HASH4(name(), f1, f2, f3) : 0; \
a61af66fc99e Initial load
duke
parents:
diff changeset
258 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
259 virtual bool is_equal(Value v) const { \
a61af66fc99e Initial load
duke
parents:
diff changeset
260 if (!(enabled) ) return false; \
a61af66fc99e Initial load
duke
parents:
diff changeset
261 class_name* _v = v->as_##class_name(); \
a61af66fc99e Initial load
duke
parents:
diff changeset
262 if (_v == NULL ) return false; \
a61af66fc99e Initial load
duke
parents:
diff changeset
263 if (f1 != _v->f1) return false; \
a61af66fc99e Initial load
duke
parents:
diff changeset
264 if (f2 != _v->f2) return false; \
a61af66fc99e Initial load
duke
parents:
diff changeset
265 if (f3 != _v->f3) return false; \
a61af66fc99e Initial load
duke
parents:
diff changeset
266 return true; \
a61af66fc99e Initial load
duke
parents:
diff changeset
267 } \
a61af66fc99e Initial load
duke
parents:
diff changeset
268
a61af66fc99e Initial load
duke
parents:
diff changeset
269
a61af66fc99e Initial load
duke
parents:
diff changeset
270 // The mother of all instructions...
a61af66fc99e Initial load
duke
parents:
diff changeset
271
a61af66fc99e Initial load
duke
parents:
diff changeset
272 class Instruction: public CompilationResourceObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
273 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
274 int _id; // the unique instruction id
a61af66fc99e Initial load
duke
parents:
diff changeset
275 int _bci; // the instruction bci
a61af66fc99e Initial load
duke
parents:
diff changeset
276 int _use_count; // the number of instructions refering to this value (w/o prev/next); only roots can have use count = 0 or > 1
a61af66fc99e Initial load
duke
parents:
diff changeset
277 int _pin_state; // set of PinReason describing the reason for pinning
a61af66fc99e Initial load
duke
parents:
diff changeset
278 ValueType* _type; // the instruction value type
a61af66fc99e Initial load
duke
parents:
diff changeset
279 Instruction* _next; // the next instruction if any (NULL for BlockEnd instructions)
a61af66fc99e Initial load
duke
parents:
diff changeset
280 Instruction* _subst; // the substitution instruction if any
a61af66fc99e Initial load
duke
parents:
diff changeset
281 LIR_Opr _operand; // LIR specific information
a61af66fc99e Initial load
duke
parents:
diff changeset
282 unsigned int _flags; // Flag bits
a61af66fc99e Initial load
duke
parents:
diff changeset
283
a61af66fc99e Initial load
duke
parents:
diff changeset
284 XHandlers* _exception_handlers; // Flat list of exception handlers covering this instruction
a61af66fc99e Initial load
duke
parents:
diff changeset
285
a61af66fc99e Initial load
duke
parents:
diff changeset
286 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
287 HiWord* _hi_word;
a61af66fc99e Initial load
duke
parents:
diff changeset
288 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
289
a61af66fc99e Initial load
duke
parents:
diff changeset
290 friend class UseCountComputer;
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
291 friend class BlockBegin;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
292
a61af66fc99e Initial load
duke
parents:
diff changeset
293 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
294 void set_bci(int bci) { assert(bci == SynchronizationEntryBCI || bci >= 0, "illegal bci"); _bci = bci; }
a61af66fc99e Initial load
duke
parents:
diff changeset
295 void set_type(ValueType* type) {
a61af66fc99e Initial load
duke
parents:
diff changeset
296 assert(type != NULL, "type must exist");
a61af66fc99e Initial load
duke
parents:
diff changeset
297 _type = type;
a61af66fc99e Initial load
duke
parents:
diff changeset
298 }
a61af66fc99e Initial load
duke
parents:
diff changeset
299
a61af66fc99e Initial load
duke
parents:
diff changeset
300 public:
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
301 void* operator new(size_t size) {
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
302 Compilation* c = Compilation::current();
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
303 void* res = c->arena()->Amalloc(size);
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
304 ((Instruction*)res)->_id = c->get_next_id();
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
305 return res;
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
306 }
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
307
0
a61af66fc99e Initial load
duke
parents:
diff changeset
308 enum InstructionFlag {
a61af66fc99e Initial load
duke
parents:
diff changeset
309 NeedsNullCheckFlag = 0,
a61af66fc99e Initial load
duke
parents:
diff changeset
310 CanTrapFlag,
a61af66fc99e Initial load
duke
parents:
diff changeset
311 DirectCompareFlag,
a61af66fc99e Initial load
duke
parents:
diff changeset
312 IsEliminatedFlag,
a61af66fc99e Initial load
duke
parents:
diff changeset
313 IsInitializedFlag,
a61af66fc99e Initial load
duke
parents:
diff changeset
314 IsLoadedFlag,
a61af66fc99e Initial load
duke
parents:
diff changeset
315 IsSafepointFlag,
a61af66fc99e Initial load
duke
parents:
diff changeset
316 IsStaticFlag,
a61af66fc99e Initial load
duke
parents:
diff changeset
317 IsStrictfpFlag,
a61af66fc99e Initial load
duke
parents:
diff changeset
318 NeedsStoreCheckFlag,
a61af66fc99e Initial load
duke
parents:
diff changeset
319 NeedsWriteBarrierFlag,
a61af66fc99e Initial load
duke
parents:
diff changeset
320 PreservesStateFlag,
a61af66fc99e Initial load
duke
parents:
diff changeset
321 TargetIsFinalFlag,
a61af66fc99e Initial load
duke
parents:
diff changeset
322 TargetIsLoadedFlag,
a61af66fc99e Initial load
duke
parents:
diff changeset
323 TargetIsStrictfpFlag,
a61af66fc99e Initial load
duke
parents:
diff changeset
324 UnorderedIsTrueFlag,
a61af66fc99e Initial load
duke
parents:
diff changeset
325 NeedsPatchingFlag,
a61af66fc99e Initial load
duke
parents:
diff changeset
326 ThrowIncompatibleClassChangeErrorFlag,
a61af66fc99e Initial load
duke
parents:
diff changeset
327 ProfileMDOFlag,
a61af66fc99e Initial load
duke
parents:
diff changeset
328 InstructionLastFlag
a61af66fc99e Initial load
duke
parents:
diff changeset
329 };
a61af66fc99e Initial load
duke
parents:
diff changeset
330
a61af66fc99e Initial load
duke
parents:
diff changeset
331 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
332 bool check_flag(InstructionFlag id) const { return (_flags & (1 << id)) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
333 void set_flag(InstructionFlag id, bool f) { _flags = f ? (_flags | (1 << id)) : (_flags & ~(1 << id)); };
a61af66fc99e Initial load
duke
parents:
diff changeset
334
a61af66fc99e Initial load
duke
parents:
diff changeset
335 // 'globally' used condition values
a61af66fc99e Initial load
duke
parents:
diff changeset
336 enum Condition {
a61af66fc99e Initial load
duke
parents:
diff changeset
337 eql, neq, lss, leq, gtr, geq
a61af66fc99e Initial load
duke
parents:
diff changeset
338 };
a61af66fc99e Initial load
duke
parents:
diff changeset
339
a61af66fc99e Initial load
duke
parents:
diff changeset
340 // Instructions may be pinned for many reasons and under certain conditions
a61af66fc99e Initial load
duke
parents:
diff changeset
341 // with enough knowledge it's possible to safely unpin them.
a61af66fc99e Initial load
duke
parents:
diff changeset
342 enum PinReason {
a61af66fc99e Initial load
duke
parents:
diff changeset
343 PinUnknown = 1 << 0
a61af66fc99e Initial load
duke
parents:
diff changeset
344 , PinExplicitNullCheck = 1 << 3
a61af66fc99e Initial load
duke
parents:
diff changeset
345 , PinStackForStateSplit= 1 << 12
a61af66fc99e Initial load
duke
parents:
diff changeset
346 , PinStateSplitConstructor= 1 << 13
a61af66fc99e Initial load
duke
parents:
diff changeset
347 , PinGlobalValueNumbering= 1 << 14
a61af66fc99e Initial load
duke
parents:
diff changeset
348 };
a61af66fc99e Initial load
duke
parents:
diff changeset
349
a61af66fc99e Initial load
duke
parents:
diff changeset
350 static Condition mirror(Condition cond);
a61af66fc99e Initial load
duke
parents:
diff changeset
351 static Condition negate(Condition cond);
a61af66fc99e Initial load
duke
parents:
diff changeset
352
a61af66fc99e Initial load
duke
parents:
diff changeset
353 // initialization
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
354 static int number_of_instructions() {
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
355 return Compilation::current()->number_of_instructions();
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
356 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
357
a61af66fc99e Initial load
duke
parents:
diff changeset
358 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
359 Instruction(ValueType* type, bool type_is_constant = false, bool create_hi = true)
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
360 : _bci(-99)
0
a61af66fc99e Initial load
duke
parents:
diff changeset
361 , _use_count(0)
a61af66fc99e Initial load
duke
parents:
diff changeset
362 , _pin_state(0)
a61af66fc99e Initial load
duke
parents:
diff changeset
363 , _type(type)
a61af66fc99e Initial load
duke
parents:
diff changeset
364 , _next(NULL)
a61af66fc99e Initial load
duke
parents:
diff changeset
365 , _subst(NULL)
a61af66fc99e Initial load
duke
parents:
diff changeset
366 , _flags(0)
a61af66fc99e Initial load
duke
parents:
diff changeset
367 , _operand(LIR_OprFact::illegalOpr)
a61af66fc99e Initial load
duke
parents:
diff changeset
368 , _exception_handlers(NULL)
a61af66fc99e Initial load
duke
parents:
diff changeset
369 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
370 , _hi_word(NULL)
a61af66fc99e Initial load
duke
parents:
diff changeset
371 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
372 {
a61af66fc99e Initial load
duke
parents:
diff changeset
373 assert(type != NULL && (!type->is_constant() || type_is_constant), "type must exist");
a61af66fc99e Initial load
duke
parents:
diff changeset
374 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
375 if (create_hi && type->is_double_word()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
376 create_hi_word();
a61af66fc99e Initial load
duke
parents:
diff changeset
377 }
a61af66fc99e Initial load
duke
parents:
diff changeset
378 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
379 }
a61af66fc99e Initial load
duke
parents:
diff changeset
380
a61af66fc99e Initial load
duke
parents:
diff changeset
381 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
382 int id() const { return _id; }
a61af66fc99e Initial load
duke
parents:
diff changeset
383 int bci() const { return _bci; }
a61af66fc99e Initial load
duke
parents:
diff changeset
384 int use_count() const { return _use_count; }
a61af66fc99e Initial load
duke
parents:
diff changeset
385 int pin_state() const { return _pin_state; }
a61af66fc99e Initial load
duke
parents:
diff changeset
386 bool is_pinned() const { return _pin_state != 0 || PinAllInstructions; }
a61af66fc99e Initial load
duke
parents:
diff changeset
387 ValueType* type() const { return _type; }
a61af66fc99e Initial load
duke
parents:
diff changeset
388 Instruction* prev(BlockBegin* block); // use carefully, expensive operation
a61af66fc99e Initial load
duke
parents:
diff changeset
389 Instruction* next() const { return _next; }
a61af66fc99e Initial load
duke
parents:
diff changeset
390 bool has_subst() const { return _subst != NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
391 Instruction* subst() { return _subst == NULL ? this : _subst->subst(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
392 LIR_Opr operand() const { return _operand; }
a61af66fc99e Initial load
duke
parents:
diff changeset
393
a61af66fc99e Initial load
duke
parents:
diff changeset
394 void set_needs_null_check(bool f) { set_flag(NeedsNullCheckFlag, f); }
a61af66fc99e Initial load
duke
parents:
diff changeset
395 bool needs_null_check() const { return check_flag(NeedsNullCheckFlag); }
a61af66fc99e Initial load
duke
parents:
diff changeset
396
a61af66fc99e Initial load
duke
parents:
diff changeset
397 bool has_uses() const { return use_count() > 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
398 bool is_root() const { return is_pinned() || use_count() > 1; }
a61af66fc99e Initial load
duke
parents:
diff changeset
399 XHandlers* exception_handlers() const { return _exception_handlers; }
a61af66fc99e Initial load
duke
parents:
diff changeset
400
a61af66fc99e Initial load
duke
parents:
diff changeset
401 // manipulation
a61af66fc99e Initial load
duke
parents:
diff changeset
402 void pin(PinReason reason) { _pin_state |= reason; }
a61af66fc99e Initial load
duke
parents:
diff changeset
403 void pin() { _pin_state |= PinUnknown; }
a61af66fc99e Initial load
duke
parents:
diff changeset
404 // DANGEROUS: only used by EliminateStores
a61af66fc99e Initial load
duke
parents:
diff changeset
405 void unpin(PinReason reason) { assert((reason & PinUnknown) == 0, "can't unpin unknown state"); _pin_state &= ~reason; }
a61af66fc99e Initial load
duke
parents:
diff changeset
406 virtual void set_lock_stack(ValueStack* l) { /* do nothing*/ }
a61af66fc99e Initial load
duke
parents:
diff changeset
407 virtual ValueStack* lock_stack() const { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
408
a61af66fc99e Initial load
duke
parents:
diff changeset
409 Instruction* set_next(Instruction* next, int bci) {
a61af66fc99e Initial load
duke
parents:
diff changeset
410 if (next != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
411 assert(as_BlockEnd() == NULL, "BlockEnd instructions must have no next");
a61af66fc99e Initial load
duke
parents:
diff changeset
412 assert(next->as_Phi() == NULL && next->as_Local() == NULL, "shouldn't link these instructions into list");
a61af66fc99e Initial load
duke
parents:
diff changeset
413 next->set_bci(bci);
a61af66fc99e Initial load
duke
parents:
diff changeset
414 }
a61af66fc99e Initial load
duke
parents:
diff changeset
415 _next = next;
a61af66fc99e Initial load
duke
parents:
diff changeset
416 return next;
a61af66fc99e Initial load
duke
parents:
diff changeset
417 }
a61af66fc99e Initial load
duke
parents:
diff changeset
418
a61af66fc99e Initial load
duke
parents:
diff changeset
419 void set_subst(Instruction* subst) {
a61af66fc99e Initial load
duke
parents:
diff changeset
420 assert(subst == NULL ||
a61af66fc99e Initial load
duke
parents:
diff changeset
421 type()->base() == subst->type()->base() ||
a61af66fc99e Initial load
duke
parents:
diff changeset
422 subst->type()->base() == illegalType, "type can't change");
a61af66fc99e Initial load
duke
parents:
diff changeset
423 _subst = subst;
a61af66fc99e Initial load
duke
parents:
diff changeset
424 }
a61af66fc99e Initial load
duke
parents:
diff changeset
425 void set_exception_handlers(XHandlers *xhandlers) { _exception_handlers = xhandlers; }
a61af66fc99e Initial load
duke
parents:
diff changeset
426
a61af66fc99e Initial load
duke
parents:
diff changeset
427 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
428 // HiWord is used for debugging and is allocated early to avoid
a61af66fc99e Initial load
duke
parents:
diff changeset
429 // allocation at inconvenient points
a61af66fc99e Initial load
duke
parents:
diff changeset
430 HiWord* hi_word() { return _hi_word; }
a61af66fc99e Initial load
duke
parents:
diff changeset
431 void create_hi_word();
a61af66fc99e Initial load
duke
parents:
diff changeset
432 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
433
a61af66fc99e Initial load
duke
parents:
diff changeset
434
a61af66fc99e Initial load
duke
parents:
diff changeset
435 // machine-specifics
a61af66fc99e Initial load
duke
parents:
diff changeset
436 void set_operand(LIR_Opr operand) { assert(operand != LIR_OprFact::illegalOpr, "operand must exist"); _operand = operand; }
a61af66fc99e Initial load
duke
parents:
diff changeset
437 void clear_operand() { _operand = LIR_OprFact::illegalOpr; }
a61af66fc99e Initial load
duke
parents:
diff changeset
438
a61af66fc99e Initial load
duke
parents:
diff changeset
439 // generic
a61af66fc99e Initial load
duke
parents:
diff changeset
440 virtual Instruction* as_Instruction() { return this; } // to satisfy HASHING1 macro
a61af66fc99e Initial load
duke
parents:
diff changeset
441 virtual HiWord* as_HiWord() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
442 virtual Phi* as_Phi() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
443 virtual Local* as_Local() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
444 virtual Constant* as_Constant() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
445 virtual AccessField* as_AccessField() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
446 virtual LoadField* as_LoadField() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
447 virtual StoreField* as_StoreField() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
448 virtual AccessArray* as_AccessArray() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
449 virtual ArrayLength* as_ArrayLength() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
450 virtual AccessIndexed* as_AccessIndexed() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
451 virtual LoadIndexed* as_LoadIndexed() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
452 virtual StoreIndexed* as_StoreIndexed() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
453 virtual NegateOp* as_NegateOp() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
454 virtual Op2* as_Op2() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
455 virtual ArithmeticOp* as_ArithmeticOp() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
456 virtual ShiftOp* as_ShiftOp() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
457 virtual LogicOp* as_LogicOp() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
458 virtual CompareOp* as_CompareOp() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
459 virtual IfOp* as_IfOp() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
460 virtual Convert* as_Convert() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
461 virtual NullCheck* as_NullCheck() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
462 virtual OsrEntry* as_OsrEntry() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
463 virtual StateSplit* as_StateSplit() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
464 virtual Invoke* as_Invoke() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
465 virtual NewInstance* as_NewInstance() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
466 virtual NewArray* as_NewArray() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
467 virtual NewTypeArray* as_NewTypeArray() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
468 virtual NewObjectArray* as_NewObjectArray() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
469 virtual NewMultiArray* as_NewMultiArray() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
470 virtual TypeCheck* as_TypeCheck() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
471 virtual CheckCast* as_CheckCast() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
472 virtual InstanceOf* as_InstanceOf() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
473 virtual AccessMonitor* as_AccessMonitor() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
474 virtual MonitorEnter* as_MonitorEnter() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
475 virtual MonitorExit* as_MonitorExit() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
476 virtual Intrinsic* as_Intrinsic() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
477 virtual BlockBegin* as_BlockBegin() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
478 virtual BlockEnd* as_BlockEnd() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
479 virtual Goto* as_Goto() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
480 virtual If* as_If() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
481 virtual IfInstanceOf* as_IfInstanceOf() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
482 virtual TableSwitch* as_TableSwitch() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
483 virtual LookupSwitch* as_LookupSwitch() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
484 virtual Return* as_Return() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
485 virtual Throw* as_Throw() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
486 virtual Base* as_Base() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
487 virtual RoundFP* as_RoundFP() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
488 virtual ExceptionObject* as_ExceptionObject() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
489 virtual UnsafeOp* as_UnsafeOp() { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
490
a61af66fc99e Initial load
duke
parents:
diff changeset
491 virtual void visit(InstructionVisitor* v) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
492
a61af66fc99e Initial load
duke
parents:
diff changeset
493 virtual bool can_trap() const { return false; }
a61af66fc99e Initial load
duke
parents:
diff changeset
494
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
495 virtual void input_values_do(ValueVisitor* f) = 0;
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
496 virtual void state_values_do(ValueVisitor* f) { /* usually no state - override on demand */ }
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
497 virtual void other_values_do(ValueVisitor* f) { /* usually no other - override on demand */ }
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
498 void values_do(ValueVisitor* f) { input_values_do(f); state_values_do(f); other_values_do(f); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
499
a61af66fc99e Initial load
duke
parents:
diff changeset
500 virtual ciType* exact_type() const { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
501 virtual ciType* declared_type() const { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
502
a61af66fc99e Initial load
duke
parents:
diff changeset
503 // hashing
a61af66fc99e Initial load
duke
parents:
diff changeset
504 virtual const char* name() const = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
505 HASHING1(Instruction, false, id()) // hashing disabled by default
a61af66fc99e Initial load
duke
parents:
diff changeset
506
a61af66fc99e Initial load
duke
parents:
diff changeset
507 // debugging
a61af66fc99e Initial load
duke
parents:
diff changeset
508 void print() PRODUCT_RETURN;
a61af66fc99e Initial load
duke
parents:
diff changeset
509 void print_line() PRODUCT_RETURN;
a61af66fc99e Initial load
duke
parents:
diff changeset
510 void print(InstructionPrinter& ip) PRODUCT_RETURN;
a61af66fc99e Initial load
duke
parents:
diff changeset
511 };
a61af66fc99e Initial load
duke
parents:
diff changeset
512
a61af66fc99e Initial load
duke
parents:
diff changeset
513
a61af66fc99e Initial load
duke
parents:
diff changeset
514 // The following macros are used to define base (i.e., non-leaf)
a61af66fc99e Initial load
duke
parents:
diff changeset
515 // and leaf instruction classes. They define class-name related
a61af66fc99e Initial load
duke
parents:
diff changeset
516 // generic functionality in one place.
a61af66fc99e Initial load
duke
parents:
diff changeset
517
a61af66fc99e Initial load
duke
parents:
diff changeset
518 #define BASE(class_name, super_class_name) \
a61af66fc99e Initial load
duke
parents:
diff changeset
519 class class_name: public super_class_name { \
a61af66fc99e Initial load
duke
parents:
diff changeset
520 public: \
a61af66fc99e Initial load
duke
parents:
diff changeset
521 virtual class_name* as_##class_name() { return this; } \
a61af66fc99e Initial load
duke
parents:
diff changeset
522
a61af66fc99e Initial load
duke
parents:
diff changeset
523
a61af66fc99e Initial load
duke
parents:
diff changeset
524 #define LEAF(class_name, super_class_name) \
a61af66fc99e Initial load
duke
parents:
diff changeset
525 BASE(class_name, super_class_name) \
a61af66fc99e Initial load
duke
parents:
diff changeset
526 public: \
a61af66fc99e Initial load
duke
parents:
diff changeset
527 virtual const char* name() const { return #class_name; } \
a61af66fc99e Initial load
duke
parents:
diff changeset
528 virtual void visit(InstructionVisitor* v) { v->do_##class_name(this); } \
a61af66fc99e Initial load
duke
parents:
diff changeset
529
a61af66fc99e Initial load
duke
parents:
diff changeset
530
a61af66fc99e Initial load
duke
parents:
diff changeset
531 // Debugging support
a61af66fc99e Initial load
duke
parents:
diff changeset
532
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
533
0
a61af66fc99e Initial load
duke
parents:
diff changeset
534 #ifdef ASSERT
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
535 class AssertValues: public ValueVisitor {
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
536 void visit(Value* x) { assert((*x) != NULL, "value must exist"); }
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
537 };
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
538 #define ASSERT_VALUES { AssertValues assert_value; values_do(&assert_value); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
539 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
540 #define ASSERT_VALUES
a61af66fc99e Initial load
duke
parents:
diff changeset
541 #endif // ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
542
a61af66fc99e Initial load
duke
parents:
diff changeset
543
a61af66fc99e Initial load
duke
parents:
diff changeset
544 // A HiWord occupies the 'high word' of a 2-word
a61af66fc99e Initial load
duke
parents:
diff changeset
545 // expression stack entry. Hi & lo words must be
a61af66fc99e Initial load
duke
parents:
diff changeset
546 // paired on the expression stack (otherwise the
a61af66fc99e Initial load
duke
parents:
diff changeset
547 // bytecode sequence is illegal). Note that 'hi'
a61af66fc99e Initial load
duke
parents:
diff changeset
548 // refers to the IR expression stack format and
a61af66fc99e Initial load
duke
parents:
diff changeset
549 // does *not* imply a machine word ordering. No
a61af66fc99e Initial load
duke
parents:
diff changeset
550 // HiWords are used in optimized mode for speed,
a61af66fc99e Initial load
duke
parents:
diff changeset
551 // but NULL pointers are used instead.
a61af66fc99e Initial load
duke
parents:
diff changeset
552
a61af66fc99e Initial load
duke
parents:
diff changeset
553 LEAF(HiWord, Instruction)
a61af66fc99e Initial load
duke
parents:
diff changeset
554 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
555 Value _lo_word;
a61af66fc99e Initial load
duke
parents:
diff changeset
556
a61af66fc99e Initial load
duke
parents:
diff changeset
557 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
558 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
559 HiWord(Value lo_word)
a61af66fc99e Initial load
duke
parents:
diff changeset
560 : Instruction(illegalType, false, false),
a61af66fc99e Initial load
duke
parents:
diff changeset
561 _lo_word(lo_word) {
a61af66fc99e Initial load
duke
parents:
diff changeset
562 // hi-words are also allowed for illegal lo-words
a61af66fc99e Initial load
duke
parents:
diff changeset
563 assert(lo_word->type()->is_double_word() || lo_word->type()->is_illegal(),
a61af66fc99e Initial load
duke
parents:
diff changeset
564 "HiWord must be used for 2-word values only");
a61af66fc99e Initial load
duke
parents:
diff changeset
565 }
a61af66fc99e Initial load
duke
parents:
diff changeset
566
a61af66fc99e Initial load
duke
parents:
diff changeset
567 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
568 Value lo_word() const { return _lo_word->subst(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
569
a61af66fc99e Initial load
duke
parents:
diff changeset
570 // for invalidating of HiWords
a61af66fc99e Initial load
duke
parents:
diff changeset
571 void make_illegal() { set_type(illegalType); }
a61af66fc99e Initial load
duke
parents:
diff changeset
572
a61af66fc99e Initial load
duke
parents:
diff changeset
573 // generic
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
574 virtual void input_values_do(ValueVisitor* f) { ShouldNotReachHere(); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
575 };
a61af66fc99e Initial load
duke
parents:
diff changeset
576
a61af66fc99e Initial load
duke
parents:
diff changeset
577
a61af66fc99e Initial load
duke
parents:
diff changeset
578 // A Phi is a phi function in the sense of SSA form. It stands for
a61af66fc99e Initial load
duke
parents:
diff changeset
579 // the value of a local variable at the beginning of a join block.
a61af66fc99e Initial load
duke
parents:
diff changeset
580 // A Phi consists of n operands, one for every incoming branch.
a61af66fc99e Initial load
duke
parents:
diff changeset
581
a61af66fc99e Initial load
duke
parents:
diff changeset
582 LEAF(Phi, Instruction)
a61af66fc99e Initial load
duke
parents:
diff changeset
583 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
584 BlockBegin* _block; // the block to which the phi function belongs
a61af66fc99e Initial load
duke
parents:
diff changeset
585 int _pf_flags; // the flags of the phi function
a61af66fc99e Initial load
duke
parents:
diff changeset
586 int _index; // to value on operand stack (index < 0) or to local
a61af66fc99e Initial load
duke
parents:
diff changeset
587 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
588 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
589 Phi(ValueType* type, BlockBegin* b, int index)
a61af66fc99e Initial load
duke
parents:
diff changeset
590 : Instruction(type->base())
a61af66fc99e Initial load
duke
parents:
diff changeset
591 , _pf_flags(0)
a61af66fc99e Initial load
duke
parents:
diff changeset
592 , _block(b)
a61af66fc99e Initial load
duke
parents:
diff changeset
593 , _index(index)
a61af66fc99e Initial load
duke
parents:
diff changeset
594 {
a61af66fc99e Initial load
duke
parents:
diff changeset
595 if (type->is_illegal()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
596 make_illegal();
a61af66fc99e Initial load
duke
parents:
diff changeset
597 }
a61af66fc99e Initial load
duke
parents:
diff changeset
598 }
a61af66fc99e Initial load
duke
parents:
diff changeset
599
a61af66fc99e Initial load
duke
parents:
diff changeset
600 // flags
a61af66fc99e Initial load
duke
parents:
diff changeset
601 enum Flag {
a61af66fc99e Initial load
duke
parents:
diff changeset
602 no_flag = 0,
a61af66fc99e Initial load
duke
parents:
diff changeset
603 visited = 1 << 0,
a61af66fc99e Initial load
duke
parents:
diff changeset
604 cannot_simplify = 1 << 1
a61af66fc99e Initial load
duke
parents:
diff changeset
605 };
a61af66fc99e Initial load
duke
parents:
diff changeset
606
a61af66fc99e Initial load
duke
parents:
diff changeset
607 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
608 bool is_local() const { return _index >= 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
609 bool is_on_stack() const { return !is_local(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
610 int local_index() const { assert(is_local(), ""); return _index; }
a61af66fc99e Initial load
duke
parents:
diff changeset
611 int stack_index() const { assert(is_on_stack(), ""); return -(_index+1); }
a61af66fc99e Initial load
duke
parents:
diff changeset
612
a61af66fc99e Initial load
duke
parents:
diff changeset
613 Value operand_at(int i) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
614 int operand_count() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
615
a61af66fc99e Initial load
duke
parents:
diff changeset
616 BlockBegin* block() const { return _block; }
a61af66fc99e Initial load
duke
parents:
diff changeset
617
a61af66fc99e Initial load
duke
parents:
diff changeset
618 void set(Flag f) { _pf_flags |= f; }
a61af66fc99e Initial load
duke
parents:
diff changeset
619 void clear(Flag f) { _pf_flags &= ~f; }
a61af66fc99e Initial load
duke
parents:
diff changeset
620 bool is_set(Flag f) const { return (_pf_flags & f) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
621
a61af66fc99e Initial load
duke
parents:
diff changeset
622 // Invalidates phis corresponding to merges of locals of two different types
a61af66fc99e Initial load
duke
parents:
diff changeset
623 // (these should never be referenced, otherwise the bytecodes are illegal)
a61af66fc99e Initial load
duke
parents:
diff changeset
624 void make_illegal() {
a61af66fc99e Initial load
duke
parents:
diff changeset
625 set(cannot_simplify);
a61af66fc99e Initial load
duke
parents:
diff changeset
626 set_type(illegalType);
a61af66fc99e Initial load
duke
parents:
diff changeset
627 }
a61af66fc99e Initial load
duke
parents:
diff changeset
628
a61af66fc99e Initial load
duke
parents:
diff changeset
629 bool is_illegal() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
630 return type()->is_illegal();
a61af66fc99e Initial load
duke
parents:
diff changeset
631 }
a61af66fc99e Initial load
duke
parents:
diff changeset
632
a61af66fc99e Initial load
duke
parents:
diff changeset
633 // generic
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
634 virtual void input_values_do(ValueVisitor* f) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
635 }
a61af66fc99e Initial load
duke
parents:
diff changeset
636 };
a61af66fc99e Initial load
duke
parents:
diff changeset
637
a61af66fc99e Initial load
duke
parents:
diff changeset
638
a61af66fc99e Initial load
duke
parents:
diff changeset
639 // A local is a placeholder for an incoming argument to a function call.
a61af66fc99e Initial load
duke
parents:
diff changeset
640 LEAF(Local, Instruction)
a61af66fc99e Initial load
duke
parents:
diff changeset
641 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
642 int _java_index; // the local index within the method to which the local belongs
a61af66fc99e Initial load
duke
parents:
diff changeset
643 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
644 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
645 Local(ValueType* type, int index)
a61af66fc99e Initial load
duke
parents:
diff changeset
646 : Instruction(type)
a61af66fc99e Initial load
duke
parents:
diff changeset
647 , _java_index(index)
a61af66fc99e Initial load
duke
parents:
diff changeset
648 {}
a61af66fc99e Initial load
duke
parents:
diff changeset
649
a61af66fc99e Initial load
duke
parents:
diff changeset
650 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
651 int java_index() const { return _java_index; }
a61af66fc99e Initial load
duke
parents:
diff changeset
652
a61af66fc99e Initial load
duke
parents:
diff changeset
653 // generic
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
654 virtual void input_values_do(ValueVisitor* f) { /* no values */ }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
655 };
a61af66fc99e Initial load
duke
parents:
diff changeset
656
a61af66fc99e Initial load
duke
parents:
diff changeset
657
a61af66fc99e Initial load
duke
parents:
diff changeset
658 LEAF(Constant, Instruction)
a61af66fc99e Initial load
duke
parents:
diff changeset
659 ValueStack* _state;
a61af66fc99e Initial load
duke
parents:
diff changeset
660
a61af66fc99e Initial load
duke
parents:
diff changeset
661 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
662 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
663 Constant(ValueType* type):
a61af66fc99e Initial load
duke
parents:
diff changeset
664 Instruction(type, true)
a61af66fc99e Initial load
duke
parents:
diff changeset
665 , _state(NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
666 assert(type->is_constant(), "must be a constant");
a61af66fc99e Initial load
duke
parents:
diff changeset
667 }
a61af66fc99e Initial load
duke
parents:
diff changeset
668
a61af66fc99e Initial load
duke
parents:
diff changeset
669 Constant(ValueType* type, ValueStack* state):
a61af66fc99e Initial load
duke
parents:
diff changeset
670 Instruction(type, true)
a61af66fc99e Initial load
duke
parents:
diff changeset
671 , _state(state) {
a61af66fc99e Initial load
duke
parents:
diff changeset
672 assert(state != NULL, "only used for constants which need patching");
a61af66fc99e Initial load
duke
parents:
diff changeset
673 assert(type->is_constant(), "must be a constant");
a61af66fc99e Initial load
duke
parents:
diff changeset
674 // since it's patching it needs to be pinned
a61af66fc99e Initial load
duke
parents:
diff changeset
675 pin();
a61af66fc99e Initial load
duke
parents:
diff changeset
676 }
a61af66fc99e Initial load
duke
parents:
diff changeset
677
a61af66fc99e Initial load
duke
parents:
diff changeset
678 ValueStack* state() const { return _state; }
a61af66fc99e Initial load
duke
parents:
diff changeset
679
a61af66fc99e Initial load
duke
parents:
diff changeset
680 // generic
a61af66fc99e Initial load
duke
parents:
diff changeset
681 virtual bool can_trap() const { return state() != NULL; }
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
682 virtual void input_values_do(ValueVisitor* f) { /* no values */ }
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
683 virtual void other_values_do(ValueVisitor* f);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
684
a61af66fc99e Initial load
duke
parents:
diff changeset
685 virtual intx hash() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
686 virtual bool is_equal(Value v) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
687
a61af66fc99e Initial load
duke
parents:
diff changeset
688 virtual BlockBegin* compare(Instruction::Condition condition, Value right,
a61af66fc99e Initial load
duke
parents:
diff changeset
689 BlockBegin* true_sux, BlockBegin* false_sux);
a61af66fc99e Initial load
duke
parents:
diff changeset
690 };
a61af66fc99e Initial load
duke
parents:
diff changeset
691
a61af66fc99e Initial load
duke
parents:
diff changeset
692
a61af66fc99e Initial load
duke
parents:
diff changeset
693 BASE(AccessField, Instruction)
a61af66fc99e Initial load
duke
parents:
diff changeset
694 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
695 Value _obj;
a61af66fc99e Initial load
duke
parents:
diff changeset
696 int _offset;
a61af66fc99e Initial load
duke
parents:
diff changeset
697 ciField* _field;
a61af66fc99e Initial load
duke
parents:
diff changeset
698 ValueStack* _state_before; // state is set only for unloaded or uninitialized fields
a61af66fc99e Initial load
duke
parents:
diff changeset
699 ValueStack* _lock_stack; // contains lock and scope information
a61af66fc99e Initial load
duke
parents:
diff changeset
700 NullCheck* _explicit_null_check; // For explicit null check elimination
a61af66fc99e Initial load
duke
parents:
diff changeset
701
a61af66fc99e Initial load
duke
parents:
diff changeset
702 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
703 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
704 AccessField(Value obj, int offset, ciField* field, bool is_static, ValueStack* lock_stack,
a61af66fc99e Initial load
duke
parents:
diff changeset
705 ValueStack* state_before, bool is_loaded, bool is_initialized)
a61af66fc99e Initial load
duke
parents:
diff changeset
706 : Instruction(as_ValueType(field->type()->basic_type()))
a61af66fc99e Initial load
duke
parents:
diff changeset
707 , _obj(obj)
a61af66fc99e Initial load
duke
parents:
diff changeset
708 , _offset(offset)
a61af66fc99e Initial load
duke
parents:
diff changeset
709 , _field(field)
a61af66fc99e Initial load
duke
parents:
diff changeset
710 , _lock_stack(lock_stack)
a61af66fc99e Initial load
duke
parents:
diff changeset
711 , _state_before(state_before)
a61af66fc99e Initial load
duke
parents:
diff changeset
712 , _explicit_null_check(NULL)
a61af66fc99e Initial load
duke
parents:
diff changeset
713 {
a61af66fc99e Initial load
duke
parents:
diff changeset
714 set_needs_null_check(!is_static);
a61af66fc99e Initial load
duke
parents:
diff changeset
715 set_flag(IsLoadedFlag, is_loaded);
a61af66fc99e Initial load
duke
parents:
diff changeset
716 set_flag(IsInitializedFlag, is_initialized);
a61af66fc99e Initial load
duke
parents:
diff changeset
717 set_flag(IsStaticFlag, is_static);
a61af66fc99e Initial load
duke
parents:
diff changeset
718 ASSERT_VALUES
a61af66fc99e Initial load
duke
parents:
diff changeset
719 if (!is_loaded || (PatchALot && !field->is_volatile())) {
a61af66fc99e Initial load
duke
parents:
diff changeset
720 // need to patch if the holder wasn't loaded or we're testing
a61af66fc99e Initial load
duke
parents:
diff changeset
721 // using PatchALot. Don't allow PatchALot for fields which are
a61af66fc99e Initial load
duke
parents:
diff changeset
722 // known to be volatile they aren't patchable.
a61af66fc99e Initial load
duke
parents:
diff changeset
723 set_flag(NeedsPatchingFlag, true);
a61af66fc99e Initial load
duke
parents:
diff changeset
724 }
a61af66fc99e Initial load
duke
parents:
diff changeset
725 // pin of all instructions with memory access
a61af66fc99e Initial load
duke
parents:
diff changeset
726 pin();
a61af66fc99e Initial load
duke
parents:
diff changeset
727 }
a61af66fc99e Initial load
duke
parents:
diff changeset
728
a61af66fc99e Initial load
duke
parents:
diff changeset
729 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
730 Value obj() const { return _obj; }
a61af66fc99e Initial load
duke
parents:
diff changeset
731 int offset() const { return _offset; }
a61af66fc99e Initial load
duke
parents:
diff changeset
732 ciField* field() const { return _field; }
a61af66fc99e Initial load
duke
parents:
diff changeset
733 BasicType field_type() const { return _field->type()->basic_type(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
734 bool is_static() const { return check_flag(IsStaticFlag); }
a61af66fc99e Initial load
duke
parents:
diff changeset
735 bool is_loaded() const { return check_flag(IsLoadedFlag); }
a61af66fc99e Initial load
duke
parents:
diff changeset
736 bool is_initialized() const { return check_flag(IsInitializedFlag); }
a61af66fc99e Initial load
duke
parents:
diff changeset
737 ValueStack* state_before() const { return _state_before; }
a61af66fc99e Initial load
duke
parents:
diff changeset
738 ValueStack* lock_stack() const { return _lock_stack; }
a61af66fc99e Initial load
duke
parents:
diff changeset
739 NullCheck* explicit_null_check() const { return _explicit_null_check; }
a61af66fc99e Initial load
duke
parents:
diff changeset
740 bool needs_patching() const { return check_flag(NeedsPatchingFlag); }
a61af66fc99e Initial load
duke
parents:
diff changeset
741
a61af66fc99e Initial load
duke
parents:
diff changeset
742 // manipulation
a61af66fc99e Initial load
duke
parents:
diff changeset
743 void set_lock_stack(ValueStack* l) { _lock_stack = l; }
a61af66fc99e Initial load
duke
parents:
diff changeset
744 // Under certain circumstances, if a previous NullCheck instruction
a61af66fc99e Initial load
duke
parents:
diff changeset
745 // proved the target object non-null, we can eliminate the explicit
a61af66fc99e Initial load
duke
parents:
diff changeset
746 // null check and do an implicit one, simply specifying the debug
a61af66fc99e Initial load
duke
parents:
diff changeset
747 // information from the NullCheck. This field should only be consulted
a61af66fc99e Initial load
duke
parents:
diff changeset
748 // if needs_null_check() is true.
a61af66fc99e Initial load
duke
parents:
diff changeset
749 void set_explicit_null_check(NullCheck* check) { _explicit_null_check = check; }
a61af66fc99e Initial load
duke
parents:
diff changeset
750
a61af66fc99e Initial load
duke
parents:
diff changeset
751 // generic
a61af66fc99e Initial load
duke
parents:
diff changeset
752 virtual bool can_trap() const { return needs_null_check() || needs_patching(); }
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
753 virtual void input_values_do(ValueVisitor* f) { f->visit(&_obj); }
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
754 virtual void other_values_do(ValueVisitor* f);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
755 };
a61af66fc99e Initial load
duke
parents:
diff changeset
756
a61af66fc99e Initial load
duke
parents:
diff changeset
757
a61af66fc99e Initial load
duke
parents:
diff changeset
758 LEAF(LoadField, AccessField)
a61af66fc99e Initial load
duke
parents:
diff changeset
759 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
760 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
761 LoadField(Value obj, int offset, ciField* field, bool is_static, ValueStack* lock_stack,
a61af66fc99e Initial load
duke
parents:
diff changeset
762 ValueStack* state_before, bool is_loaded, bool is_initialized)
a61af66fc99e Initial load
duke
parents:
diff changeset
763 : AccessField(obj, offset, field, is_static, lock_stack, state_before, is_loaded, is_initialized)
a61af66fc99e Initial load
duke
parents:
diff changeset
764 {}
a61af66fc99e Initial load
duke
parents:
diff changeset
765
a61af66fc99e Initial load
duke
parents:
diff changeset
766 ciType* declared_type() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
767 ciType* exact_type() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
768
a61af66fc99e Initial load
duke
parents:
diff changeset
769 // generic
a61af66fc99e Initial load
duke
parents:
diff changeset
770 HASHING2(LoadField, is_loaded() && !field()->is_volatile(), obj()->subst(), offset()) // cannot be eliminated if not yet loaded or if volatile
a61af66fc99e Initial load
duke
parents:
diff changeset
771 };
a61af66fc99e Initial load
duke
parents:
diff changeset
772
a61af66fc99e Initial load
duke
parents:
diff changeset
773
a61af66fc99e Initial load
duke
parents:
diff changeset
774 LEAF(StoreField, AccessField)
a61af66fc99e Initial load
duke
parents:
diff changeset
775 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
776 Value _value;
a61af66fc99e Initial load
duke
parents:
diff changeset
777
a61af66fc99e Initial load
duke
parents:
diff changeset
778 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
779 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
780 StoreField(Value obj, int offset, ciField* field, Value value, bool is_static, ValueStack* lock_stack,
a61af66fc99e Initial load
duke
parents:
diff changeset
781 ValueStack* state_before, bool is_loaded, bool is_initialized)
a61af66fc99e Initial load
duke
parents:
diff changeset
782 : AccessField(obj, offset, field, is_static, lock_stack, state_before, is_loaded, is_initialized)
a61af66fc99e Initial load
duke
parents:
diff changeset
783 , _value(value)
a61af66fc99e Initial load
duke
parents:
diff changeset
784 {
a61af66fc99e Initial load
duke
parents:
diff changeset
785 set_flag(NeedsWriteBarrierFlag, as_ValueType(field_type())->is_object());
a61af66fc99e Initial load
duke
parents:
diff changeset
786 ASSERT_VALUES
a61af66fc99e Initial load
duke
parents:
diff changeset
787 pin();
a61af66fc99e Initial load
duke
parents:
diff changeset
788 }
a61af66fc99e Initial load
duke
parents:
diff changeset
789
a61af66fc99e Initial load
duke
parents:
diff changeset
790 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
791 Value value() const { return _value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
792 bool needs_write_barrier() const { return check_flag(NeedsWriteBarrierFlag); }
a61af66fc99e Initial load
duke
parents:
diff changeset
793
a61af66fc99e Initial load
duke
parents:
diff changeset
794 // generic
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
795 virtual void input_values_do(ValueVisitor* f) { AccessField::input_values_do(f); f->visit(&_value); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
796 };
a61af66fc99e Initial load
duke
parents:
diff changeset
797
a61af66fc99e Initial load
duke
parents:
diff changeset
798
a61af66fc99e Initial load
duke
parents:
diff changeset
799 BASE(AccessArray, Instruction)
a61af66fc99e Initial load
duke
parents:
diff changeset
800 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
801 Value _array;
a61af66fc99e Initial load
duke
parents:
diff changeset
802 ValueStack* _lock_stack;
a61af66fc99e Initial load
duke
parents:
diff changeset
803
a61af66fc99e Initial load
duke
parents:
diff changeset
804 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
805 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
806 AccessArray(ValueType* type, Value array, ValueStack* lock_stack)
a61af66fc99e Initial load
duke
parents:
diff changeset
807 : Instruction(type)
a61af66fc99e Initial load
duke
parents:
diff changeset
808 , _array(array)
a61af66fc99e Initial load
duke
parents:
diff changeset
809 , _lock_stack(lock_stack) {
a61af66fc99e Initial load
duke
parents:
diff changeset
810 set_needs_null_check(true);
a61af66fc99e Initial load
duke
parents:
diff changeset
811 ASSERT_VALUES
a61af66fc99e Initial load
duke
parents:
diff changeset
812 pin(); // instruction with side effect (null exception or range check throwing)
a61af66fc99e Initial load
duke
parents:
diff changeset
813 }
a61af66fc99e Initial load
duke
parents:
diff changeset
814
a61af66fc99e Initial load
duke
parents:
diff changeset
815 Value array() const { return _array; }
a61af66fc99e Initial load
duke
parents:
diff changeset
816 ValueStack* lock_stack() const { return _lock_stack; }
a61af66fc99e Initial load
duke
parents:
diff changeset
817
a61af66fc99e Initial load
duke
parents:
diff changeset
818 // setters
a61af66fc99e Initial load
duke
parents:
diff changeset
819 void set_lock_stack(ValueStack* l) { _lock_stack = l; }
a61af66fc99e Initial load
duke
parents:
diff changeset
820
a61af66fc99e Initial load
duke
parents:
diff changeset
821 // generic
a61af66fc99e Initial load
duke
parents:
diff changeset
822 virtual bool can_trap() const { return needs_null_check(); }
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
823 virtual void input_values_do(ValueVisitor* f) { f->visit(&_array); }
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
824 virtual void other_values_do(ValueVisitor* f);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
825 };
a61af66fc99e Initial load
duke
parents:
diff changeset
826
a61af66fc99e Initial load
duke
parents:
diff changeset
827
a61af66fc99e Initial load
duke
parents:
diff changeset
828 LEAF(ArrayLength, AccessArray)
a61af66fc99e Initial load
duke
parents:
diff changeset
829 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
830 NullCheck* _explicit_null_check; // For explicit null check elimination
a61af66fc99e Initial load
duke
parents:
diff changeset
831
a61af66fc99e Initial load
duke
parents:
diff changeset
832 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
833 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
834 ArrayLength(Value array, ValueStack* lock_stack)
a61af66fc99e Initial load
duke
parents:
diff changeset
835 : AccessArray(intType, array, lock_stack)
a61af66fc99e Initial load
duke
parents:
diff changeset
836 , _explicit_null_check(NULL) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
837
a61af66fc99e Initial load
duke
parents:
diff changeset
838 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
839 NullCheck* explicit_null_check() const { return _explicit_null_check; }
a61af66fc99e Initial load
duke
parents:
diff changeset
840
a61af66fc99e Initial load
duke
parents:
diff changeset
841 // setters
a61af66fc99e Initial load
duke
parents:
diff changeset
842 // See LoadField::set_explicit_null_check for documentation
a61af66fc99e Initial load
duke
parents:
diff changeset
843 void set_explicit_null_check(NullCheck* check) { _explicit_null_check = check; }
a61af66fc99e Initial load
duke
parents:
diff changeset
844
a61af66fc99e Initial load
duke
parents:
diff changeset
845 // generic
a61af66fc99e Initial load
duke
parents:
diff changeset
846 HASHING1(ArrayLength, true, array()->subst())
a61af66fc99e Initial load
duke
parents:
diff changeset
847 };
a61af66fc99e Initial load
duke
parents:
diff changeset
848
a61af66fc99e Initial load
duke
parents:
diff changeset
849
a61af66fc99e Initial load
duke
parents:
diff changeset
850 BASE(AccessIndexed, AccessArray)
a61af66fc99e Initial load
duke
parents:
diff changeset
851 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
852 Value _index;
a61af66fc99e Initial load
duke
parents:
diff changeset
853 Value _length;
a61af66fc99e Initial load
duke
parents:
diff changeset
854 BasicType _elt_type;
a61af66fc99e Initial load
duke
parents:
diff changeset
855
a61af66fc99e Initial load
duke
parents:
diff changeset
856 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
857 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
858 AccessIndexed(Value array, Value index, Value length, BasicType elt_type, ValueStack* lock_stack)
a61af66fc99e Initial load
duke
parents:
diff changeset
859 : AccessArray(as_ValueType(elt_type), array, lock_stack)
a61af66fc99e Initial load
duke
parents:
diff changeset
860 , _index(index)
a61af66fc99e Initial load
duke
parents:
diff changeset
861 , _length(length)
a61af66fc99e Initial load
duke
parents:
diff changeset
862 , _elt_type(elt_type)
a61af66fc99e Initial load
duke
parents:
diff changeset
863 {
a61af66fc99e Initial load
duke
parents:
diff changeset
864 ASSERT_VALUES
a61af66fc99e Initial load
duke
parents:
diff changeset
865 }
a61af66fc99e Initial load
duke
parents:
diff changeset
866
a61af66fc99e Initial load
duke
parents:
diff changeset
867 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
868 Value index() const { return _index; }
a61af66fc99e Initial load
duke
parents:
diff changeset
869 Value length() const { return _length; }
a61af66fc99e Initial load
duke
parents:
diff changeset
870 BasicType elt_type() const { return _elt_type; }
a61af66fc99e Initial load
duke
parents:
diff changeset
871
a61af66fc99e Initial load
duke
parents:
diff changeset
872 // perform elimination of range checks involving constants
a61af66fc99e Initial load
duke
parents:
diff changeset
873 bool compute_needs_range_check();
a61af66fc99e Initial load
duke
parents:
diff changeset
874
a61af66fc99e Initial load
duke
parents:
diff changeset
875 // generic
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
876 virtual void input_values_do(ValueVisitor* f) { AccessArray::input_values_do(f); f->visit(&_index); if (_length != NULL) f->visit(&_length); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
877 };
a61af66fc99e Initial load
duke
parents:
diff changeset
878
a61af66fc99e Initial load
duke
parents:
diff changeset
879
a61af66fc99e Initial load
duke
parents:
diff changeset
880 LEAF(LoadIndexed, AccessIndexed)
a61af66fc99e Initial load
duke
parents:
diff changeset
881 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
882 NullCheck* _explicit_null_check; // For explicit null check elimination
a61af66fc99e Initial load
duke
parents:
diff changeset
883
a61af66fc99e Initial load
duke
parents:
diff changeset
884 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
885 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
886 LoadIndexed(Value array, Value index, Value length, BasicType elt_type, ValueStack* lock_stack)
a61af66fc99e Initial load
duke
parents:
diff changeset
887 : AccessIndexed(array, index, length, elt_type, lock_stack)
a61af66fc99e Initial load
duke
parents:
diff changeset
888 , _explicit_null_check(NULL) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
889
a61af66fc99e Initial load
duke
parents:
diff changeset
890 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
891 NullCheck* explicit_null_check() const { return _explicit_null_check; }
a61af66fc99e Initial load
duke
parents:
diff changeset
892
a61af66fc99e Initial load
duke
parents:
diff changeset
893 // setters
a61af66fc99e Initial load
duke
parents:
diff changeset
894 // See LoadField::set_explicit_null_check for documentation
a61af66fc99e Initial load
duke
parents:
diff changeset
895 void set_explicit_null_check(NullCheck* check) { _explicit_null_check = check; }
a61af66fc99e Initial load
duke
parents:
diff changeset
896
a61af66fc99e Initial load
duke
parents:
diff changeset
897 ciType* exact_type() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
898 ciType* declared_type() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
899
a61af66fc99e Initial load
duke
parents:
diff changeset
900 // generic
a61af66fc99e Initial load
duke
parents:
diff changeset
901 HASHING2(LoadIndexed, true, array()->subst(), index()->subst())
a61af66fc99e Initial load
duke
parents:
diff changeset
902 };
a61af66fc99e Initial load
duke
parents:
diff changeset
903
a61af66fc99e Initial load
duke
parents:
diff changeset
904
a61af66fc99e Initial load
duke
parents:
diff changeset
905 LEAF(StoreIndexed, AccessIndexed)
a61af66fc99e Initial load
duke
parents:
diff changeset
906 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
907 Value _value;
a61af66fc99e Initial load
duke
parents:
diff changeset
908
a61af66fc99e Initial load
duke
parents:
diff changeset
909 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
910 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
911 StoreIndexed(Value array, Value index, Value length, BasicType elt_type, Value value, ValueStack* lock_stack)
a61af66fc99e Initial load
duke
parents:
diff changeset
912 : AccessIndexed(array, index, length, elt_type, lock_stack)
a61af66fc99e Initial load
duke
parents:
diff changeset
913 , _value(value)
a61af66fc99e Initial load
duke
parents:
diff changeset
914 {
a61af66fc99e Initial load
duke
parents:
diff changeset
915 set_flag(NeedsWriteBarrierFlag, (as_ValueType(elt_type)->is_object()));
a61af66fc99e Initial load
duke
parents:
diff changeset
916 set_flag(NeedsStoreCheckFlag, (as_ValueType(elt_type)->is_object()));
a61af66fc99e Initial load
duke
parents:
diff changeset
917 ASSERT_VALUES
a61af66fc99e Initial load
duke
parents:
diff changeset
918 pin();
a61af66fc99e Initial load
duke
parents:
diff changeset
919 }
a61af66fc99e Initial load
duke
parents:
diff changeset
920
a61af66fc99e Initial load
duke
parents:
diff changeset
921 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
922 Value value() const { return _value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
923 IRScope* scope() const; // the state's scope
a61af66fc99e Initial load
duke
parents:
diff changeset
924 bool needs_write_barrier() const { return check_flag(NeedsWriteBarrierFlag); }
a61af66fc99e Initial load
duke
parents:
diff changeset
925 bool needs_store_check() const { return check_flag(NeedsStoreCheckFlag); }
a61af66fc99e Initial load
duke
parents:
diff changeset
926
a61af66fc99e Initial load
duke
parents:
diff changeset
927 // generic
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
928 virtual void input_values_do(ValueVisitor* f) { AccessIndexed::input_values_do(f); f->visit(&_value); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
929 };
a61af66fc99e Initial load
duke
parents:
diff changeset
930
a61af66fc99e Initial load
duke
parents:
diff changeset
931
a61af66fc99e Initial load
duke
parents:
diff changeset
932 LEAF(NegateOp, Instruction)
a61af66fc99e Initial load
duke
parents:
diff changeset
933 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
934 Value _x;
a61af66fc99e Initial load
duke
parents:
diff changeset
935
a61af66fc99e Initial load
duke
parents:
diff changeset
936 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
937 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
938 NegateOp(Value x) : Instruction(x->type()->base()), _x(x) {
a61af66fc99e Initial load
duke
parents:
diff changeset
939 ASSERT_VALUES
a61af66fc99e Initial load
duke
parents:
diff changeset
940 }
a61af66fc99e Initial load
duke
parents:
diff changeset
941
a61af66fc99e Initial load
duke
parents:
diff changeset
942 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
943 Value x() const { return _x; }
a61af66fc99e Initial load
duke
parents:
diff changeset
944
a61af66fc99e Initial load
duke
parents:
diff changeset
945 // generic
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
946 virtual void input_values_do(ValueVisitor* f) { f->visit(&_x); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
947 };
a61af66fc99e Initial load
duke
parents:
diff changeset
948
a61af66fc99e Initial load
duke
parents:
diff changeset
949
a61af66fc99e Initial load
duke
parents:
diff changeset
950 BASE(Op2, Instruction)
a61af66fc99e Initial load
duke
parents:
diff changeset
951 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
952 Bytecodes::Code _op;
a61af66fc99e Initial load
duke
parents:
diff changeset
953 Value _x;
a61af66fc99e Initial load
duke
parents:
diff changeset
954 Value _y;
a61af66fc99e Initial load
duke
parents:
diff changeset
955
a61af66fc99e Initial load
duke
parents:
diff changeset
956 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
957 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
958 Op2(ValueType* type, Bytecodes::Code op, Value x, Value y) : Instruction(type), _op(op), _x(x), _y(y) {
a61af66fc99e Initial load
duke
parents:
diff changeset
959 ASSERT_VALUES
a61af66fc99e Initial load
duke
parents:
diff changeset
960 }
a61af66fc99e Initial load
duke
parents:
diff changeset
961
a61af66fc99e Initial load
duke
parents:
diff changeset
962 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
963 Bytecodes::Code op() const { return _op; }
a61af66fc99e Initial load
duke
parents:
diff changeset
964 Value x() const { return _x; }
a61af66fc99e Initial load
duke
parents:
diff changeset
965 Value y() const { return _y; }
a61af66fc99e Initial load
duke
parents:
diff changeset
966
a61af66fc99e Initial load
duke
parents:
diff changeset
967 // manipulators
a61af66fc99e Initial load
duke
parents:
diff changeset
968 void swap_operands() {
a61af66fc99e Initial load
duke
parents:
diff changeset
969 assert(is_commutative(), "operation must be commutative");
a61af66fc99e Initial load
duke
parents:
diff changeset
970 Value t = _x; _x = _y; _y = t;
a61af66fc99e Initial load
duke
parents:
diff changeset
971 }
a61af66fc99e Initial load
duke
parents:
diff changeset
972
a61af66fc99e Initial load
duke
parents:
diff changeset
973 // generic
a61af66fc99e Initial load
duke
parents:
diff changeset
974 virtual bool is_commutative() const { return false; }
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
975 virtual void input_values_do(ValueVisitor* f) { f->visit(&_x); f->visit(&_y); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
976 };
a61af66fc99e Initial load
duke
parents:
diff changeset
977
a61af66fc99e Initial load
duke
parents:
diff changeset
978
a61af66fc99e Initial load
duke
parents:
diff changeset
979 LEAF(ArithmeticOp, Op2)
a61af66fc99e Initial load
duke
parents:
diff changeset
980 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
981 ValueStack* _lock_stack; // used only for division operations
a61af66fc99e Initial load
duke
parents:
diff changeset
982 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
983 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
984 ArithmeticOp(Bytecodes::Code op, Value x, Value y, bool is_strictfp, ValueStack* lock_stack)
a61af66fc99e Initial load
duke
parents:
diff changeset
985 : Op2(x->type()->meet(y->type()), op, x, y)
a61af66fc99e Initial load
duke
parents:
diff changeset
986 , _lock_stack(lock_stack) {
a61af66fc99e Initial load
duke
parents:
diff changeset
987 set_flag(IsStrictfpFlag, is_strictfp);
a61af66fc99e Initial load
duke
parents:
diff changeset
988 if (can_trap()) pin();
a61af66fc99e Initial load
duke
parents:
diff changeset
989 }
a61af66fc99e Initial load
duke
parents:
diff changeset
990
a61af66fc99e Initial load
duke
parents:
diff changeset
991 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
992 ValueStack* lock_stack() const { return _lock_stack; }
a61af66fc99e Initial load
duke
parents:
diff changeset
993 bool is_strictfp() const { return check_flag(IsStrictfpFlag); }
a61af66fc99e Initial load
duke
parents:
diff changeset
994
a61af66fc99e Initial load
duke
parents:
diff changeset
995 // setters
a61af66fc99e Initial load
duke
parents:
diff changeset
996 void set_lock_stack(ValueStack* l) { _lock_stack = l; }
a61af66fc99e Initial load
duke
parents:
diff changeset
997
a61af66fc99e Initial load
duke
parents:
diff changeset
998 // generic
a61af66fc99e Initial load
duke
parents:
diff changeset
999 virtual bool is_commutative() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
1000 virtual bool can_trap() const;
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1001 virtual void other_values_do(ValueVisitor* f);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1002 HASHING3(Op2, true, op(), x()->subst(), y()->subst())
a61af66fc99e Initial load
duke
parents:
diff changeset
1003 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1004
a61af66fc99e Initial load
duke
parents:
diff changeset
1005
a61af66fc99e Initial load
duke
parents:
diff changeset
1006 LEAF(ShiftOp, Op2)
a61af66fc99e Initial load
duke
parents:
diff changeset
1007 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
1008 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
1009 ShiftOp(Bytecodes::Code op, Value x, Value s) : Op2(x->type()->base(), op, x, s) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
1010
a61af66fc99e Initial load
duke
parents:
diff changeset
1011 // generic
a61af66fc99e Initial load
duke
parents:
diff changeset
1012 HASHING3(Op2, true, op(), x()->subst(), y()->subst())
a61af66fc99e Initial load
duke
parents:
diff changeset
1013 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1014
a61af66fc99e Initial load
duke
parents:
diff changeset
1015
a61af66fc99e Initial load
duke
parents:
diff changeset
1016 LEAF(LogicOp, Op2)
a61af66fc99e Initial load
duke
parents:
diff changeset
1017 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
1018 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
1019 LogicOp(Bytecodes::Code op, Value x, Value y) : Op2(x->type()->meet(y->type()), op, x, y) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
1020
a61af66fc99e Initial load
duke
parents:
diff changeset
1021 // generic
a61af66fc99e Initial load
duke
parents:
diff changeset
1022 virtual bool is_commutative() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
1023 HASHING3(Op2, true, op(), x()->subst(), y()->subst())
a61af66fc99e Initial load
duke
parents:
diff changeset
1024 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1025
a61af66fc99e Initial load
duke
parents:
diff changeset
1026
a61af66fc99e Initial load
duke
parents:
diff changeset
1027 LEAF(CompareOp, Op2)
a61af66fc99e Initial load
duke
parents:
diff changeset
1028 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
1029 ValueStack* _state_before; // for deoptimization, when canonicalizing
a61af66fc99e Initial load
duke
parents:
diff changeset
1030 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
1031 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
1032 CompareOp(Bytecodes::Code op, Value x, Value y, ValueStack* state_before)
a61af66fc99e Initial load
duke
parents:
diff changeset
1033 : Op2(intType, op, x, y)
a61af66fc99e Initial load
duke
parents:
diff changeset
1034 , _state_before(state_before)
a61af66fc99e Initial load
duke
parents:
diff changeset
1035 {}
a61af66fc99e Initial load
duke
parents:
diff changeset
1036
a61af66fc99e Initial load
duke
parents:
diff changeset
1037 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
1038 ValueStack* state_before() const { return _state_before; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1039
a61af66fc99e Initial load
duke
parents:
diff changeset
1040 // generic
a61af66fc99e Initial load
duke
parents:
diff changeset
1041 HASHING3(Op2, true, op(), x()->subst(), y()->subst())
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1042 virtual void other_values_do(ValueVisitor* f);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1043 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1044
a61af66fc99e Initial load
duke
parents:
diff changeset
1045
a61af66fc99e Initial load
duke
parents:
diff changeset
1046 LEAF(IfOp, Op2)
a61af66fc99e Initial load
duke
parents:
diff changeset
1047 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
1048 Value _tval;
a61af66fc99e Initial load
duke
parents:
diff changeset
1049 Value _fval;
a61af66fc99e Initial load
duke
parents:
diff changeset
1050
a61af66fc99e Initial load
duke
parents:
diff changeset
1051 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
1052 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
1053 IfOp(Value x, Condition cond, Value y, Value tval, Value fval)
a61af66fc99e Initial load
duke
parents:
diff changeset
1054 : Op2(tval->type()->meet(fval->type()), (Bytecodes::Code)cond, x, y)
a61af66fc99e Initial load
duke
parents:
diff changeset
1055 , _tval(tval)
a61af66fc99e Initial load
duke
parents:
diff changeset
1056 , _fval(fval)
a61af66fc99e Initial load
duke
parents:
diff changeset
1057 {
a61af66fc99e Initial load
duke
parents:
diff changeset
1058 ASSERT_VALUES
a61af66fc99e Initial load
duke
parents:
diff changeset
1059 assert(tval->type()->tag() == fval->type()->tag(), "types must match");
a61af66fc99e Initial load
duke
parents:
diff changeset
1060 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1061
a61af66fc99e Initial load
duke
parents:
diff changeset
1062 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
1063 virtual bool is_commutative() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
1064 Bytecodes::Code op() const { ShouldNotCallThis(); return Bytecodes::_illegal; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1065 Condition cond() const { return (Condition)Op2::op(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1066 Value tval() const { return _tval; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1067 Value fval() const { return _fval; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1068
a61af66fc99e Initial load
duke
parents:
diff changeset
1069 // generic
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1070 virtual void input_values_do(ValueVisitor* f) { Op2::input_values_do(f); f->visit(&_tval); f->visit(&_fval); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1071 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1072
a61af66fc99e Initial load
duke
parents:
diff changeset
1073
a61af66fc99e Initial load
duke
parents:
diff changeset
1074 LEAF(Convert, Instruction)
a61af66fc99e Initial load
duke
parents:
diff changeset
1075 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
1076 Bytecodes::Code _op;
a61af66fc99e Initial load
duke
parents:
diff changeset
1077 Value _value;
a61af66fc99e Initial load
duke
parents:
diff changeset
1078
a61af66fc99e Initial load
duke
parents:
diff changeset
1079 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
1080 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
1081 Convert(Bytecodes::Code op, Value value, ValueType* to_type) : Instruction(to_type), _op(op), _value(value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1082 ASSERT_VALUES
a61af66fc99e Initial load
duke
parents:
diff changeset
1083 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1084
a61af66fc99e Initial load
duke
parents:
diff changeset
1085 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
1086 Bytecodes::Code op() const { return _op; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1087 Value value() const { return _value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1088
a61af66fc99e Initial load
duke
parents:
diff changeset
1089 // generic
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1090 virtual void input_values_do(ValueVisitor* f) { f->visit(&_value); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1091 HASHING2(Convert, true, op(), value()->subst())
a61af66fc99e Initial load
duke
parents:
diff changeset
1092 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1093
a61af66fc99e Initial load
duke
parents:
diff changeset
1094
a61af66fc99e Initial load
duke
parents:
diff changeset
1095 LEAF(NullCheck, Instruction)
a61af66fc99e Initial load
duke
parents:
diff changeset
1096 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
1097 Value _obj;
a61af66fc99e Initial load
duke
parents:
diff changeset
1098 ValueStack* _lock_stack;
a61af66fc99e Initial load
duke
parents:
diff changeset
1099
a61af66fc99e Initial load
duke
parents:
diff changeset
1100 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
1101 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
1102 NullCheck(Value obj, ValueStack* lock_stack) : Instruction(obj->type()->base()), _obj(obj), _lock_stack(lock_stack) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1103 ASSERT_VALUES
a61af66fc99e Initial load
duke
parents:
diff changeset
1104 set_can_trap(true);
a61af66fc99e Initial load
duke
parents:
diff changeset
1105 assert(_obj->type()->is_object(), "null check must be applied to objects only");
a61af66fc99e Initial load
duke
parents:
diff changeset
1106 pin(Instruction::PinExplicitNullCheck);
a61af66fc99e Initial load
duke
parents:
diff changeset
1107 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1108
a61af66fc99e Initial load
duke
parents:
diff changeset
1109 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
1110 Value obj() const { return _obj; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1111 ValueStack* lock_stack() const { return _lock_stack; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1112
a61af66fc99e Initial load
duke
parents:
diff changeset
1113 // setters
a61af66fc99e Initial load
duke
parents:
diff changeset
1114 void set_lock_stack(ValueStack* l) { _lock_stack = l; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1115 void set_can_trap(bool can_trap) { set_flag(CanTrapFlag, can_trap); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1116
a61af66fc99e Initial load
duke
parents:
diff changeset
1117 // generic
a61af66fc99e Initial load
duke
parents:
diff changeset
1118 virtual bool can_trap() const { return check_flag(CanTrapFlag); /* null-check elimination sets to false */ }
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1119 virtual void input_values_do(ValueVisitor* f) { f->visit(&_obj); }
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1120 virtual void other_values_do(ValueVisitor* f);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1121 HASHING1(NullCheck, true, obj()->subst())
a61af66fc99e Initial load
duke
parents:
diff changeset
1122 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1123
a61af66fc99e Initial load
duke
parents:
diff changeset
1124
a61af66fc99e Initial load
duke
parents:
diff changeset
1125 BASE(StateSplit, Instruction)
a61af66fc99e Initial load
duke
parents:
diff changeset
1126 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
1127 ValueStack* _state;
a61af66fc99e Initial load
duke
parents:
diff changeset
1128
a61af66fc99e Initial load
duke
parents:
diff changeset
1129 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
1130 static void substitute(BlockList& list, BlockBegin* old_block, BlockBegin* new_block);
a61af66fc99e Initial load
duke
parents:
diff changeset
1131
a61af66fc99e Initial load
duke
parents:
diff changeset
1132 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
1133 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
1134 StateSplit(ValueType* type) : Instruction(type), _state(NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1135 pin(PinStateSplitConstructor);
a61af66fc99e Initial load
duke
parents:
diff changeset
1136 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1137
a61af66fc99e Initial load
duke
parents:
diff changeset
1138 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
1139 ValueStack* state() const { return _state; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1140 IRScope* scope() const; // the state's scope
a61af66fc99e Initial load
duke
parents:
diff changeset
1141
a61af66fc99e Initial load
duke
parents:
diff changeset
1142 // manipulation
a61af66fc99e Initial load
duke
parents:
diff changeset
1143 void set_state(ValueStack* state) { _state = state; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1144
a61af66fc99e Initial load
duke
parents:
diff changeset
1145 // generic
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1146 virtual void input_values_do(ValueVisitor* f) { /* no values */ }
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1147 virtual void state_values_do(ValueVisitor* f);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1148 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1149
a61af66fc99e Initial load
duke
parents:
diff changeset
1150
a61af66fc99e Initial load
duke
parents:
diff changeset
1151 LEAF(Invoke, StateSplit)
a61af66fc99e Initial load
duke
parents:
diff changeset
1152 private:
1295
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 0
diff changeset
1153 Bytecodes::Code _code;
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 0
diff changeset
1154 Value _recv;
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 0
diff changeset
1155 Values* _args;
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 0
diff changeset
1156 BasicTypeList* _signature;
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 0
diff changeset
1157 int _vtable_index;
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 0
diff changeset
1158 ciMethod* _target;
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 0
diff changeset
1159 ValueStack* _state_before; // Required for deoptimization.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1160
a61af66fc99e Initial load
duke
parents:
diff changeset
1161 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
1162 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
1163 Invoke(Bytecodes::Code code, ValueType* result_type, Value recv, Values* args,
1295
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 0
diff changeset
1164 int vtable_index, ciMethod* target, ValueStack* state_before);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1165
a61af66fc99e Initial load
duke
parents:
diff changeset
1166 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
1167 Bytecodes::Code code() const { return _code; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1168 Value receiver() const { return _recv; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1169 bool has_receiver() const { return receiver() != NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1170 int number_of_arguments() const { return _args->length(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1171 Value argument_at(int i) const { return _args->at(i); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1172 int vtable_index() const { return _vtable_index; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1173 BasicTypeList* signature() const { return _signature; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1174 ciMethod* target() const { return _target; }
1295
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 0
diff changeset
1175 ValueStack* state_before() const { return _state_before; }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1176
a61af66fc99e Initial load
duke
parents:
diff changeset
1177 // Returns false if target is not loaded
a61af66fc99e Initial load
duke
parents:
diff changeset
1178 bool target_is_final() const { return check_flag(TargetIsFinalFlag); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1179 bool target_is_loaded() const { return check_flag(TargetIsLoadedFlag); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1180 // Returns false if target is not loaded
a61af66fc99e Initial load
duke
parents:
diff changeset
1181 bool target_is_strictfp() const { return check_flag(TargetIsStrictfpFlag); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1182
1295
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 0
diff changeset
1183 // JSR 292 support
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 0
diff changeset
1184 bool is_invokedynamic() const { return code() == Bytecodes::_invokedynamic; }
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 0
diff changeset
1185
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1186 // generic
a61af66fc99e Initial load
duke
parents:
diff changeset
1187 virtual bool can_trap() const { return true; }
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1188 virtual void input_values_do(ValueVisitor* f) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1189 StateSplit::input_values_do(f);
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1190 if (has_receiver()) f->visit(&_recv);
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1191 for (int i = 0; i < _args->length(); i++) f->visit(_args->adr_at(i));
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1192 }
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1193 virtual void state_values_do(ValueVisitor *f);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1194 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1195
a61af66fc99e Initial load
duke
parents:
diff changeset
1196
a61af66fc99e Initial load
duke
parents:
diff changeset
1197 LEAF(NewInstance, StateSplit)
a61af66fc99e Initial load
duke
parents:
diff changeset
1198 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
1199 ciInstanceKlass* _klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
1200
a61af66fc99e Initial load
duke
parents:
diff changeset
1201 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
1202 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
1203 NewInstance(ciInstanceKlass* klass) : StateSplit(instanceType), _klass(klass) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
1204
a61af66fc99e Initial load
duke
parents:
diff changeset
1205 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
1206 ciInstanceKlass* klass() const { return _klass; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1207
a61af66fc99e Initial load
duke
parents:
diff changeset
1208 // generic
a61af66fc99e Initial load
duke
parents:
diff changeset
1209 virtual bool can_trap() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1210 ciType* exact_type() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
1211 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1212
a61af66fc99e Initial load
duke
parents:
diff changeset
1213
a61af66fc99e Initial load
duke
parents:
diff changeset
1214 BASE(NewArray, StateSplit)
a61af66fc99e Initial load
duke
parents:
diff changeset
1215 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
1216 Value _length;
a61af66fc99e Initial load
duke
parents:
diff changeset
1217 ValueStack* _state_before;
a61af66fc99e Initial load
duke
parents:
diff changeset
1218
a61af66fc99e Initial load
duke
parents:
diff changeset
1219 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
1220 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
1221 NewArray(Value length, ValueStack* state_before) : StateSplit(objectType), _length(length), _state_before(state_before) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1222 // Do not ASSERT_VALUES since length is NULL for NewMultiArray
a61af66fc99e Initial load
duke
parents:
diff changeset
1223 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1224
a61af66fc99e Initial load
duke
parents:
diff changeset
1225 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
1226 ValueStack* state_before() const { return _state_before; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1227 Value length() const { return _length; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1228
a61af66fc99e Initial load
duke
parents:
diff changeset
1229 // generic
a61af66fc99e Initial load
duke
parents:
diff changeset
1230 virtual bool can_trap() const { return true; }
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1231 virtual void input_values_do(ValueVisitor* f) { StateSplit::input_values_do(f); f->visit(&_length); }
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1232 virtual void other_values_do(ValueVisitor* f);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1233 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1234
a61af66fc99e Initial load
duke
parents:
diff changeset
1235
a61af66fc99e Initial load
duke
parents:
diff changeset
1236 LEAF(NewTypeArray, NewArray)
a61af66fc99e Initial load
duke
parents:
diff changeset
1237 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
1238 BasicType _elt_type;
a61af66fc99e Initial load
duke
parents:
diff changeset
1239
a61af66fc99e Initial load
duke
parents:
diff changeset
1240 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
1241 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
1242 NewTypeArray(Value length, BasicType elt_type) : NewArray(length, NULL), _elt_type(elt_type) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
1243
a61af66fc99e Initial load
duke
parents:
diff changeset
1244 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
1245 BasicType elt_type() const { return _elt_type; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1246 ciType* exact_type() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
1247 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1248
a61af66fc99e Initial load
duke
parents:
diff changeset
1249
a61af66fc99e Initial load
duke
parents:
diff changeset
1250 LEAF(NewObjectArray, NewArray)
a61af66fc99e Initial load
duke
parents:
diff changeset
1251 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
1252 ciKlass* _klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
1253
a61af66fc99e Initial load
duke
parents:
diff changeset
1254 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
1255 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
1256 NewObjectArray(ciKlass* klass, Value length, ValueStack* state_before) : NewArray(length, state_before), _klass(klass) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
1257
a61af66fc99e Initial load
duke
parents:
diff changeset
1258 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
1259 ciKlass* klass() const { return _klass; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1260 ciType* exact_type() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
1261 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1262
a61af66fc99e Initial load
duke
parents:
diff changeset
1263
a61af66fc99e Initial load
duke
parents:
diff changeset
1264 LEAF(NewMultiArray, NewArray)
a61af66fc99e Initial load
duke
parents:
diff changeset
1265 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
1266 ciKlass* _klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
1267 Values* _dims;
a61af66fc99e Initial load
duke
parents:
diff changeset
1268
a61af66fc99e Initial load
duke
parents:
diff changeset
1269 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
1270 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
1271 NewMultiArray(ciKlass* klass, Values* dims, ValueStack* state_before) : NewArray(NULL, state_before), _klass(klass), _dims(dims) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1272 ASSERT_VALUES
a61af66fc99e Initial load
duke
parents:
diff changeset
1273 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1274
a61af66fc99e Initial load
duke
parents:
diff changeset
1275 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
1276 ciKlass* klass() const { return _klass; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1277 Values* dims() const { return _dims; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1278 int rank() const { return dims()->length(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1279
a61af66fc99e Initial load
duke
parents:
diff changeset
1280 // generic
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1281 virtual void input_values_do(ValueVisitor* f) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1282 // NOTE: we do not call NewArray::input_values_do since "length"
a61af66fc99e Initial load
duke
parents:
diff changeset
1283 // is meaningless for a multi-dimensional array; passing the
a61af66fc99e Initial load
duke
parents:
diff changeset
1284 // zeroth element down to NewArray as its length is a bad idea
a61af66fc99e Initial load
duke
parents:
diff changeset
1285 // since there will be a copy in the "dims" array which doesn't
a61af66fc99e Initial load
duke
parents:
diff changeset
1286 // get updated, and the value must not be traversed twice. Was bug
a61af66fc99e Initial load
duke
parents:
diff changeset
1287 // - kbr 4/10/2001
a61af66fc99e Initial load
duke
parents:
diff changeset
1288 StateSplit::input_values_do(f);
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1289 for (int i = 0; i < _dims->length(); i++) f->visit(_dims->adr_at(i));
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1290 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1291 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1292
a61af66fc99e Initial load
duke
parents:
diff changeset
1293
a61af66fc99e Initial load
duke
parents:
diff changeset
1294 BASE(TypeCheck, StateSplit)
a61af66fc99e Initial load
duke
parents:
diff changeset
1295 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
1296 ciKlass* _klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
1297 Value _obj;
a61af66fc99e Initial load
duke
parents:
diff changeset
1298 ValueStack* _state_before;
a61af66fc99e Initial load
duke
parents:
diff changeset
1299
a61af66fc99e Initial load
duke
parents:
diff changeset
1300 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
1301 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
1302 TypeCheck(ciKlass* klass, Value obj, ValueType* type, ValueStack* state_before) : StateSplit(type), _klass(klass), _obj(obj), _state_before(state_before) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1303 ASSERT_VALUES
a61af66fc99e Initial load
duke
parents:
diff changeset
1304 set_direct_compare(false);
a61af66fc99e Initial load
duke
parents:
diff changeset
1305 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1306
a61af66fc99e Initial load
duke
parents:
diff changeset
1307 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
1308 ValueStack* state_before() const { return _state_before; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1309 ciKlass* klass() const { return _klass; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1310 Value obj() const { return _obj; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1311 bool is_loaded() const { return klass() != NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1312 bool direct_compare() const { return check_flag(DirectCompareFlag); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1313
a61af66fc99e Initial load
duke
parents:
diff changeset
1314 // manipulation
a61af66fc99e Initial load
duke
parents:
diff changeset
1315 void set_direct_compare(bool flag) { set_flag(DirectCompareFlag, flag); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1316
a61af66fc99e Initial load
duke
parents:
diff changeset
1317 // generic
a61af66fc99e Initial load
duke
parents:
diff changeset
1318 virtual bool can_trap() const { return true; }
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1319 virtual void input_values_do(ValueVisitor* f) { StateSplit::input_values_do(f); f->visit(&_obj); }
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1320 virtual void other_values_do(ValueVisitor* f);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1321 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1322
a61af66fc99e Initial load
duke
parents:
diff changeset
1323
a61af66fc99e Initial load
duke
parents:
diff changeset
1324 LEAF(CheckCast, TypeCheck)
a61af66fc99e Initial load
duke
parents:
diff changeset
1325 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
1326 ciMethod* _profiled_method;
a61af66fc99e Initial load
duke
parents:
diff changeset
1327 int _profiled_bci;
a61af66fc99e Initial load
duke
parents:
diff changeset
1328
a61af66fc99e Initial load
duke
parents:
diff changeset
1329 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
1330 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
1331 CheckCast(ciKlass* klass, Value obj, ValueStack* state_before)
a61af66fc99e Initial load
duke
parents:
diff changeset
1332 : TypeCheck(klass, obj, objectType, state_before)
a61af66fc99e Initial load
duke
parents:
diff changeset
1333 , _profiled_method(NULL)
a61af66fc99e Initial load
duke
parents:
diff changeset
1334 , _profiled_bci(0) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
1335
a61af66fc99e Initial load
duke
parents:
diff changeset
1336 void set_incompatible_class_change_check() {
a61af66fc99e Initial load
duke
parents:
diff changeset
1337 set_flag(ThrowIncompatibleClassChangeErrorFlag, true);
a61af66fc99e Initial load
duke
parents:
diff changeset
1338 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1339 bool is_incompatible_class_change_check() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
1340 return check_flag(ThrowIncompatibleClassChangeErrorFlag);
a61af66fc99e Initial load
duke
parents:
diff changeset
1341 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1342
a61af66fc99e Initial load
duke
parents:
diff changeset
1343 // Helpers for methodDataOop profiling
a61af66fc99e Initial load
duke
parents:
diff changeset
1344 void set_should_profile(bool value) { set_flag(ProfileMDOFlag, value); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1345 void set_profiled_method(ciMethod* method) { _profiled_method = method; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1346 void set_profiled_bci(int bci) { _profiled_bci = bci; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1347 bool should_profile() const { return check_flag(ProfileMDOFlag); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1348 ciMethod* profiled_method() const { return _profiled_method; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1349 int profiled_bci() const { return _profiled_bci; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1350
a61af66fc99e Initial load
duke
parents:
diff changeset
1351 ciType* declared_type() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
1352 ciType* exact_type() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
1353
a61af66fc99e Initial load
duke
parents:
diff changeset
1354 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1355
a61af66fc99e Initial load
duke
parents:
diff changeset
1356
a61af66fc99e Initial load
duke
parents:
diff changeset
1357 LEAF(InstanceOf, TypeCheck)
a61af66fc99e Initial load
duke
parents:
diff changeset
1358 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
1359 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
1360 InstanceOf(ciKlass* klass, Value obj, ValueStack* state_before) : TypeCheck(klass, obj, intType, state_before) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
1361 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1362
a61af66fc99e Initial load
duke
parents:
diff changeset
1363
a61af66fc99e Initial load
duke
parents:
diff changeset
1364 BASE(AccessMonitor, StateSplit)
a61af66fc99e Initial load
duke
parents:
diff changeset
1365 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
1366 Value _obj;
a61af66fc99e Initial load
duke
parents:
diff changeset
1367 int _monitor_no;
a61af66fc99e Initial load
duke
parents:
diff changeset
1368
a61af66fc99e Initial load
duke
parents:
diff changeset
1369 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
1370 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
1371 AccessMonitor(Value obj, int monitor_no)
a61af66fc99e Initial load
duke
parents:
diff changeset
1372 : StateSplit(illegalType)
a61af66fc99e Initial load
duke
parents:
diff changeset
1373 , _obj(obj)
a61af66fc99e Initial load
duke
parents:
diff changeset
1374 , _monitor_no(monitor_no)
a61af66fc99e Initial load
duke
parents:
diff changeset
1375 {
a61af66fc99e Initial load
duke
parents:
diff changeset
1376 set_needs_null_check(true);
a61af66fc99e Initial load
duke
parents:
diff changeset
1377 ASSERT_VALUES
a61af66fc99e Initial load
duke
parents:
diff changeset
1378 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1379
a61af66fc99e Initial load
duke
parents:
diff changeset
1380 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
1381 Value obj() const { return _obj; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1382 int monitor_no() const { return _monitor_no; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1383
a61af66fc99e Initial load
duke
parents:
diff changeset
1384 // generic
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1385 virtual void input_values_do(ValueVisitor* f) { StateSplit::input_values_do(f); f->visit(&_obj); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1386 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1387
a61af66fc99e Initial load
duke
parents:
diff changeset
1388
a61af66fc99e Initial load
duke
parents:
diff changeset
1389 LEAF(MonitorEnter, AccessMonitor)
a61af66fc99e Initial load
duke
parents:
diff changeset
1390 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
1391 ValueStack* _lock_stack_before;
a61af66fc99e Initial load
duke
parents:
diff changeset
1392
a61af66fc99e Initial load
duke
parents:
diff changeset
1393 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
1394 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
1395 MonitorEnter(Value obj, int monitor_no, ValueStack* lock_stack_before)
a61af66fc99e Initial load
duke
parents:
diff changeset
1396 : AccessMonitor(obj, monitor_no)
a61af66fc99e Initial load
duke
parents:
diff changeset
1397 , _lock_stack_before(lock_stack_before)
a61af66fc99e Initial load
duke
parents:
diff changeset
1398 {
a61af66fc99e Initial load
duke
parents:
diff changeset
1399 ASSERT_VALUES
a61af66fc99e Initial load
duke
parents:
diff changeset
1400 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1401
a61af66fc99e Initial load
duke
parents:
diff changeset
1402 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
1403 ValueStack* lock_stack_before() const { return _lock_stack_before; }
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1404 virtual void state_values_do(ValueVisitor* f);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1405
a61af66fc99e Initial load
duke
parents:
diff changeset
1406 // generic
a61af66fc99e Initial load
duke
parents:
diff changeset
1407 virtual bool can_trap() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1408 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1409
a61af66fc99e Initial load
duke
parents:
diff changeset
1410
a61af66fc99e Initial load
duke
parents:
diff changeset
1411 LEAF(MonitorExit, AccessMonitor)
a61af66fc99e Initial load
duke
parents:
diff changeset
1412 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
1413 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
1414 MonitorExit(Value obj, int monitor_no) : AccessMonitor(obj, monitor_no) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
1415 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1416
a61af66fc99e Initial load
duke
parents:
diff changeset
1417
a61af66fc99e Initial load
duke
parents:
diff changeset
1418 LEAF(Intrinsic, StateSplit)
a61af66fc99e Initial load
duke
parents:
diff changeset
1419 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
1420 vmIntrinsics::ID _id;
a61af66fc99e Initial load
duke
parents:
diff changeset
1421 Values* _args;
a61af66fc99e Initial load
duke
parents:
diff changeset
1422 ValueStack* _lock_stack;
a61af66fc99e Initial load
duke
parents:
diff changeset
1423 Value _recv;
a61af66fc99e Initial load
duke
parents:
diff changeset
1424
a61af66fc99e Initial load
duke
parents:
diff changeset
1425 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
1426 // preserves_state can be set to true for Intrinsics
a61af66fc99e Initial load
duke
parents:
diff changeset
1427 // which are guaranteed to preserve register state across any slow
a61af66fc99e Initial load
duke
parents:
diff changeset
1428 // cases; setting it to true does not mean that the Intrinsic can
a61af66fc99e Initial load
duke
parents:
diff changeset
1429 // not trap, only that if we continue execution in the same basic
a61af66fc99e Initial load
duke
parents:
diff changeset
1430 // block after the Intrinsic, all of the registers are intact. This
a61af66fc99e Initial load
duke
parents:
diff changeset
1431 // allows load elimination and common expression elimination to be
a61af66fc99e Initial load
duke
parents:
diff changeset
1432 // performed across the Intrinsic. The default value is false.
a61af66fc99e Initial load
duke
parents:
diff changeset
1433 Intrinsic(ValueType* type,
a61af66fc99e Initial load
duke
parents:
diff changeset
1434 vmIntrinsics::ID id,
a61af66fc99e Initial load
duke
parents:
diff changeset
1435 Values* args,
a61af66fc99e Initial load
duke
parents:
diff changeset
1436 bool has_receiver,
a61af66fc99e Initial load
duke
parents:
diff changeset
1437 ValueStack* lock_stack,
a61af66fc99e Initial load
duke
parents:
diff changeset
1438 bool preserves_state,
a61af66fc99e Initial load
duke
parents:
diff changeset
1439 bool cantrap = true)
a61af66fc99e Initial load
duke
parents:
diff changeset
1440 : StateSplit(type)
a61af66fc99e Initial load
duke
parents:
diff changeset
1441 , _id(id)
a61af66fc99e Initial load
duke
parents:
diff changeset
1442 , _args(args)
a61af66fc99e Initial load
duke
parents:
diff changeset
1443 , _lock_stack(lock_stack)
a61af66fc99e Initial load
duke
parents:
diff changeset
1444 , _recv(NULL)
a61af66fc99e Initial load
duke
parents:
diff changeset
1445 {
a61af66fc99e Initial load
duke
parents:
diff changeset
1446 assert(args != NULL, "args must exist");
a61af66fc99e Initial load
duke
parents:
diff changeset
1447 ASSERT_VALUES
a61af66fc99e Initial load
duke
parents:
diff changeset
1448 set_flag(PreservesStateFlag, preserves_state);
a61af66fc99e Initial load
duke
parents:
diff changeset
1449 set_flag(CanTrapFlag, cantrap);
a61af66fc99e Initial load
duke
parents:
diff changeset
1450 if (has_receiver) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1451 _recv = argument_at(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
1452 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1453 set_needs_null_check(has_receiver);
a61af66fc99e Initial load
duke
parents:
diff changeset
1454
a61af66fc99e Initial load
duke
parents:
diff changeset
1455 // some intrinsics can't trap, so don't force them to be pinned
a61af66fc99e Initial load
duke
parents:
diff changeset
1456 if (!can_trap()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1457 unpin(PinStateSplitConstructor);
a61af66fc99e Initial load
duke
parents:
diff changeset
1458 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1459 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1460
a61af66fc99e Initial load
duke
parents:
diff changeset
1461 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
1462 vmIntrinsics::ID id() const { return _id; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1463 int number_of_arguments() const { return _args->length(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1464 Value argument_at(int i) const { return _args->at(i); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1465 ValueStack* lock_stack() const { return _lock_stack; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1466
a61af66fc99e Initial load
duke
parents:
diff changeset
1467 bool has_receiver() const { return (_recv != NULL); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1468 Value receiver() const { assert(has_receiver(), "must have receiver"); return _recv; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1469 bool preserves_state() const { return check_flag(PreservesStateFlag); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1470
a61af66fc99e Initial load
duke
parents:
diff changeset
1471 // generic
a61af66fc99e Initial load
duke
parents:
diff changeset
1472 virtual bool can_trap() const { return check_flag(CanTrapFlag); }
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1473 virtual void input_values_do(ValueVisitor* f) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1474 StateSplit::input_values_do(f);
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1475 for (int i = 0; i < _args->length(); i++) f->visit(_args->adr_at(i));
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1476 }
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1477 virtual void state_values_do(ValueVisitor* f);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1478
a61af66fc99e Initial load
duke
parents:
diff changeset
1479 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1480
a61af66fc99e Initial load
duke
parents:
diff changeset
1481
a61af66fc99e Initial load
duke
parents:
diff changeset
1482 class LIR_List;
a61af66fc99e Initial load
duke
parents:
diff changeset
1483
a61af66fc99e Initial load
duke
parents:
diff changeset
1484 LEAF(BlockBegin, StateSplit)
a61af66fc99e Initial load
duke
parents:
diff changeset
1485 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
1486 int _block_id; // the unique block id
a61af66fc99e Initial load
duke
parents:
diff changeset
1487 int _depth_first_number; // number of this block in a depth-first ordering
a61af66fc99e Initial load
duke
parents:
diff changeset
1488 int _linear_scan_number; // number of this block in linear-scan ordering
a61af66fc99e Initial load
duke
parents:
diff changeset
1489 int _loop_depth; // the loop nesting level of this block
a61af66fc99e Initial load
duke
parents:
diff changeset
1490 int _loop_index; // number of the innermost loop of this block
a61af66fc99e Initial load
duke
parents:
diff changeset
1491 int _flags; // the flags associated with this block
a61af66fc99e Initial load
duke
parents:
diff changeset
1492
a61af66fc99e Initial load
duke
parents:
diff changeset
1493 // fields used by BlockListBuilder
a61af66fc99e Initial load
duke
parents:
diff changeset
1494 int _total_preds; // number of predecessors found by BlockListBuilder
a61af66fc99e Initial load
duke
parents:
diff changeset
1495 BitMap _stores_to_locals; // bit is set when a local variable is stored in the block
a61af66fc99e Initial load
duke
parents:
diff changeset
1496
a61af66fc99e Initial load
duke
parents:
diff changeset
1497 // SSA specific fields: (factor out later)
a61af66fc99e Initial load
duke
parents:
diff changeset
1498 BlockList _successors; // the successors of this block
a61af66fc99e Initial load
duke
parents:
diff changeset
1499 BlockList _predecessors; // the predecessors of this block
a61af66fc99e Initial load
duke
parents:
diff changeset
1500 BlockBegin* _dominator; // the dominator of this block
a61af66fc99e Initial load
duke
parents:
diff changeset
1501 // SSA specific ends
a61af66fc99e Initial load
duke
parents:
diff changeset
1502 BlockEnd* _end; // the last instruction of this block
a61af66fc99e Initial load
duke
parents:
diff changeset
1503 BlockList _exception_handlers; // the exception handlers potentially invoked by this block
a61af66fc99e Initial load
duke
parents:
diff changeset
1504 ValueStackStack* _exception_states; // only for xhandler entries: states of all instructions that have an edge to this xhandler
a61af66fc99e Initial load
duke
parents:
diff changeset
1505 int _exception_handler_pco; // if this block is the start of an exception handler,
a61af66fc99e Initial load
duke
parents:
diff changeset
1506 // this records the PC offset in the assembly code of the
a61af66fc99e Initial load
duke
parents:
diff changeset
1507 // first instruction in this block
a61af66fc99e Initial load
duke
parents:
diff changeset
1508 Label _label; // the label associated with this block
a61af66fc99e Initial load
duke
parents:
diff changeset
1509 LIR_List* _lir; // the low level intermediate representation for this block
a61af66fc99e Initial load
duke
parents:
diff changeset
1510
a61af66fc99e Initial load
duke
parents:
diff changeset
1511 BitMap _live_in; // set of live LIR_Opr registers at entry to this block
a61af66fc99e Initial load
duke
parents:
diff changeset
1512 BitMap _live_out; // set of live LIR_Opr registers at exit from this block
a61af66fc99e Initial load
duke
parents:
diff changeset
1513 BitMap _live_gen; // set of registers used before any redefinition in this block
a61af66fc99e Initial load
duke
parents:
diff changeset
1514 BitMap _live_kill; // set of registers defined in this block
a61af66fc99e Initial load
duke
parents:
diff changeset
1515
a61af66fc99e Initial load
duke
parents:
diff changeset
1516 BitMap _fpu_register_usage;
a61af66fc99e Initial load
duke
parents:
diff changeset
1517 intArray* _fpu_stack_state; // For x86 FPU code generation with UseLinearScan
a61af66fc99e Initial load
duke
parents:
diff changeset
1518 int _first_lir_instruction_id; // ID of first LIR instruction in this block
a61af66fc99e Initial load
duke
parents:
diff changeset
1519 int _last_lir_instruction_id; // ID of last LIR instruction in this block
a61af66fc99e Initial load
duke
parents:
diff changeset
1520
a61af66fc99e Initial load
duke
parents:
diff changeset
1521 void iterate_preorder (boolArray& mark, BlockClosure* closure);
a61af66fc99e Initial load
duke
parents:
diff changeset
1522 void iterate_postorder(boolArray& mark, BlockClosure* closure);
a61af66fc99e Initial load
duke
parents:
diff changeset
1523
a61af66fc99e Initial load
duke
parents:
diff changeset
1524 friend class SuxAndWeightAdjuster;
a61af66fc99e Initial load
duke
parents:
diff changeset
1525
a61af66fc99e Initial load
duke
parents:
diff changeset
1526 public:
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1527 void* operator new(size_t size) {
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1528 Compilation* c = Compilation::current();
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1529 void* res = c->arena()->Amalloc(size);
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1530 ((BlockBegin*)res)->_id = c->get_next_id();
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1531 ((BlockBegin*)res)->_block_id = c->get_next_block_id();
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1532 return res;
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1533 }
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1534
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1535 // initialization/counting
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1536 static int number_of_blocks() {
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1537 return Compilation::current()->number_of_blocks();
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1538 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1539
a61af66fc99e Initial load
duke
parents:
diff changeset
1540 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
1541 BlockBegin(int bci)
a61af66fc99e Initial load
duke
parents:
diff changeset
1542 : StateSplit(illegalType)
a61af66fc99e Initial load
duke
parents:
diff changeset
1543 , _depth_first_number(-1)
a61af66fc99e Initial load
duke
parents:
diff changeset
1544 , _linear_scan_number(-1)
a61af66fc99e Initial load
duke
parents:
diff changeset
1545 , _loop_depth(0)
a61af66fc99e Initial load
duke
parents:
diff changeset
1546 , _flags(0)
a61af66fc99e Initial load
duke
parents:
diff changeset
1547 , _dominator(NULL)
a61af66fc99e Initial load
duke
parents:
diff changeset
1548 , _end(NULL)
a61af66fc99e Initial load
duke
parents:
diff changeset
1549 , _predecessors(2)
a61af66fc99e Initial load
duke
parents:
diff changeset
1550 , _successors(2)
a61af66fc99e Initial load
duke
parents:
diff changeset
1551 , _exception_handlers(1)
a61af66fc99e Initial load
duke
parents:
diff changeset
1552 , _exception_states(NULL)
a61af66fc99e Initial load
duke
parents:
diff changeset
1553 , _exception_handler_pco(-1)
a61af66fc99e Initial load
duke
parents:
diff changeset
1554 , _lir(NULL)
a61af66fc99e Initial load
duke
parents:
diff changeset
1555 , _loop_index(-1)
a61af66fc99e Initial load
duke
parents:
diff changeset
1556 , _live_in()
a61af66fc99e Initial load
duke
parents:
diff changeset
1557 , _live_out()
a61af66fc99e Initial load
duke
parents:
diff changeset
1558 , _live_gen()
a61af66fc99e Initial load
duke
parents:
diff changeset
1559 , _live_kill()
a61af66fc99e Initial load
duke
parents:
diff changeset
1560 , _fpu_register_usage()
a61af66fc99e Initial load
duke
parents:
diff changeset
1561 , _fpu_stack_state(NULL)
a61af66fc99e Initial load
duke
parents:
diff changeset
1562 , _first_lir_instruction_id(-1)
a61af66fc99e Initial load
duke
parents:
diff changeset
1563 , _last_lir_instruction_id(-1)
a61af66fc99e Initial load
duke
parents:
diff changeset
1564 , _total_preds(0)
a61af66fc99e Initial load
duke
parents:
diff changeset
1565 , _stores_to_locals()
a61af66fc99e Initial load
duke
parents:
diff changeset
1566 {
a61af66fc99e Initial load
duke
parents:
diff changeset
1567 set_bci(bci);
a61af66fc99e Initial load
duke
parents:
diff changeset
1568 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1569
a61af66fc99e Initial load
duke
parents:
diff changeset
1570 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
1571 int block_id() const { return _block_id; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1572 BlockList* successors() { return &_successors; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1573 BlockBegin* dominator() const { return _dominator; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1574 int loop_depth() const { return _loop_depth; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1575 int depth_first_number() const { return _depth_first_number; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1576 int linear_scan_number() const { return _linear_scan_number; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1577 BlockEnd* end() const { return _end; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1578 Label* label() { return &_label; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1579 LIR_List* lir() const { return _lir; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1580 int exception_handler_pco() const { return _exception_handler_pco; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1581 BitMap& live_in() { return _live_in; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1582 BitMap& live_out() { return _live_out; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1583 BitMap& live_gen() { return _live_gen; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1584 BitMap& live_kill() { return _live_kill; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1585 BitMap& fpu_register_usage() { return _fpu_register_usage; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1586 intArray* fpu_stack_state() const { return _fpu_stack_state; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1587 int first_lir_instruction_id() const { return _first_lir_instruction_id; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1588 int last_lir_instruction_id() const { return _last_lir_instruction_id; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1589 int total_preds() const { return _total_preds; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1590 BitMap& stores_to_locals() { return _stores_to_locals; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1591
a61af66fc99e Initial load
duke
parents:
diff changeset
1592 // manipulation
a61af66fc99e Initial load
duke
parents:
diff changeset
1593 void set_bci(int bci) { Instruction::set_bci(bci); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1594 void set_dominator(BlockBegin* dom) { _dominator = dom; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1595 void set_loop_depth(int d) { _loop_depth = d; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1596 void set_depth_first_number(int dfn) { _depth_first_number = dfn; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1597 void set_linear_scan_number(int lsn) { _linear_scan_number = lsn; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1598 void set_end(BlockEnd* end);
a61af66fc99e Initial load
duke
parents:
diff changeset
1599 void disconnect_from_graph();
a61af66fc99e Initial load
duke
parents:
diff changeset
1600 static void disconnect_edge(BlockBegin* from, BlockBegin* to);
a61af66fc99e Initial load
duke
parents:
diff changeset
1601 BlockBegin* insert_block_between(BlockBegin* sux);
a61af66fc99e Initial load
duke
parents:
diff changeset
1602 void substitute_sux(BlockBegin* old_sux, BlockBegin* new_sux);
a61af66fc99e Initial load
duke
parents:
diff changeset
1603 void set_lir(LIR_List* lir) { _lir = lir; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1604 void set_exception_handler_pco(int pco) { _exception_handler_pco = pco; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1605 void set_live_in (BitMap map) { _live_in = map; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1606 void set_live_out (BitMap map) { _live_out = map; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1607 void set_live_gen (BitMap map) { _live_gen = map; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1608 void set_live_kill (BitMap map) { _live_kill = map; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1609 void set_fpu_register_usage(BitMap map) { _fpu_register_usage = map; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1610 void set_fpu_stack_state(intArray* state) { _fpu_stack_state = state; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1611 void set_first_lir_instruction_id(int id) { _first_lir_instruction_id = id; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1612 void set_last_lir_instruction_id(int id) { _last_lir_instruction_id = id; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1613 void increment_total_preds(int n = 1) { _total_preds += n; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1614 void init_stores_to_locals(int locals_count) { _stores_to_locals = BitMap(locals_count); _stores_to_locals.clear(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1615
a61af66fc99e Initial load
duke
parents:
diff changeset
1616 // generic
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1617 virtual void state_values_do(ValueVisitor* f);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1618
a61af66fc99e Initial load
duke
parents:
diff changeset
1619 // successors and predecessors
a61af66fc99e Initial load
duke
parents:
diff changeset
1620 int number_of_sux() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
1621 BlockBegin* sux_at(int i) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
1622 void add_successor(BlockBegin* sux);
a61af66fc99e Initial load
duke
parents:
diff changeset
1623 void remove_successor(BlockBegin* pred);
a61af66fc99e Initial load
duke
parents:
diff changeset
1624 bool is_successor(BlockBegin* sux) const { return _successors.contains(sux); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1625
a61af66fc99e Initial load
duke
parents:
diff changeset
1626 void add_predecessor(BlockBegin* pred);
a61af66fc99e Initial load
duke
parents:
diff changeset
1627 void remove_predecessor(BlockBegin* pred);
a61af66fc99e Initial load
duke
parents:
diff changeset
1628 bool is_predecessor(BlockBegin* pred) const { return _predecessors.contains(pred); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1629 int number_of_preds() const { return _predecessors.length(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1630 BlockBegin* pred_at(int i) const { return _predecessors[i]; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1631
a61af66fc99e Initial load
duke
parents:
diff changeset
1632 // exception handlers potentially invoked by this block
a61af66fc99e Initial load
duke
parents:
diff changeset
1633 void add_exception_handler(BlockBegin* b);
a61af66fc99e Initial load
duke
parents:
diff changeset
1634 bool is_exception_handler(BlockBegin* b) const { return _exception_handlers.contains(b); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1635 int number_of_exception_handlers() const { return _exception_handlers.length(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1636 BlockBegin* exception_handler_at(int i) const { return _exception_handlers.at(i); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1637
a61af66fc99e Initial load
duke
parents:
diff changeset
1638 // states of the instructions that have an edge to this exception handler
a61af66fc99e Initial load
duke
parents:
diff changeset
1639 int number_of_exception_states() { assert(is_set(exception_entry_flag), "only for xhandlers"); return _exception_states == NULL ? 0 : _exception_states->length(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1640 ValueStack* exception_state_at(int idx) const { assert(is_set(exception_entry_flag), "only for xhandlers"); return _exception_states->at(idx); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1641 int add_exception_state(ValueStack* state);
a61af66fc99e Initial load
duke
parents:
diff changeset
1642
a61af66fc99e Initial load
duke
parents:
diff changeset
1643 // flags
a61af66fc99e Initial load
duke
parents:
diff changeset
1644 enum Flag {
a61af66fc99e Initial load
duke
parents:
diff changeset
1645 no_flag = 0,
a61af66fc99e Initial load
duke
parents:
diff changeset
1646 std_entry_flag = 1 << 0,
a61af66fc99e Initial load
duke
parents:
diff changeset
1647 osr_entry_flag = 1 << 1,
a61af66fc99e Initial load
duke
parents:
diff changeset
1648 exception_entry_flag = 1 << 2,
a61af66fc99e Initial load
duke
parents:
diff changeset
1649 subroutine_entry_flag = 1 << 3,
a61af66fc99e Initial load
duke
parents:
diff changeset
1650 backward_branch_target_flag = 1 << 4,
a61af66fc99e Initial load
duke
parents:
diff changeset
1651 is_on_work_list_flag = 1 << 5,
a61af66fc99e Initial load
duke
parents:
diff changeset
1652 was_visited_flag = 1 << 6,
1378
9f5b60a14736 6939930: exception unwind changes in 6919934 hurts compilation speed
never
parents: 1295
diff changeset
1653 parser_loop_header_flag = 1 << 7, // set by parser to identify blocks where phi functions can not be created on demand
9f5b60a14736 6939930: exception unwind changes in 6919934 hurts compilation speed
never
parents: 1295
diff changeset
1654 critical_edge_split_flag = 1 << 8, // set for all blocks that are introduced when critical edges are split
9f5b60a14736 6939930: exception unwind changes in 6919934 hurts compilation speed
never
parents: 1295
diff changeset
1655 linear_scan_loop_header_flag = 1 << 9, // set during loop-detection for LinearScan
9f5b60a14736 6939930: exception unwind changes in 6919934 hurts compilation speed
never
parents: 1295
diff changeset
1656 linear_scan_loop_end_flag = 1 << 10 // set during loop-detection for LinearScan
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1657 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1658
a61af66fc99e Initial load
duke
parents:
diff changeset
1659 void set(Flag f) { _flags |= f; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1660 void clear(Flag f) { _flags &= ~f; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1661 bool is_set(Flag f) const { return (_flags & f) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1662 bool is_entry_block() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
1663 const int entry_mask = std_entry_flag | osr_entry_flag | exception_entry_flag;
a61af66fc99e Initial load
duke
parents:
diff changeset
1664 return (_flags & entry_mask) != 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
1665 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1666
a61af66fc99e Initial load
duke
parents:
diff changeset
1667 // iteration
a61af66fc99e Initial load
duke
parents:
diff changeset
1668 void iterate_preorder (BlockClosure* closure);
a61af66fc99e Initial load
duke
parents:
diff changeset
1669 void iterate_postorder (BlockClosure* closure);
a61af66fc99e Initial load
duke
parents:
diff changeset
1670
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1671 void block_values_do(ValueVisitor* f);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1672
a61af66fc99e Initial load
duke
parents:
diff changeset
1673 // loops
a61af66fc99e Initial load
duke
parents:
diff changeset
1674 void set_loop_index(int ix) { _loop_index = ix; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1675 int loop_index() const { return _loop_index; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1676
a61af66fc99e Initial load
duke
parents:
diff changeset
1677 // merging
a61af66fc99e Initial load
duke
parents:
diff changeset
1678 bool try_merge(ValueStack* state); // try to merge states at block begin
a61af66fc99e Initial load
duke
parents:
diff changeset
1679 void merge(ValueStack* state) { bool b = try_merge(state); assert(b, "merge failed"); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1680
a61af66fc99e Initial load
duke
parents:
diff changeset
1681 // debugging
a61af66fc99e Initial load
duke
parents:
diff changeset
1682 void print_block() PRODUCT_RETURN;
a61af66fc99e Initial load
duke
parents:
diff changeset
1683 void print_block(InstructionPrinter& ip, bool live_only = false) PRODUCT_RETURN;
a61af66fc99e Initial load
duke
parents:
diff changeset
1684 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1685
a61af66fc99e Initial load
duke
parents:
diff changeset
1686
a61af66fc99e Initial load
duke
parents:
diff changeset
1687 BASE(BlockEnd, StateSplit)
a61af66fc99e Initial load
duke
parents:
diff changeset
1688 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
1689 BlockBegin* _begin;
a61af66fc99e Initial load
duke
parents:
diff changeset
1690 BlockList* _sux;
a61af66fc99e Initial load
duke
parents:
diff changeset
1691 ValueStack* _state_before;
a61af66fc99e Initial load
duke
parents:
diff changeset
1692
a61af66fc99e Initial load
duke
parents:
diff changeset
1693 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
1694 BlockList* sux() const { return _sux; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1695
a61af66fc99e Initial load
duke
parents:
diff changeset
1696 void set_sux(BlockList* sux) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1697 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
1698 assert(sux != NULL, "sux must exist");
a61af66fc99e Initial load
duke
parents:
diff changeset
1699 for (int i = sux->length() - 1; i >= 0; i--) assert(sux->at(i) != NULL, "sux must exist");
a61af66fc99e Initial load
duke
parents:
diff changeset
1700 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
1701 _sux = sux;
a61af66fc99e Initial load
duke
parents:
diff changeset
1702 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1703
a61af66fc99e Initial load
duke
parents:
diff changeset
1704 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
1705 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
1706 BlockEnd(ValueType* type, ValueStack* state_before, bool is_safepoint)
a61af66fc99e Initial load
duke
parents:
diff changeset
1707 : StateSplit(type)
a61af66fc99e Initial load
duke
parents:
diff changeset
1708 , _begin(NULL)
a61af66fc99e Initial load
duke
parents:
diff changeset
1709 , _sux(NULL)
a61af66fc99e Initial load
duke
parents:
diff changeset
1710 , _state_before(state_before) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1711 set_flag(IsSafepointFlag, is_safepoint);
a61af66fc99e Initial load
duke
parents:
diff changeset
1712 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1713
a61af66fc99e Initial load
duke
parents:
diff changeset
1714 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
1715 ValueStack* state_before() const { return _state_before; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1716 bool is_safepoint() const { return check_flag(IsSafepointFlag); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1717 BlockBegin* begin() const { return _begin; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1718
a61af66fc99e Initial load
duke
parents:
diff changeset
1719 // manipulation
a61af66fc99e Initial load
duke
parents:
diff changeset
1720 void set_begin(BlockBegin* begin);
a61af66fc99e Initial load
duke
parents:
diff changeset
1721
a61af66fc99e Initial load
duke
parents:
diff changeset
1722 // generic
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1723 virtual void other_values_do(ValueVisitor* f);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1724
a61af66fc99e Initial load
duke
parents:
diff changeset
1725 // successors
a61af66fc99e Initial load
duke
parents:
diff changeset
1726 int number_of_sux() const { return _sux != NULL ? _sux->length() : 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1727 BlockBegin* sux_at(int i) const { return _sux->at(i); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1728 BlockBegin* default_sux() const { return sux_at(number_of_sux() - 1); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1729 BlockBegin** addr_sux_at(int i) const { return _sux->adr_at(i); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1730 int sux_index(BlockBegin* sux) const { return _sux->find(sux); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1731 void substitute_sux(BlockBegin* old_sux, BlockBegin* new_sux);
a61af66fc99e Initial load
duke
parents:
diff changeset
1732 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1733
a61af66fc99e Initial load
duke
parents:
diff changeset
1734
a61af66fc99e Initial load
duke
parents:
diff changeset
1735 LEAF(Goto, BlockEnd)
a61af66fc99e Initial load
duke
parents:
diff changeset
1736 public:
1783
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1737 enum Direction {
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1738 none, // Just a regular goto
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1739 taken, not_taken // Goto produced from If
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1740 };
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1741 private:
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1742 ciMethod* _profiled_method;
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1743 int _profiled_bci;
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1744 Direction _direction;
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1745 public:
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1746 // creation
1783
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1747 Goto(BlockBegin* sux, ValueStack* state_before, bool is_safepoint = false)
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1748 : BlockEnd(illegalType, state_before, is_safepoint)
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1749 , _direction(none)
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1750 , _profiled_method(NULL)
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1751 , _profiled_bci(0) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1752 BlockList* s = new BlockList(1);
a61af66fc99e Initial load
duke
parents:
diff changeset
1753 s->append(sux);
a61af66fc99e Initial load
duke
parents:
diff changeset
1754 set_sux(s);
a61af66fc99e Initial load
duke
parents:
diff changeset
1755 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1756
1783
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1757 Goto(BlockBegin* sux, bool is_safepoint) : BlockEnd(illegalType, NULL, is_safepoint)
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1758 , _direction(none)
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1759 , _profiled_method(NULL)
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1760 , _profiled_bci(0) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1761 BlockList* s = new BlockList(1);
a61af66fc99e Initial load
duke
parents:
diff changeset
1762 s->append(sux);
a61af66fc99e Initial load
duke
parents:
diff changeset
1763 set_sux(s);
a61af66fc99e Initial load
duke
parents:
diff changeset
1764 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1765
1783
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1766 bool should_profile() const { return check_flag(ProfileMDOFlag); }
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1767 ciMethod* profiled_method() const { return _profiled_method; } // set only for profiled branches
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1768 int profiled_bci() const { return _profiled_bci; }
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1769 Direction direction() const { return _direction; }
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1770
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1771 void set_should_profile(bool value) { set_flag(ProfileMDOFlag, value); }
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1772 void set_profiled_method(ciMethod* method) { _profiled_method = method; }
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1773 void set_profiled_bci(int bci) { _profiled_bci = bci; }
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1774 void set_direction(Direction d) { _direction = d; }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1775 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1776
a61af66fc99e Initial load
duke
parents:
diff changeset
1777
a61af66fc99e Initial load
duke
parents:
diff changeset
1778 LEAF(If, BlockEnd)
a61af66fc99e Initial load
duke
parents:
diff changeset
1779 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
1780 Value _x;
a61af66fc99e Initial load
duke
parents:
diff changeset
1781 Condition _cond;
a61af66fc99e Initial load
duke
parents:
diff changeset
1782 Value _y;
a61af66fc99e Initial load
duke
parents:
diff changeset
1783 ciMethod* _profiled_method;
a61af66fc99e Initial load
duke
parents:
diff changeset
1784 int _profiled_bci; // Canonicalizer may alter bci of If node
1783
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1785 bool _swapped; // Is the order reversed with respect to the original If in the
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1786 // bytecode stream?
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1787 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
1788 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
1789 // unordered_is_true is valid for float/double compares only
a61af66fc99e Initial load
duke
parents:
diff changeset
1790 If(Value x, Condition cond, bool unordered_is_true, Value y, BlockBegin* tsux, BlockBegin* fsux, ValueStack* state_before, bool is_safepoint)
a61af66fc99e Initial load
duke
parents:
diff changeset
1791 : BlockEnd(illegalType, state_before, is_safepoint)
a61af66fc99e Initial load
duke
parents:
diff changeset
1792 , _x(x)
a61af66fc99e Initial load
duke
parents:
diff changeset
1793 , _cond(cond)
a61af66fc99e Initial load
duke
parents:
diff changeset
1794 , _y(y)
a61af66fc99e Initial load
duke
parents:
diff changeset
1795 , _profiled_method(NULL)
a61af66fc99e Initial load
duke
parents:
diff changeset
1796 , _profiled_bci(0)
1783
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1797 , _swapped(false)
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1798 {
a61af66fc99e Initial load
duke
parents:
diff changeset
1799 ASSERT_VALUES
a61af66fc99e Initial load
duke
parents:
diff changeset
1800 set_flag(UnorderedIsTrueFlag, unordered_is_true);
a61af66fc99e Initial load
duke
parents:
diff changeset
1801 assert(x->type()->tag() == y->type()->tag(), "types must match");
a61af66fc99e Initial load
duke
parents:
diff changeset
1802 BlockList* s = new BlockList(2);
a61af66fc99e Initial load
duke
parents:
diff changeset
1803 s->append(tsux);
a61af66fc99e Initial load
duke
parents:
diff changeset
1804 s->append(fsux);
a61af66fc99e Initial load
duke
parents:
diff changeset
1805 set_sux(s);
a61af66fc99e Initial load
duke
parents:
diff changeset
1806 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1807
a61af66fc99e Initial load
duke
parents:
diff changeset
1808 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
1809 Value x() const { return _x; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1810 Condition cond() const { return _cond; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1811 bool unordered_is_true() const { return check_flag(UnorderedIsTrueFlag); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1812 Value y() const { return _y; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1813 BlockBegin* sux_for(bool is_true) const { return sux_at(is_true ? 0 : 1); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1814 BlockBegin* tsux() const { return sux_for(true); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1815 BlockBegin* fsux() const { return sux_for(false); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1816 BlockBegin* usux() const { return sux_for(unordered_is_true()); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1817 bool should_profile() const { return check_flag(ProfileMDOFlag); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1818 ciMethod* profiled_method() const { return _profiled_method; } // set only for profiled branches
1783
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1819 int profiled_bci() const { return _profiled_bci; } // set for profiled branches and tiered
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1820 bool is_swapped() const { return _swapped; }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1821
a61af66fc99e Initial load
duke
parents:
diff changeset
1822 // manipulation
a61af66fc99e Initial load
duke
parents:
diff changeset
1823 void swap_operands() {
a61af66fc99e Initial load
duke
parents:
diff changeset
1824 Value t = _x; _x = _y; _y = t;
a61af66fc99e Initial load
duke
parents:
diff changeset
1825 _cond = mirror(_cond);
a61af66fc99e Initial load
duke
parents:
diff changeset
1826 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1827
a61af66fc99e Initial load
duke
parents:
diff changeset
1828 void swap_sux() {
a61af66fc99e Initial load
duke
parents:
diff changeset
1829 assert(number_of_sux() == 2, "wrong number of successors");
a61af66fc99e Initial load
duke
parents:
diff changeset
1830 BlockList* s = sux();
a61af66fc99e Initial load
duke
parents:
diff changeset
1831 BlockBegin* t = s->at(0); s->at_put(0, s->at(1)); s->at_put(1, t);
a61af66fc99e Initial load
duke
parents:
diff changeset
1832 _cond = negate(_cond);
a61af66fc99e Initial load
duke
parents:
diff changeset
1833 set_flag(UnorderedIsTrueFlag, !check_flag(UnorderedIsTrueFlag));
a61af66fc99e Initial load
duke
parents:
diff changeset
1834 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1835
a61af66fc99e Initial load
duke
parents:
diff changeset
1836 void set_should_profile(bool value) { set_flag(ProfileMDOFlag, value); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1837 void set_profiled_method(ciMethod* method) { _profiled_method = method; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1838 void set_profiled_bci(int bci) { _profiled_bci = bci; }
1783
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
1839 void set_swapped(bool value) { _swapped = value; }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1840 // generic
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1841 virtual void input_values_do(ValueVisitor* f) { BlockEnd::input_values_do(f); f->visit(&_x); f->visit(&_y); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1842 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1843
a61af66fc99e Initial load
duke
parents:
diff changeset
1844
a61af66fc99e Initial load
duke
parents:
diff changeset
1845 LEAF(IfInstanceOf, BlockEnd)
a61af66fc99e Initial load
duke
parents:
diff changeset
1846 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
1847 ciKlass* _klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
1848 Value _obj;
a61af66fc99e Initial load
duke
parents:
diff changeset
1849 bool _test_is_instance; // jump if instance
a61af66fc99e Initial load
duke
parents:
diff changeset
1850 int _instanceof_bci;
a61af66fc99e Initial load
duke
parents:
diff changeset
1851
a61af66fc99e Initial load
duke
parents:
diff changeset
1852 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
1853 IfInstanceOf(ciKlass* klass, Value obj, bool test_is_instance, int instanceof_bci, BlockBegin* tsux, BlockBegin* fsux)
a61af66fc99e Initial load
duke
parents:
diff changeset
1854 : BlockEnd(illegalType, NULL, false) // temporary set to false
a61af66fc99e Initial load
duke
parents:
diff changeset
1855 , _klass(klass)
a61af66fc99e Initial load
duke
parents:
diff changeset
1856 , _obj(obj)
a61af66fc99e Initial load
duke
parents:
diff changeset
1857 , _test_is_instance(test_is_instance)
a61af66fc99e Initial load
duke
parents:
diff changeset
1858 , _instanceof_bci(instanceof_bci)
a61af66fc99e Initial load
duke
parents:
diff changeset
1859 {
a61af66fc99e Initial load
duke
parents:
diff changeset
1860 ASSERT_VALUES
a61af66fc99e Initial load
duke
parents:
diff changeset
1861 assert(instanceof_bci >= 0, "illegal bci");
a61af66fc99e Initial load
duke
parents:
diff changeset
1862 BlockList* s = new BlockList(2);
a61af66fc99e Initial load
duke
parents:
diff changeset
1863 s->append(tsux);
a61af66fc99e Initial load
duke
parents:
diff changeset
1864 s->append(fsux);
a61af66fc99e Initial load
duke
parents:
diff changeset
1865 set_sux(s);
a61af66fc99e Initial load
duke
parents:
diff changeset
1866 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1867
a61af66fc99e Initial load
duke
parents:
diff changeset
1868 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
1869 //
a61af66fc99e Initial load
duke
parents:
diff changeset
1870 // Note 1: If test_is_instance() is true, IfInstanceOf tests if obj *is* an
a61af66fc99e Initial load
duke
parents:
diff changeset
1871 // instance of klass; otherwise it tests if it is *not* and instance
a61af66fc99e Initial load
duke
parents:
diff changeset
1872 // of klass.
a61af66fc99e Initial load
duke
parents:
diff changeset
1873 //
a61af66fc99e Initial load
duke
parents:
diff changeset
1874 // Note 2: IfInstanceOf instructions are created by combining an InstanceOf
a61af66fc99e Initial load
duke
parents:
diff changeset
1875 // and an If instruction. The IfInstanceOf bci() corresponds to the
a61af66fc99e Initial load
duke
parents:
diff changeset
1876 // bci that the If would have had; the (this->) instanceof_bci() is
a61af66fc99e Initial load
duke
parents:
diff changeset
1877 // the bci of the original InstanceOf instruction.
a61af66fc99e Initial load
duke
parents:
diff changeset
1878 ciKlass* klass() const { return _klass; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1879 Value obj() const { return _obj; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1880 int instanceof_bci() const { return _instanceof_bci; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1881 bool test_is_instance() const { return _test_is_instance; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1882 BlockBegin* sux_for(bool is_true) const { return sux_at(is_true ? 0 : 1); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1883 BlockBegin* tsux() const { return sux_for(true); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1884 BlockBegin* fsux() const { return sux_for(false); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1885
a61af66fc99e Initial load
duke
parents:
diff changeset
1886 // manipulation
a61af66fc99e Initial load
duke
parents:
diff changeset
1887 void swap_sux() {
a61af66fc99e Initial load
duke
parents:
diff changeset
1888 assert(number_of_sux() == 2, "wrong number of successors");
a61af66fc99e Initial load
duke
parents:
diff changeset
1889 BlockList* s = sux();
a61af66fc99e Initial load
duke
parents:
diff changeset
1890 BlockBegin* t = s->at(0); s->at_put(0, s->at(1)); s->at_put(1, t);
a61af66fc99e Initial load
duke
parents:
diff changeset
1891 _test_is_instance = !_test_is_instance;
a61af66fc99e Initial load
duke
parents:
diff changeset
1892 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1893
a61af66fc99e Initial load
duke
parents:
diff changeset
1894 // generic
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1895 virtual void input_values_do(ValueVisitor* f) { BlockEnd::input_values_do(f); f->visit(&_obj); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1896 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1897
a61af66fc99e Initial load
duke
parents:
diff changeset
1898
a61af66fc99e Initial load
duke
parents:
diff changeset
1899 BASE(Switch, BlockEnd)
a61af66fc99e Initial load
duke
parents:
diff changeset
1900 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
1901 Value _tag;
a61af66fc99e Initial load
duke
parents:
diff changeset
1902
a61af66fc99e Initial load
duke
parents:
diff changeset
1903 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
1904 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
1905 Switch(Value tag, BlockList* sux, ValueStack* state_before, bool is_safepoint)
a61af66fc99e Initial load
duke
parents:
diff changeset
1906 : BlockEnd(illegalType, state_before, is_safepoint)
a61af66fc99e Initial load
duke
parents:
diff changeset
1907 , _tag(tag) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1908 ASSERT_VALUES
a61af66fc99e Initial load
duke
parents:
diff changeset
1909 set_sux(sux);
a61af66fc99e Initial load
duke
parents:
diff changeset
1910 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1911
a61af66fc99e Initial load
duke
parents:
diff changeset
1912 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
1913 Value tag() const { return _tag; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1914 int length() const { return number_of_sux() - 1; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1915
a61af66fc99e Initial load
duke
parents:
diff changeset
1916 // generic
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1917 virtual void input_values_do(ValueVisitor* f) { BlockEnd::input_values_do(f); f->visit(&_tag); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1918 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1919
a61af66fc99e Initial load
duke
parents:
diff changeset
1920
a61af66fc99e Initial load
duke
parents:
diff changeset
1921 LEAF(TableSwitch, Switch)
a61af66fc99e Initial load
duke
parents:
diff changeset
1922 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
1923 int _lo_key;
a61af66fc99e Initial load
duke
parents:
diff changeset
1924
a61af66fc99e Initial load
duke
parents:
diff changeset
1925 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
1926 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
1927 TableSwitch(Value tag, BlockList* sux, int lo_key, ValueStack* state_before, bool is_safepoint)
a61af66fc99e Initial load
duke
parents:
diff changeset
1928 : Switch(tag, sux, state_before, is_safepoint)
a61af66fc99e Initial load
duke
parents:
diff changeset
1929 , _lo_key(lo_key) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
1930
a61af66fc99e Initial load
duke
parents:
diff changeset
1931 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
1932 int lo_key() const { return _lo_key; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1933 int hi_key() const { return _lo_key + length() - 1; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1934 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1935
a61af66fc99e Initial load
duke
parents:
diff changeset
1936
a61af66fc99e Initial load
duke
parents:
diff changeset
1937 LEAF(LookupSwitch, Switch)
a61af66fc99e Initial load
duke
parents:
diff changeset
1938 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
1939 intArray* _keys;
a61af66fc99e Initial load
duke
parents:
diff changeset
1940
a61af66fc99e Initial load
duke
parents:
diff changeset
1941 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
1942 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
1943 LookupSwitch(Value tag, BlockList* sux, intArray* keys, ValueStack* state_before, bool is_safepoint)
a61af66fc99e Initial load
duke
parents:
diff changeset
1944 : Switch(tag, sux, state_before, is_safepoint)
a61af66fc99e Initial load
duke
parents:
diff changeset
1945 , _keys(keys) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1946 assert(keys != NULL, "keys must exist");
a61af66fc99e Initial load
duke
parents:
diff changeset
1947 assert(keys->length() == length(), "sux & keys have incompatible lengths");
a61af66fc99e Initial load
duke
parents:
diff changeset
1948 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1949
a61af66fc99e Initial load
duke
parents:
diff changeset
1950 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
1951 int key_at(int i) const { return _keys->at(i); }
a61af66fc99e Initial load
duke
parents:
diff changeset
1952 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1953
a61af66fc99e Initial load
duke
parents:
diff changeset
1954
a61af66fc99e Initial load
duke
parents:
diff changeset
1955 LEAF(Return, BlockEnd)
a61af66fc99e Initial load
duke
parents:
diff changeset
1956 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
1957 Value _result;
a61af66fc99e Initial load
duke
parents:
diff changeset
1958
a61af66fc99e Initial load
duke
parents:
diff changeset
1959 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
1960 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
1961 Return(Value result) :
a61af66fc99e Initial load
duke
parents:
diff changeset
1962 BlockEnd(result == NULL ? voidType : result->type()->base(), NULL, true),
a61af66fc99e Initial load
duke
parents:
diff changeset
1963 _result(result) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
1964
a61af66fc99e Initial load
duke
parents:
diff changeset
1965 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
1966 Value result() const { return _result; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1967 bool has_result() const { return result() != NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1968
a61af66fc99e Initial load
duke
parents:
diff changeset
1969 // generic
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1970 virtual void input_values_do(ValueVisitor* f) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1971 BlockEnd::input_values_do(f);
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1972 if (has_result()) f->visit(&_result);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1973 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1974 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1975
a61af66fc99e Initial load
duke
parents:
diff changeset
1976
a61af66fc99e Initial load
duke
parents:
diff changeset
1977 LEAF(Throw, BlockEnd)
a61af66fc99e Initial load
duke
parents:
diff changeset
1978 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
1979 Value _exception;
a61af66fc99e Initial load
duke
parents:
diff changeset
1980
a61af66fc99e Initial load
duke
parents:
diff changeset
1981 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
1982 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
1983 Throw(Value exception, ValueStack* state_before) : BlockEnd(illegalType, state_before, true), _exception(exception) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1984 ASSERT_VALUES
a61af66fc99e Initial load
duke
parents:
diff changeset
1985 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1986
a61af66fc99e Initial load
duke
parents:
diff changeset
1987 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
1988 Value exception() const { return _exception; }
a61af66fc99e Initial load
duke
parents:
diff changeset
1989
a61af66fc99e Initial load
duke
parents:
diff changeset
1990 // generic
a61af66fc99e Initial load
duke
parents:
diff changeset
1991 virtual bool can_trap() const { return true; }
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1992 virtual void input_values_do(ValueVisitor* f) { BlockEnd::input_values_do(f); f->visit(&_exception); }
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
1993 virtual void state_values_do(ValueVisitor* f);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1994 };
a61af66fc99e Initial load
duke
parents:
diff changeset
1995
a61af66fc99e Initial load
duke
parents:
diff changeset
1996
a61af66fc99e Initial load
duke
parents:
diff changeset
1997 LEAF(Base, BlockEnd)
a61af66fc99e Initial load
duke
parents:
diff changeset
1998 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
1999 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
2000 Base(BlockBegin* std_entry, BlockBegin* osr_entry) : BlockEnd(illegalType, NULL, false) {
a61af66fc99e Initial load
duke
parents:
diff changeset
2001 assert(std_entry->is_set(BlockBegin::std_entry_flag), "std entry must be flagged");
a61af66fc99e Initial load
duke
parents:
diff changeset
2002 assert(osr_entry == NULL || osr_entry->is_set(BlockBegin::osr_entry_flag), "osr entry must be flagged");
a61af66fc99e Initial load
duke
parents:
diff changeset
2003 BlockList* s = new BlockList(2);
a61af66fc99e Initial load
duke
parents:
diff changeset
2004 if (osr_entry != NULL) s->append(osr_entry);
a61af66fc99e Initial load
duke
parents:
diff changeset
2005 s->append(std_entry); // must be default sux!
a61af66fc99e Initial load
duke
parents:
diff changeset
2006 set_sux(s);
a61af66fc99e Initial load
duke
parents:
diff changeset
2007 }
a61af66fc99e Initial load
duke
parents:
diff changeset
2008
a61af66fc99e Initial load
duke
parents:
diff changeset
2009 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
2010 BlockBegin* std_entry() const { return default_sux(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
2011 BlockBegin* osr_entry() const { return number_of_sux() < 2 ? NULL : sux_at(0); }
a61af66fc99e Initial load
duke
parents:
diff changeset
2012 };
a61af66fc99e Initial load
duke
parents:
diff changeset
2013
a61af66fc99e Initial load
duke
parents:
diff changeset
2014
a61af66fc99e Initial load
duke
parents:
diff changeset
2015 LEAF(OsrEntry, Instruction)
a61af66fc99e Initial load
duke
parents:
diff changeset
2016 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
2017 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
2018 #ifdef _LP64
a61af66fc99e Initial load
duke
parents:
diff changeset
2019 OsrEntry() : Instruction(longType, false) { pin(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
2020 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
2021 OsrEntry() : Instruction(intType, false) { pin(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
2022 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
2023
a61af66fc99e Initial load
duke
parents:
diff changeset
2024 // generic
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
2025 virtual void input_values_do(ValueVisitor* f) { }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
2026 };
a61af66fc99e Initial load
duke
parents:
diff changeset
2027
a61af66fc99e Initial load
duke
parents:
diff changeset
2028
a61af66fc99e Initial load
duke
parents:
diff changeset
2029 // Models the incoming exception at a catch site
a61af66fc99e Initial load
duke
parents:
diff changeset
2030 LEAF(ExceptionObject, Instruction)
a61af66fc99e Initial load
duke
parents:
diff changeset
2031 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
2032 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
2033 ExceptionObject() : Instruction(objectType, false) {
a61af66fc99e Initial load
duke
parents:
diff changeset
2034 pin();
a61af66fc99e Initial load
duke
parents:
diff changeset
2035 }
a61af66fc99e Initial load
duke
parents:
diff changeset
2036
a61af66fc99e Initial load
duke
parents:
diff changeset
2037 // generic
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
2038 virtual void input_values_do(ValueVisitor* f) { }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
2039 };
a61af66fc99e Initial load
duke
parents:
diff changeset
2040
a61af66fc99e Initial load
duke
parents:
diff changeset
2041
a61af66fc99e Initial load
duke
parents:
diff changeset
2042 // Models needed rounding for floating-point values on Intel.
a61af66fc99e Initial load
duke
parents:
diff changeset
2043 // Currently only used to represent rounding of double-precision
a61af66fc99e Initial load
duke
parents:
diff changeset
2044 // values stored into local variables, but could be used to model
a61af66fc99e Initial load
duke
parents:
diff changeset
2045 // intermediate rounding of single-precision values as well.
a61af66fc99e Initial load
duke
parents:
diff changeset
2046 LEAF(RoundFP, Instruction)
a61af66fc99e Initial load
duke
parents:
diff changeset
2047 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
2048 Value _input; // floating-point value to be rounded
a61af66fc99e Initial load
duke
parents:
diff changeset
2049
a61af66fc99e Initial load
duke
parents:
diff changeset
2050 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
2051 RoundFP(Value input)
a61af66fc99e Initial load
duke
parents:
diff changeset
2052 : Instruction(input->type()) // Note: should not be used for constants
a61af66fc99e Initial load
duke
parents:
diff changeset
2053 , _input(input)
a61af66fc99e Initial load
duke
parents:
diff changeset
2054 {
a61af66fc99e Initial load
duke
parents:
diff changeset
2055 ASSERT_VALUES
a61af66fc99e Initial load
duke
parents:
diff changeset
2056 }
a61af66fc99e Initial load
duke
parents:
diff changeset
2057
a61af66fc99e Initial load
duke
parents:
diff changeset
2058 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
2059 Value input() const { return _input; }
a61af66fc99e Initial load
duke
parents:
diff changeset
2060
a61af66fc99e Initial load
duke
parents:
diff changeset
2061 // generic
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
2062 virtual void input_values_do(ValueVisitor* f) { f->visit(&_input); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
2063 };
a61af66fc99e Initial load
duke
parents:
diff changeset
2064
a61af66fc99e Initial load
duke
parents:
diff changeset
2065
a61af66fc99e Initial load
duke
parents:
diff changeset
2066 BASE(UnsafeOp, Instruction)
a61af66fc99e Initial load
duke
parents:
diff changeset
2067 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
2068 BasicType _basic_type; // ValueType can not express byte-sized integers
a61af66fc99e Initial load
duke
parents:
diff changeset
2069
a61af66fc99e Initial load
duke
parents:
diff changeset
2070 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
2071 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
2072 UnsafeOp(BasicType basic_type, bool is_put)
a61af66fc99e Initial load
duke
parents:
diff changeset
2073 : Instruction(is_put ? voidType : as_ValueType(basic_type))
a61af66fc99e Initial load
duke
parents:
diff changeset
2074 , _basic_type(basic_type)
a61af66fc99e Initial load
duke
parents:
diff changeset
2075 {
a61af66fc99e Initial load
duke
parents:
diff changeset
2076 //Note: Unsafe ops are not not guaranteed to throw NPE.
a61af66fc99e Initial load
duke
parents:
diff changeset
2077 // Convservatively, Unsafe operations must be pinned though we could be
a61af66fc99e Initial load
duke
parents:
diff changeset
2078 // looser about this if we wanted to..
a61af66fc99e Initial load
duke
parents:
diff changeset
2079 pin();
a61af66fc99e Initial load
duke
parents:
diff changeset
2080 }
a61af66fc99e Initial load
duke
parents:
diff changeset
2081
a61af66fc99e Initial load
duke
parents:
diff changeset
2082 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
2083 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
2084 BasicType basic_type() { return _basic_type; }
a61af66fc99e Initial load
duke
parents:
diff changeset
2085
a61af66fc99e Initial load
duke
parents:
diff changeset
2086 // generic
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
2087 virtual void input_values_do(ValueVisitor* f) { }
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
2088 virtual void other_values_do(ValueVisitor* f) { }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
2089 };
a61af66fc99e Initial load
duke
parents:
diff changeset
2090
a61af66fc99e Initial load
duke
parents:
diff changeset
2091
a61af66fc99e Initial load
duke
parents:
diff changeset
2092 BASE(UnsafeRawOp, UnsafeOp)
a61af66fc99e Initial load
duke
parents:
diff changeset
2093 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
2094 Value _base; // Base address (a Java long)
a61af66fc99e Initial load
duke
parents:
diff changeset
2095 Value _index; // Index if computed by optimizer; initialized to NULL
a61af66fc99e Initial load
duke
parents:
diff changeset
2096 int _log2_scale; // Scale factor: 0, 1, 2, or 3.
a61af66fc99e Initial load
duke
parents:
diff changeset
2097 // Indicates log2 of number of bytes (1, 2, 4, or 8)
a61af66fc99e Initial load
duke
parents:
diff changeset
2098 // to scale index by.
a61af66fc99e Initial load
duke
parents:
diff changeset
2099
a61af66fc99e Initial load
duke
parents:
diff changeset
2100 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
2101 UnsafeRawOp(BasicType basic_type, Value addr, bool is_put)
a61af66fc99e Initial load
duke
parents:
diff changeset
2102 : UnsafeOp(basic_type, is_put)
a61af66fc99e Initial load
duke
parents:
diff changeset
2103 , _base(addr)
a61af66fc99e Initial load
duke
parents:
diff changeset
2104 , _index(NULL)
a61af66fc99e Initial load
duke
parents:
diff changeset
2105 , _log2_scale(0)
a61af66fc99e Initial load
duke
parents:
diff changeset
2106 {
a61af66fc99e Initial load
duke
parents:
diff changeset
2107 // Can not use ASSERT_VALUES because index may be NULL
a61af66fc99e Initial load
duke
parents:
diff changeset
2108 assert(addr != NULL && addr->type()->is_long(), "just checking");
a61af66fc99e Initial load
duke
parents:
diff changeset
2109 }
a61af66fc99e Initial load
duke
parents:
diff changeset
2110
a61af66fc99e Initial load
duke
parents:
diff changeset
2111 UnsafeRawOp(BasicType basic_type, Value base, Value index, int log2_scale, bool is_put)
a61af66fc99e Initial load
duke
parents:
diff changeset
2112 : UnsafeOp(basic_type, is_put)
a61af66fc99e Initial load
duke
parents:
diff changeset
2113 , _base(base)
a61af66fc99e Initial load
duke
parents:
diff changeset
2114 , _index(index)
a61af66fc99e Initial load
duke
parents:
diff changeset
2115 , _log2_scale(log2_scale)
a61af66fc99e Initial load
duke
parents:
diff changeset
2116 {
a61af66fc99e Initial load
duke
parents:
diff changeset
2117 }
a61af66fc99e Initial load
duke
parents:
diff changeset
2118
a61af66fc99e Initial load
duke
parents:
diff changeset
2119 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
2120 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
2121 Value base() { return _base; }
a61af66fc99e Initial load
duke
parents:
diff changeset
2122 Value index() { return _index; }
a61af66fc99e Initial load
duke
parents:
diff changeset
2123 bool has_index() { return (_index != NULL); }
a61af66fc99e Initial load
duke
parents:
diff changeset
2124 int log2_scale() { return _log2_scale; }
a61af66fc99e Initial load
duke
parents:
diff changeset
2125
a61af66fc99e Initial load
duke
parents:
diff changeset
2126 // setters
a61af66fc99e Initial load
duke
parents:
diff changeset
2127 void set_base (Value base) { _base = base; }
a61af66fc99e Initial load
duke
parents:
diff changeset
2128 void set_index(Value index) { _index = index; }
a61af66fc99e Initial load
duke
parents:
diff changeset
2129 void set_log2_scale(int log2_scale) { _log2_scale = log2_scale; }
a61af66fc99e Initial load
duke
parents:
diff changeset
2130
a61af66fc99e Initial load
duke
parents:
diff changeset
2131 // generic
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
2132 virtual void input_values_do(ValueVisitor* f) { UnsafeOp::input_values_do(f);
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
2133 f->visit(&_base);
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
2134 if (has_index()) f->visit(&_index); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
2135 };
a61af66fc99e Initial load
duke
parents:
diff changeset
2136
a61af66fc99e Initial load
duke
parents:
diff changeset
2137
a61af66fc99e Initial load
duke
parents:
diff changeset
2138 LEAF(UnsafeGetRaw, UnsafeRawOp)
a61af66fc99e Initial load
duke
parents:
diff changeset
2139 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
2140 bool _may_be_unaligned; // For OSREntry
a61af66fc99e Initial load
duke
parents:
diff changeset
2141
a61af66fc99e Initial load
duke
parents:
diff changeset
2142 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
2143 UnsafeGetRaw(BasicType basic_type, Value addr, bool may_be_unaligned)
a61af66fc99e Initial load
duke
parents:
diff changeset
2144 : UnsafeRawOp(basic_type, addr, false) {
a61af66fc99e Initial load
duke
parents:
diff changeset
2145 _may_be_unaligned = may_be_unaligned;
a61af66fc99e Initial load
duke
parents:
diff changeset
2146 }
a61af66fc99e Initial load
duke
parents:
diff changeset
2147
a61af66fc99e Initial load
duke
parents:
diff changeset
2148 UnsafeGetRaw(BasicType basic_type, Value base, Value index, int log2_scale, bool may_be_unaligned)
a61af66fc99e Initial load
duke
parents:
diff changeset
2149 : UnsafeRawOp(basic_type, base, index, log2_scale, false) {
a61af66fc99e Initial load
duke
parents:
diff changeset
2150 _may_be_unaligned = may_be_unaligned;
a61af66fc99e Initial load
duke
parents:
diff changeset
2151 }
a61af66fc99e Initial load
duke
parents:
diff changeset
2152
a61af66fc99e Initial load
duke
parents:
diff changeset
2153 bool may_be_unaligned() { return _may_be_unaligned; }
a61af66fc99e Initial load
duke
parents:
diff changeset
2154 };
a61af66fc99e Initial load
duke
parents:
diff changeset
2155
a61af66fc99e Initial load
duke
parents:
diff changeset
2156
a61af66fc99e Initial load
duke
parents:
diff changeset
2157 LEAF(UnsafePutRaw, UnsafeRawOp)
a61af66fc99e Initial load
duke
parents:
diff changeset
2158 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
2159 Value _value; // Value to be stored
a61af66fc99e Initial load
duke
parents:
diff changeset
2160
a61af66fc99e Initial load
duke
parents:
diff changeset
2161 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
2162 UnsafePutRaw(BasicType basic_type, Value addr, Value value)
a61af66fc99e Initial load
duke
parents:
diff changeset
2163 : UnsafeRawOp(basic_type, addr, true)
a61af66fc99e Initial load
duke
parents:
diff changeset
2164 , _value(value)
a61af66fc99e Initial load
duke
parents:
diff changeset
2165 {
a61af66fc99e Initial load
duke
parents:
diff changeset
2166 assert(value != NULL, "just checking");
a61af66fc99e Initial load
duke
parents:
diff changeset
2167 ASSERT_VALUES
a61af66fc99e Initial load
duke
parents:
diff changeset
2168 }
a61af66fc99e Initial load
duke
parents:
diff changeset
2169
a61af66fc99e Initial load
duke
parents:
diff changeset
2170 UnsafePutRaw(BasicType basic_type, Value base, Value index, int log2_scale, Value value)
a61af66fc99e Initial load
duke
parents:
diff changeset
2171 : UnsafeRawOp(basic_type, base, index, log2_scale, true)
a61af66fc99e Initial load
duke
parents:
diff changeset
2172 , _value(value)
a61af66fc99e Initial load
duke
parents:
diff changeset
2173 {
a61af66fc99e Initial load
duke
parents:
diff changeset
2174 assert(value != NULL, "just checking");
a61af66fc99e Initial load
duke
parents:
diff changeset
2175 ASSERT_VALUES
a61af66fc99e Initial load
duke
parents:
diff changeset
2176 }
a61af66fc99e Initial load
duke
parents:
diff changeset
2177
a61af66fc99e Initial load
duke
parents:
diff changeset
2178 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
2179 Value value() { return _value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
2180
a61af66fc99e Initial load
duke
parents:
diff changeset
2181 // generic
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
2182 virtual void input_values_do(ValueVisitor* f) { UnsafeRawOp::input_values_do(f);
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
2183 f->visit(&_value); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
2184 };
a61af66fc99e Initial load
duke
parents:
diff changeset
2185
a61af66fc99e Initial load
duke
parents:
diff changeset
2186
a61af66fc99e Initial load
duke
parents:
diff changeset
2187 BASE(UnsafeObjectOp, UnsafeOp)
a61af66fc99e Initial load
duke
parents:
diff changeset
2188 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
2189 Value _object; // Object to be fetched from or mutated
a61af66fc99e Initial load
duke
parents:
diff changeset
2190 Value _offset; // Offset within object
a61af66fc99e Initial load
duke
parents:
diff changeset
2191 bool _is_volatile; // true if volatile - dl/JSR166
a61af66fc99e Initial load
duke
parents:
diff changeset
2192 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
2193 UnsafeObjectOp(BasicType basic_type, Value object, Value offset, bool is_put, bool is_volatile)
a61af66fc99e Initial load
duke
parents:
diff changeset
2194 : UnsafeOp(basic_type, is_put), _object(object), _offset(offset), _is_volatile(is_volatile)
a61af66fc99e Initial load
duke
parents:
diff changeset
2195 {
a61af66fc99e Initial load
duke
parents:
diff changeset
2196 }
a61af66fc99e Initial load
duke
parents:
diff changeset
2197
a61af66fc99e Initial load
duke
parents:
diff changeset
2198 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
2199 Value object() { return _object; }
a61af66fc99e Initial load
duke
parents:
diff changeset
2200 Value offset() { return _offset; }
a61af66fc99e Initial load
duke
parents:
diff changeset
2201 bool is_volatile() { return _is_volatile; }
a61af66fc99e Initial load
duke
parents:
diff changeset
2202 // generic
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
2203 virtual void input_values_do(ValueVisitor* f) { UnsafeOp::input_values_do(f);
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
2204 f->visit(&_object);
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
2205 f->visit(&_offset); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
2206 };
a61af66fc99e Initial load
duke
parents:
diff changeset
2207
a61af66fc99e Initial load
duke
parents:
diff changeset
2208
a61af66fc99e Initial load
duke
parents:
diff changeset
2209 LEAF(UnsafeGetObject, UnsafeObjectOp)
a61af66fc99e Initial load
duke
parents:
diff changeset
2210 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
2211 UnsafeGetObject(BasicType basic_type, Value object, Value offset, bool is_volatile)
a61af66fc99e Initial load
duke
parents:
diff changeset
2212 : UnsafeObjectOp(basic_type, object, offset, false, is_volatile)
a61af66fc99e Initial load
duke
parents:
diff changeset
2213 {
a61af66fc99e Initial load
duke
parents:
diff changeset
2214 ASSERT_VALUES
a61af66fc99e Initial load
duke
parents:
diff changeset
2215 }
a61af66fc99e Initial load
duke
parents:
diff changeset
2216 };
a61af66fc99e Initial load
duke
parents:
diff changeset
2217
a61af66fc99e Initial load
duke
parents:
diff changeset
2218
a61af66fc99e Initial load
duke
parents:
diff changeset
2219 LEAF(UnsafePutObject, UnsafeObjectOp)
a61af66fc99e Initial load
duke
parents:
diff changeset
2220 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
2221 Value _value; // Value to be stored
a61af66fc99e Initial load
duke
parents:
diff changeset
2222 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
2223 UnsafePutObject(BasicType basic_type, Value object, Value offset, Value value, bool is_volatile)
a61af66fc99e Initial load
duke
parents:
diff changeset
2224 : UnsafeObjectOp(basic_type, object, offset, true, is_volatile)
a61af66fc99e Initial load
duke
parents:
diff changeset
2225 , _value(value)
a61af66fc99e Initial load
duke
parents:
diff changeset
2226 {
a61af66fc99e Initial load
duke
parents:
diff changeset
2227 ASSERT_VALUES
a61af66fc99e Initial load
duke
parents:
diff changeset
2228 }
a61af66fc99e Initial load
duke
parents:
diff changeset
2229
a61af66fc99e Initial load
duke
parents:
diff changeset
2230 // accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
2231 Value value() { return _value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
2232
a61af66fc99e Initial load
duke
parents:
diff changeset
2233 // generic
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
2234 virtual void input_values_do(ValueVisitor* f) { UnsafeObjectOp::input_values_do(f);
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
2235 f->visit(&_value); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
2236 };
a61af66fc99e Initial load
duke
parents:
diff changeset
2237
a61af66fc99e Initial load
duke
parents:
diff changeset
2238
a61af66fc99e Initial load
duke
parents:
diff changeset
2239 BASE(UnsafePrefetch, UnsafeObjectOp)
a61af66fc99e Initial load
duke
parents:
diff changeset
2240 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
2241 UnsafePrefetch(Value object, Value offset)
a61af66fc99e Initial load
duke
parents:
diff changeset
2242 : UnsafeObjectOp(T_VOID, object, offset, false, false)
a61af66fc99e Initial load
duke
parents:
diff changeset
2243 {
a61af66fc99e Initial load
duke
parents:
diff changeset
2244 }
a61af66fc99e Initial load
duke
parents:
diff changeset
2245 };
a61af66fc99e Initial load
duke
parents:
diff changeset
2246
a61af66fc99e Initial load
duke
parents:
diff changeset
2247
a61af66fc99e Initial load
duke
parents:
diff changeset
2248 LEAF(UnsafePrefetchRead, UnsafePrefetch)
a61af66fc99e Initial load
duke
parents:
diff changeset
2249 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
2250 UnsafePrefetchRead(Value object, Value offset)
a61af66fc99e Initial load
duke
parents:
diff changeset
2251 : UnsafePrefetch(object, offset)
a61af66fc99e Initial load
duke
parents:
diff changeset
2252 {
a61af66fc99e Initial load
duke
parents:
diff changeset
2253 ASSERT_VALUES
a61af66fc99e Initial load
duke
parents:
diff changeset
2254 }
a61af66fc99e Initial load
duke
parents:
diff changeset
2255 };
a61af66fc99e Initial load
duke
parents:
diff changeset
2256
a61af66fc99e Initial load
duke
parents:
diff changeset
2257
a61af66fc99e Initial load
duke
parents:
diff changeset
2258 LEAF(UnsafePrefetchWrite, UnsafePrefetch)
a61af66fc99e Initial load
duke
parents:
diff changeset
2259 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
2260 UnsafePrefetchWrite(Value object, Value offset)
a61af66fc99e Initial load
duke
parents:
diff changeset
2261 : UnsafePrefetch(object, offset)
a61af66fc99e Initial load
duke
parents:
diff changeset
2262 {
a61af66fc99e Initial load
duke
parents:
diff changeset
2263 ASSERT_VALUES
a61af66fc99e Initial load
duke
parents:
diff changeset
2264 }
a61af66fc99e Initial load
duke
parents:
diff changeset
2265 };
a61af66fc99e Initial load
duke
parents:
diff changeset
2266
a61af66fc99e Initial load
duke
parents:
diff changeset
2267 LEAF(ProfileCall, Instruction)
a61af66fc99e Initial load
duke
parents:
diff changeset
2268 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
2269 ciMethod* _method;
a61af66fc99e Initial load
duke
parents:
diff changeset
2270 int _bci_of_invoke;
a61af66fc99e Initial load
duke
parents:
diff changeset
2271 Value _recv;
a61af66fc99e Initial load
duke
parents:
diff changeset
2272 ciKlass* _known_holder;
a61af66fc99e Initial load
duke
parents:
diff changeset
2273
a61af66fc99e Initial load
duke
parents:
diff changeset
2274 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
2275 ProfileCall(ciMethod* method, int bci, Value recv, ciKlass* known_holder)
a61af66fc99e Initial load
duke
parents:
diff changeset
2276 : Instruction(voidType)
a61af66fc99e Initial load
duke
parents:
diff changeset
2277 , _method(method)
a61af66fc99e Initial load
duke
parents:
diff changeset
2278 , _bci_of_invoke(bci)
a61af66fc99e Initial load
duke
parents:
diff changeset
2279 , _recv(recv)
a61af66fc99e Initial load
duke
parents:
diff changeset
2280 , _known_holder(known_holder)
a61af66fc99e Initial load
duke
parents:
diff changeset
2281 {
a61af66fc99e Initial load
duke
parents:
diff changeset
2282 // The ProfileCall has side-effects and must occur precisely where located
a61af66fc99e Initial load
duke
parents:
diff changeset
2283 pin();
a61af66fc99e Initial load
duke
parents:
diff changeset
2284 }
a61af66fc99e Initial load
duke
parents:
diff changeset
2285
a61af66fc99e Initial load
duke
parents:
diff changeset
2286 ciMethod* method() { return _method; }
a61af66fc99e Initial load
duke
parents:
diff changeset
2287 int bci_of_invoke() { return _bci_of_invoke; }
a61af66fc99e Initial load
duke
parents:
diff changeset
2288 Value recv() { return _recv; }
a61af66fc99e Initial load
duke
parents:
diff changeset
2289 ciKlass* known_holder() { return _known_holder; }
a61af66fc99e Initial load
duke
parents:
diff changeset
2290
1584
b812ff5abc73 6958292: C1: Enable parallel compilation
iveresov
parents: 1552
diff changeset
2291 virtual void input_values_do(ValueVisitor* f) { if (_recv != NULL) f->visit(&_recv); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
2292 };
a61af66fc99e Initial load
duke
parents:
diff changeset
2293
1783
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
2294 // Use to trip invocation counter of an inlined method
0
a61af66fc99e Initial load
duke
parents:
diff changeset
2295
1783
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
2296 LEAF(ProfileInvoke, Instruction)
0
a61af66fc99e Initial load
duke
parents:
diff changeset
2297 private:
1783
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
2298 ciMethod* _inlinee;
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
2299 ValueStack* _state;
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
2300 int _bci_of_invoke;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
2301
a61af66fc99e Initial load
duke
parents:
diff changeset
2302 public:
1783
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
2303 ProfileInvoke(ciMethod* inlinee, ValueStack* state, int bci)
0
a61af66fc99e Initial load
duke
parents:
diff changeset
2304 : Instruction(voidType)
1783
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
2305 , _inlinee(inlinee)
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
2306 , _bci_of_invoke(bci)
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
2307 , _state(state)
0
a61af66fc99e Initial load
duke
parents:
diff changeset
2308 {
1783
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
2309 // The ProfileInvoke has side-effects and must occur precisely where located QQQ???
0
a61af66fc99e Initial load
duke
parents:
diff changeset
2310 pin();
a61af66fc99e Initial load
duke
parents:
diff changeset
2311 }
a61af66fc99e Initial load
duke
parents:
diff changeset
2312
1783
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
2313 ciMethod* inlinee() { return _inlinee; }
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
2314 ValueStack* state() { return _state; }
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
2315 int bci_of_invoke() { return _bci_of_invoke; }
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
2316 virtual void input_values_do(ValueVisitor*) {}
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1584
diff changeset
2317 virtual void state_values_do(ValueVisitor*);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
2318 };
a61af66fc99e Initial load
duke
parents:
diff changeset
2319
a61af66fc99e Initial load
duke
parents:
diff changeset
2320 class BlockPair: public CompilationResourceObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
2321 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
2322 BlockBegin* _from;
a61af66fc99e Initial load
duke
parents:
diff changeset
2323 BlockBegin* _to;
a61af66fc99e Initial load
duke
parents:
diff changeset
2324 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
2325 BlockPair(BlockBegin* from, BlockBegin* to): _from(from), _to(to) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
2326 BlockBegin* from() const { return _from; }
a61af66fc99e Initial load
duke
parents:
diff changeset
2327 BlockBegin* to() const { return _to; }
a61af66fc99e Initial load
duke
parents:
diff changeset
2328 bool is_same(BlockBegin* from, BlockBegin* to) const { return _from == from && _to == to; }
a61af66fc99e Initial load
duke
parents:
diff changeset
2329 bool is_same(BlockPair* p) const { return _from == p->from() && _to == p->to(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
2330 void set_to(BlockBegin* b) { _to = b; }
a61af66fc99e Initial load
duke
parents:
diff changeset
2331 void set_from(BlockBegin* b) { _from = b; }
a61af66fc99e Initial load
duke
parents:
diff changeset
2332 };
a61af66fc99e Initial load
duke
parents:
diff changeset
2333
a61af66fc99e Initial load
duke
parents:
diff changeset
2334
a61af66fc99e Initial load
duke
parents:
diff changeset
2335 define_array(BlockPairArray, BlockPair*)
a61af66fc99e Initial load
duke
parents:
diff changeset
2336 define_stack(BlockPairList, BlockPairArray)
a61af66fc99e Initial load
duke
parents:
diff changeset
2337
a61af66fc99e Initial load
duke
parents:
diff changeset
2338
a61af66fc99e Initial load
duke
parents:
diff changeset
2339 inline int BlockBegin::number_of_sux() const { assert(_end == NULL || _end->number_of_sux() == _successors.length(), "mismatch"); return _successors.length(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
2340 inline BlockBegin* BlockBegin::sux_at(int i) const { assert(_end == NULL || _end->sux_at(i) == _successors.at(i), "mismatch"); return _successors.at(i); }
a61af66fc99e Initial load
duke
parents:
diff changeset
2341 inline void BlockBegin::add_successor(BlockBegin* sux) { assert(_end == NULL, "Would create mismatch with successors of BlockEnd"); _successors.append(sux); }
a61af66fc99e Initial load
duke
parents:
diff changeset
2342
a61af66fc99e Initial load
duke
parents:
diff changeset
2343 #undef ASSERT_VALUES