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