90 class Switch;
91 class TableSwitch;
92 class LookupSwitch;
93 class Return;
94 class Throw;
95 class Base;
96 class RoundFP;
97 class UnsafeOp;
98 class UnsafeRawOp;
99 class UnsafeGetRaw;
100 class UnsafePutRaw;
101 class UnsafeObjectOp;
102 class UnsafeGetObject;
103 class UnsafePutObject;
104 class UnsafePrefetch;
105 class UnsafePrefetchRead;
106 class UnsafePrefetchWrite;
107 class ProfileCall;
108 class ProfileInvoke;
109 class RuntimeCall;
110
111 // A Value is a reference to the instruction creating the value
112 typedef Instruction* Value;
113 define_array(ValueArray, Value)
114 define_stack(Values, ValueArray)
115
116 define_array(ValueStackArray, ValueStack*)
117 define_stack(ValueStackStack, ValueStackArray)
118
119 // BlockClosure is the base class for block traversal/iteration.
120
121 class BlockClosure: public CompilationResourceObj {
122 public:
123 virtual void block_do(BlockBegin* block) = 0;
124 };
125
126
127 // A simple closure class for visiting the values of an Instruction
128 class ValueVisitor: public StackObj {
129 public:
187 virtual void do_Goto (Goto* x) = 0;
188 virtual void do_If (If* x) = 0;
189 virtual void do_IfInstanceOf (IfInstanceOf* x) = 0;
190 virtual void do_TableSwitch (TableSwitch* x) = 0;
191 virtual void do_LookupSwitch (LookupSwitch* x) = 0;
192 virtual void do_Return (Return* x) = 0;
193 virtual void do_Throw (Throw* x) = 0;
194 virtual void do_Base (Base* x) = 0;
195 virtual void do_OsrEntry (OsrEntry* x) = 0;
196 virtual void do_ExceptionObject(ExceptionObject* x) = 0;
197 virtual void do_RoundFP (RoundFP* x) = 0;
198 virtual void do_UnsafeGetRaw (UnsafeGetRaw* x) = 0;
199 virtual void do_UnsafePutRaw (UnsafePutRaw* x) = 0;
200 virtual void do_UnsafeGetObject(UnsafeGetObject* x) = 0;
201 virtual void do_UnsafePutObject(UnsafePutObject* x) = 0;
202 virtual void do_UnsafePrefetchRead (UnsafePrefetchRead* x) = 0;
203 virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) = 0;
204 virtual void do_ProfileCall (ProfileCall* x) = 0;
205 virtual void do_ProfileInvoke (ProfileInvoke* x) = 0;
206 virtual void do_RuntimeCall (RuntimeCall* x) = 0;
207 };
208
209
210 // Hashing support
211 //
212 // Note: This hash functions affect the performance
213 // of ValueMap - make changes carefully!
214
215 #define HASH1(x1 ) ((intx)(x1))
216 #define HASH2(x1, x2 ) ((HASH1(x1 ) << 7) ^ HASH1(x2))
217 #define HASH3(x1, x2, x3 ) ((HASH2(x1, x2 ) << 7) ^ HASH1(x3))
218 #define HASH4(x1, x2, x3, x4) ((HASH3(x1, x2, x3) << 7) ^ HASH1(x4))
219
220
221 // The following macros are used to implement instruction-specific hashing.
222 // By default, each instruction implements hash() and is_equal(Value), used
223 // for value numbering/common subexpression elimination. The default imple-
224 // mentation disables value numbering. Each instruction which can be value-
225 // numbered, should define corresponding hash() and is_equal(Value) functions
226 // via the macros below. The f arguments specify all the values/op codes, etc.
2334 private:
2335 ciMethod* _inlinee;
2336 ValueStack* _state;
2337
2338 public:
2339 ProfileInvoke(ciMethod* inlinee, ValueStack* state)
2340 : Instruction(voidType)
2341 , _inlinee(inlinee)
2342 , _state(state)
2343 {
2344 // The ProfileInvoke has side-effects and must occur precisely where located QQQ???
2345 pin();
2346 }
2347
2348 ciMethod* inlinee() { return _inlinee; }
2349 ValueStack* state() { return _state; }
2350 virtual void input_values_do(ValueVisitor*) {}
2351 virtual void state_values_do(ValueVisitor*);
2352 };
2353
2354 class BlockPair: public CompilationResourceObj {
2355 private:
2356 BlockBegin* _from;
2357 BlockBegin* _to;
2358 public:
2359 BlockPair(BlockBegin* from, BlockBegin* to): _from(from), _to(to) {}
2360 BlockBegin* from() const { return _from; }
2361 BlockBegin* to() const { return _to; }
2362 bool is_same(BlockBegin* from, BlockBegin* to) const { return _from == from && _to == to; }
2363 bool is_same(BlockPair* p) const { return _from == p->from() && _to == p->to(); }
2364 void set_to(BlockBegin* b) { _to = b; }
2365 void set_from(BlockBegin* b) { _from = b; }
2366 };
2367
2368
2369 define_array(BlockPairArray, BlockPair*)
2370 define_stack(BlockPairList, BlockPairArray)
2371
2372
2373 inline int BlockBegin::number_of_sux() const { assert(_end == NULL || _end->number_of_sux() == _successors.length(), "mismatch"); return _successors.length(); }
|
90 class Switch;
91 class TableSwitch;
92 class LookupSwitch;
93 class Return;
94 class Throw;
95 class Base;
96 class RoundFP;
97 class UnsafeOp;
98 class UnsafeRawOp;
99 class UnsafeGetRaw;
100 class UnsafePutRaw;
101 class UnsafeObjectOp;
102 class UnsafeGetObject;
103 class UnsafePutObject;
104 class UnsafePrefetch;
105 class UnsafePrefetchRead;
106 class UnsafePrefetchWrite;
107 class ProfileCall;
108 class ProfileInvoke;
109 class RuntimeCall;
110 class MemBar;
111
112 // A Value is a reference to the instruction creating the value
113 typedef Instruction* Value;
114 define_array(ValueArray, Value)
115 define_stack(Values, ValueArray)
116
117 define_array(ValueStackArray, ValueStack*)
118 define_stack(ValueStackStack, ValueStackArray)
119
120 // BlockClosure is the base class for block traversal/iteration.
121
122 class BlockClosure: public CompilationResourceObj {
123 public:
124 virtual void block_do(BlockBegin* block) = 0;
125 };
126
127
128 // A simple closure class for visiting the values of an Instruction
129 class ValueVisitor: public StackObj {
130 public:
188 virtual void do_Goto (Goto* x) = 0;
189 virtual void do_If (If* x) = 0;
190 virtual void do_IfInstanceOf (IfInstanceOf* x) = 0;
191 virtual void do_TableSwitch (TableSwitch* x) = 0;
192 virtual void do_LookupSwitch (LookupSwitch* x) = 0;
193 virtual void do_Return (Return* x) = 0;
194 virtual void do_Throw (Throw* x) = 0;
195 virtual void do_Base (Base* x) = 0;
196 virtual void do_OsrEntry (OsrEntry* x) = 0;
197 virtual void do_ExceptionObject(ExceptionObject* x) = 0;
198 virtual void do_RoundFP (RoundFP* x) = 0;
199 virtual void do_UnsafeGetRaw (UnsafeGetRaw* x) = 0;
200 virtual void do_UnsafePutRaw (UnsafePutRaw* x) = 0;
201 virtual void do_UnsafeGetObject(UnsafeGetObject* x) = 0;
202 virtual void do_UnsafePutObject(UnsafePutObject* x) = 0;
203 virtual void do_UnsafePrefetchRead (UnsafePrefetchRead* x) = 0;
204 virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) = 0;
205 virtual void do_ProfileCall (ProfileCall* x) = 0;
206 virtual void do_ProfileInvoke (ProfileInvoke* x) = 0;
207 virtual void do_RuntimeCall (RuntimeCall* x) = 0;
208 virtual void do_MemBar (MemBar* x) = 0;
209 };
210
211
212 // Hashing support
213 //
214 // Note: This hash functions affect the performance
215 // of ValueMap - make changes carefully!
216
217 #define HASH1(x1 ) ((intx)(x1))
218 #define HASH2(x1, x2 ) ((HASH1(x1 ) << 7) ^ HASH1(x2))
219 #define HASH3(x1, x2, x3 ) ((HASH2(x1, x2 ) << 7) ^ HASH1(x3))
220 #define HASH4(x1, x2, x3, x4) ((HASH3(x1, x2, x3) << 7) ^ HASH1(x4))
221
222
223 // The following macros are used to implement instruction-specific hashing.
224 // By default, each instruction implements hash() and is_equal(Value), used
225 // for value numbering/common subexpression elimination. The default imple-
226 // mentation disables value numbering. Each instruction which can be value-
227 // numbered, should define corresponding hash() and is_equal(Value) functions
228 // via the macros below. The f arguments specify all the values/op codes, etc.
2336 private:
2337 ciMethod* _inlinee;
2338 ValueStack* _state;
2339
2340 public:
2341 ProfileInvoke(ciMethod* inlinee, ValueStack* state)
2342 : Instruction(voidType)
2343 , _inlinee(inlinee)
2344 , _state(state)
2345 {
2346 // The ProfileInvoke has side-effects and must occur precisely where located QQQ???
2347 pin();
2348 }
2349
2350 ciMethod* inlinee() { return _inlinee; }
2351 ValueStack* state() { return _state; }
2352 virtual void input_values_do(ValueVisitor*) {}
2353 virtual void state_values_do(ValueVisitor*);
2354 };
2355
2356 LEAF(MemBar, Instruction)
2357 private:
2358 LIR_Code _code;
2359
2360 public:
2361 MemBar(LIR_Code code)
2362 : Instruction(voidType)
2363 , _code(code)
2364 {
2365 pin();
2366 }
2367
2368 LIR_Code code() { return _code; }
2369
2370 virtual void input_values_do(ValueVisitor*) {}
2371 };
2372
2373 class BlockPair: public CompilationResourceObj {
2374 private:
2375 BlockBegin* _from;
2376 BlockBegin* _to;
2377 public:
2378 BlockPair(BlockBegin* from, BlockBegin* to): _from(from), _to(to) {}
2379 BlockBegin* from() const { return _from; }
2380 BlockBegin* to() const { return _to; }
2381 bool is_same(BlockBegin* from, BlockBegin* to) const { return _from == from && _to == to; }
2382 bool is_same(BlockPair* p) const { return _from == p->from() && _to == p->to(); }
2383 void set_to(BlockBegin* b) { _to = b; }
2384 void set_from(BlockBegin* b) { _from = b; }
2385 };
2386
2387
2388 define_array(BlockPairArray, BlockPair*)
2389 define_stack(BlockPairList, BlockPairArray)
2390
2391
2392 inline int BlockBegin::number_of_sux() const { assert(_end == NULL || _end->number_of_sux() == _successors.length(), "mismatch"); return _successors.length(); }
|