< prev index next >

src/hotspot/share/opto/escape.cpp

Print this page




  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "ci/bcEscapeAnalyzer.hpp"
  27 #include "compiler/compileLog.hpp"
  28 #include "libadt/vectset.hpp"
  29 #include "memory/allocation.hpp"
  30 #include "memory/resourceArea.hpp"
  31 #include "opto/c2compiler.hpp"
  32 #include "opto/arraycopynode.hpp"
  33 #include "opto/callnode.hpp"
  34 #include "opto/cfgnode.hpp"
  35 #include "opto/compile.hpp"
  36 #include "opto/escape.hpp"
  37 #include "opto/phaseX.hpp"
  38 #include "opto/movenode.hpp"
  39 #include "opto/rootnode.hpp"

  40 
  41 ConnectionGraph::ConnectionGraph(Compile * C, PhaseIterGVN *igvn) :
  42   _nodes(C->comp_arena(), C->unique(), C->unique(), NULL),
  43   _in_worklist(C->comp_arena()),
  44   _next_pidx(0),
  45   _collecting(true),
  46   _verify(false),
  47   _compile(C),
  48   _igvn(igvn),
  49   _node_map(C->comp_arena()) {
  50   // Add unknown java object.
  51   add_java_object(C->top(), PointsToNode::GlobalEscape);
  52   phantom_obj = ptnode_adr(C->top()->_idx)->as_JavaObject();
  53   // Add ConP(#NULL) and ConN(#NULL) nodes.
  54   Node* oop_null = igvn->zerocon(T_OBJECT);
  55   assert(oop_null->_idx < nodes_size(), "should be created already");
  56   add_java_object(oop_null, PointsToNode::NoEscape);
  57   null_obj = ptnode_adr(oop_null->_idx)->as_JavaObject();
  58   if (UseCompressedOops) {
  59     Node* noop_null = igvn->zerocon(T_NARROWOOP);


 143     add_node_to_connection_graph(n, &delayed_worklist);
 144     PointsToNode* ptn = ptnode_adr(n->_idx);
 145     if (ptn != NULL && ptn != phantom_obj) {
 146       ptnodes_worklist.append(ptn);
 147       if (ptn->is_JavaObject()) {
 148         java_objects_worklist.append(ptn->as_JavaObject());
 149         if ((n->is_Allocate() || n->is_CallStaticJava()) &&
 150             (ptn->escape_state() < PointsToNode::GlobalEscape)) {
 151           // Only allocations and java static calls results are interesting.
 152           non_escaped_worklist.append(ptn->as_JavaObject());
 153         }
 154       } else if (ptn->is_Field() && ptn->as_Field()->is_oop()) {
 155         oop_fields_worklist.append(ptn->as_Field());
 156       }
 157     }
 158     if (n->is_MergeMem()) {
 159       // Collect all MergeMem nodes to add memory slices for
 160       // scalar replaceable objects in split_unique_types().
 161       _mergemem_worklist.append(n->as_MergeMem());
 162     } else if (OptimizePtrCompare && n->is_Cmp() &&
 163                (n->Opcode() == Op_CmpP || n->Opcode() == Op_CmpN)) {

 164       // Collect compare pointers nodes.
 165       ptr_cmp_worklist.append(n);
 166     } else if (n->is_MemBarStoreStore()) {
 167       // Collect all MemBarStoreStore nodes so that depending on the
 168       // escape status of the associated Allocate node some of them
 169       // may be eliminated.
 170       storestore_worklist.append(n);
 171     } else if (n->is_MemBar() && (n->Opcode() == Op_MemBarRelease) &&
 172                (n->req() > MemBarNode::Precedent)) {
 173       record_for_optimizer(n);
 174 #ifdef ASSERT
 175     } else if (n->is_AddP()) {
 176       // Collect address nodes for graph verification.
 177       addp_worklist.append(n);
 178 #endif
 179     } else if (n->is_ArrayCopy()) {
 180       // Keep a list of ArrayCopy nodes so if one of its input is non
 181       // escaping, we can record a unique type
 182       arraycopy_worklist.append(n->as_ArrayCopy());
 183     }




  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "ci/bcEscapeAnalyzer.hpp"
  27 #include "compiler/compileLog.hpp"
  28 #include "libadt/vectset.hpp"
  29 #include "memory/allocation.hpp"
  30 #include "memory/resourceArea.hpp"
  31 #include "opto/c2compiler.hpp"
  32 #include "opto/arraycopynode.hpp"
  33 #include "opto/callnode.hpp"
  34 #include "opto/cfgnode.hpp"
  35 #include "opto/compile.hpp"
  36 #include "opto/escape.hpp"
  37 #include "opto/phaseX.hpp"
  38 #include "opto/movenode.hpp"
  39 #include "opto/rootnode.hpp"
  40 #include "opto/subnode.hpp"
  41 
  42 ConnectionGraph::ConnectionGraph(Compile * C, PhaseIterGVN *igvn) :
  43   _nodes(C->comp_arena(), C->unique(), C->unique(), NULL),
  44   _in_worklist(C->comp_arena()),
  45   _next_pidx(0),
  46   _collecting(true),
  47   _verify(false),
  48   _compile(C),
  49   _igvn(igvn),
  50   _node_map(C->comp_arena()) {
  51   // Add unknown java object.
  52   add_java_object(C->top(), PointsToNode::GlobalEscape);
  53   phantom_obj = ptnode_adr(C->top()->_idx)->as_JavaObject();
  54   // Add ConP(#NULL) and ConN(#NULL) nodes.
  55   Node* oop_null = igvn->zerocon(T_OBJECT);
  56   assert(oop_null->_idx < nodes_size(), "should be created already");
  57   add_java_object(oop_null, PointsToNode::NoEscape);
  58   null_obj = ptnode_adr(oop_null->_idx)->as_JavaObject();
  59   if (UseCompressedOops) {
  60     Node* noop_null = igvn->zerocon(T_NARROWOOP);


 144     add_node_to_connection_graph(n, &delayed_worklist);
 145     PointsToNode* ptn = ptnode_adr(n->_idx);
 146     if (ptn != NULL && ptn != phantom_obj) {
 147       ptnodes_worklist.append(ptn);
 148       if (ptn->is_JavaObject()) {
 149         java_objects_worklist.append(ptn->as_JavaObject());
 150         if ((n->is_Allocate() || n->is_CallStaticJava()) &&
 151             (ptn->escape_state() < PointsToNode::GlobalEscape)) {
 152           // Only allocations and java static calls results are interesting.
 153           non_escaped_worklist.append(ptn->as_JavaObject());
 154         }
 155       } else if (ptn->is_Field() && ptn->as_Field()->is_oop()) {
 156         oop_fields_worklist.append(ptn->as_Field());
 157       }
 158     }
 159     if (n->is_MergeMem()) {
 160       // Collect all MergeMem nodes to add memory slices for
 161       // scalar replaceable objects in split_unique_types().
 162       _mergemem_worklist.append(n->as_MergeMem());
 163     } else if (OptimizePtrCompare && n->is_Cmp() &&
 164                ((n->Opcode() == Op_CmpP && !(((CmpPNode*)n)->has_perturbed_operand() != NULL)) ||
 165                  n->Opcode() == Op_CmpN)) {
 166       // Collect compare pointers nodes.
 167       ptr_cmp_worklist.append(n);
 168     } else if (n->is_MemBarStoreStore()) {
 169       // Collect all MemBarStoreStore nodes so that depending on the
 170       // escape status of the associated Allocate node some of them
 171       // may be eliminated.
 172       storestore_worklist.append(n);
 173     } else if (n->is_MemBar() && (n->Opcode() == Op_MemBarRelease) &&
 174                (n->req() > MemBarNode::Precedent)) {
 175       record_for_optimizer(n);
 176 #ifdef ASSERT
 177     } else if (n->is_AddP()) {
 178       // Collect address nodes for graph verification.
 179       addp_worklist.append(n);
 180 #endif
 181     } else if (n->is_ArrayCopy()) {
 182       // Keep a list of ArrayCopy nodes so if one of its input is non
 183       // escaping, we can record a unique type
 184       arraycopy_worklist.append(n->as_ArrayCopy());
 185     }


< prev index next >