RFR: 8373039: Remove Incorrect Asserts in shenandoahScanRemembered

William Kemper wkemper at openjdk.org
Wed Dec 3 17:47:47 UTC 2025


On Wed, 3 Dec 2025 17:16:02 GMT, Ben Taylor <btaylor at openjdk.org> wrote:

> The `Klass->is_valid` asserts in this file do not hold the required `ClassLoaderDataGraph_lock` and can cause a crash.
> 
> A similar issue was seen in https://bugs.openjdk.org/browse/JDK-8372566
> 
> This change passes all tests in `TEST=hotspot_gc_shenandoah` with a fastdebug build

Changes requested by wkemper (Reviewer).

src/hotspot/share/gc/shenandoah/shenandoahScanRemembered.cpp line 384:

> 382:   oop obj = cast_to_oop(p);
> 383:   assert(oopDesc::is_oop(obj), "Should be an object");
> 384:   assert(p <= left, "p should start at or before left end of card");

I think it's fine to take out this loop, but the assert on 384 now seems redundant to the assert on 363. I'm also not sure if the assert on 385 necessarily holds because `p` is no longer increased in the loop. Maybe remove this whole `#ifdef ASSERT` block, or leave in the loop and just take out the `Klass::is_valid` usage.

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

PR Review: https://git.openjdk.org/jdk/pull/28642#pullrequestreview-3536232605
PR Review Comment: https://git.openjdk.org/jdk/pull/28642#discussion_r2586068246


More information about the shenandoah-dev mailing list