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