Print this page
rev 2237 : [mq]: initial-intrinsification-changes
rev 2238 : [mq]: code-review-comments-vladimir
Split |
Close |
Expand all |
Collapse all |
--- old/src/share/vm/c1/c1_LIRGenerator.hpp
+++ new/src/share/vm/c1/c1_LIRGenerator.hpp
1 1 /*
2 2 * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 4 *
5 5 * This code is free software; you can redistribute it and/or modify it
6 6 * under the terms of the GNU General Public License version 2 only, as
7 7 * published by the Free Software Foundation.
8 8 *
9 9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 12 * version 2 for more details (a copy is included in the LICENSE file that
13 13 * accompanied this code).
14 14 *
15 15 * You should have received a copy of the GNU General Public License version
16 16 * 2 along with this work; if not, write to the Free Software Foundation,
17 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 18 *
19 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 20 * or visit www.oracle.com if you need additional information or have any
21 21 * questions.
22 22 *
23 23 */
24 24
25 25 #ifndef SHARE_VM_C1_C1_LIRGENERATOR_HPP
26 26 #define SHARE_VM_C1_C1_LIRGENERATOR_HPP
27 27
28 28 #include "c1/c1_Instruction.hpp"
29 29 #include "c1/c1_LIR.hpp"
30 30 #include "ci/ciMethodData.hpp"
31 31 #include "utilities/sizes.hpp"
32 32
33 33 // The classes responsible for code emission and register allocation
34 34
35 35
36 36 class LIRGenerator;
37 37 class LIREmitter;
38 38 class Invoke;
39 39 class SwitchRange;
40 40 class LIRItem;
41 41
42 42 define_array(LIRItemArray, LIRItem*)
43 43 define_stack(LIRItemList, LIRItemArray)
44 44
45 45 class SwitchRange: public CompilationResourceObj {
46 46 private:
47 47 int _low_key;
48 48 int _high_key;
49 49 BlockBegin* _sux;
50 50 public:
51 51 SwitchRange(int start_key, BlockBegin* sux): _low_key(start_key), _high_key(start_key), _sux(sux) {}
52 52 void set_high_key(int key) { _high_key = key; }
53 53
54 54 int high_key() const { return _high_key; }
55 55 int low_key() const { return _low_key; }
56 56 BlockBegin* sux() const { return _sux; }
57 57 };
58 58
59 59 define_array(SwitchRangeArray, SwitchRange*)
60 60 define_stack(SwitchRangeList, SwitchRangeArray)
61 61
62 62
63 63 class ResolveNode;
64 64
65 65 define_array(NodeArray, ResolveNode*);
66 66 define_stack(NodeList, NodeArray);
67 67
68 68
69 69 // Node objects form a directed graph of LIR_Opr
70 70 // Edges between Nodes represent moves from one Node to its destinations
71 71 class ResolveNode: public CompilationResourceObj {
72 72 private:
73 73 LIR_Opr _operand; // the source or destinaton
74 74 NodeList _destinations; // for the operand
75 75 bool _assigned; // Value assigned to this Node?
76 76 bool _visited; // Node already visited?
77 77 bool _start_node; // Start node already visited?
78 78
79 79 public:
80 80 ResolveNode(LIR_Opr operand)
81 81 : _operand(operand)
82 82 , _assigned(false)
83 83 , _visited(false)
84 84 , _start_node(false) {};
85 85
86 86 // accessors
87 87 LIR_Opr operand() const { return _operand; }
88 88 int no_of_destinations() const { return _destinations.length(); }
89 89 ResolveNode* destination_at(int i) { return _destinations[i]; }
90 90 bool assigned() const { return _assigned; }
91 91 bool visited() const { return _visited; }
92 92 bool start_node() const { return _start_node; }
93 93
94 94 // modifiers
95 95 void append(ResolveNode* dest) { _destinations.append(dest); }
96 96 void set_assigned() { _assigned = true; }
97 97 void set_visited() { _visited = true; }
98 98 void set_start_node() { _start_node = true; }
99 99 };
100 100
101 101
102 102 // This is shared state to be used by the PhiResolver so the operand
103 103 // arrays don't have to be reallocated for reach resolution.
104 104 class PhiResolverState: public CompilationResourceObj {
105 105 friend class PhiResolver;
106 106
107 107 private:
108 108 NodeList _virtual_operands; // Nodes where the operand is a virtual register
109 109 NodeList _other_operands; // Nodes where the operand is not a virtual register
110 110 NodeList _vreg_table; // Mapping from virtual register to Node
111 111
112 112 public:
113 113 PhiResolverState() {}
114 114
115 115 void reset(int max_vregs);
116 116 };
117 117
118 118
119 119 // class used to move value of phi operand to phi function
120 120 class PhiResolver: public CompilationResourceObj {
121 121 private:
122 122 LIRGenerator* _gen;
123 123 PhiResolverState& _state; // temporary state cached by LIRGenerator
124 124
125 125 ResolveNode* _loop;
126 126 LIR_Opr _temp;
127 127
128 128 // access to shared state arrays
129 129 NodeList& virtual_operands() { return _state._virtual_operands; }
130 130 NodeList& other_operands() { return _state._other_operands; }
131 131 NodeList& vreg_table() { return _state._vreg_table; }
132 132
133 133 ResolveNode* create_node(LIR_Opr opr, bool source);
134 134 ResolveNode* source_node(LIR_Opr opr) { return create_node(opr, true); }
135 135 ResolveNode* destination_node(LIR_Opr opr) { return create_node(opr, false); }
136 136
137 137 void emit_move(LIR_Opr src, LIR_Opr dest);
138 138 void move_to_temp(LIR_Opr src);
139 139 void move_temp_to(LIR_Opr dest);
140 140 void move(ResolveNode* src, ResolveNode* dest);
141 141
142 142 LIRGenerator* gen() {
143 143 return _gen;
144 144 }
145 145
146 146 public:
147 147 PhiResolver(LIRGenerator* _lir_gen, int max_vregs);
148 148 ~PhiResolver();
149 149
150 150 void move(LIR_Opr src, LIR_Opr dest);
151 151 };
152 152
153 153
154 154 // only the classes below belong in the same file
155 155 class LIRGenerator: public InstructionVisitor, public BlockClosure {
156 156
157 157 private:
158 158 Compilation* _compilation;
159 159 ciMethod* _method; // method that we are compiling
160 160 PhiResolverState _resolver_state;
161 161 BlockBegin* _block;
162 162 int _virtual_register_number;
163 163 Values _instruction_for_operand;
164 164 BitMap2D _vreg_flags; // flags which can be set on a per-vreg basis
165 165 LIR_List* _lir;
166 166 BarrierSet* _bs;
167 167
168 168 LIRGenerator* gen() {
169 169 return this;
170 170 }
171 171
172 172 #ifdef ASSERT
173 173 LIR_List* lir(const char * file, int line) const {
174 174 _lir->set_file_and_line(file, line);
175 175 return _lir;
176 176 }
177 177 #endif
178 178 LIR_List* lir() const {
179 179 return _lir;
180 180 }
181 181
182 182 // a simple cache of constants used within a block
183 183 GrowableArray<LIR_Const*> _constants;
184 184 LIR_OprList _reg_for_constants;
185 185 Values _unpinned_constants;
186 186
187 187 friend class PhiResolver;
188 188
189 189 // unified bailout support
190 190 void bailout(const char* msg) const { compilation()->bailout(msg); }
191 191 bool bailed_out() const { return compilation()->bailed_out(); }
192 192
193 193 void block_do_prolog(BlockBegin* block);
194 194 void block_do_epilog(BlockBegin* block);
195 195
196 196 // register allocation
197 197 LIR_Opr rlock(Value instr); // lock a free register
198 198 LIR_Opr rlock_result(Value instr);
199 199 LIR_Opr rlock_result(Value instr, BasicType type);
200 200 LIR_Opr rlock_byte(BasicType type);
201 201 LIR_Opr rlock_callee_saved(BasicType type);
202 202
203 203 // get a constant into a register and get track of what register was used
204 204 LIR_Opr load_constant(Constant* x);
205 205 LIR_Opr load_constant(LIR_Const* constant);
206 206
207 207 // Given an immediate value, return an operand usable in logical ops.
208 208 LIR_Opr load_immediate(int x, BasicType type);
209 209
210 210 void set_result(Value x, LIR_Opr opr) {
211 211 assert(opr->is_valid(), "must set to valid value");
212 212 assert(x->operand()->is_illegal(), "operand should never change");
213 213 assert(!opr->is_register() || opr->is_virtual(), "should never set result to a physical register");
214 214 x->set_operand(opr);
215 215 assert(opr == x->operand(), "must be");
216 216 if (opr->is_virtual()) {
217 217 _instruction_for_operand.at_put_grow(opr->vreg_number(), x, NULL);
218 218 }
219 219 }
220 220 void set_no_result(Value x) { assert(!x->has_uses(), "can't have use"); x->clear_operand(); }
221 221
222 222 friend class LIRItem;
223 223
224 224 LIR_Opr round_item(LIR_Opr opr);
225 225 LIR_Opr force_to_spill(LIR_Opr value, BasicType t);
226 226
227 227 PhiResolverState& resolver_state() { return _resolver_state; }
228 228
229 229 void move_to_phi(PhiResolver* resolver, Value cur_val, Value sux_val);
230 230 void move_to_phi(ValueStack* cur_state);
231 231
232 232 // code emission
233 233 void do_ArithmeticOp_Long (ArithmeticOp* x);
234 234 void do_ArithmeticOp_Int (ArithmeticOp* x);
235 235 void do_ArithmeticOp_FPU (ArithmeticOp* x);
236 236
237 237 // platform dependent
238 238 LIR_Opr getThreadPointer();
↓ open down ↓ |
238 lines elided |
↑ open up ↑ |
239 239
240 240 void do_RegisterFinalizer(Intrinsic* x);
241 241 void do_getClass(Intrinsic* x);
242 242 void do_currentThread(Intrinsic* x);
243 243 void do_MathIntrinsic(Intrinsic* x);
244 244 void do_ArrayCopy(Intrinsic* x);
245 245 void do_CompareAndSwap(Intrinsic* x, ValueType* type);
246 246 void do_AttemptUpdate(Intrinsic* x);
247 247 void do_NIOCheckIndex(Intrinsic* x);
248 248 void do_FPIntrinsics(Intrinsic* x);
249 + void do_Reference_get(Intrinsic* x);
249 250
250 251 void do_UnsafePrefetch(UnsafePrefetch* x, bool is_store);
251 252
252 253 LIR_Opr call_runtime(BasicTypeArray* signature, LIRItemList* args, address entry, ValueType* result_type, CodeEmitInfo* info);
253 254 LIR_Opr call_runtime(BasicTypeArray* signature, LIR_OprList* args, address entry, ValueType* result_type, CodeEmitInfo* info);
254 255
255 256 // convenience functions
256 257 LIR_Opr call_runtime(Value arg1, address entry, ValueType* result_type, CodeEmitInfo* info);
257 258 LIR_Opr call_runtime(Value arg1, Value arg2, address entry, ValueType* result_type, CodeEmitInfo* info);
258 259
259 260 // GC Barriers
260 261
261 262 // generic interface
262 263
263 - void pre_barrier(LIR_Opr addr_opr, bool patch, CodeEmitInfo* info);
264 + void pre_barrier(LIR_Opr addr_opr, LIR_Opr pre_val, bool do_load, bool patch, CodeEmitInfo* info);
264 265 void post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val);
265 266
266 267 // specific implementations
267 268 // pre barriers
268 269
269 - void G1SATBCardTableModRef_pre_barrier(LIR_Opr addr_opr, bool patch, CodeEmitInfo* info);
270 + void G1SATBCardTableModRef_pre_barrier(LIR_Opr addr_opr, LIR_Opr pre_val,
271 + bool do_load, bool patch, CodeEmitInfo* info);
270 272
271 273 // post barriers
272 274
273 275 void G1SATBCardTableModRef_post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val);
274 276 void CardTableModRef_post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val);
275 277
276 278
277 279 static LIR_Opr result_register_for(ValueType* type, bool callee = false);
278 280
279 281 ciObject* get_jobject_constant(Value value);
280 282
281 283 LIRItemList* invoke_visit_arguments(Invoke* x);
282 284 void invoke_load_arguments(Invoke* x, LIRItemList* args, const LIR_OprList* arg_list);
283 285
284 286 void trace_block_entry(BlockBegin* block);
285 287
286 288 // volatile field operations are never patchable because a klass
287 289 // must be loaded to know it's volatile which means that the offset
288 290 // it always known as well.
289 291 void volatile_field_store(LIR_Opr value, LIR_Address* address, CodeEmitInfo* info);
290 292 void volatile_field_load(LIR_Address* address, LIR_Opr result, CodeEmitInfo* info);
291 293
292 294 void put_Object_unsafe(LIR_Opr src, LIR_Opr offset, LIR_Opr data, BasicType type, bool is_volatile);
293 295 void get_Object_unsafe(LIR_Opr dest, LIR_Opr src, LIR_Opr offset, BasicType type, bool is_volatile);
294 296
295 297 void arithmetic_call_op (Bytecodes::Code code, LIR_Opr result, LIR_OprList* args);
296 298
297 299 void increment_counter(address counter, BasicType type, int step = 1);
298 300 void increment_counter(LIR_Address* addr, int step = 1);
299 301
300 302 // is_strictfp is only needed for mul and div (and only generates different code on i486)
301 303 void arithmetic_op(Bytecodes::Code code, LIR_Opr result, LIR_Opr left, LIR_Opr right, bool is_strictfp, LIR_Opr tmp, CodeEmitInfo* info = NULL);
302 304 // machine dependent. returns true if it emitted code for the multiply
303 305 bool strength_reduce_multiply(LIR_Opr left, int constant, LIR_Opr result, LIR_Opr tmp);
304 306
305 307 void store_stack_parameter (LIR_Opr opr, ByteSize offset_from_sp_in_bytes);
306 308
307 309 void jobject2reg_with_patching(LIR_Opr r, ciObject* obj, CodeEmitInfo* info);
308 310
309 311 // this loads the length and compares against the index
310 312 void array_range_check (LIR_Opr array, LIR_Opr index, CodeEmitInfo* null_check_info, CodeEmitInfo* range_check_info);
311 313 // For java.nio.Buffer.checkIndex
312 314 void nio_range_check (LIR_Opr buffer, LIR_Opr index, LIR_Opr result, CodeEmitInfo* info);
313 315
314 316 void arithmetic_op_int (Bytecodes::Code code, LIR_Opr result, LIR_Opr left, LIR_Opr right, LIR_Opr tmp);
315 317 void arithmetic_op_long (Bytecodes::Code code, LIR_Opr result, LIR_Opr left, LIR_Opr right, CodeEmitInfo* info = NULL);
316 318 void arithmetic_op_fpu (Bytecodes::Code code, LIR_Opr result, LIR_Opr left, LIR_Opr right, bool is_strictfp, LIR_Opr tmp = LIR_OprFact::illegalOpr);
317 319
318 320 void shift_op (Bytecodes::Code code, LIR_Opr dst_reg, LIR_Opr value, LIR_Opr count, LIR_Opr tmp);
319 321
320 322 void logic_op (Bytecodes::Code code, LIR_Opr dst_reg, LIR_Opr left, LIR_Opr right);
321 323
322 324 void monitor_enter (LIR_Opr object, LIR_Opr lock, LIR_Opr hdr, LIR_Opr scratch, int monitor_no, CodeEmitInfo* info_for_exception, CodeEmitInfo* info);
323 325 void monitor_exit (LIR_Opr object, LIR_Opr lock, LIR_Opr hdr, LIR_Opr scratch, int monitor_no);
324 326
325 327 void new_instance (LIR_Opr dst, ciInstanceKlass* klass, LIR_Opr scratch1, LIR_Opr scratch2, LIR_Opr scratch3, LIR_Opr scratch4, LIR_Opr klass_reg, CodeEmitInfo* info);
326 328
327 329 // machine dependent
328 330 void cmp_mem_int(LIR_Condition condition, LIR_Opr base, int disp, int c, CodeEmitInfo* info);
329 331 void cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Opr base, int disp, BasicType type, CodeEmitInfo* info);
330 332 void cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Opr base, LIR_Opr disp, BasicType type, CodeEmitInfo* info);
331 333
332 334 void arraycopy_helper(Intrinsic* x, int* flags, ciArrayKlass** expected_type);
333 335
334 336 // returns a LIR_Address to address an array location. May also
335 337 // emit some code as part of address calculation. If
336 338 // needs_card_mark is true then compute the full address for use by
337 339 // both the store and the card mark.
338 340 LIR_Address* generate_address(LIR_Opr base,
339 341 LIR_Opr index, int shift,
340 342 int disp,
341 343 BasicType type);
342 344 LIR_Address* generate_address(LIR_Opr base, int disp, BasicType type) {
343 345 return generate_address(base, LIR_OprFact::illegalOpr, 0, disp, type);
344 346 }
345 347 LIR_Address* emit_array_address(LIR_Opr array_opr, LIR_Opr index_opr, BasicType type, bool needs_card_mark);
346 348
347 349 // the helper for generate_address
348 350 void add_large_constant(LIR_Opr src, int c, LIR_Opr dest);
349 351
350 352 // machine preferences and characteristics
351 353 bool can_inline_as_constant(Value i) const;
352 354 bool can_inline_as_constant(LIR_Const* c) const;
353 355 bool can_store_as_constant(Value i, BasicType type) const;
354 356
355 357 LIR_Opr safepoint_poll_register();
356 358
357 359 void profile_branch(If* if_instr, If::Condition cond);
358 360 void increment_event_counter_impl(CodeEmitInfo* info,
359 361 ciMethod *method, int frequency,
360 362 int bci, bool backedge, bool notify);
361 363 void increment_event_counter(CodeEmitInfo* info, int bci, bool backedge);
362 364 void increment_invocation_counter(CodeEmitInfo *info) {
363 365 if (compilation()->count_invocations()) {
364 366 increment_event_counter(info, InvocationEntryBci, false);
365 367 }
366 368 }
367 369 void increment_backedge_counter(CodeEmitInfo* info, int bci) {
368 370 if (compilation()->count_backedges()) {
369 371 increment_event_counter(info, bci, true);
370 372 }
371 373 }
372 374
373 375 CodeEmitInfo* state_for(Instruction* x, ValueStack* state, bool ignore_xhandler = false);
374 376 CodeEmitInfo* state_for(Instruction* x);
375 377
376 378 // allocates a virtual register for this instruction if
377 379 // one isn't already allocated. Only for Phi and Local.
378 380 LIR_Opr operand_for_instruction(Instruction *x);
379 381
380 382 void set_block(BlockBegin* block) { _block = block; }
381 383
382 384 void block_prolog(BlockBegin* block);
383 385 void block_epilog(BlockBegin* block);
384 386
385 387 void do_root (Instruction* instr);
386 388 void walk (Instruction* instr);
387 389
388 390 void bind_block_entry(BlockBegin* block);
389 391 void start_block(BlockBegin* block);
390 392
391 393 LIR_Opr new_register(BasicType type);
392 394 LIR_Opr new_register(Value value) { return new_register(as_BasicType(value->type())); }
393 395 LIR_Opr new_register(ValueType* type) { return new_register(as_BasicType(type)); }
394 396
395 397 // returns a register suitable for doing pointer math
396 398 LIR_Opr new_pointer_register() {
397 399 #ifdef _LP64
398 400 return new_register(T_LONG);
399 401 #else
400 402 return new_register(T_INT);
401 403 #endif
402 404 }
403 405
404 406 static LIR_Condition lir_cond(If::Condition cond) {
405 407 LIR_Condition l;
406 408 switch (cond) {
407 409 case If::eql: l = lir_cond_equal; break;
408 410 case If::neq: l = lir_cond_notEqual; break;
409 411 case If::lss: l = lir_cond_less; break;
410 412 case If::leq: l = lir_cond_lessEqual; break;
411 413 case If::geq: l = lir_cond_greaterEqual; break;
412 414 case If::gtr: l = lir_cond_greater; break;
413 415 };
414 416 return l;
415 417 }
416 418
417 419 #ifdef __SOFTFP__
418 420 void do_soft_float_compare(If *x);
419 421 #endif // __SOFTFP__
420 422
421 423 void init();
422 424
423 425 SwitchRangeArray* create_lookup_ranges(TableSwitch* x);
424 426 SwitchRangeArray* create_lookup_ranges(LookupSwitch* x);
425 427 void do_SwitchRanges(SwitchRangeArray* x, LIR_Opr value, BlockBegin* default_sux);
426 428
427 429 public:
428 430 Compilation* compilation() const { return _compilation; }
429 431 FrameMap* frame_map() const { return _compilation->frame_map(); }
430 432 ciMethod* method() const { return _method; }
431 433 BlockBegin* block() const { return _block; }
432 434 IRScope* scope() const { return block()->scope(); }
433 435
434 436 int max_virtual_register_number() const { return _virtual_register_number; }
435 437
436 438 void block_do(BlockBegin* block);
437 439
438 440 // Flags that can be set on vregs
439 441 enum VregFlag {
440 442 must_start_in_memory = 0 // needs to be assigned a memory location at beginning, but may then be loaded in a register
441 443 , callee_saved = 1 // must be in a callee saved register
442 444 , byte_reg = 2 // must be in a byte register
443 445 , num_vreg_flags
444 446
445 447 };
446 448
447 449 LIRGenerator(Compilation* compilation, ciMethod* method)
448 450 : _compilation(compilation)
449 451 , _method(method)
450 452 , _virtual_register_number(LIR_OprDesc::vreg_base)
451 453 , _vreg_flags(NULL, 0, num_vreg_flags) {
452 454 init();
453 455 }
454 456
455 457 // for virtual registers, maps them back to Phi's or Local's
456 458 Instruction* instruction_for_opr(LIR_Opr opr);
457 459 Instruction* instruction_for_vreg(int reg_num);
458 460
459 461 void set_vreg_flag (int vreg_num, VregFlag f);
460 462 bool is_vreg_flag_set(int vreg_num, VregFlag f);
461 463 void set_vreg_flag (LIR_Opr opr, VregFlag f) { set_vreg_flag(opr->vreg_number(), f); }
462 464 bool is_vreg_flag_set(LIR_Opr opr, VregFlag f) { return is_vreg_flag_set(opr->vreg_number(), f); }
463 465
464 466 // statics
465 467 static LIR_Opr exceptionOopOpr();
466 468 static LIR_Opr exceptionPcOpr();
467 469 static LIR_Opr divInOpr();
468 470 static LIR_Opr divOutOpr();
469 471 static LIR_Opr remOutOpr();
470 472 static LIR_Opr shiftCountOpr();
471 473 LIR_Opr syncTempOpr();
472 474 LIR_Opr atomicLockOpr();
473 475
474 476 // returns a register suitable for saving the thread in a
475 477 // call_runtime_leaf if one is needed.
476 478 LIR_Opr getThreadTemp();
477 479
478 480 // visitor functionality
479 481 virtual void do_Phi (Phi* x);
480 482 virtual void do_Local (Local* x);
481 483 virtual void do_Constant (Constant* x);
482 484 virtual void do_LoadField (LoadField* x);
483 485 virtual void do_StoreField (StoreField* x);
484 486 virtual void do_ArrayLength (ArrayLength* x);
485 487 virtual void do_LoadIndexed (LoadIndexed* x);
486 488 virtual void do_StoreIndexed (StoreIndexed* x);
487 489 virtual void do_NegateOp (NegateOp* x);
488 490 virtual void do_ArithmeticOp (ArithmeticOp* x);
489 491 virtual void do_ShiftOp (ShiftOp* x);
490 492 virtual void do_LogicOp (LogicOp* x);
491 493 virtual void do_CompareOp (CompareOp* x);
492 494 virtual void do_IfOp (IfOp* x);
493 495 virtual void do_Convert (Convert* x);
494 496 virtual void do_NullCheck (NullCheck* x);
495 497 virtual void do_Invoke (Invoke* x);
496 498 virtual void do_NewInstance (NewInstance* x);
497 499 virtual void do_NewTypeArray (NewTypeArray* x);
498 500 virtual void do_NewObjectArray (NewObjectArray* x);
499 501 virtual void do_NewMultiArray (NewMultiArray* x);
500 502 virtual void do_CheckCast (CheckCast* x);
501 503 virtual void do_InstanceOf (InstanceOf* x);
502 504 virtual void do_MonitorEnter (MonitorEnter* x);
503 505 virtual void do_MonitorExit (MonitorExit* x);
504 506 virtual void do_Intrinsic (Intrinsic* x);
505 507 virtual void do_BlockBegin (BlockBegin* x);
506 508 virtual void do_Goto (Goto* x);
507 509 virtual void do_If (If* x);
508 510 virtual void do_IfInstanceOf (IfInstanceOf* x);
509 511 virtual void do_TableSwitch (TableSwitch* x);
510 512 virtual void do_LookupSwitch (LookupSwitch* x);
511 513 virtual void do_Return (Return* x);
512 514 virtual void do_Throw (Throw* x);
513 515 virtual void do_Base (Base* x);
514 516 virtual void do_OsrEntry (OsrEntry* x);
515 517 virtual void do_ExceptionObject(ExceptionObject* x);
516 518 virtual void do_RoundFP (RoundFP* x);
517 519 virtual void do_UnsafeGetRaw (UnsafeGetRaw* x);
518 520 virtual void do_UnsafePutRaw (UnsafePutRaw* x);
519 521 virtual void do_UnsafeGetObject(UnsafeGetObject* x);
520 522 virtual void do_UnsafePutObject(UnsafePutObject* x);
521 523 virtual void do_UnsafePrefetchRead (UnsafePrefetchRead* x);
522 524 virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x);
523 525 virtual void do_ProfileCall (ProfileCall* x);
524 526 virtual void do_ProfileInvoke (ProfileInvoke* x);
525 527 virtual void do_RuntimeCall (RuntimeCall* x);
526 528 };
527 529
528 530
529 531 class LIRItem: public CompilationResourceObj {
530 532 private:
531 533 Value _value;
532 534 LIRGenerator* _gen;
533 535 LIR_Opr _result;
534 536 bool _destroys_register;
535 537 LIR_Opr _new_result;
536 538
537 539 LIRGenerator* gen() const { return _gen; }
538 540
539 541 public:
540 542 LIRItem(Value value, LIRGenerator* gen) {
541 543 _destroys_register = false;
542 544 _gen = gen;
543 545 set_instruction(value);
544 546 }
545 547
546 548 LIRItem(LIRGenerator* gen) {
547 549 _destroys_register = false;
548 550 _gen = gen;
549 551 _result = LIR_OprFact::illegalOpr;
550 552 set_instruction(NULL);
551 553 }
552 554
553 555 void set_instruction(Value value) {
554 556 _value = value;
555 557 _result = LIR_OprFact::illegalOpr;
556 558 if (_value != NULL) {
557 559 _gen->walk(_value);
558 560 _result = _value->operand();
559 561 }
560 562 _new_result = LIR_OprFact::illegalOpr;
561 563 }
562 564
563 565 Value value() const { return _value; }
564 566 ValueType* type() const { return value()->type(); }
565 567 LIR_Opr result() {
566 568 assert(!_destroys_register || (!_result->is_register() || _result->is_virtual()),
567 569 "shouldn't use set_destroys_register with physical regsiters");
568 570 if (_destroys_register && _result->is_register()) {
569 571 if (_new_result->is_illegal()) {
570 572 _new_result = _gen->new_register(type());
571 573 gen()->lir()->move(_result, _new_result);
572 574 }
573 575 return _new_result;
574 576 } else {
575 577 return _result;
576 578 }
577 579 return _result;
578 580 }
579 581
580 582 void set_result(LIR_Opr opr);
581 583
582 584 void load_item();
583 585 void load_byte_item();
584 586 void load_nonconstant();
585 587 // load any values which can't be expressed as part of a single store instruction
586 588 void load_for_store(BasicType store_type);
587 589 void load_item_force(LIR_Opr reg);
588 590
589 591 void dont_load_item() {
590 592 // do nothing
591 593 }
592 594
593 595 void set_destroys_register() {
594 596 _destroys_register = true;
595 597 }
596 598
597 599 bool is_constant() const { return value()->as_Constant() != NULL; }
598 600 bool is_stack() { return result()->is_stack(); }
599 601 bool is_register() { return result()->is_register(); }
600 602
601 603 ciObject* get_jobject_constant() const;
602 604 jint get_jint_constant() const;
603 605 jlong get_jlong_constant() const;
604 606 jfloat get_jfloat_constant() const;
605 607 jdouble get_jdouble_constant() const;
606 608 jint get_address_constant() const;
607 609 };
608 610
609 611 #endif // SHARE_VM_C1_C1_LIRGENERATOR_HPP
↓ open down ↓ |
330 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX