Fri, 18 Oct 2013 10:50:17 +0200
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
duke@435 | 1 | /* |
coleenp@4037 | 2 | * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
trims@1907 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | * questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
stefank@2314 | 25 | #include "precompiled.hpp" |
kvn@5110 | 26 | #include "opto/callnode.hpp" |
stefank@2314 | 27 | #include "opto/matcher.hpp" |
rbackman@5791 | 28 | #include "opto/mathexactnode.hpp" |
stefank@2314 | 29 | #include "opto/multnode.hpp" |
stefank@2314 | 30 | #include "opto/opcodes.hpp" |
stefank@2314 | 31 | #include "opto/phaseX.hpp" |
stefank@2314 | 32 | #include "opto/regmask.hpp" |
stefank@2314 | 33 | #include "opto/type.hpp" |
duke@435 | 34 | |
duke@435 | 35 | //============================================================================= |
duke@435 | 36 | //------------------------------MultiNode-------------------------------------- |
duke@435 | 37 | const RegMask &MultiNode::out_RegMask() const { |
duke@435 | 38 | return RegMask::Empty; |
duke@435 | 39 | } |
duke@435 | 40 | |
duke@435 | 41 | Node *MultiNode::match( const ProjNode *proj, const Matcher *m ) { return proj->clone(); } |
duke@435 | 42 | |
duke@435 | 43 | //------------------------------proj_out--------------------------------------- |
duke@435 | 44 | // Get a named projection |
duke@435 | 45 | ProjNode* MultiNode::proj_out(uint which_proj) const { |
duke@435 | 46 | assert(Opcode() != Op_If || which_proj == (uint)true || which_proj == (uint)false, "must be 1 or 0"); |
duke@435 | 47 | assert(Opcode() != Op_If || outcnt() == 2, "bad if #1"); |
duke@435 | 48 | for( DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++ ) { |
duke@435 | 49 | Node *p = fast_out(i); |
rbackman@5791 | 50 | if (p->is_Proj()) { |
rbackman@5791 | 51 | ProjNode *proj = p->as_Proj(); |
rbackman@5791 | 52 | if (proj->_con == which_proj) { |
rbackman@5791 | 53 | assert(Opcode() != Op_If || proj->Opcode() == (which_proj?Op_IfTrue:Op_IfFalse), "bad if #2"); |
rbackman@5791 | 54 | return proj; |
rbackman@5791 | 55 | } |
rbackman@5791 | 56 | } else if (p->is_FlagsProj()) { |
rbackman@5791 | 57 | FlagsProjNode *proj = p->as_FlagsProj(); |
rbackman@5791 | 58 | if (proj->_con == which_proj) { |
rbackman@5791 | 59 | return proj; |
rbackman@5791 | 60 | } |
rbackman@5791 | 61 | } else { |
duke@435 | 62 | assert(p == this && this->is_Start(), "else must be proj"); |
duke@435 | 63 | continue; |
duke@435 | 64 | } |
duke@435 | 65 | } |
duke@435 | 66 | return NULL; |
duke@435 | 67 | } |
duke@435 | 68 | |
duke@435 | 69 | //============================================================================= |
duke@435 | 70 | //------------------------------ProjNode--------------------------------------- |
duke@435 | 71 | uint ProjNode::hash() const { |
duke@435 | 72 | // only one input |
duke@435 | 73 | return (uintptr_t)in(TypeFunc::Control) + (_con << 1) + (_is_io_use ? 1 : 0); |
duke@435 | 74 | } |
duke@435 | 75 | uint ProjNode::cmp( const Node &n ) const { return _con == ((ProjNode&)n)._con && ((ProjNode&)n)._is_io_use == _is_io_use; } |
duke@435 | 76 | uint ProjNode::size_of() const { return sizeof(ProjNode); } |
duke@435 | 77 | |
duke@435 | 78 | // Test if we propagate interesting control along this projection |
duke@435 | 79 | bool ProjNode::is_CFG() const { |
duke@435 | 80 | Node *def = in(0); |
duke@435 | 81 | return (_con == TypeFunc::Control && def->is_CFG()); |
duke@435 | 82 | } |
duke@435 | 83 | |
kvn@5110 | 84 | const Type* ProjNode::proj_type(const Type* t) const { |
kvn@5110 | 85 | if (t == Type::TOP) { |
kvn@5110 | 86 | return Type::TOP; |
kvn@5110 | 87 | } |
kvn@5110 | 88 | if (t == Type::BOTTOM) { |
kvn@5110 | 89 | return Type::BOTTOM; |
kvn@5110 | 90 | } |
kvn@5110 | 91 | t = t->is_tuple()->field_at(_con); |
kvn@5110 | 92 | Node* n = in(0); |
kvn@5110 | 93 | if ((_con == TypeFunc::Parms) && |
kvn@5110 | 94 | n->is_CallStaticJava() && n->as_CallStaticJava()->is_boxing_method()) { |
kvn@5110 | 95 | // The result of autoboxing is always non-null on normal path. |
kvn@5110 | 96 | t = t->join(TypePtr::NOTNULL); |
kvn@5110 | 97 | } |
kvn@5110 | 98 | return t; |
kvn@5110 | 99 | } |
kvn@5110 | 100 | |
duke@435 | 101 | const Type *ProjNode::bottom_type() const { |
kvn@5110 | 102 | if (in(0) == NULL) return Type::TOP; |
kvn@5110 | 103 | return proj_type(in(0)->bottom_type()); |
duke@435 | 104 | } |
duke@435 | 105 | |
duke@435 | 106 | const TypePtr *ProjNode::adr_type() const { |
duke@435 | 107 | if (bottom_type() == Type::MEMORY) { |
duke@435 | 108 | // in(0) might be a narrow MemBar; otherwise we will report TypePtr::BOTTOM |
duke@435 | 109 | const TypePtr* adr_type = in(0)->adr_type(); |
duke@435 | 110 | #ifdef ASSERT |
duke@435 | 111 | if (!is_error_reported() && !Node::in_dump()) |
duke@435 | 112 | assert(adr_type != NULL, "source must have adr_type"); |
duke@435 | 113 | #endif |
duke@435 | 114 | return adr_type; |
duke@435 | 115 | } |
duke@435 | 116 | assert(bottom_type()->base() != Type::Memory, "no other memories?"); |
duke@435 | 117 | return NULL; |
duke@435 | 118 | } |
duke@435 | 119 | |
duke@435 | 120 | bool ProjNode::pinned() const { return in(0)->pinned(); } |
duke@435 | 121 | #ifndef PRODUCT |
duke@435 | 122 | void ProjNode::dump_spec(outputStream *st) const { st->print("#%d",_con); if(_is_io_use) st->print(" (i_o_use)");} |
duke@435 | 123 | #endif |
duke@435 | 124 | |
duke@435 | 125 | //----------------------------check_con---------------------------------------- |
duke@435 | 126 | void ProjNode::check_con() const { |
duke@435 | 127 | Node* n = in(0); |
duke@435 | 128 | if (n == NULL) return; // should be assert, but NodeHash makes bogons |
duke@435 | 129 | if (n->is_Mach()) return; // mach. projs. are not type-safe |
duke@435 | 130 | if (n->is_Start()) return; // alas, starts can have mach. projs. also |
duke@435 | 131 | if (_con == SCMemProjNode::SCMEMPROJCON ) return; |
duke@435 | 132 | const Type* t = n->bottom_type(); |
duke@435 | 133 | if (t == Type::TOP) return; // multi is dead |
duke@435 | 134 | assert(_con < t->is_tuple()->cnt(), "ProjNode::_con must be in range"); |
duke@435 | 135 | } |
duke@435 | 136 | |
duke@435 | 137 | //------------------------------Value------------------------------------------ |
duke@435 | 138 | const Type *ProjNode::Value( PhaseTransform *phase ) const { |
kvn@5110 | 139 | if (in(0) == NULL) return Type::TOP; |
kvn@5110 | 140 | return proj_type(phase->type(in(0))); |
duke@435 | 141 | } |
duke@435 | 142 | |
duke@435 | 143 | //------------------------------out_RegMask------------------------------------ |
duke@435 | 144 | // Pass the buck uphill |
duke@435 | 145 | const RegMask &ProjNode::out_RegMask() const { |
duke@435 | 146 | return RegMask::Empty; |
duke@435 | 147 | } |
duke@435 | 148 | |
duke@435 | 149 | //------------------------------ideal_reg-------------------------------------- |
duke@435 | 150 | uint ProjNode::ideal_reg() const { |
coleenp@4037 | 151 | return bottom_type()->ideal_reg(); |
duke@435 | 152 | } |