< prev index next >

src/share/vm/gc_implementation/g1/g1HotCardCache.hpp

Print this page
rev 7695 : 8069273: Reduce Hot Card Cache Lock contention
Reviewed-by: tschatzl

*** 52,76 **** // // This can significantly reduce the overhead of the write barrier // code, increasing throughput. class G1HotCardCache: public CHeapObj<mtGC> { G1CollectedHeap* _g1h; // The card cache table jbyte** _hot_cache; ! int _hot_cache_size; ! int _n_hot; ! int _hot_cache_idx; int _hot_cache_par_chunk_size; - volatile int _hot_cache_par_claimed_idx; ! bool _use_cache; ! G1CardCounts _card_counts; // The number of cached cards a thread claims when flushing the cache static const int ClaimChunkSize = 32; bool default_use_cache() const { --- 52,85 ---- // // This can significantly reduce the overhead of the write barrier // code, increasing throughput. class G1HotCardCache: public CHeapObj<mtGC> { + G1CollectedHeap* _g1h; + bool _use_cache; + + G1CardCounts _card_counts; + // The card cache table jbyte** _hot_cache; ! intptr_t _hot_cache_size; int _hot_cache_par_chunk_size; ! // Avoids false sharing when concurrently updating _hot_cache_idx or ! // _hot_cache_par_claimed_idx. These are never updated at the same time ! // thus it's not necessary to separate them as well ! char _pad_before[DEFAULT_CACHE_LINE_SIZE]; ! volatile intptr_t _hot_cache_idx; ! ! volatile intptr_t _hot_cache_par_claimed_idx; ! ! char _pad_after[DEFAULT_CACHE_LINE_SIZE]; // The number of cached cards a thread claims when flushing the cache static const int ClaimChunkSize = 32; bool default_use_cache() const {
*** 111,124 **** // Resets the hot card cache and discards the entries. void reset_hot_cache() { assert(SafepointSynchronize::is_at_safepoint(), "Should be at a safepoint"); assert(Thread::current()->is_VM_thread(), "Current thread should be the VMthread"); ! _hot_cache_idx = 0; _n_hot = 0; } ! bool hot_cache_is_empty() { return _n_hot == 0; } // Zeros the values in the card counts table for entire committed heap void reset_card_counts(); // Zeros the values in the card counts table for the given region --- 120,136 ---- // Resets the hot card cache and discards the entries. void reset_hot_cache() { assert(SafepointSynchronize::is_at_safepoint(), "Should be at a safepoint"); assert(Thread::current()->is_VM_thread(), "Current thread should be the VMthread"); ! _hot_cache_idx = 0; ! for (intptr_t i = 0; i < _hot_cache_size; i++) { ! _hot_cache[i] = NULL; ! } } ! bool hot_cache_is_empty() { return _hot_cache[0] == NULL; } // Zeros the values in the card counts table for entire committed heap void reset_card_counts(); // Zeros the values in the card counts table for the given region
< prev index next >