annotate src/share/vm/opto/live.hpp @ 10111:8373c19be854

8011621: live_ranges_in_separate_class.patch Reviewed-by: kvn, roland Contributed-by: niclas.adlertz@oracle.com
author neliasso
date Tue, 16 Apr 2013 10:08:41 +0200
parents 056ab43544a4
children 8c83625e3a53
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
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
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #ifndef SHARE_VM_OPTO_LIVE_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define SHARE_VM_OPTO_LIVE_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #include "libadt/port.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "libadt/vectset.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30 #include "opto/block.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
31 #include "opto/indexSet.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
32 #include "opto/phase.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
33 #include "opto/regmask.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
34
0
a61af66fc99e Initial load
duke
parents:
diff changeset
35 class Block;
a61af66fc99e Initial load
duke
parents:
diff changeset
36 class PhaseCFG;
a61af66fc99e Initial load
duke
parents:
diff changeset
37 class VectorSet;
a61af66fc99e Initial load
duke
parents:
diff changeset
38 class IndexSet;
a61af66fc99e Initial load
duke
parents:
diff changeset
39
8728
056ab43544a4 8009721: Make PhaseLive independent from regalloc
neliasso
parents: 1972
diff changeset
40 //------------------------------LRG_List---------------------------------------
056ab43544a4 8009721: Make PhaseLive independent from regalloc
neliasso
parents: 1972
diff changeset
41 // Map Node indices to Live RanGe indices.
056ab43544a4 8009721: Make PhaseLive independent from regalloc
neliasso
parents: 1972
diff changeset
42 // Array lookup in the optimized case.
056ab43544a4 8009721: Make PhaseLive independent from regalloc
neliasso
parents: 1972
diff changeset
43 class LRG_List : public ResourceObj {
056ab43544a4 8009721: Make PhaseLive independent from regalloc
neliasso
parents: 1972
diff changeset
44 friend class VMStructs;
056ab43544a4 8009721: Make PhaseLive independent from regalloc
neliasso
parents: 1972
diff changeset
45 uint _cnt, _max;
056ab43544a4 8009721: Make PhaseLive independent from regalloc
neliasso
parents: 1972
diff changeset
46 uint* _lidxs;
056ab43544a4 8009721: Make PhaseLive independent from regalloc
neliasso
parents: 1972
diff changeset
47 ReallocMark _nesting; // assertion check for reallocations
056ab43544a4 8009721: Make PhaseLive independent from regalloc
neliasso
parents: 1972
diff changeset
48 public:
056ab43544a4 8009721: Make PhaseLive independent from regalloc
neliasso
parents: 1972
diff changeset
49 LRG_List( uint max );
056ab43544a4 8009721: Make PhaseLive independent from regalloc
neliasso
parents: 1972
diff changeset
50
056ab43544a4 8009721: Make PhaseLive independent from regalloc
neliasso
parents: 1972
diff changeset
51 uint lookup( uint nidx ) const {
056ab43544a4 8009721: Make PhaseLive independent from regalloc
neliasso
parents: 1972
diff changeset
52 return _lidxs[nidx];
056ab43544a4 8009721: Make PhaseLive independent from regalloc
neliasso
parents: 1972
diff changeset
53 }
056ab43544a4 8009721: Make PhaseLive independent from regalloc
neliasso
parents: 1972
diff changeset
54 uint operator[] (uint nidx) const { return lookup(nidx); }
056ab43544a4 8009721: Make PhaseLive independent from regalloc
neliasso
parents: 1972
diff changeset
55
056ab43544a4 8009721: Make PhaseLive independent from regalloc
neliasso
parents: 1972
diff changeset
56 void map( uint nidx, uint lidx ) {
056ab43544a4 8009721: Make PhaseLive independent from regalloc
neliasso
parents: 1972
diff changeset
57 assert( nidx < _cnt, "oob" );
056ab43544a4 8009721: Make PhaseLive independent from regalloc
neliasso
parents: 1972
diff changeset
58 _lidxs[nidx] = lidx;
056ab43544a4 8009721: Make PhaseLive independent from regalloc
neliasso
parents: 1972
diff changeset
59 }
056ab43544a4 8009721: Make PhaseLive independent from regalloc
neliasso
parents: 1972
diff changeset
60 void extend( uint nidx, uint lidx );
056ab43544a4 8009721: Make PhaseLive independent from regalloc
neliasso
parents: 1972
diff changeset
61
056ab43544a4 8009721: Make PhaseLive independent from regalloc
neliasso
parents: 1972
diff changeset
62 uint Size() const { return _cnt; }
056ab43544a4 8009721: Make PhaseLive independent from regalloc
neliasso
parents: 1972
diff changeset
63 };
056ab43544a4 8009721: Make PhaseLive independent from regalloc
neliasso
parents: 1972
diff changeset
64
0
a61af66fc99e Initial load
duke
parents:
diff changeset
65 //------------------------------PhaseLive--------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
66 // Compute live-in/live-out
a61af66fc99e Initial load
duke
parents:
diff changeset
67 class PhaseLive : public Phase {
a61af66fc99e Initial load
duke
parents:
diff changeset
68 // Array of Sets of values live at the start of a block.
a61af66fc99e Initial load
duke
parents:
diff changeset
69 // Indexed by block pre-order number.
a61af66fc99e Initial load
duke
parents:
diff changeset
70 IndexSet *_live;
a61af66fc99e Initial load
duke
parents:
diff changeset
71
a61af66fc99e Initial load
duke
parents:
diff changeset
72 // Array of Sets of values defined locally in the block
a61af66fc99e Initial load
duke
parents:
diff changeset
73 // Indexed by block pre-order number.
a61af66fc99e Initial load
duke
parents:
diff changeset
74 IndexSet *_defs;
a61af66fc99e Initial load
duke
parents:
diff changeset
75
a61af66fc99e Initial load
duke
parents:
diff changeset
76 // Array of delta-set pointers, indexed by block pre-order number
a61af66fc99e Initial load
duke
parents:
diff changeset
77 IndexSet **_deltas;
a61af66fc99e Initial load
duke
parents:
diff changeset
78 IndexSet *_free_IndexSet; // Free list of same
a61af66fc99e Initial load
duke
parents:
diff changeset
79
a61af66fc99e Initial load
duke
parents:
diff changeset
80 Block_List *_worklist; // Worklist for iterative solution
a61af66fc99e Initial load
duke
parents:
diff changeset
81
a61af66fc99e Initial load
duke
parents:
diff changeset
82 const PhaseCFG &_cfg; // Basic blocks
10111
8373c19be854 8011621: live_ranges_in_separate_class.patch
neliasso
parents: 8728
diff changeset
83 const LRG_List &_names; // Mapping from Nodes to live ranges
0
a61af66fc99e Initial load
duke
parents:
diff changeset
84 uint _maxlrg; // Largest live-range number
a61af66fc99e Initial load
duke
parents:
diff changeset
85 Arena *_arena;
a61af66fc99e Initial load
duke
parents:
diff changeset
86
a61af66fc99e Initial load
duke
parents:
diff changeset
87 IndexSet *getset( Block *p );
a61af66fc99e Initial load
duke
parents:
diff changeset
88 IndexSet *getfreeset( );
a61af66fc99e Initial load
duke
parents:
diff changeset
89 void freeset( const Block *p );
a61af66fc99e Initial load
duke
parents:
diff changeset
90 void add_liveout( Block *p, uint r, VectorSet &first_pass );
a61af66fc99e Initial load
duke
parents:
diff changeset
91 void add_liveout( Block *p, IndexSet *lo, VectorSet &first_pass );
a61af66fc99e Initial load
duke
parents:
diff changeset
92
a61af66fc99e Initial load
duke
parents:
diff changeset
93 public:
10111
8373c19be854 8011621: live_ranges_in_separate_class.patch
neliasso
parents: 8728
diff changeset
94 PhaseLive(const PhaseCFG &cfg, const LRG_List &names, Arena *arena);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
95 ~PhaseLive() {}
a61af66fc99e Initial load
duke
parents:
diff changeset
96 // Compute liveness info
a61af66fc99e Initial load
duke
parents:
diff changeset
97 void compute(uint maxlrg);
a61af66fc99e Initial load
duke
parents:
diff changeset
98 // Reset arena storage
a61af66fc99e Initial load
duke
parents:
diff changeset
99 void reset() { _live = NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
100
a61af66fc99e Initial load
duke
parents:
diff changeset
101 // Return the live-out set for this block
a61af66fc99e Initial load
duke
parents:
diff changeset
102 IndexSet *live( const Block * b ) { return &_live[b->_pre_order-1]; }
a61af66fc99e Initial load
duke
parents:
diff changeset
103
a61af66fc99e Initial load
duke
parents:
diff changeset
104 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
105 void dump( const Block *b ) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
106 void stats(uint iters) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
107 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
108 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
109
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
110 #endif // SHARE_VM_OPTO_LIVE_HPP