RFR: 8338688: Shenandoah: Avoid calling java_lang_Class accessors in asserts/verifier

Roman Kennke rkennke at openjdk.org
Tue Aug 20 17:10:03 UTC 2024


On Tue, 20 Aug 2024 16:55:53 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> In GC verification code, we are not always safe to touch the klass directly. This becomes a problem in Lilliput, where loading klass from the from-space is erroneous. Lilliput would replace `obj->klass()` with `obj->forward_safe_klass()` to make it right in GC code. But accessors like `java_lang_Class` would not be fixed: they would instead rely on barriers to always be called on to-space objects.
> 
> So we are better avoiding using these `java_lang_Class` accessors in GC verification code, and use the loaded `klass` directly. 
> 
> Additional tests:
>  - [x] Linux x86_64 server fastdebug, `hotspot_gc_shenandoah`
>  - [ ] Linux x86_64 server fastdebug, `all` with `-XX:+UseShenandoahGC`

Looks good to me, and I verified that it fixes the problems that I've observed in Lilliput.

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

Marked as reviewed by rkennke (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/20651#pullrequestreview-2248582655


More information about the hotspot-gc-dev mailing list