< prev index next >

src/hotspot/share/gc/g1/g1RegionMarkStatsCache.cpp

Print this page
rev 50098 : [mq]: 8202842-g1-footprint-regressions


  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc/g1/g1RegionMarkStatsCache.inline.hpp"
  27 #include "memory/allocation.inline.hpp"
  28 
  29 G1RegionMarkStatsCache::G1RegionMarkStatsCache(G1RegionMarkStats* target, uint max_regions, uint num_cache_entries) :
  30   _num_stats(max_regions),
  31   _target(target),
  32   _num_cache_entries(num_cache_entries),
  33   _cache_hits(0),
  34   _cache_misses(0) {
  35 
  36   guarantee(is_power_of_2(num_cache_entries),
  37             "Number of cache entries must be power of two, but is %u", num_cache_entries);
  38   _cache = NEW_C_HEAP_ARRAY(G1RegionMarkStatsCacheEntry, _num_cache_entries, mtGC);
  39   for (uint i = 0; i < _num_cache_entries; i++) {
  40     _cache[i].clear();
  41   }
  42   _num_cache_entries_mask = _num_cache_entries - 1;
  43 }
  44 
  45 G1RegionMarkStatsCache::~G1RegionMarkStatsCache() {
  46   FREE_C_HEAP_ARRAY(G1RegionMarkStatsCacheEntry, _cache);
  47 }
  48 
  49 // Evict all remaining statistics, returning cache hits and misses.
  50 Pair<size_t, size_t> G1RegionMarkStatsCache::evict_all() {
  51   for (uint i = 0; i < _num_cache_entries; i++) {
  52     evict(i);
  53   }
  54   return Pair<size_t,size_t>(_cache_hits, _cache_misses);
  55 }
  56 
  57 // Reset all cache entries to their default values.
  58 void G1RegionMarkStatsCache::reset() {
  59   _cache_hits = 0;
  60   _cache_misses = 0;
  61 


  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc/g1/g1RegionMarkStatsCache.inline.hpp"
  27 #include "memory/allocation.inline.hpp"
  28 
  29 G1RegionMarkStatsCache::G1RegionMarkStatsCache(G1RegionMarkStats* target, uint max_regions, uint num_cache_entries) :
  30   _num_stats(max_regions),
  31   _target(target),
  32   _num_cache_entries(num_cache_entries),
  33   _cache_hits(0),
  34   _cache_misses(0) {
  35 
  36   guarantee(is_power_of_2(num_cache_entries),
  37             "Number of cache entries must be power of two, but is %u", num_cache_entries);
  38   _cache = NEW_C_HEAP_ARRAY(G1RegionMarkStatsCacheEntry, _num_cache_entries, mtGC);



  39   _num_cache_entries_mask = _num_cache_entries - 1;
  40 }
  41 
  42 G1RegionMarkStatsCache::~G1RegionMarkStatsCache() {
  43   FREE_C_HEAP_ARRAY(G1RegionMarkStatsCacheEntry, _cache);
  44 }
  45 
  46 // Evict all remaining statistics, returning cache hits and misses.
  47 Pair<size_t, size_t> G1RegionMarkStatsCache::evict_all() {
  48   for (uint i = 0; i < _num_cache_entries; i++) {
  49     evict(i);
  50   }
  51   return Pair<size_t,size_t>(_cache_hits, _cache_misses);
  52 }
  53 
  54 // Reset all cache entries to their default values.
  55 void G1RegionMarkStatsCache::reset() {
  56   _cache_hits = 0;
  57   _cache_misses = 0;
  58 
< prev index next >