30
30
#include " runtime/atomic.hpp"
31
31
32
32
G1HotCardCache::G1HotCardCache (G1CollectedHeap *g1h):
33
- _g1h(g1h), _use_cache( false ), _card_counts(g1h),
33
+ _g1h(g1h), _card_counts(g1h),
34
34
_hot_cache(NULL ), _hot_cache_size(0 ), _hot_cache_par_chunk_size(0 ),
35
35
_hot_cache_idx(0 ), _hot_cache_par_claimed_idx(0 ), _cache_wrapped_around(false )
36
36
{}
37
37
38
38
void G1HotCardCache::initialize (G1RegionToSpaceMapper* card_counts_storage) {
39
- if (default_use_cache ()) {
40
- _use_cache = true ;
41
-
39
+ if (use_cache ()) {
42
40
_hot_cache_size = (size_t )1 << G1ConcRSLogCacheSize;
43
41
_hot_cache = ArrayAllocator<CardValue*>::allocate (_hot_cache_size, mtGC);
44
42
@@ -55,7 +53,7 @@ void G1HotCardCache::initialize(G1RegionToSpaceMapper* card_counts_storage) {
55
53
}
56
54
57
55
G1HotCardCache::~G1HotCardCache () {
58
- if (default_use_cache ()) {
56
+ if (use_cache ()) {
59
57
assert (_hot_cache != NULL , " Logic" );
60
58
ArrayAllocator<CardValue*>::free (_hot_cache, _hot_cache_size);
61
59
_hot_cache = NULL ;
@@ -92,10 +90,9 @@ CardTable::CardValue* G1HotCardCache::insert(CardValue* card_ptr) {
92
90
}
93
91
94
92
void G1HotCardCache::drain (G1CardTableEntryClosure* cl, uint worker_id) {
95
- assert (default_use_cache (), " Drain only necessary if we use the hot card cache." );
93
+ assert (use_cache (), " Drain only necessary if we use the hot card cache." );
96
94
97
95
assert (_hot_cache != NULL , " Logic" );
98
- assert (!use_cache (), " cache should be disabled" );
99
96
100
97
while (_hot_cache_par_claimed_idx < _hot_cache_size) {
101
98
size_t end_idx = Atomic::add (&_hot_cache_par_claimed_idx,
0 commit comments