RFR: 8269914: Factor out heap printing for G1 young and full gc [v2]

Thomas Schatzl tschatzl at openjdk.java.net
Thu Jul 8 12:21:37 UTC 2021


On Thu, 8 Jul 2021 11:37:56 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

>> Thomas Schatzl has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR.
>
> src/hotspot/share/gc/g1/g1CollectedHeap.cpp line 983:
> 
>> 981: };
>> 982: 
>> 983: void G1CollectedHeap::print_heap_after_full_collection() {
> 
> It's a bit odd to see `*_full_collection` as an API of `G1CollectedHeap`; I would have expected full-collection-only APIs in g1 full gc files.

There are quite a few "after_full_collection" methods in `G1CollectedHeap`, everything below the

  // Internal helpers used during full GC to split it up to
  // increase readability.

comment. Ultimately there will always be young/full gc specific in `G1CollectedHeap` to avoid exposing too many details to the respective collector algorithm class. I do not know whether the current division is good, but I can and will revisit this at some point later.

Fwiw, the next PR will also add a few methods for young gc that are somewhat similar. Maybe we can group them in special per gc type `G1CollectedHeap` accessor classes?

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

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



More information about the hotspot-gc-dev mailing list