hotspot/src/share/vm/opto/phaseX.cpp
changeset 214 c5d9b4456687
parent 1 489c9b5090e2
child 238 803c80713999
--- a/hotspot/src/share/vm/opto/phaseX.cpp	Thu Mar 06 20:58:16 2008 -0800
+++ b/hotspot/src/share/vm/opto/phaseX.cpp	Fri Mar 07 11:09:13 2008 -0800
@@ -648,79 +648,9 @@
 //=============================================================================
 //------------------------------transform--------------------------------------
 // Return a node which computes the same function as this node, but in a
-// faster or cheaper fashion.  The Node passed in here must have no other
-// pointers to it, as its storage will be reclaimed if the Node can be
-// optimized away.
+// faster or cheaper fashion.
 Node *PhaseGVN::transform( Node *n ) {
-  NOT_PRODUCT( set_transforms(); )
-
-  // Apply the Ideal call in a loop until it no longer applies
-  Node *k = n;
-  NOT_PRODUCT( uint loop_count = 0; )
-  while( 1 ) {
-    Node *i = k->Ideal(this, /*can_reshape=*/false);
-    if( !i ) break;
-    assert( i->_idx >= k->_idx, "Idealize should return new nodes, use Identity to return old nodes" );
-    // Can never reclaim storage for Ideal calls, because the Ideal call
-    // returns a new Node, bumping the High Water Mark and our old Node
-    // is caught behind the new one.
-    //if( k != i ) {
-    //k->destruct();            // Reclaim storage for recent node
-    k = i;
-    //}
-    assert(loop_count++ < K, "infinite loop in PhaseGVN::transform");
-  }
-  NOT_PRODUCT( if( loop_count != 0 ) { set_progress(); } )
-
-  // If brand new node, make space in type array.
-  ensure_type_or_null(k);
-
-  // Cache result of Value call since it can be expensive
-  // (abstract interpretation of node 'k' using phase->_types[ inputs ])
-  const Type *t = k->Value(this); // Get runtime Value set
-  assert(t != NULL, "value sanity");
-  if (type_or_null(k) != t) {
-#ifndef PRODUCT
-    // Do not record transformation or value construction on first visit
-    if (type_or_null(k) == NULL) {
-      inc_new_values();
-      set_progress();
-    }
-#endif
-    set_type(k, t);
-    // If k is a TypeNode, capture any more-precise type permanently into Node
-    k->raise_bottom_type(t);
-  }
-
-  if( t->singleton() && !k->is_Con() ) {
-    //k->destruct();              // Reclaim storage for recent node
-    NOT_PRODUCT( set_progress(); )
-    return makecon(t);          // Turn into a constant
-  }
-
-  // Now check for Identities
-  Node *i = k->Identity(this);  // Look for a nearby replacement
-  if( i != k ) {                // Found? Return replacement!
-    //k->destruct();              // Reclaim storage for recent node
-    NOT_PRODUCT( set_progress(); )
-    return i;
-  }
-
-  // Try Global Value Numbering
-  i = hash_find_insert(k);      // Found older value when i != NULL
-  if( i && i != k ) {           // Hit? Return the old guy
-    NOT_PRODUCT( set_progress(); )
-    return i;
-  }
-
-  // Collect points-to information for escape analysys
-  ConnectionGraph *cgr = C->congraph();
-  if (cgr != NULL) {
-    cgr->record_escape(k, this);
-  }
-
-  // Return Idealized original
-  return k;
+  return transform_no_reclaim(n);
 }
 
 //------------------------------transform--------------------------------------
@@ -784,6 +714,12 @@
     return i;
   }
 
+  // Collect points-to information for escape analysys
+  ConnectionGraph *cgr = C->congraph();
+  if (cgr != NULL) {
+    cgr->record_escape(k, this);
+  }
+
   // Return Idealized original
   return k;
 }