src/share/vm/opto/multnode.cpp

Fri, 18 Oct 2013 10:50:17 +0200

author
adlertz
date
Fri, 18 Oct 2013 10:50:17 +0200
changeset 5978
1856ea98184a
parent 5791
c9ccd7b85f20
child 5981
3213ba4d3dff
permissions
-rw-r--r--

8022783: Nashorn test fails with: assert(!def_outside->member(r))
Summary: Enables private copies of inputs for recent spill copies as well
Reviewed-by: kvn, twisti

     1 /*
     2  * Copyright (c) 1997, 2012, 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  *
    23  */
    25 #include "precompiled.hpp"
    26 #include "opto/callnode.hpp"
    27 #include "opto/matcher.hpp"
    28 #include "opto/mathexactnode.hpp"
    29 #include "opto/multnode.hpp"
    30 #include "opto/opcodes.hpp"
    31 #include "opto/phaseX.hpp"
    32 #include "opto/regmask.hpp"
    33 #include "opto/type.hpp"
    35 //=============================================================================
    36 //------------------------------MultiNode--------------------------------------
    37 const RegMask &MultiNode::out_RegMask() const {
    38   return RegMask::Empty;
    39 }
    41 Node *MultiNode::match( const ProjNode *proj, const Matcher *m ) { return proj->clone(); }
    43 //------------------------------proj_out---------------------------------------
    44 // Get a named projection
    45 ProjNode* MultiNode::proj_out(uint which_proj) const {
    46   assert(Opcode() != Op_If || which_proj == (uint)true || which_proj == (uint)false, "must be 1 or 0");
    47   assert(Opcode() != Op_If || outcnt() == 2, "bad if #1");
    48   for( DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++ ) {
    49     Node *p = fast_out(i);
    50     if (p->is_Proj()) {
    51       ProjNode *proj = p->as_Proj();
    52       if (proj->_con == which_proj) {
    53         assert(Opcode() != Op_If || proj->Opcode() == (which_proj?Op_IfTrue:Op_IfFalse), "bad if #2");
    54         return proj;
    55       }
    56     } else if (p->is_FlagsProj()) {
    57       FlagsProjNode *proj = p->as_FlagsProj();
    58       if (proj->_con == which_proj) {
    59         return proj;
    60       }
    61     } else {
    62       assert(p == this && this->is_Start(), "else must be proj");
    63       continue;
    64     }
    65   }
    66   return NULL;
    67 }
    69 //=============================================================================
    70 //------------------------------ProjNode---------------------------------------
    71 uint ProjNode::hash() const {
    72   // only one input
    73   return (uintptr_t)in(TypeFunc::Control) + (_con << 1) + (_is_io_use ? 1 : 0);
    74 }
    75 uint ProjNode::cmp( const Node &n ) const { return _con == ((ProjNode&)n)._con && ((ProjNode&)n)._is_io_use == _is_io_use; }
    76 uint ProjNode::size_of() const { return sizeof(ProjNode); }
    78 // Test if we propagate interesting control along this projection
    79 bool ProjNode::is_CFG() const {
    80   Node *def = in(0);
    81   return (_con == TypeFunc::Control && def->is_CFG());
    82 }
    84 const Type* ProjNode::proj_type(const Type* t) const {
    85   if (t == Type::TOP) {
    86     return Type::TOP;
    87   }
    88   if (t == Type::BOTTOM) {
    89     return Type::BOTTOM;
    90   }
    91   t = t->is_tuple()->field_at(_con);
    92   Node* n = in(0);
    93   if ((_con == TypeFunc::Parms) &&
    94       n->is_CallStaticJava() && n->as_CallStaticJava()->is_boxing_method()) {
    95     // The result of autoboxing is always non-null on normal path.
    96     t = t->join(TypePtr::NOTNULL);
    97   }
    98   return t;
    99 }
   101 const Type *ProjNode::bottom_type() const {
   102   if (in(0) == NULL) return Type::TOP;
   103   return proj_type(in(0)->bottom_type());
   104 }
   106 const TypePtr *ProjNode::adr_type() const {
   107   if (bottom_type() == Type::MEMORY) {
   108     // in(0) might be a narrow MemBar; otherwise we will report TypePtr::BOTTOM
   109     const TypePtr* adr_type = in(0)->adr_type();
   110     #ifdef ASSERT
   111     if (!is_error_reported() && !Node::in_dump())
   112       assert(adr_type != NULL, "source must have adr_type");
   113     #endif
   114     return adr_type;
   115   }
   116   assert(bottom_type()->base() != Type::Memory, "no other memories?");
   117   return NULL;
   118 }
   120 bool ProjNode::pinned() const { return in(0)->pinned(); }
   121 #ifndef PRODUCT
   122 void ProjNode::dump_spec(outputStream *st) const { st->print("#%d",_con); if(_is_io_use) st->print(" (i_o_use)");}
   123 #endif
   125 //----------------------------check_con----------------------------------------
   126 void ProjNode::check_con() const {
   127   Node* n = in(0);
   128   if (n == NULL)       return;  // should be assert, but NodeHash makes bogons
   129   if (n->is_Mach())    return;  // mach. projs. are not type-safe
   130   if (n->is_Start())   return;  // alas, starts can have mach. projs. also
   131   if (_con == SCMemProjNode::SCMEMPROJCON ) return;
   132   const Type* t = n->bottom_type();
   133   if (t == Type::TOP)  return;  // multi is dead
   134   assert(_con < t->is_tuple()->cnt(), "ProjNode::_con must be in range");
   135 }
   137 //------------------------------Value------------------------------------------
   138 const Type *ProjNode::Value( PhaseTransform *phase ) const {
   139   if (in(0) == NULL) return Type::TOP;
   140   return proj_type(phase->type(in(0)));
   141 }
   143 //------------------------------out_RegMask------------------------------------
   144 // Pass the buck uphill
   145 const RegMask &ProjNode::out_RegMask() const {
   146   return RegMask::Empty;
   147 }
   149 //------------------------------ideal_reg--------------------------------------
   150 uint ProjNode::ideal_reg() const {
   151   return bottom_type()->ideal_reg();
   152 }

mercurial