468 }
469
470 // Propagate GlobalEscape and ArgEscape escape states to all nodes
471 // and check that we still have non-escaping java objects.
472 bool find_non_escaped_objects(GrowableArray<PointsToNode*>& ptnodes_worklist,
473 GrowableArray<JavaObjectNode*>& non_escaped_worklist,
474 bool print_method = true);
475
476 // Adjust scalar_replaceable state after Connection Graph is built.
477 void adjust_scalar_replaceable_state(JavaObjectNode* jobj, Unique_Node_List &reducible_merges);
478
479 // Reevaluate Phis reducible status after 'obj' became NSR.
480 void revisit_reducible_phi_status(JavaObjectNode* jobj, Unique_Node_List& reducible_merges);
481
482 // Propagate NSR (Not scalar replaceable) state.
483 void find_scalar_replaceable_allocs(GrowableArray<JavaObjectNode*>& jobj_worklist, Unique_Node_List &reducible_merges);
484
485 // Optimize ideal graph.
486 void optimize_ideal_graph(GrowableArray<Node*>& ptr_cmp_worklist,
487 GrowableArray<MemBarStoreStoreNode*>& storestore_worklist);
488 // Optimize objects compare.
489 const TypeInt* optimize_ptr_compare(Node* left, Node* right);
490
491 // Returns unique corresponding java object or null.
492 JavaObjectNode* unique_java_object(Node *n) const;
493
494 // Add an edge of the specified type pointing to the specified target.
495 bool add_edge(PointsToNode* from, PointsToNode* to) {
496 assert(!from->is_Field() || from->as_Field()->is_oop(), "sanity");
497
498 if (to == phantom_obj) {
499 if (from->has_unknown_ptr()) {
500 return false; // already points to phantom_obj
501 }
502 from->set_has_unknown_ptr();
503 }
504
505 bool is_new = from->add_edge(to);
506 assert(to != phantom_obj || is_new, "sanity");
507 if (is_new) { // New edge?
641 #endif
642
643 public:
644 ConnectionGraph(Compile *C, PhaseIterGVN *igvn, int iteration);
645
646 // Verify that SafePointScalarMerge nodes are correctly connected
647 static void verify_ram_nodes(Compile* C, Node* root);
648
649 // Check for non-escaping candidates
650 static bool has_candidates(Compile *C);
651
652 // Perform escape analysis
653 static void do_analysis(Compile *C, PhaseIterGVN *igvn);
654
655 bool not_global_escape(Node *n);
656
657 bool can_eliminate_lock(AbstractLockNode* alock);
658
659 // To be used by, e.g., BarrierSetC2 impls
660 Node* get_addp_base(Node* addp);
661
662 // Utility function for nodes that load an object
663 void add_objload_to_connection_graph(Node* n, Unique_Node_List* delayed_worklist);
664
665 // Add LocalVar node and edge if possible
666 void add_local_var_and_edge(Node* n, PointsToNode::EscapeState es, Node* to,
667 Unique_Node_List *delayed_worklist) {
668 PointsToNode* ptn = ptnode_adr(to->_idx);
669 if (delayed_worklist != nullptr) { // First iteration of CG construction
670 add_local_var(n, es);
671 if (ptn == nullptr) {
672 delayed_worklist->push(n);
673 return; // Process it later.
674 }
675 } else {
676 assert(ptn != nullptr, "node should be registered");
677 }
678 add_edge(ptnode_adr(n->_idx), ptn);
679 }
680
|
468 }
469
470 // Propagate GlobalEscape and ArgEscape escape states to all nodes
471 // and check that we still have non-escaping java objects.
472 bool find_non_escaped_objects(GrowableArray<PointsToNode*>& ptnodes_worklist,
473 GrowableArray<JavaObjectNode*>& non_escaped_worklist,
474 bool print_method = true);
475
476 // Adjust scalar_replaceable state after Connection Graph is built.
477 void adjust_scalar_replaceable_state(JavaObjectNode* jobj, Unique_Node_List &reducible_merges);
478
479 // Reevaluate Phis reducible status after 'obj' became NSR.
480 void revisit_reducible_phi_status(JavaObjectNode* jobj, Unique_Node_List& reducible_merges);
481
482 // Propagate NSR (Not scalar replaceable) state.
483 void find_scalar_replaceable_allocs(GrowableArray<JavaObjectNode*>& jobj_worklist, Unique_Node_List &reducible_merges);
484
485 // Optimize ideal graph.
486 void optimize_ideal_graph(GrowableArray<Node*>& ptr_cmp_worklist,
487 GrowableArray<MemBarStoreStoreNode*>& storestore_worklist);
488 // Expand flat accesses to accesses to each component if the object does not escape
489 void optimize_flat_accesses(GrowableArray<SafePointNode*>& sfn_worklist);
490 // Optimize objects compare.
491 const TypeInt* optimize_ptr_compare(Node* left, Node* right);
492
493 // Returns unique corresponding java object or null.
494 JavaObjectNode* unique_java_object(Node *n) const;
495
496 // Add an edge of the specified type pointing to the specified target.
497 bool add_edge(PointsToNode* from, PointsToNode* to) {
498 assert(!from->is_Field() || from->as_Field()->is_oop(), "sanity");
499
500 if (to == phantom_obj) {
501 if (from->has_unknown_ptr()) {
502 return false; // already points to phantom_obj
503 }
504 from->set_has_unknown_ptr();
505 }
506
507 bool is_new = from->add_edge(to);
508 assert(to != phantom_obj || is_new, "sanity");
509 if (is_new) { // New edge?
643 #endif
644
645 public:
646 ConnectionGraph(Compile *C, PhaseIterGVN *igvn, int iteration);
647
648 // Verify that SafePointScalarMerge nodes are correctly connected
649 static void verify_ram_nodes(Compile* C, Node* root);
650
651 // Check for non-escaping candidates
652 static bool has_candidates(Compile *C);
653
654 // Perform escape analysis
655 static void do_analysis(Compile *C, PhaseIterGVN *igvn);
656
657 bool not_global_escape(Node *n);
658
659 bool can_eliminate_lock(AbstractLockNode* alock);
660
661 // To be used by, e.g., BarrierSetC2 impls
662 Node* get_addp_base(Node* addp);
663 DEBUG_ONLY(static bool is_load_array_klass_related(const Node* uncast_base));
664
665 // Utility function for nodes that load an object
666 void add_objload_to_connection_graph(Node* n, Unique_Node_List* delayed_worklist);
667
668 // Add LocalVar node and edge if possible
669 void add_local_var_and_edge(Node* n, PointsToNode::EscapeState es, Node* to,
670 Unique_Node_List *delayed_worklist) {
671 PointsToNode* ptn = ptnode_adr(to->_idx);
672 if (delayed_worklist != nullptr) { // First iteration of CG construction
673 add_local_var(n, es);
674 if (ptn == nullptr) {
675 delayed_worklist->push(n);
676 return; // Process it later.
677 }
678 } else {
679 assert(ptn != nullptr, "node should be registered");
680 }
681 add_edge(ptnode_adr(n->_idx), ptn);
682 }
683
|