Wed, 09 Nov 2011 06:14:32 -0800
7109887: java/util/Arrays/CopyMethods.java fails with -XX:+DeoptimizeALot
Summary: zero array when compiled code is deoptimized.
Reviewed-by: never, twisti
duke@435 | 1 | /* |
stefank@2314 | 2 | * Copyright (c) 1997, 2010, 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" |
stefank@2314 | 26 | #include "memory/allocation.inline.hpp" |
stefank@2314 | 27 | #include "opto/callnode.hpp" |
stefank@2314 | 28 | #include "opto/cfgnode.hpp" |
stefank@2314 | 29 | #include "opto/phaseX.hpp" |
stefank@2314 | 30 | #include "opto/regmask.hpp" |
stefank@2314 | 31 | #include "opto/rootnode.hpp" |
stefank@2314 | 32 | #include "opto/subnode.hpp" |
stefank@2314 | 33 | #include "opto/type.hpp" |
duke@435 | 34 | |
duke@435 | 35 | //------------------------------Ideal------------------------------------------ |
duke@435 | 36 | // Remove dead inputs |
duke@435 | 37 | Node *RootNode::Ideal(PhaseGVN *phase, bool can_reshape) { |
duke@435 | 38 | for( uint i = 1; i < req(); i++ ) { // For all inputs |
duke@435 | 39 | // Check for and remove dead inputs |
duke@435 | 40 | if( phase->type(in(i)) == Type::TOP ) { |
duke@435 | 41 | del_req(i--); // Delete TOP inputs |
duke@435 | 42 | } |
duke@435 | 43 | } |
duke@435 | 44 | |
duke@435 | 45 | // I used to do tail-splitting in the Ideal graph here, but it does not |
duke@435 | 46 | // work. The tail-splitting forces values live into the Return to be |
duke@435 | 47 | // ready at a point which dominates the split returns. This forces Stores |
duke@435 | 48 | // to be hoisted high. The "proper" fix would be to split Stores down |
duke@435 | 49 | // each path, but this makes the split unprofitable. If we want to do this |
duke@435 | 50 | // optimization, it needs to be done after allocation so we can count all |
duke@435 | 51 | // the instructions needing to be cloned in the cost metric. |
duke@435 | 52 | |
duke@435 | 53 | // There used to be a spoof here for caffeine marks which completely |
duke@435 | 54 | // eliminated very simple self-recursion recursions, but it's not worth it. |
duke@435 | 55 | // Deep inlining of self-calls gets nearly all of the same benefits. |
duke@435 | 56 | // If we want to get the rest of the win later, we should pattern match |
duke@435 | 57 | // simple recursive call trees to closed-form solutions. |
duke@435 | 58 | |
duke@435 | 59 | return NULL; // No further opportunities exposed |
duke@435 | 60 | } |
duke@435 | 61 | |
duke@435 | 62 | //============================================================================= |
duke@435 | 63 | HaltNode::HaltNode( Node *ctrl, Node *frameptr ) : Node(TypeFunc::Parms) { |
duke@435 | 64 | Node* top = Compile::current()->top(); |
duke@435 | 65 | init_req(TypeFunc::Control, ctrl ); |
duke@435 | 66 | init_req(TypeFunc::I_O, top); |
duke@435 | 67 | init_req(TypeFunc::Memory, top); |
duke@435 | 68 | init_req(TypeFunc::FramePtr, frameptr ); |
duke@435 | 69 | init_req(TypeFunc::ReturnAdr,top); |
duke@435 | 70 | } |
duke@435 | 71 | |
duke@435 | 72 | const Type *HaltNode::bottom_type() const { return Type::BOTTOM; } |
duke@435 | 73 | |
duke@435 | 74 | //------------------------------Ideal------------------------------------------ |
duke@435 | 75 | Node *HaltNode::Ideal(PhaseGVN *phase, bool can_reshape) { |
duke@435 | 76 | return remove_dead_region(phase, can_reshape) ? this : NULL; |
duke@435 | 77 | } |
duke@435 | 78 | |
duke@435 | 79 | //------------------------------Value------------------------------------------ |
duke@435 | 80 | const Type *HaltNode::Value( PhaseTransform *phase ) const { |
duke@435 | 81 | return ( phase->type(in(TypeFunc::Control)) == Type::TOP) |
duke@435 | 82 | ? Type::TOP |
duke@435 | 83 | : Type::BOTTOM; |
duke@435 | 84 | } |
duke@435 | 85 | |
duke@435 | 86 | const RegMask &HaltNode::out_RegMask() const { |
duke@435 | 87 | return RegMask::Empty; |
duke@435 | 88 | } |