RFR: 8332548: GenShen: Factor generational mode out of gc helpers
William Kemper
wkemper at openjdk.org
Tue May 21 21:16:24 UTC 2024
On Tue, 21 May 2024 17:44:16 GMT, Y. Srinivas Ramakrishna <ysr at openjdk.org> wrote:
>> Some of the generational mode support in `shenandoahConcurrentGC.cpp` and `shenandoahDegeneratedGC.cpp` can be factored into generational mode specific files and coalesced under fewer generational mode checks.
>
> src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp line 789:
>
>> 787: JavaThread* const jt = JavaThread::cast(thread);
>> 788: StackWatermarkSet::finish_processing(jt, _oops, StackWatermarkKind::gc);
>> 789: if (ShenandoahHeap::heap()->mode()->is_generational()) {
>
> For patterns such as this, I wonder if the closure might just be enhanced with a `_generational_mode` boolean (or templatized, but that is usually ugly and makes debugging a pain) to do these kinds of checks, and whether it makes a difference from a readability or performance perspective. Not important but thought a uniform approach might make it easier. I personally prefer a const value embedded in closures nicer, but it would show up as a diff in legacy Shenandoah (which might still be acceptable to reviewers, I think). Anyway, nothing to actually do now, but leaving this comment here for people to think/dicsuss about from a maintainability and readability perspective for the future....
Yes, there are many cases where the singleton is accessed directly. I also do not prefer this approach because it makes it difficult to run such classes in a unit test. I will refactor this.
-------------
PR Review Comment: https://git.openjdk.org/shenandoah/pull/436#discussion_r1608958237
More information about the shenandoah-dev
mailing list