Mercurial > hg > truffle
annotate src/share/vm/opto/coalesce.hpp @ 9691:bd5c6b3dedc5
implement inlining support for JSR 292
author | twisti |
---|---|
date | Tue, 14 May 2013 11:27:09 -0700 |
parents | f95d63e2154a |
children | 8373c19be854 |
rev | line source |
---|---|
0 | 1 /* |
1972 | 2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_OPTO_COALESCE_HPP |
26 #define SHARE_VM_OPTO_COALESCE_HPP | |
27 | |
28 #include "opto/phase.hpp" | |
29 | |
0 | 30 class LoopTree; |
31 class LRG; | |
32 class LRG_List; | |
33 class Matcher; | |
34 class PhaseIFG; | |
35 class PhaseCFG; | |
36 | |
37 //------------------------------PhaseCoalesce---------------------------------- | |
38 class PhaseCoalesce : public Phase { | |
39 protected: | |
40 PhaseChaitin &_phc; | |
41 | |
42 public: | |
43 // Coalesce copies | |
44 PhaseCoalesce( PhaseChaitin &chaitin ) : Phase(Coalesce), _phc(chaitin) { } | |
45 | |
46 virtual void verify() = 0; | |
47 | |
48 // Coalesce copies | |
49 void coalesce_driver( ); | |
50 | |
51 // Coalesce copies in this block | |
52 virtual void coalesce( Block *b ) = 0; | |
53 | |
54 // Attempt to coalesce live ranges defined by these 2 | |
55 void combine_these_two( Node *n1, Node *n2 ); | |
56 | |
57 LRG &lrgs( uint lidx ) { return _phc.lrgs(lidx); } | |
58 #ifndef PRODUCT | |
59 // Dump internally name | |
60 void dump( Node *n ) const; | |
61 // Dump whole shebang | |
62 void dump() const; | |
63 #endif | |
64 }; | |
65 | |
66 //------------------------------PhaseAggressiveCoalesce------------------------ | |
67 // Aggressively, pessimistic coalesce copies. Aggressive means ignore graph | |
68 // colorability; perhaps coalescing to the point of forcing a spill. | |
69 // Pessimistic means we cannot coalesce if 2 live ranges interfere. This | |
70 // implies we do not hit a fixed point right away. | |
71 class PhaseAggressiveCoalesce : public PhaseCoalesce { | |
72 uint _unique; | |
73 public: | |
74 // Coalesce copies | |
75 PhaseAggressiveCoalesce( PhaseChaitin &chaitin ) : PhaseCoalesce(chaitin) {} | |
76 | |
77 virtual void verify() { }; | |
78 | |
79 // Aggressively coalesce copies in this block | |
80 virtual void coalesce( Block *b ); | |
81 | |
82 // Where I fail to coalesce, manifest virtual copies as the Real Thing | |
83 void insert_copies( Matcher &matcher ); | |
84 | |
85 // Copy insertion needs some smarts in case live ranges overlap | |
86 void insert_copy_with_overlap( Block *b, Node *copy, uint dst_name, uint src_name ); | |
87 }; | |
88 | |
89 | |
90 //------------------------------PhaseConservativeCoalesce---------------------- | |
91 // Conservatively, pessimistic coalesce copies. Conservative means do not | |
92 // coalesce if the resultant live range will be uncolorable. Pessimistic | |
93 // means we cannot coalesce if 2 live ranges interfere. This implies we do | |
94 // not hit a fixed point right away. | |
95 class PhaseConservativeCoalesce : public PhaseCoalesce { | |
96 IndexSet _ulr; // Union live range interferences | |
97 public: | |
98 // Coalesce copies | |
99 PhaseConservativeCoalesce( PhaseChaitin &chaitin ); | |
100 | |
101 virtual void verify(); | |
102 | |
103 // Conservatively coalesce copies in this block | |
104 virtual void coalesce( Block *b ); | |
105 | |
106 // Coalesce this chain of copies away | |
107 bool copy_copy( Node *dst_copy, Node *src_copy, Block *b, uint bindex ); | |
108 | |
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 ); | |
110 | |
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); | |
112 | |
113 void update_ifg(uint lr1, uint lr2, IndexSet *n_lr1, IndexSet *n_lr2); | |
114 }; | |
1972 | 115 |
116 #endif // SHARE_VM_OPTO_COALESCE_HPP |