Mercurial > hg > graal-jvmci-8
comparison src/share/vm/opto/compile.hpp @ 14422:2b8e28fdf503
Merge
author | kvn |
---|---|
date | Tue, 05 Nov 2013 17:38:04 -0800 |
parents | b2ee5dc63353 |
children | 94a83e0f9ce1 |
comparison
equal
deleted
inserted
replaced
14421:3068270ba476 | 14422:2b8e28fdf503 |
---|---|
70 class relocInfo; | 70 class relocInfo; |
71 class Scope; | 71 class Scope; |
72 class StartNode; | 72 class StartNode; |
73 class SafePointNode; | 73 class SafePointNode; |
74 class JVMState; | 74 class JVMState; |
75 class Type; | |
75 class TypeData; | 76 class TypeData; |
76 class TypePtr; | 77 class TypePtr; |
77 class TypeOopPtr; | 78 class TypeOopPtr; |
78 class TypeFunc; | 79 class TypeFunc; |
79 class Unique_Node_List; | 80 class Unique_Node_List; |
117 friend class Compile; | 118 friend class Compile; |
118 | 119 |
119 int _index; // unique index, used with MergeMemNode | 120 int _index; // unique index, used with MergeMemNode |
120 const TypePtr* _adr_type; // normalized address type | 121 const TypePtr* _adr_type; // normalized address type |
121 ciField* _field; // relevant instance field, or null if none | 122 ciField* _field; // relevant instance field, or null if none |
123 const Type* _element; // relevant array element type, or null if none | |
122 bool _is_rewritable; // false if the memory is write-once only | 124 bool _is_rewritable; // false if the memory is write-once only |
123 int _general_index; // if this is type is an instance, the general | 125 int _general_index; // if this is type is an instance, the general |
124 // type that this is an instance of | 126 // type that this is an instance of |
125 | 127 |
126 void Init(int i, const TypePtr* at); | 128 void Init(int i, const TypePtr* at); |
127 | 129 |
128 public: | 130 public: |
129 int index() const { return _index; } | 131 int index() const { return _index; } |
130 const TypePtr* adr_type() const { return _adr_type; } | 132 const TypePtr* adr_type() const { return _adr_type; } |
131 ciField* field() const { return _field; } | 133 ciField* field() const { return _field; } |
134 const Type* element() const { return _element; } | |
132 bool is_rewritable() const { return _is_rewritable; } | 135 bool is_rewritable() const { return _is_rewritable; } |
133 bool is_volatile() const { return (_field ? _field->is_volatile() : false); } | 136 bool is_volatile() const { return (_field ? _field->is_volatile() : false); } |
134 int general_index() const { return (_general_index != 0) ? _general_index : _index; } | 137 int general_index() const { return (_general_index != 0) ? _general_index : _index; } |
135 | 138 |
136 void set_rewritable(bool z) { _is_rewritable = z; } | 139 void set_rewritable(bool z) { _is_rewritable = z; } |
137 void set_field(ciField* f) { | 140 void set_field(ciField* f) { |
138 assert(!_field,""); | 141 assert(!_field,""); |
139 _field = f; | 142 _field = f; |
140 if (f->is_final()) _is_rewritable = false; | 143 if (f->is_final() || f->is_stable()) { |
144 // In the case of @Stable, multiple writes are possible but may be assumed to be no-ops. | |
145 _is_rewritable = false; | |
146 } | |
147 } | |
148 void set_element(const Type* e) { | |
149 assert(_element == NULL, ""); | |
150 _element = e; | |
141 } | 151 } |
142 | 152 |
143 void print_on(outputStream* st) PRODUCT_RETURN; | 153 void print_on(outputStream* st) PRODUCT_RETURN; |
144 }; | 154 }; |
145 | 155 |
300 bool _do_freq_based_layout; // True if we intend to do frequency based block layout | 310 bool _do_freq_based_layout; // True if we intend to do frequency based block layout |
301 bool _do_count_invocations; // True if we generate code to count invocations | 311 bool _do_count_invocations; // True if we generate code to count invocations |
302 bool _do_method_data_update; // True if we generate code to update MethodData*s | 312 bool _do_method_data_update; // True if we generate code to update MethodData*s |
303 int _AliasLevel; // Locally-adjusted version of AliasLevel flag. | 313 int _AliasLevel; // Locally-adjusted version of AliasLevel flag. |
304 bool _print_assembly; // True if we should dump assembly code for this compilation | 314 bool _print_assembly; // True if we should dump assembly code for this compilation |
315 bool _print_inlining; // True if we should print inlining for this compilation | |
316 bool _print_intrinsics; // True if we should print intrinsics for this compilation | |
305 #ifndef PRODUCT | 317 #ifndef PRODUCT |
306 bool _trace_opto_output; | 318 bool _trace_opto_output; |
307 bool _parsed_irreducible_loop; // True if ciTypeFlow detected irreducible loops during parsing | 319 bool _parsed_irreducible_loop; // True if ciTypeFlow detected irreducible loops during parsing |
308 #endif | 320 #endif |
309 | 321 |
402 CallGenerator* cg() const { return _cg; } | 414 CallGenerator* cg() const { return _cg; } |
403 void set_cg(CallGenerator* cg) { _cg = cg; } | 415 void set_cg(CallGenerator* cg) { _cg = cg; } |
404 }; | 416 }; |
405 | 417 |
406 GrowableArray<PrintInliningBuffer>* _print_inlining_list; | 418 GrowableArray<PrintInliningBuffer>* _print_inlining_list; |
407 int _print_inlining; | 419 int _print_inlining_idx; |
408 | 420 |
409 // Only keep nodes in the expensive node list that need to be optimized | 421 // Only keep nodes in the expensive node list that need to be optimized |
410 void cleanup_expensive_nodes(PhaseIterGVN &igvn); | 422 void cleanup_expensive_nodes(PhaseIterGVN &igvn); |
411 // Use for sorting expensive nodes to bring similar nodes together | 423 // Use for sorting expensive nodes to bring similar nodes together |
412 static int cmp_expensive_nodes(Node** n1, Node** n2); | 424 static int cmp_expensive_nodes(Node** n1, Node** n2); |
413 // Expensive nodes list already sorted? | 425 // Expensive nodes list already sorted? |
414 bool expensive_nodes_sorted() const; | 426 bool expensive_nodes_sorted() const; |
427 // Remove the speculative part of types and clean up the graph | |
428 void remove_speculative_types(PhaseIterGVN &igvn); | |
429 | |
430 // Are we within a PreserveJVMState block? | |
431 int _preserve_jvm_state; | |
415 | 432 |
416 public: | 433 public: |
417 | 434 |
418 outputStream* print_inlining_stream() const { | 435 outputStream* print_inlining_stream() const { |
419 return _print_inlining_list->at(_print_inlining).ss(); | 436 return _print_inlining_list->adr_at(_print_inlining_idx)->ss(); |
420 } | 437 } |
421 | 438 |
422 void print_inlining_skip(CallGenerator* cg) { | 439 void print_inlining_skip(CallGenerator* cg) { |
423 if (PrintInlining) { | 440 if (_print_inlining) { |
424 _print_inlining_list->at(_print_inlining).set_cg(cg); | 441 _print_inlining_list->adr_at(_print_inlining_idx)->set_cg(cg); |
425 _print_inlining++; | 442 _print_inlining_idx++; |
426 _print_inlining_list->insert_before(_print_inlining, PrintInliningBuffer()); | 443 _print_inlining_list->insert_before(_print_inlining_idx, PrintInliningBuffer()); |
427 } | 444 } |
428 } | 445 } |
429 | 446 |
430 void print_inlining_insert(CallGenerator* cg) { | 447 void print_inlining_insert(CallGenerator* cg) { |
431 if (PrintInlining) { | 448 if (_print_inlining) { |
432 for (int i = 0; i < _print_inlining_list->length(); i++) { | 449 for (int i = 0; i < _print_inlining_list->length(); i++) { |
433 if (_print_inlining_list->at(i).cg() == cg) { | 450 if (_print_inlining_list->adr_at(i)->cg() == cg) { |
434 _print_inlining_list->insert_before(i+1, PrintInliningBuffer()); | 451 _print_inlining_list->insert_before(i+1, PrintInliningBuffer()); |
435 _print_inlining = i+1; | 452 _print_inlining_idx = i+1; |
436 _print_inlining_list->at(i).set_cg(NULL); | 453 _print_inlining_list->adr_at(i)->set_cg(NULL); |
437 return; | 454 return; |
438 } | 455 } |
439 } | 456 } |
440 ShouldNotReachHere(); | 457 ShouldNotReachHere(); |
441 } | 458 } |
560 bool do_method_data_update() const { return _do_method_data_update; } | 577 bool do_method_data_update() const { return _do_method_data_update; } |
561 void set_do_method_data_update(bool z) { _do_method_data_update = z; } | 578 void set_do_method_data_update(bool z) { _do_method_data_update = z; } |
562 int AliasLevel() const { return _AliasLevel; } | 579 int AliasLevel() const { return _AliasLevel; } |
563 bool print_assembly() const { return _print_assembly; } | 580 bool print_assembly() const { return _print_assembly; } |
564 void set_print_assembly(bool z) { _print_assembly = z; } | 581 void set_print_assembly(bool z) { _print_assembly = z; } |
582 bool print_inlining() const { return _print_inlining; } | |
583 void set_print_inlining(bool z) { _print_inlining = z; } | |
584 bool print_intrinsics() const { return _print_intrinsics; } | |
585 void set_print_intrinsics(bool z) { _print_intrinsics = z; } | |
565 // check the CompilerOracle for special behaviours for this compile | 586 // check the CompilerOracle for special behaviours for this compile |
566 bool method_has_option(const char * option) { | 587 bool method_has_option(const char * option) { |
567 return method() != NULL && method()->has_option(option); | 588 return method() != NULL && method()->has_option(option); |
568 } | 589 } |
569 #ifndef PRODUCT | 590 #ifndef PRODUCT |
802 void return_values(JVMState* jvms); | 823 void return_values(JVMState* jvms); |
803 JVMState* build_start_state(StartNode* start, const TypeFunc* tf); | 824 JVMState* build_start_state(StartNode* start, const TypeFunc* tf); |
804 | 825 |
805 // Decide how to build a call. | 826 // Decide how to build a call. |
806 // The profile factor is a discount to apply to this site's interp. profile. | 827 // The profile factor is a discount to apply to this site's interp. profile. |
807 CallGenerator* call_generator(ciMethod* call_method, int vtable_index, bool call_does_dispatch, JVMState* jvms, bool allow_inline, float profile_factor, bool allow_intrinsics = true, bool delayed_forbidden = false); | 828 CallGenerator* call_generator(ciMethod* call_method, int vtable_index, bool call_does_dispatch, |
829 JVMState* jvms, bool allow_inline, float profile_factor, ciKlass* speculative_receiver_type = NULL, | |
830 bool allow_intrinsics = true, bool delayed_forbidden = false); | |
808 bool should_delay_inlining(ciMethod* call_method, JVMState* jvms) { | 831 bool should_delay_inlining(ciMethod* call_method, JVMState* jvms) { |
809 return should_delay_string_inlining(call_method, jvms) || | 832 return should_delay_string_inlining(call_method, jvms) || |
810 should_delay_boxing_inlining(call_method, jvms); | 833 should_delay_boxing_inlining(call_method, jvms); |
811 } | 834 } |
812 bool should_delay_string_inlining(ciMethod* call_method, JVMState* jvms); | 835 bool should_delay_string_inlining(ciMethod* call_method, JVMState* jvms); |
1138 // Definitions of pd methods | 1161 // Definitions of pd methods |
1139 static void pd_compiler2_init(); | 1162 static void pd_compiler2_init(); |
1140 | 1163 |
1141 // Auxiliary method for randomized fuzzing/stressing | 1164 // Auxiliary method for randomized fuzzing/stressing |
1142 static bool randomized_select(int count); | 1165 static bool randomized_select(int count); |
1166 | |
1167 // enter a PreserveJVMState block | |
1168 void inc_preserve_jvm_state() { | |
1169 _preserve_jvm_state++; | |
1170 } | |
1171 | |
1172 // exit a PreserveJVMState block | |
1173 void dec_preserve_jvm_state() { | |
1174 _preserve_jvm_state--; | |
1175 assert(_preserve_jvm_state >= 0, "_preserve_jvm_state shouldn't be negative"); | |
1176 } | |
1177 | |
1178 bool has_preserve_jvm_state() const { | |
1179 return _preserve_jvm_state > 0; | |
1180 } | |
1143 }; | 1181 }; |
1144 | 1182 |
1145 #endif // SHARE_VM_OPTO_COMPILE_HPP | 1183 #endif // SHARE_VM_OPTO_COMPILE_HPP |