Mon, 26 Sep 2011 10:24:05 -0700
7081933: Use zeroing elimination optimization for large array
Summary: Don't zero new typeArray during runtime call if the allocation is followed by arraycopy into it.
Reviewed-by: 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 | #ifndef SHARE_VM_OPTO_COALESCE_HPP |
stefank@2314 | 26 | #define SHARE_VM_OPTO_COALESCE_HPP |
stefank@2314 | 27 | |
stefank@2314 | 28 | #include "opto/phase.hpp" |
stefank@2314 | 29 | |
duke@435 | 30 | class LoopTree; |
duke@435 | 31 | class LRG; |
duke@435 | 32 | class LRG_List; |
duke@435 | 33 | class Matcher; |
duke@435 | 34 | class PhaseIFG; |
duke@435 | 35 | class PhaseCFG; |
duke@435 | 36 | |
duke@435 | 37 | //------------------------------PhaseCoalesce---------------------------------- |
duke@435 | 38 | class PhaseCoalesce : public Phase { |
duke@435 | 39 | protected: |
duke@435 | 40 | PhaseChaitin &_phc; |
duke@435 | 41 | |
duke@435 | 42 | public: |
duke@435 | 43 | // Coalesce copies |
duke@435 | 44 | PhaseCoalesce( PhaseChaitin &chaitin ) : Phase(Coalesce), _phc(chaitin) { } |
duke@435 | 45 | |
duke@435 | 46 | virtual void verify() = 0; |
duke@435 | 47 | |
duke@435 | 48 | // Coalesce copies |
duke@435 | 49 | void coalesce_driver( ); |
duke@435 | 50 | |
duke@435 | 51 | // Coalesce copies in this block |
duke@435 | 52 | virtual void coalesce( Block *b ) = 0; |
duke@435 | 53 | |
duke@435 | 54 | // Attempt to coalesce live ranges defined by these 2 |
duke@435 | 55 | void combine_these_two( Node *n1, Node *n2 ); |
duke@435 | 56 | |
duke@435 | 57 | LRG &lrgs( uint lidx ) { return _phc.lrgs(lidx); } |
duke@435 | 58 | #ifndef PRODUCT |
duke@435 | 59 | // Dump internally name |
duke@435 | 60 | void dump( Node *n ) const; |
duke@435 | 61 | // Dump whole shebang |
duke@435 | 62 | void dump() const; |
duke@435 | 63 | #endif |
duke@435 | 64 | }; |
duke@435 | 65 | |
duke@435 | 66 | //------------------------------PhaseAggressiveCoalesce------------------------ |
duke@435 | 67 | // Aggressively, pessimistic coalesce copies. Aggressive means ignore graph |
duke@435 | 68 | // colorability; perhaps coalescing to the point of forcing a spill. |
duke@435 | 69 | // Pessimistic means we cannot coalesce if 2 live ranges interfere. This |
duke@435 | 70 | // implies we do not hit a fixed point right away. |
duke@435 | 71 | class PhaseAggressiveCoalesce : public PhaseCoalesce { |
duke@435 | 72 | uint _unique; |
duke@435 | 73 | public: |
duke@435 | 74 | // Coalesce copies |
duke@435 | 75 | PhaseAggressiveCoalesce( PhaseChaitin &chaitin ) : PhaseCoalesce(chaitin) {} |
duke@435 | 76 | |
duke@435 | 77 | virtual void verify() { }; |
duke@435 | 78 | |
duke@435 | 79 | // Aggressively coalesce copies in this block |
duke@435 | 80 | virtual void coalesce( Block *b ); |
duke@435 | 81 | |
duke@435 | 82 | // Where I fail to coalesce, manifest virtual copies as the Real Thing |
duke@435 | 83 | void insert_copies( Matcher &matcher ); |
duke@435 | 84 | |
duke@435 | 85 | // Copy insertion needs some smarts in case live ranges overlap |
duke@435 | 86 | void insert_copy_with_overlap( Block *b, Node *copy, uint dst_name, uint src_name ); |
duke@435 | 87 | }; |
duke@435 | 88 | |
duke@435 | 89 | |
duke@435 | 90 | //------------------------------PhaseConservativeCoalesce---------------------- |
duke@435 | 91 | // Conservatively, pessimistic coalesce copies. Conservative means do not |
duke@435 | 92 | // coalesce if the resultant live range will be uncolorable. Pessimistic |
duke@435 | 93 | // means we cannot coalesce if 2 live ranges interfere. This implies we do |
duke@435 | 94 | // not hit a fixed point right away. |
duke@435 | 95 | class PhaseConservativeCoalesce : public PhaseCoalesce { |
duke@435 | 96 | IndexSet _ulr; // Union live range interferences |
duke@435 | 97 | public: |
duke@435 | 98 | // Coalesce copies |
duke@435 | 99 | PhaseConservativeCoalesce( PhaseChaitin &chaitin ); |
duke@435 | 100 | |
duke@435 | 101 | virtual void verify(); |
duke@435 | 102 | |
duke@435 | 103 | // Conservatively coalesce copies in this block |
duke@435 | 104 | virtual void coalesce( Block *b ); |
duke@435 | 105 | |
duke@435 | 106 | // Coalesce this chain of copies away |
duke@435 | 107 | bool copy_copy( Node *dst_copy, Node *src_copy, Block *b, uint bindex ); |
duke@435 | 108 | |
duke@435 | 109 | void union_helper( Node *lr1_node, Node *lr2_node, uint lr1, uint lr2, Node *src_def, Node *dst_copy, Node *src_copy, Block *b, uint bindex ); |
duke@435 | 110 | |
duke@435 | 111 | uint compute_separating_interferences(Node *dst_copy, Node *src_copy, Block *b, uint bindex, RegMask &rm, uint rm_size, uint reg_degree, uint lr1, uint lr2); |
duke@435 | 112 | |
duke@435 | 113 | void update_ifg(uint lr1, uint lr2, IndexSet *n_lr1, IndexSet *n_lr2); |
duke@435 | 114 | }; |
stefank@2314 | 115 | |
stefank@2314 | 116 | #endif // SHARE_VM_OPTO_COALESCE_HPP |