< prev index next >

src/share/vm/opto/cfgnode.cpp

Print this page




  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/systemDictionary.hpp"
  27 #include "memory/allocation.inline.hpp"
  28 #include "memory/resourceArea.hpp"
  29 #include "oops/objArrayKlass.hpp"
  30 #include "opto/addnode.hpp"
  31 #include "opto/castnode.hpp"
  32 #include "opto/cfgnode.hpp"
  33 #include "opto/connode.hpp"
  34 #include "opto/convertnode.hpp"
  35 #include "opto/loopnode.hpp"
  36 #include "opto/machnode.hpp"
  37 #include "opto/movenode.hpp"
  38 #include "opto/narrowptrnode.hpp"
  39 #include "opto/mulnode.hpp"
  40 #include "opto/phaseX.hpp"
  41 #include "opto/regmask.hpp"
  42 #include "opto/runtime.hpp"
  43 #include "opto/subnode.hpp"

  44 
  45 // Portions of code courtesy of Clifford Click
  46 
  47 // Optimization - Graph Style
  48 
  49 //=============================================================================
  50 //------------------------------Value------------------------------------------
  51 // Compute the type of the RegionNode.
  52 const Type* RegionNode::Value(PhaseGVN* phase) const {
  53   for( uint i=1; i<req(); ++i ) {       // For all paths in
  54     Node *n = in(i);            // Get Control source
  55     if( !n ) continue;          // Missing inputs are TOP
  56     if( phase->type(n) == Type::CONTROL )
  57       return Type::CONTROL;
  58   }
  59   return Type::TOP;             // All paths dead?  Then so are we
  60 }
  61 
  62 //------------------------------Identity---------------------------------------
  63 // Check for Region being Identity.


 856     Node* n = in(i);
 857     if (n == NULL)  continue;
 858     const Node* np = in(i);
 859     if (np->is_Phi()) {
 860       np->as_Phi()->verify_adr_type(visited, at);
 861     } else if (n->bottom_type() == Type::TOP
 862                || (n->is_Mem() && n->in(MemNode::Address)->bottom_type() == Type::TOP)) {
 863       // ignore top inputs
 864     } else {
 865       const TypePtr* nat = flatten_phi_adr_type(n->adr_type());
 866       // recheck phi/non-phi consistency at leaves:
 867       assert((nat != NULL) == (at != NULL), "");
 868       assert(nat == at || nat == TypePtr::BOTTOM,
 869              "adr_type must be consistent at leaves of phi nest");
 870     }
 871   }
 872 }
 873 
 874 // Verify a whole nest of phis rooted at this one.
 875 void PhiNode::verify_adr_type(bool recursive) const {
 876   if (is_error_reported())  return;  // muzzle asserts when debugging an error
 877   if (Node::in_dump())      return;  // muzzle asserts when printing
 878 
 879   assert((_type == Type::MEMORY) == (_adr_type != NULL), "adr_type for memory phis only");
 880 
 881   if (!VerifyAliases)       return;  // verify thoroughly only if requested
 882 
 883   assert(_adr_type == flatten_phi_adr_type(_adr_type),
 884          "Phi::adr_type must be pre-normalized");
 885 
 886   if (recursive) {
 887     VectorSet visited(Thread::current()->resource_area());
 888     verify_adr_type(visited, _adr_type);
 889   }
 890 }
 891 #endif
 892 
 893 
 894 //------------------------------Value------------------------------------------
 895 // Compute the type of the PhiNode
 896 const Type* PhiNode::Value(PhaseGVN* phase) const {




  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/systemDictionary.hpp"
  27 #include "memory/allocation.inline.hpp"
  28 #include "memory/resourceArea.hpp"
  29 #include "oops/objArrayKlass.hpp"
  30 #include "opto/addnode.hpp"
  31 #include "opto/castnode.hpp"
  32 #include "opto/cfgnode.hpp"
  33 #include "opto/connode.hpp"
  34 #include "opto/convertnode.hpp"
  35 #include "opto/loopnode.hpp"
  36 #include "opto/machnode.hpp"
  37 #include "opto/movenode.hpp"
  38 #include "opto/narrowptrnode.hpp"
  39 #include "opto/mulnode.hpp"
  40 #include "opto/phaseX.hpp"
  41 #include "opto/regmask.hpp"
  42 #include "opto/runtime.hpp"
  43 #include "opto/subnode.hpp"
  44 #include "utilities/vmError.hpp"
  45 
  46 // Portions of code courtesy of Clifford Click
  47 
  48 // Optimization - Graph Style
  49 
  50 //=============================================================================
  51 //------------------------------Value------------------------------------------
  52 // Compute the type of the RegionNode.
  53 const Type* RegionNode::Value(PhaseGVN* phase) const {
  54   for( uint i=1; i<req(); ++i ) {       // For all paths in
  55     Node *n = in(i);            // Get Control source
  56     if( !n ) continue;          // Missing inputs are TOP
  57     if( phase->type(n) == Type::CONTROL )
  58       return Type::CONTROL;
  59   }
  60   return Type::TOP;             // All paths dead?  Then so are we
  61 }
  62 
  63 //------------------------------Identity---------------------------------------
  64 // Check for Region being Identity.


 857     Node* n = in(i);
 858     if (n == NULL)  continue;
 859     const Node* np = in(i);
 860     if (np->is_Phi()) {
 861       np->as_Phi()->verify_adr_type(visited, at);
 862     } else if (n->bottom_type() == Type::TOP
 863                || (n->is_Mem() && n->in(MemNode::Address)->bottom_type() == Type::TOP)) {
 864       // ignore top inputs
 865     } else {
 866       const TypePtr* nat = flatten_phi_adr_type(n->adr_type());
 867       // recheck phi/non-phi consistency at leaves:
 868       assert((nat != NULL) == (at != NULL), "");
 869       assert(nat == at || nat == TypePtr::BOTTOM,
 870              "adr_type must be consistent at leaves of phi nest");
 871     }
 872   }
 873 }
 874 
 875 // Verify a whole nest of phis rooted at this one.
 876 void PhiNode::verify_adr_type(bool recursive) const {
 877   if (VMError::is_error_reported())  return;  // muzzle asserts when debugging an error
 878   if (Node::in_dump())               return;  // muzzle asserts when printing
 879 
 880   assert((_type == Type::MEMORY) == (_adr_type != NULL), "adr_type for memory phis only");
 881 
 882   if (!VerifyAliases)       return;  // verify thoroughly only if requested
 883 
 884   assert(_adr_type == flatten_phi_adr_type(_adr_type),
 885          "Phi::adr_type must be pre-normalized");
 886 
 887   if (recursive) {
 888     VectorSet visited(Thread::current()->resource_area());
 889     verify_adr_type(visited, _adr_type);
 890   }
 891 }
 892 #endif
 893 
 894 
 895 //------------------------------Value------------------------------------------
 896 // Compute the type of the PhiNode
 897 const Type* PhiNode::Value(PhaseGVN* phase) const {


< prev index next >