RFR: 8278891: G1: Call reset in G1RegionMarkStatsCache constructor

Albert Mingkun Yang ayang at openjdk.java.net
Thu Dec 16 14:41:57 UTC 2021


On Thu, 16 Dec 2021 10:08:20 GMT, Hamlin Li <mli at openjdk.org> wrote:

> Currently, G1RegionMarkStatsCache constructor does not call G1RegionMarkStatsCache::reset(), it depends on user to call it explicitly to make sure it works well and without crash in G1RegionMarkStatsCache::evict(uint idx).
> 
> In fact G1RegionMarkStatsCache constructor should call G1RegionMarkStatsCache::reset() to ensure its valid initial state.
> 
> ( I met this issue when I tried to reuse this class to implement some parallel cache when improve the parallelism of evacuation failure. )

Marked as reviewed by ayang (Reviewer).

src/hotspot/share/gc/g1/g1RegionMarkStatsCache.cpp line 42:

> 40:             "Number of cache entries must be power of two, but is %u", num_cache_entries);
> 41:   _cache = NEW_C_HEAP_ARRAY(G1RegionMarkStatsCacheEntry, _num_cache_entries, mtGC);
> 42:   reset();

I believe the three fields named like `_cache*` can be dropped from the member initializer list.

-------------

PR: https://git.openjdk.java.net/jdk/pull/6861



More information about the hotspot-gc-dev mailing list