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