annotate src/share/vm/c1/c1_Instruction.hpp @ 23842:d109bda16490

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