383 bool _print_intrinsics; // True if we should print intrinsics for this compilation
384 #ifndef PRODUCT
385 bool _trace_opto_output;
386 bool _parsed_irreducible_loop; // True if ciTypeFlow detected irreducible loops during parsing
387 #endif
388 bool _has_irreducible_loop; // Found irreducible loops
389 // JSR 292
390 bool _has_method_handle_invokes; // True if this method has MethodHandle invokes.
391 RTMState _rtm_state; // State of Restricted Transactional Memory usage
392
393 // Compilation environment.
394 Arena _comp_arena; // Arena with lifetime equivalent to Compile
395 ciEnv* _env; // CI interface
396 DirectiveSet* _directive; // Compiler directive
397 CompileLog* _log; // from CompilerThread
398 const char* _failure_reason; // for record_failure/failing pattern
399 GrowableArray<CallGenerator*>* _intrinsics; // List of intrinsics.
400 GrowableArray<Node*>* _macro_nodes; // List of nodes which need to be expanded before matching.
401 GrowableArray<Node*>* _predicate_opaqs; // List of Opaque1 nodes for the loop predicates.
402 GrowableArray<Node*>* _expensive_nodes; // List of nodes that are expensive to compute and that we'd better not let the GVN freely common
403 ConnectionGraph* _congraph;
404 #ifndef PRODUCT
405 IdealGraphPrinter* _printer;
406 #endif
407
408
409 // Node management
410 uint _unique; // Counter for unique Node indices
411 VectorSet _dead_node_list; // Set of dead nodes
412 uint _dead_node_count; // Number of dead nodes; VectorSet::Size() is O(N).
413 // So use this to keep count and make the call O(1).
414 DEBUG_ONLY( Unique_Node_List* _modified_nodes; ) // List of nodes which inputs were modified
415
416 debug_only(static int _debug_idx;) // Monotonic counter (not reset), use -XX:BreakAtNode=<idx>
417 Arena _node_arena; // Arena for new-space Nodes
418 Arena _old_arena; // Arena for old-space Nodes, lifetime during xform
419 RootNode* _root; // Unique root of compilation, or NULL after bail-out.
420 Node* _top; // Unique top node. (Reset by various phases.)
421
422 Node* _immutable_memory; // Initial memory state
736 event.set_phaseLevel(level);
737 event.commit();
738 }
739 #ifndef PRODUCT
740 if (_printer && _printer->should_print(level)) {
741 _printer->end_method();
742 }
743 #endif
744 }
745
746 int macro_count() const { return _macro_nodes->length(); }
747 int predicate_count() const { return _predicate_opaqs->length();}
748 int expensive_count() const { return _expensive_nodes->length(); }
749 Node* macro_node(int idx) const { return _macro_nodes->at(idx); }
750 Node* predicate_opaque1_node(int idx) const { return _predicate_opaqs->at(idx);}
751 Node* expensive_node(int idx) const { return _expensive_nodes->at(idx); }
752 ConnectionGraph* congraph() { return _congraph;}
753 void set_congraph(ConnectionGraph* congraph) { _congraph = congraph;}
754 void add_macro_node(Node * n) {
755 //assert(n->is_macro(), "must be a macro node");
756 assert(!_macro_nodes->contains(n), " duplicate entry in expand list");
757 _macro_nodes->append(n);
758 }
759 void remove_macro_node(Node * n) {
760 // this function may be called twice for a node so check
761 // that the node is in the array before attempting to remove it
762 if (_macro_nodes->contains(n))
763 _macro_nodes->remove(n);
764 // remove from _predicate_opaqs list also if it is there
765 if (predicate_count() > 0 && _predicate_opaqs->contains(n)){
766 _predicate_opaqs->remove(n);
767 }
768 }
769 void add_expensive_node(Node * n);
770 void remove_expensive_node(Node * n) {
771 if (_expensive_nodes->contains(n)) {
772 _expensive_nodes->remove(n);
773 }
774 }
775 void add_predicate_opaq(Node * n) {
776 assert(!_predicate_opaqs->contains(n), " duplicate entry in predicate opaque1");
777 assert(_macro_nodes->contains(n), "should have already been in macro list");
778 _predicate_opaqs->append(n);
779 }
780 // remove the opaque nodes that protect the predicates so that the unused checks and
781 // uncommon traps will be eliminated from the graph.
782 void cleanup_loop_predicates(PhaseIterGVN &igvn);
783 bool is_predicate_opaq(Node * n) {
784 return _predicate_opaqs->contains(n);
785 }
786
787 // Are there candidate expensive nodes for optimization?
788 bool should_optimize_expensive_nodes(PhaseIterGVN &igvn);
789 // Check whether n1 and n2 are similar
790 static int cmp_expensive_nodes(Node* n1, Node* n2);
791 // Sort expensive nodes to locate similar expensive nodes
792 void sort_expensive_nodes();
793
794 // Compilation environment.
795 Arena* comp_arena() { return &_comp_arena; }
796 ciEnv* env() const { return _env; }
797 CompileLog* log() const { return _log; }
798 bool failing() const { return _env->failing() || _failure_reason != NULL; }
799 const char* failure_reason() const { return (_env->failing()) ? _env->failure_reason() : _failure_reason; }
1275 // Verify GC barrier patterns
1276 void verify_barriers() PRODUCT_RETURN;
1277
1278 // End-of-run dumps.
1279 static void print_statistics() PRODUCT_RETURN;
1280
1281 // Dump formatted assembly
1282 void dump_asm(int *pcs = NULL, uint pc_limit = 0) PRODUCT_RETURN;
1283 void dump_pc(int *pcs, int pc_limit, Node *n);
1284
1285 // Verify ADLC assumptions during startup
1286 static void adlc_verification() PRODUCT_RETURN;
1287
1288 // Definitions of pd methods
1289 static void pd_compiler2_init();
1290
1291 // Static parse-time type checking logic for gen_subtype_check:
1292 enum { SSC_always_false, SSC_always_true, SSC_easy_test, SSC_full_test };
1293 int static_subtype_check(ciKlass* superk, ciKlass* subk);
1294
1295 static Node* conv_I2X_index(PhaseGVN *phase, Node* offset, const TypeInt* sizetype);
1296
1297 // Auxiliary method for randomized fuzzing/stressing
1298 static bool randomized_select(int count);
1299
1300 // supporting clone_map
1301 CloneMap& clone_map();
1302 void set_clone_map(Dict* d);
1303
1304 };
1305
1306 #endif // SHARE_VM_OPTO_COMPILE_HPP
|
383 bool _print_intrinsics; // True if we should print intrinsics for this compilation
384 #ifndef PRODUCT
385 bool _trace_opto_output;
386 bool _parsed_irreducible_loop; // True if ciTypeFlow detected irreducible loops during parsing
387 #endif
388 bool _has_irreducible_loop; // Found irreducible loops
389 // JSR 292
390 bool _has_method_handle_invokes; // True if this method has MethodHandle invokes.
391 RTMState _rtm_state; // State of Restricted Transactional Memory usage
392
393 // Compilation environment.
394 Arena _comp_arena; // Arena with lifetime equivalent to Compile
395 ciEnv* _env; // CI interface
396 DirectiveSet* _directive; // Compiler directive
397 CompileLog* _log; // from CompilerThread
398 const char* _failure_reason; // for record_failure/failing pattern
399 GrowableArray<CallGenerator*>* _intrinsics; // List of intrinsics.
400 GrowableArray<Node*>* _macro_nodes; // List of nodes which need to be expanded before matching.
401 GrowableArray<Node*>* _predicate_opaqs; // List of Opaque1 nodes for the loop predicates.
402 GrowableArray<Node*>* _expensive_nodes; // List of nodes that are expensive to compute and that we'd better not let the GVN freely common
403 #ifdef _LP64
404 GrowableArray<Node*>* _range_check_casts; // List of CastII nodes with a range check dependency
405 #endif
406 ConnectionGraph* _congraph;
407 #ifndef PRODUCT
408 IdealGraphPrinter* _printer;
409 #endif
410
411
412 // Node management
413 uint _unique; // Counter for unique Node indices
414 VectorSet _dead_node_list; // Set of dead nodes
415 uint _dead_node_count; // Number of dead nodes; VectorSet::Size() is O(N).
416 // So use this to keep count and make the call O(1).
417 DEBUG_ONLY( Unique_Node_List* _modified_nodes; ) // List of nodes which inputs were modified
418
419 debug_only(static int _debug_idx;) // Monotonic counter (not reset), use -XX:BreakAtNode=<idx>
420 Arena _node_arena; // Arena for new-space Nodes
421 Arena _old_arena; // Arena for old-space Nodes, lifetime during xform
422 RootNode* _root; // Unique root of compilation, or NULL after bail-out.
423 Node* _top; // Unique top node. (Reset by various phases.)
424
425 Node* _immutable_memory; // Initial memory state
739 event.set_phaseLevel(level);
740 event.commit();
741 }
742 #ifndef PRODUCT
743 if (_printer && _printer->should_print(level)) {
744 _printer->end_method();
745 }
746 #endif
747 }
748
749 int macro_count() const { return _macro_nodes->length(); }
750 int predicate_count() const { return _predicate_opaqs->length();}
751 int expensive_count() const { return _expensive_nodes->length(); }
752 Node* macro_node(int idx) const { return _macro_nodes->at(idx); }
753 Node* predicate_opaque1_node(int idx) const { return _predicate_opaqs->at(idx);}
754 Node* expensive_node(int idx) const { return _expensive_nodes->at(idx); }
755 ConnectionGraph* congraph() { return _congraph;}
756 void set_congraph(ConnectionGraph* congraph) { _congraph = congraph;}
757 void add_macro_node(Node * n) {
758 //assert(n->is_macro(), "must be a macro node");
759 assert(!_macro_nodes->contains(n), "duplicate entry in expand list");
760 _macro_nodes->append(n);
761 }
762 void remove_macro_node(Node * n) {
763 // this function may be called twice for a node so check
764 // that the node is in the array before attempting to remove it
765 if (_macro_nodes->contains(n))
766 _macro_nodes->remove(n);
767 // remove from _predicate_opaqs list also if it is there
768 if (predicate_count() > 0 && _predicate_opaqs->contains(n)){
769 _predicate_opaqs->remove(n);
770 }
771 }
772 void add_expensive_node(Node * n);
773 void remove_expensive_node(Node * n) {
774 if (_expensive_nodes->contains(n)) {
775 _expensive_nodes->remove(n);
776 }
777 }
778 void add_predicate_opaq(Node * n) {
779 assert(!_predicate_opaqs->contains(n), "duplicate entry in predicate opaque1");
780 assert(_macro_nodes->contains(n), "should have already been in macro list");
781 _predicate_opaqs->append(n);
782 }
783
784 #ifdef _LP64
785 // Range check dependent CastII nodes that can be removed after loop optimizations
786 void add_range_check_cast(Node* n);
787 void remove_range_check_cast(Node* n) {
788 if (_range_check_casts->contains(n)) {
789 _range_check_casts->remove(n);
790 }
791 }
792 Node* range_check_cast_node(int idx) const { return _range_check_casts->at(idx); }
793 int range_check_cast_count() const { return _range_check_casts->length(); }
794 // Remove all range check dependent CastIINodes.
795 void remove_range_check_casts(PhaseIterGVN &igvn);
796 #endif
797
798 // remove the opaque nodes that protect the predicates so that the unused checks and
799 // uncommon traps will be eliminated from the graph.
800 void cleanup_loop_predicates(PhaseIterGVN &igvn);
801 bool is_predicate_opaq(Node * n) {
802 return _predicate_opaqs->contains(n);
803 }
804
805 // Are there candidate expensive nodes for optimization?
806 bool should_optimize_expensive_nodes(PhaseIterGVN &igvn);
807 // Check whether n1 and n2 are similar
808 static int cmp_expensive_nodes(Node* n1, Node* n2);
809 // Sort expensive nodes to locate similar expensive nodes
810 void sort_expensive_nodes();
811
812 // Compilation environment.
813 Arena* comp_arena() { return &_comp_arena; }
814 ciEnv* env() const { return _env; }
815 CompileLog* log() const { return _log; }
816 bool failing() const { return _env->failing() || _failure_reason != NULL; }
817 const char* failure_reason() const { return (_env->failing()) ? _env->failure_reason() : _failure_reason; }
1293 // Verify GC barrier patterns
1294 void verify_barriers() PRODUCT_RETURN;
1295
1296 // End-of-run dumps.
1297 static void print_statistics() PRODUCT_RETURN;
1298
1299 // Dump formatted assembly
1300 void dump_asm(int *pcs = NULL, uint pc_limit = 0) PRODUCT_RETURN;
1301 void dump_pc(int *pcs, int pc_limit, Node *n);
1302
1303 // Verify ADLC assumptions during startup
1304 static void adlc_verification() PRODUCT_RETURN;
1305
1306 // Definitions of pd methods
1307 static void pd_compiler2_init();
1308
1309 // Static parse-time type checking logic for gen_subtype_check:
1310 enum { SSC_always_false, SSC_always_true, SSC_easy_test, SSC_full_test };
1311 int static_subtype_check(ciKlass* superk, ciKlass* subk);
1312
1313 static Node* conv_I2X_index(PhaseGVN* phase, Node* offset, const TypeInt* sizetype,
1314 // Optional control dependency (for example, on range check)
1315 Node* ctrl = NULL);
1316
1317 #ifdef _LP64
1318 // Convert integer value to a narrowed long type dependent on ctrl (for example, a range check)
1319 static Node* constrained_convI2L(PhaseGVN* phase, Node* value, const TypeInt* itype, Node* ctrl);
1320 #endif
1321
1322 // Auxiliary method for randomized fuzzing/stressing
1323 static bool randomized_select(int count);
1324
1325 // supporting clone_map
1326 CloneMap& clone_map();
1327 void set_clone_map(Dict* d);
1328
1329 };
1330
1331 #endif // SHARE_VM_OPTO_COMPILE_HPP
|