author | adlertz |
Fri, 16 Aug 2013 10:23:55 +0200 | |
changeset 19330 | 49d6711171e6 |
parent 17013 | 22a05c7f3314 |
child 20007 | b67e71448544 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
7397 | 2 |
* Copyright (c) 1997, 2010, 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_LIVE_HPP |
26 |
#define SHARE_VM_OPTO_LIVE_HPP |
|
27 |
||
28 |
#include "libadt/port.hpp" |
|
29 |
#include "libadt/vectset.hpp" |
|
30 |
#include "opto/block.hpp" |
|
31 |
#include "opto/indexSet.hpp" |
|
32 |
#include "opto/phase.hpp" |
|
33 |
#include "opto/regmask.hpp" |
|
34 |
||
1 | 35 |
class Block; |
36 |
class PhaseCFG; |
|
37 |
class VectorSet; |
|
38 |
class IndexSet; |
|
39 |
||
15944
095248beb690
8009721: Make PhaseLive independent from regalloc
neliasso
parents:
7397
diff
changeset
|
40 |
//------------------------------LRG_List--------------------------------------- |
095248beb690
8009721: Make PhaseLive independent from regalloc
neliasso
parents:
7397
diff
changeset
|
41 |
// Map Node indices to Live RanGe indices. |
095248beb690
8009721: Make PhaseLive independent from regalloc
neliasso
parents:
7397
diff
changeset
|
42 |
// Array lookup in the optimized case. |
095248beb690
8009721: Make PhaseLive independent from regalloc
neliasso
parents:
7397
diff
changeset
|
43 |
class LRG_List : public ResourceObj { |
095248beb690
8009721: Make PhaseLive independent from regalloc
neliasso
parents:
7397
diff
changeset
|
44 |
friend class VMStructs; |
095248beb690
8009721: Make PhaseLive independent from regalloc
neliasso
parents:
7397
diff
changeset
|
45 |
uint _cnt, _max; |
095248beb690
8009721: Make PhaseLive independent from regalloc
neliasso
parents:
7397
diff
changeset
|
46 |
uint* _lidxs; |
095248beb690
8009721: Make PhaseLive independent from regalloc
neliasso
parents:
7397
diff
changeset
|
47 |
ReallocMark _nesting; // assertion check for reallocations |
095248beb690
8009721: Make PhaseLive independent from regalloc
neliasso
parents:
7397
diff
changeset
|
48 |
public: |
095248beb690
8009721: Make PhaseLive independent from regalloc
neliasso
parents:
7397
diff
changeset
|
49 |
LRG_List( uint max ); |
095248beb690
8009721: Make PhaseLive independent from regalloc
neliasso
parents:
7397
diff
changeset
|
50 |
|
095248beb690
8009721: Make PhaseLive independent from regalloc
neliasso
parents:
7397
diff
changeset
|
51 |
uint lookup( uint nidx ) const { |
095248beb690
8009721: Make PhaseLive independent from regalloc
neliasso
parents:
7397
diff
changeset
|
52 |
return _lidxs[nidx]; |
095248beb690
8009721: Make PhaseLive independent from regalloc
neliasso
parents:
7397
diff
changeset
|
53 |
} |
095248beb690
8009721: Make PhaseLive independent from regalloc
neliasso
parents:
7397
diff
changeset
|
54 |
uint operator[] (uint nidx) const { return lookup(nidx); } |
095248beb690
8009721: Make PhaseLive independent from regalloc
neliasso
parents:
7397
diff
changeset
|
55 |
|
095248beb690
8009721: Make PhaseLive independent from regalloc
neliasso
parents:
7397
diff
changeset
|
56 |
void map( uint nidx, uint lidx ) { |
095248beb690
8009721: Make PhaseLive independent from regalloc
neliasso
parents:
7397
diff
changeset
|
57 |
assert( nidx < _cnt, "oob" ); |
095248beb690
8009721: Make PhaseLive independent from regalloc
neliasso
parents:
7397
diff
changeset
|
58 |
_lidxs[nidx] = lidx; |
095248beb690
8009721: Make PhaseLive independent from regalloc
neliasso
parents:
7397
diff
changeset
|
59 |
} |
095248beb690
8009721: Make PhaseLive independent from regalloc
neliasso
parents:
7397
diff
changeset
|
60 |
void extend( uint nidx, uint lidx ); |
095248beb690
8009721: Make PhaseLive independent from regalloc
neliasso
parents:
7397
diff
changeset
|
61 |
|
095248beb690
8009721: Make PhaseLive independent from regalloc
neliasso
parents:
7397
diff
changeset
|
62 |
uint Size() const { return _cnt; } |
095248beb690
8009721: Make PhaseLive independent from regalloc
neliasso
parents:
7397
diff
changeset
|
63 |
}; |
095248beb690
8009721: Make PhaseLive independent from regalloc
neliasso
parents:
7397
diff
changeset
|
64 |
|
1 | 65 |
//------------------------------PhaseLive-------------------------------------- |
66 |
// Compute live-in/live-out |
|
67 |
class PhaseLive : public Phase { |
|
68 |
// Array of Sets of values live at the start of a block. |
|
69 |
// Indexed by block pre-order number. |
|
70 |
IndexSet *_live; |
|
71 |
||
72 |
// Array of Sets of values defined locally in the block |
|
73 |
// Indexed by block pre-order number. |
|
74 |
IndexSet *_defs; |
|
75 |
||
76 |
// Array of delta-set pointers, indexed by block pre-order number |
|
77 |
IndexSet **_deltas; |
|
78 |
IndexSet *_free_IndexSet; // Free list of same |
|
79 |
||
80 |
Block_List *_worklist; // Worklist for iterative solution |
|
81 |
||
82 |
const PhaseCFG &_cfg; // Basic blocks |
|
17013 | 83 |
const LRG_List &_names; // Mapping from Nodes to live ranges |
1 | 84 |
uint _maxlrg; // Largest live-range number |
85 |
Arena *_arena; |
|
86 |
||
87 |
IndexSet *getset( Block *p ); |
|
88 |
IndexSet *getfreeset( ); |
|
89 |
void freeset( const Block *p ); |
|
90 |
void add_liveout( Block *p, uint r, VectorSet &first_pass ); |
|
91 |
void add_liveout( Block *p, IndexSet *lo, VectorSet &first_pass ); |
|
92 |
||
93 |
public: |
|
17013 | 94 |
PhaseLive(const PhaseCFG &cfg, const LRG_List &names, Arena *arena); |
1 | 95 |
~PhaseLive() {} |
96 |
// Compute liveness info |
|
97 |
void compute(uint maxlrg); |
|
98 |
// Reset arena storage |
|
99 |
void reset() { _live = NULL; } |
|
100 |
||
101 |
// Return the live-out set for this block |
|
102 |
IndexSet *live( const Block * b ) { return &_live[b->_pre_order-1]; } |
|
103 |
||
104 |
#ifndef PRODUCT |
|
105 |
void dump( const Block *b ) const; |
|
106 |
void stats(uint iters) const; |
|
107 |
#endif |
|
108 |
}; |
|
7397 | 109 |
|
110 |
#endif // SHARE_VM_OPTO_LIVE_HPP |