< prev index next >

src/share/vm/opto/multnode.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:
   1 /*
   2  * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 101 
 102 const TypePtr *ProjNode::adr_type() const {
 103   if (bottom_type() == Type::MEMORY) {
 104     // in(0) might be a narrow MemBar; otherwise we will report TypePtr::BOTTOM
 105     Node* ctrl = in(0);
 106     if (ctrl == NULL)  return NULL; // node is dead
 107     const TypePtr* adr_type = ctrl->adr_type();
 108     #ifdef ASSERT
 109     if (!is_error_reported() && !Node::in_dump())
 110       assert(adr_type != NULL, "source must have adr_type");
 111     #endif
 112     return adr_type;
 113   }
 114   assert(bottom_type()->base() != Type::Memory, "no other memories?");
 115   return NULL;
 116 }
 117 
 118 bool ProjNode::pinned() const { return in(0)->pinned(); }
 119 #ifndef PRODUCT
 120 void ProjNode::dump_spec(outputStream *st) const { st->print("#%d",_con); if(_is_io_use) st->print(" (i_o_use)");}














 121 #endif
 122 
 123 //----------------------------check_con----------------------------------------
 124 void ProjNode::check_con() const {
 125   Node* n = in(0);
 126   if (n == NULL)       return;  // should be assert, but NodeHash makes bogons
 127   if (n->is_Mach())    return;  // mach. projs. are not type-safe
 128   if (n->is_Start())   return;  // alas, starts can have mach. projs. also
 129   if (_con == SCMemProjNode::SCMEMPROJCON ) return;
 130   const Type* t = n->bottom_type();
 131   if (t == Type::TOP)  return;  // multi is dead
 132   assert(_con < t->is_tuple()->cnt(), "ProjNode::_con must be in range");
 133 }
 134 
 135 //------------------------------Value------------------------------------------
 136 const Type *ProjNode::Value( PhaseTransform *phase ) const {
 137   if (in(0) == NULL) return Type::TOP;
 138   return proj_type(phase->type(in(0)));
 139 }
 140 


   1 /*
   2  * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 101 
 102 const TypePtr *ProjNode::adr_type() const {
 103   if (bottom_type() == Type::MEMORY) {
 104     // in(0) might be a narrow MemBar; otherwise we will report TypePtr::BOTTOM
 105     Node* ctrl = in(0);
 106     if (ctrl == NULL)  return NULL; // node is dead
 107     const TypePtr* adr_type = ctrl->adr_type();
 108     #ifdef ASSERT
 109     if (!is_error_reported() && !Node::in_dump())
 110       assert(adr_type != NULL, "source must have adr_type");
 111     #endif
 112     return adr_type;
 113   }
 114   assert(bottom_type()->base() != Type::Memory, "no other memories?");
 115   return NULL;
 116 }
 117 
 118 bool ProjNode::pinned() const { return in(0)->pinned(); }
 119 #ifndef PRODUCT
 120 void ProjNode::dump_spec(outputStream *st) const { st->print("#%d",_con); if(_is_io_use) st->print(" (i_o_use)");}
 121 
 122 void ProjNode::dump_comp_spec(outputStream *st) const {
 123   for (DUIterator i = this->outs(); this->has_out(i); i++) {
 124     Node* o = this->out(i);
 125     if (NotANode(o)) {
 126       st->print("[?]");
 127     } else if (o == NULL) {
 128       st->print("[_]");
 129     } else {
 130       st->print("[%d]", o->_idx);
 131     }
 132   }
 133   st->print("#%d", _con);
 134 }
 135 #endif
 136 
 137 //----------------------------check_con----------------------------------------
 138 void ProjNode::check_con() const {
 139   Node* n = in(0);
 140   if (n == NULL)       return;  // should be assert, but NodeHash makes bogons
 141   if (n->is_Mach())    return;  // mach. projs. are not type-safe
 142   if (n->is_Start())   return;  // alas, starts can have mach. projs. also
 143   if (_con == SCMemProjNode::SCMEMPROJCON ) return;
 144   const Type* t = n->bottom_type();
 145   if (t == Type::TOP)  return;  // multi is dead
 146   assert(_con < t->is_tuple()->cnt(), "ProjNode::_con must be in range");
 147 }
 148 
 149 //------------------------------Value------------------------------------------
 150 const Type *ProjNode::Value( PhaseTransform *phase ) const {
 151   if (in(0) == NULL) return Type::TOP;
 152   return proj_type(phase->type(in(0)));
 153 }
 154 


< prev index next >