RFR: 8364111: InstanceMirrorKlass iterators should handle CDS and hidden classes consistently

Aleksey Shipilev shade at openjdk.org
Fri Jul 25 17:07:54 UTC 2025


On Fri, 25 Jul 2025 17:00:49 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> Actually, I now see this assert is tautological: `java_lang_Class::is_primitive` checks that `java_class->metadata_field(_klass_offset) == nullptr`, which is the same as pulling the `Klass*` with `java_lang_Class::as_Klass` and null-checking it, like _we already just did_. So really the assert is redundant and we can purge it.
>> 
>> But this also suggests that whatever interaction with GC exists, it affects current code as well. I think it works with concurrent GCs through a different mechanism: the classes loaded during the GC and their mirrors would be either treated as implicitly live (e.g. via SATB invariants), or need to be specially keep-alived (Shenandoah's IU mode did this, IIRC).
>
> This is what old CMS comment tried to say, I think:
> 
> 
> // However, we might get across a klass that just changed during CMS concurrent
> // marking if allocation occurred in the old generation.
> //
> // This is benign here, as we keep alive all CLDs that were loaded during the
> // CMS concurrent phase in the class loading, i.e. they will be iterated over
> // and kept alive during remark.

Pretty exhausted at this point, I'll mull over it after the weekend. But so far I think we are fine. Testing returns clean as well. If you can schedule some aggressive testing over the weekend, it would be helpful.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26477#discussion_r2231628450


More information about the hotspot-dev mailing list