author | iveresov |
Mon, 11 May 2009 16:30:56 -0700 | |
changeset 2881 | 74a1337e4acc |
parent 2105 | 347008ce7984 |
child 2882 | d508a8bac491 |
permissions | -rw-r--r-- |
1374 | 1 |
/* |
2105 | 2 |
* Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved. |
1374 | 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 |
* |
|
19 |
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
20 |
* CA 95054 USA or visit www.sun.com if you need additional information or |
|
21 |
* have any questions. |
|
22 |
* |
|
23 |
*/ |
|
24 |
||
25 |
// Forward decl |
|
26 |
class ConcurrentG1RefineThread; |
|
27 |
class G1RemSet; |
|
28 |
||
2013
49e915da0905
6700941: G1: allocation spec missing for some G1 classes
apetrusenko
parents:
1374
diff
changeset
|
29 |
class ConcurrentG1Refine: public CHeapObj { |
2881 | 30 |
ConcurrentG1RefineThread** _threads; |
31 |
int _n_threads; |
|
1374 | 32 |
|
33 |
// The cache for card refinement. |
|
34 |
bool _use_cache; |
|
35 |
bool _def_use_cache; |
|
36 |
size_t _n_periods; |
|
37 |
size_t _total_cards; |
|
38 |
size_t _total_travs; |
|
39 |
||
40 |
unsigned char* _card_counts; |
|
41 |
unsigned _n_card_counts; |
|
42 |
const jbyte* _ct_bot; |
|
43 |
unsigned* _cur_card_count_histo; |
|
44 |
unsigned* _cum_card_count_histo; |
|
45 |
jbyte** _hot_cache; |
|
46 |
int _hot_cache_size; |
|
47 |
int _n_hot; |
|
48 |
int _hot_cache_idx; |
|
49 |
||
50 |
// Returns the count of this card after incrementing it. |
|
51 |
int add_card_count(jbyte* card_ptr); |
|
52 |
||
53 |
void print_card_count_histo_range(unsigned* histo, int from, int to, |
|
54 |
float& cum_card_pct, |
|
55 |
float& cum_travs_pct); |
|
56 |
public: |
|
57 |
ConcurrentG1Refine(); |
|
58 |
~ConcurrentG1Refine(); |
|
59 |
||
60 |
void init(); // Accomplish some initialization that has to wait. |
|
2881 | 61 |
void stop(); |
1374 | 62 |
|
2881 | 63 |
// Iterate over the conc refine threads |
64 |
void threads_do(ThreadClosure *tc); |
|
1374 | 65 |
|
66 |
// If this is the first entry for the slot, writes into the cache and |
|
67 |
// returns NULL. If it causes an eviction, returns the evicted pointer. |
|
68 |
// Otherwise, its a cache hit, and returns NULL. |
|
69 |
jbyte* cache_insert(jbyte* card_ptr); |
|
70 |
||
71 |
// Process the cached entries. |
|
72 |
void clean_up_cache(int worker_i, G1RemSet* g1rs); |
|
73 |
||
74 |
// Discard entries in the hot cache. |
|
75 |
void clear_hot_cache() { |
|
76 |
_hot_cache_idx = 0; _n_hot = 0; |
|
77 |
} |
|
78 |
||
79 |
bool hot_cache_is_empty() { return _n_hot == 0; } |
|
80 |
||
81 |
bool use_cache() { return _use_cache; } |
|
82 |
void set_use_cache(bool b) { |
|
83 |
if (b) _use_cache = _def_use_cache; |
|
84 |
else _use_cache = false; |
|
85 |
} |
|
86 |
||
87 |
void clear_and_record_card_counts(); |
|
88 |
void print_final_card_counts(); |
|
89 |
}; |