src/share/vm/opto/multnode.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6934604 Sdiff src/share/vm/opto

src/share/vm/opto/multnode.cpp

Print this page




   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  *
  23  */
  24 
  25 #include "precompiled.hpp"

  26 #include "opto/matcher.hpp"
  27 #include "opto/multnode.hpp"
  28 #include "opto/opcodes.hpp"
  29 #include "opto/phaseX.hpp"
  30 #include "opto/regmask.hpp"
  31 #include "opto/type.hpp"
  32 
  33 //=============================================================================
  34 //------------------------------MultiNode--------------------------------------
  35 const RegMask &MultiNode::out_RegMask() const {
  36   return RegMask::Empty;
  37 }
  38 
  39 Node *MultiNode::match( const ProjNode *proj, const Matcher *m ) { return proj->clone(); }
  40 
  41 //------------------------------proj_out---------------------------------------
  42 // Get a named projection
  43 ProjNode* MultiNode::proj_out(uint which_proj) const {
  44   assert(Opcode() != Op_If || which_proj == (uint)true || which_proj == (uint)false, "must be 1 or 0");
  45   assert(Opcode() != Op_If || outcnt() == 2, "bad if #1");


  56     }
  57   }
  58   return NULL;
  59 }
  60 
  61 //=============================================================================
  62 //------------------------------ProjNode---------------------------------------
  63 uint ProjNode::hash() const {
  64   // only one input
  65   return (uintptr_t)in(TypeFunc::Control) + (_con << 1) + (_is_io_use ? 1 : 0);
  66 }
  67 uint ProjNode::cmp( const Node &n ) const { return _con == ((ProjNode&)n)._con && ((ProjNode&)n)._is_io_use == _is_io_use; }
  68 uint ProjNode::size_of() const { return sizeof(ProjNode); }
  69 
  70 // Test if we propagate interesting control along this projection
  71 bool ProjNode::is_CFG() const {
  72   Node *def = in(0);
  73   return (_con == TypeFunc::Control && def->is_CFG());
  74 }
  75 

















  76 const Type *ProjNode::bottom_type() const {
  77   if (in(0) == NULL)  return Type::TOP;
  78   const Type *tb = in(0)->bottom_type();
  79   if( tb == Type::TOP ) return Type::TOP;
  80   if( tb == Type::BOTTOM ) return Type::BOTTOM;
  81   const TypeTuple *t = tb->is_tuple();
  82   return t->field_at(_con);
  83 }
  84 
  85 const TypePtr *ProjNode::adr_type() const {
  86   if (bottom_type() == Type::MEMORY) {
  87     // in(0) might be a narrow MemBar; otherwise we will report TypePtr::BOTTOM
  88     const TypePtr* adr_type = in(0)->adr_type();
  89     #ifdef ASSERT
  90     if (!is_error_reported() && !Node::in_dump())
  91       assert(adr_type != NULL, "source must have adr_type");
  92     #endif
  93     return adr_type;
  94   }
  95   assert(bottom_type()->base() != Type::Memory, "no other memories?");
  96   return NULL;
  97 }
  98 
  99 bool ProjNode::pinned() const { return in(0)->pinned(); }
 100 #ifndef PRODUCT
 101 void ProjNode::dump_spec(outputStream *st) const { st->print("#%d",_con); if(_is_io_use) st->print(" (i_o_use)");}
 102 #endif
 103 
 104 //----------------------------check_con----------------------------------------
 105 void ProjNode::check_con() const {
 106   Node* n = in(0);
 107   if (n == NULL)       return;  // should be assert, but NodeHash makes bogons
 108   if (n->is_Mach())    return;  // mach. projs. are not type-safe
 109   if (n->is_Start())   return;  // alas, starts can have mach. projs. also
 110   if (_con == SCMemProjNode::SCMEMPROJCON ) return;
 111   const Type* t = n->bottom_type();
 112   if (t == Type::TOP)  return;  // multi is dead
 113   assert(_con < t->is_tuple()->cnt(), "ProjNode::_con must be in range");
 114 }
 115 
 116 //------------------------------Value------------------------------------------
 117 const Type *ProjNode::Value( PhaseTransform *phase ) const {
 118   if( !in(0) ) return Type::TOP;
 119   const Type *t = phase->type(in(0));
 120   if( t == Type::TOP ) return t;
 121   if( t == Type::BOTTOM ) return t;
 122   return t->is_tuple()->field_at(_con);
 123 }
 124 
 125 //------------------------------out_RegMask------------------------------------
 126 // Pass the buck uphill
 127 const RegMask &ProjNode::out_RegMask() const {
 128   return RegMask::Empty;
 129 }
 130 
 131 //------------------------------ideal_reg--------------------------------------
 132 uint ProjNode::ideal_reg() const {
 133   return bottom_type()->ideal_reg();
 134 }


   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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "opto/callnode.hpp"
  27 #include "opto/matcher.hpp"
  28 #include "opto/multnode.hpp"
  29 #include "opto/opcodes.hpp"
  30 #include "opto/phaseX.hpp"
  31 #include "opto/regmask.hpp"
  32 #include "opto/type.hpp"
  33 
  34 //=============================================================================
  35 //------------------------------MultiNode--------------------------------------
  36 const RegMask &MultiNode::out_RegMask() const {
  37   return RegMask::Empty;
  38 }
  39 
  40 Node *MultiNode::match( const ProjNode *proj, const Matcher *m ) { return proj->clone(); }
  41 
  42 //------------------------------proj_out---------------------------------------
  43 // Get a named projection
  44 ProjNode* MultiNode::proj_out(uint which_proj) const {
  45   assert(Opcode() != Op_If || which_proj == (uint)true || which_proj == (uint)false, "must be 1 or 0");
  46   assert(Opcode() != Op_If || outcnt() == 2, "bad if #1");


  57     }
  58   }
  59   return NULL;
  60 }
  61 
  62 //=============================================================================
  63 //------------------------------ProjNode---------------------------------------
  64 uint ProjNode::hash() const {
  65   // only one input
  66   return (uintptr_t)in(TypeFunc::Control) + (_con << 1) + (_is_io_use ? 1 : 0);
  67 }
  68 uint ProjNode::cmp( const Node &n ) const { return _con == ((ProjNode&)n)._con && ((ProjNode&)n)._is_io_use == _is_io_use; }
  69 uint ProjNode::size_of() const { return sizeof(ProjNode); }
  70 
  71 // Test if we propagate interesting control along this projection
  72 bool ProjNode::is_CFG() const {
  73   Node *def = in(0);
  74   return (_con == TypeFunc::Control && def->is_CFG());
  75 }
  76 
  77 const Type* ProjNode::proj_type(const Type* t) const {
  78   if (t == Type::TOP) {
  79     return Type::TOP;
  80   }
  81   if (t == Type::BOTTOM) {
  82     return Type::BOTTOM;
  83   }
  84   t = t->is_tuple()->field_at(_con);
  85   Node* n = in(0);
  86   if ((_con == TypeFunc::Parms) &&
  87       n->is_CallStaticJava() && n->as_CallStaticJava()->is_boxing_method()) {
  88     // The result of autoboxing is always non-null on normal path.
  89     t = t->join(TypePtr::NOTNULL);
  90   }
  91   return t;
  92 }
  93 
  94 const Type *ProjNode::bottom_type() const {
  95   if (in(0) == NULL) return Type::TOP;
  96   return proj_type(in(0)->bottom_type());




  97 }
  98 
  99 const TypePtr *ProjNode::adr_type() const {
 100   if (bottom_type() == Type::MEMORY) {
 101     // in(0) might be a narrow MemBar; otherwise we will report TypePtr::BOTTOM
 102     const TypePtr* adr_type = in(0)->adr_type();
 103     #ifdef ASSERT
 104     if (!is_error_reported() && !Node::in_dump())
 105       assert(adr_type != NULL, "source must have adr_type");
 106     #endif
 107     return adr_type;
 108   }
 109   assert(bottom_type()->base() != Type::Memory, "no other memories?");
 110   return NULL;
 111 }
 112 
 113 bool ProjNode::pinned() const { return in(0)->pinned(); }
 114 #ifndef PRODUCT
 115 void ProjNode::dump_spec(outputStream *st) const { st->print("#%d",_con); if(_is_io_use) st->print(" (i_o_use)");}
 116 #endif
 117 
 118 //----------------------------check_con----------------------------------------
 119 void ProjNode::check_con() const {
 120   Node* n = in(0);
 121   if (n == NULL)       return;  // should be assert, but NodeHash makes bogons
 122   if (n->is_Mach())    return;  // mach. projs. are not type-safe
 123   if (n->is_Start())   return;  // alas, starts can have mach. projs. also
 124   if (_con == SCMemProjNode::SCMEMPROJCON ) return;
 125   const Type* t = n->bottom_type();
 126   if (t == Type::TOP)  return;  // multi is dead
 127   assert(_con < t->is_tuple()->cnt(), "ProjNode::_con must be in range");
 128 }
 129 
 130 //------------------------------Value------------------------------------------
 131 const Type *ProjNode::Value( PhaseTransform *phase ) const {
 132   if (in(0) == NULL) return Type::TOP;
 133   return proj_type(phase->type(in(0)));



 134 }
 135 
 136 //------------------------------out_RegMask------------------------------------
 137 // Pass the buck uphill
 138 const RegMask &ProjNode::out_RegMask() const {
 139   return RegMask::Empty;
 140 }
 141 
 142 //------------------------------ideal_reg--------------------------------------
 143 uint ProjNode::ideal_reg() const {
 144   return bottom_type()->ideal_reg();
 145 }
src/share/vm/opto/multnode.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File