< prev index next >

src/share/vm/opto/cfgnode.cpp

Print this page
rev 8739 : 8004073: Implement C2 Ideal node specific dump() method
Summary: add Node::dump_rel() to dump a node and its related nodes (the notion of "related" depends on the node at hand); add Node::dump_comp() to dump a node in compact representation; add Node::dump_rel_comp() to dump a node and its related nodes in compact representation; add the required machinery; extend some C2 IR nodes with compact and related dumping
Reviewed-by:


2030   }
2031 }
2032 #endif
2033 
2034 
2035 //=============================================================================
2036 const Type *GotoNode::Value( PhaseTransform *phase ) const {
2037   // If the input is reachable, then we are executed.
2038   // If the input is not reachable, then we are not executed.
2039   return phase->type(in(0));
2040 }
2041 
2042 Node *GotoNode::Identity( PhaseTransform *phase ) {
2043   return in(0);                // Simple copy of incoming control
2044 }
2045 
2046 const RegMask &GotoNode::out_RegMask() const {
2047   return RegMask::Empty;
2048 }
2049 











2050 //=============================================================================
2051 const RegMask &JumpNode::out_RegMask() const {
2052   return RegMask::Empty;
2053 }
2054 











2055 //=============================================================================
2056 const RegMask &JProjNode::out_RegMask() const {
2057   return RegMask::Empty;
2058 }
2059 
2060 //=============================================================================
2061 const RegMask &CProjNode::out_RegMask() const {
2062   return RegMask::Empty;
2063 }
2064 
2065 
2066 
2067 //=============================================================================
2068 
2069 uint PCTableNode::hash() const { return Node::hash() + _size; }
2070 uint PCTableNode::cmp( const Node &n ) const
2071 { return _size == ((PCTableNode&)n)._size; }
2072 
2073 const Type *PCTableNode::bottom_type() const {
2074   const Type** f = TypeTuple::fields(_size);


2090 // control copies
2091 Node *PCTableNode::Ideal(PhaseGVN *phase, bool can_reshape) {
2092   return remove_dead_region(phase, can_reshape) ? this : NULL;
2093 }
2094 
2095 //=============================================================================
2096 uint JumpProjNode::hash() const {
2097   return Node::hash() + _dest_bci;
2098 }
2099 
2100 uint JumpProjNode::cmp( const Node &n ) const {
2101   return ProjNode::cmp(n) &&
2102     _dest_bci == ((JumpProjNode&)n)._dest_bci;
2103 }
2104 
2105 #ifndef PRODUCT
2106 void JumpProjNode::dump_spec(outputStream *st) const {
2107   ProjNode::dump_spec(st);
2108    st->print("@bci %d ",_dest_bci);
2109 }











2110 #endif
2111 
2112 //=============================================================================
2113 //------------------------------Value------------------------------------------
2114 // Check for being unreachable, or for coming from a Rethrow.  Rethrow's cannot
2115 // have the default "fall_through_index" path.
2116 const Type *CatchNode::Value( PhaseTransform *phase ) const {
2117   // Unreachable?  Then so are all paths from here.
2118   if( phase->type(in(0)) == Type::TOP ) return Type::TOP;
2119   // First assume all paths are reachable
2120   const Type** f = TypeTuple::fields(_size);
2121   for( uint i = 0; i < _size; i++ ) f[i] = Type::CONTROL;
2122   // Identify cases that will always throw an exception
2123   // () rethrow call
2124   // () virtual or interface call with NULL receiver
2125   // () call is a check cast with incompatible arguments
2126   if( in(1)->is_Proj() ) {
2127     Node *i10 = in(1)->in(0);
2128     if( i10->is_Call() ) {
2129       CallNode *call = i10->as_Call();




2030   }
2031 }
2032 #endif
2033 
2034 
2035 //=============================================================================
2036 const Type *GotoNode::Value( PhaseTransform *phase ) const {
2037   // If the input is reachable, then we are executed.
2038   // If the input is not reachable, then we are not executed.
2039   return phase->type(in(0));
2040 }
2041 
2042 Node *GotoNode::Identity( PhaseTransform *phase ) {
2043   return in(0);                // Simple copy of incoming control
2044 }
2045 
2046 const RegMask &GotoNode::out_RegMask() const {
2047   return RegMask::Empty;
2048 }
2049 
2050 #ifndef PRODUCT
2051 //-------------------------------rel-------------------------------------------
2052 // The related nodes of a GotoNode are all inputs at level 1, as well as the
2053 // outputs at level 1. This is regardless of compact mode.
2054 void GotoNode::rel(GrowableArray<Node*> *in_rel, GrowableArray<Node*> *out_rel, bool compact) const {
2055   this->collect_nodes(in_rel, 1, false, false);
2056   this->collect_nodes(out_rel, -1, false, false);
2057 }
2058 #endif
2059 
2060 
2061 //=============================================================================
2062 const RegMask &JumpNode::out_RegMask() const {
2063   return RegMask::Empty;
2064 }
2065 
2066 #ifndef PRODUCT
2067 //-------------------------------rel-------------------------------------------
2068 // The related nodes of a JumpNode are all inputs at level 1, as well as the
2069 // outputs at level 2 (to include actual jump targets beyond projection nodes).
2070 // This is regardless of compact mode.
2071 void JumpNode::rel(GrowableArray<Node*> *in_rel, GrowableArray<Node*> *out_rel, bool compact) const {
2072   this->collect_nodes(in_rel, 1, false, false);
2073   this->collect_nodes(out_rel, -2, false, false);
2074 }
2075 #endif
2076 
2077 //=============================================================================
2078 const RegMask &JProjNode::out_RegMask() const {
2079   return RegMask::Empty;
2080 }
2081 
2082 //=============================================================================
2083 const RegMask &CProjNode::out_RegMask() const {
2084   return RegMask::Empty;
2085 }
2086 
2087 
2088 
2089 //=============================================================================
2090 
2091 uint PCTableNode::hash() const { return Node::hash() + _size; }
2092 uint PCTableNode::cmp( const Node &n ) const
2093 { return _size == ((PCTableNode&)n)._size; }
2094 
2095 const Type *PCTableNode::bottom_type() const {
2096   const Type** f = TypeTuple::fields(_size);


2112 // control copies
2113 Node *PCTableNode::Ideal(PhaseGVN *phase, bool can_reshape) {
2114   return remove_dead_region(phase, can_reshape) ? this : NULL;
2115 }
2116 
2117 //=============================================================================
2118 uint JumpProjNode::hash() const {
2119   return Node::hash() + _dest_bci;
2120 }
2121 
2122 uint JumpProjNode::cmp( const Node &n ) const {
2123   return ProjNode::cmp(n) &&
2124     _dest_bci == ((JumpProjNode&)n)._dest_bci;
2125 }
2126 
2127 #ifndef PRODUCT
2128 void JumpProjNode::dump_spec(outputStream *st) const {
2129   ProjNode::dump_spec(st);
2130   st->print("@bci %d ",_dest_bci);
2131 }
2132 
2133 void JumpProjNode::dump_comp_spec(outputStream *st) const {
2134   ProjNode::dump_comp_spec(st);
2135   st->print("(%d)%d@%d", _switch_val, _proj_no, _dest_bci);
2136 }
2137 
2138 void JumpProjNode::rel(GrowableArray<Node*> *in_rel, GrowableArray<Node*> *out_rel, bool compact) const {
2139   // The related nodes of a JumpProjNode are its inputs and outputs at level 1.
2140   this->collect_nodes(in_rel, 1, false, false);
2141   this->collect_nodes(out_rel, -1, false, false);
2142 }
2143 #endif
2144 
2145 //=============================================================================
2146 //------------------------------Value------------------------------------------
2147 // Check for being unreachable, or for coming from a Rethrow.  Rethrow's cannot
2148 // have the default "fall_through_index" path.
2149 const Type *CatchNode::Value( PhaseTransform *phase ) const {
2150   // Unreachable?  Then so are all paths from here.
2151   if( phase->type(in(0)) == Type::TOP ) return Type::TOP;
2152   // First assume all paths are reachable
2153   const Type** f = TypeTuple::fields(_size);
2154   for( uint i = 0; i < _size; i++ ) f[i] = Type::CONTROL;
2155   // Identify cases that will always throw an exception
2156   // () rethrow call
2157   // () virtual or interface call with NULL receiver
2158   // () call is a check cast with incompatible arguments
2159   if( in(1)->is_Proj() ) {
2160     Node *i10 = in(1)->in(0);
2161     if( i10->is_Call() ) {
2162       CallNode *call = i10->as_Call();


< prev index next >