src/share/vm/opto/rootnode.cpp

Mon, 28 Jul 2008 17:12:52 -0700

author
kvn
date
Mon, 28 Jul 2008 17:12:52 -0700
changeset 688
b0fe4deeb9fb
parent 435
a61af66fc99e
child 1907
c18cbe5936b8
permissions
-rw-r--r--

6726999: nsk/stress/jck12a/jck12a010 assert(n != null,"Bad immediate dominator info.")
Summary: Escape Analysis fixes.
Reviewed-by: never, rasbold

duke@435 1 /*
duke@435 2 * Copyright 1997-2005 Sun Microsystems, Inc. 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 *
duke@435 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@435 20 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@435 21 * have any questions.
duke@435 22 *
duke@435 23 */
duke@435 24
duke@435 25 #include "incls/_precompiled.incl"
duke@435 26 #include "incls/_rootnode.cpp.incl"
duke@435 27
duke@435 28 //------------------------------Ideal------------------------------------------
duke@435 29 // Remove dead inputs
duke@435 30 Node *RootNode::Ideal(PhaseGVN *phase, bool can_reshape) {
duke@435 31 for( uint i = 1; i < req(); i++ ) { // For all inputs
duke@435 32 // Check for and remove dead inputs
duke@435 33 if( phase->type(in(i)) == Type::TOP ) {
duke@435 34 del_req(i--); // Delete TOP inputs
duke@435 35 }
duke@435 36 }
duke@435 37
duke@435 38 // I used to do tail-splitting in the Ideal graph here, but it does not
duke@435 39 // work. The tail-splitting forces values live into the Return to be
duke@435 40 // ready at a point which dominates the split returns. This forces Stores
duke@435 41 // to be hoisted high. The "proper" fix would be to split Stores down
duke@435 42 // each path, but this makes the split unprofitable. If we want to do this
duke@435 43 // optimization, it needs to be done after allocation so we can count all
duke@435 44 // the instructions needing to be cloned in the cost metric.
duke@435 45
duke@435 46 // There used to be a spoof here for caffeine marks which completely
duke@435 47 // eliminated very simple self-recursion recursions, but it's not worth it.
duke@435 48 // Deep inlining of self-calls gets nearly all of the same benefits.
duke@435 49 // If we want to get the rest of the win later, we should pattern match
duke@435 50 // simple recursive call trees to closed-form solutions.
duke@435 51
duke@435 52 return NULL; // No further opportunities exposed
duke@435 53 }
duke@435 54
duke@435 55 //=============================================================================
duke@435 56 HaltNode::HaltNode( Node *ctrl, Node *frameptr ) : Node(TypeFunc::Parms) {
duke@435 57 Node* top = Compile::current()->top();
duke@435 58 init_req(TypeFunc::Control, ctrl );
duke@435 59 init_req(TypeFunc::I_O, top);
duke@435 60 init_req(TypeFunc::Memory, top);
duke@435 61 init_req(TypeFunc::FramePtr, frameptr );
duke@435 62 init_req(TypeFunc::ReturnAdr,top);
duke@435 63 }
duke@435 64
duke@435 65 const Type *HaltNode::bottom_type() const { return Type::BOTTOM; }
duke@435 66
duke@435 67 //------------------------------Ideal------------------------------------------
duke@435 68 Node *HaltNode::Ideal(PhaseGVN *phase, bool can_reshape) {
duke@435 69 return remove_dead_region(phase, can_reshape) ? this : NULL;
duke@435 70 }
duke@435 71
duke@435 72 //------------------------------Value------------------------------------------
duke@435 73 const Type *HaltNode::Value( PhaseTransform *phase ) const {
duke@435 74 return ( phase->type(in(TypeFunc::Control)) == Type::TOP)
duke@435 75 ? Type::TOP
duke@435 76 : Type::BOTTOM;
duke@435 77 }
duke@435 78
duke@435 79 const RegMask &HaltNode::out_RegMask() const {
duke@435 80 return RegMask::Empty;
duke@435 81 }

mercurial