RFR: 8351091: Shenandoah: global marking context completeness is not accurately maintained [v4]
Y. Srinivas Ramakrishna
ysr at openjdk.org
Thu Mar 6 22:57:09 UTC 2025
On Thu, 6 Mar 2025 20:20:17 GMT, Xiaolong Peng <xpeng at openjdk.org> wrote:
>> OK, I see that `ShenandoahGlobalGeneration` forces the state of `ShenandoahOdGeneration` and `ShenandoahYoungGeneration`, but is that our intention? I am seeing (see comment elsewhere) that we are always either using global generation's marking context explicitly, or using a region to index into the appropriate containing generation's marking context. If so, can we dispense with the forcing of global context's state into the contexts for the two generations?
>
>> If so, can we dispense with the forcing of global context's state into the contexts for the two generations?
>
> I think we can do that if we deprecated the classical mode and only support generational Shenandoah, in classical mode, there is only global generation.
I am not sure I follow. In the legacy (non-generational mode) we shouldn't care about the marking state of the old and young generations, just that of the GlobalGeneration. In the generational case, we explicitly track the marking state of the old and young generations explicitly. It sounds to me as if forcing the Old and Young marking states to the state of that of the GlobalGeneration must be exactly for the case where we are using Generational Shenandoah, and we are doing a Global collection? Indeed:
void ShenandoahGlobalGeneration::set_mark_complete() {
ShenandoahGeneration::set_mark_complete();
if (ShenandoahHeap::heap()->mode()->is_generational()) {
ShenandoahGenerationalHeap* heap = ShenandoahGenerationalHeap::heap();
heap->young_generation()->set_mark_complete();
heap->old_generation()->set_mark_complete();
}
}
I am saying that each of Old, Young, and Global generations maintain their own mark completion state and use that to determine what they pass back in response to `complete_marking_context()`. This completely localizes all state rather than unnecessarily and confusingly coupling the states of these generations.
So, you remove the part in the `if` branch in the code above, which reduces to the default (or rather only) implementation in the base class, not requiring the over-ride of the Global generation's method for the generational case.
void ShenandoahGeneration::set_mark_complete() {
_is_marking_complete.set();
}
It is possible that I am still missing the actual structure here that requires the override for GlobalGeneration for the generational case.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23886#discussion_r1984121357
More information about the shenandoah-dev
mailing list