RFR: 8295658 G1: Refactor G1SegmentedArray to indicate that it is an allocator

Thomas Schatzl tschatzl at openjdk.org
Thu Oct 20 10:14:48 UTC 2022


On Wed, 19 Oct 2022 14:52:07 GMT, Ivan Walulya <iwalulya at openjdk.org> wrote:

> Hi,
> 
> Please review this refactoring change of G1SegmentedArray to G1MonotonicArena which is a more appropriate name for the intended use of the class objects.
> 
> The change has two commits, with the first commit refactoring the class names and the second commit adding the corresponding changes to file names. 
> 
> Testing: builds

Lgtm sans the minor formatting issues.

src/hotspot/share/gc/g1/g1CollectedHeap.hpp line 148:

> 146:   G1ServiceThread* _service_thread;
> 147:   G1ServiceTask* _periodic_gc_task;
> 148:   G1MonotonicArenaFreeMemoryTask* _free_monotonic_arena_memory_task;

I do not think it is required to have variable names that repeat the whole type name, particularly if there is no ambiguity. I.e. `_free_arena_memory_task` seems sufficient instead of `_free_monotonic_arena....` but I do not mind either way.

src/hotspot/share/gc/g1/g1SegmentedArray.hpp line 44:

> 42: // The allocation pattern for these Segments is assumed to be strictly two-phased:
> 43: //
> 44: // - in the first phase, Segment are allocated from the C heap (or a free

(probably pre-existing) s/Segment/Segments or "Segment instances"

src/hotspot/share/gc/g1/g1SegmentedArray.hpp line 59:

> 57: // Their values are only consistent within each other with extra global
> 58: // synchronization.
> 59: 

(pre-existing) additional newline

src/hotspot/share/gc/g1/g1SegmentedArray.hpp line 67:

> 65: private:
> 66:   // AllocOptions provides parameters for allocation segment
> 67:   // sizing and expansion.

Maybe:

AllocOptions provides parameters for Segment sizing and expansion.

src/hotspot/share/gc/g1/g1SegmentedArray.hpp line 76:

> 74: 
> 75:   SegmentFreeList* _segment_free_list;   // The global free segment list to preferentially
> 76:                                       // get new segments from.

Comment should be aligned to the start of the one above.

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

Marked as reviewed by tschatzl (Reviewer).

PR: https://git.openjdk.org/jdk/pull/10767


More information about the hotspot-gc-dev mailing list