Integrated: 8364159: Shenandoah assertions after JDK-8361712

Thomas Stuefe stuefe at openjdk.org
Wed Jul 30 10:15:00 UTC 2025


On Mon, 28 Jul 2025 16:49:40 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

> In `ShenandoahAsserts::extract_klass_safely`, we attempt to carefully extract the Klass for an object and trip over our own feet doing this. We load the Markword twice: once to read "is_marked" and get the forwardee, once to extract the narrowKlass.
> 
> If between the first and the second load we did evacuate the object concurrently, this happens:
> 
> T1 : fwd = SheandoahForwarding::get_forwardee_raw_unchecked(obj)  => obj unmarked => (fwd == obj)
> T2 : (installs forwarding pointer in obj)
> T1: read markword from fwd again, (fwd == obj) => reads markword from forwarded obj, interprets the zeros in the upper part of the forwardee address as narrowKlass == 0, asserts
> 
> The solution is - as ShenandoahForwarding::klass() already does - to load the MW from original obj only once. Patch does that.

This pull request has now been integrated.

Changeset: 317dacc3
Author:    Thomas Stuefe <stuefe at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/317dacc308993d534aeba397d0550ad056fe595b
Stats:     8 lines in 1 file changed: 4 ins; 0 del; 4 mod

8364159: Shenandoah assertions after JDK-8361712

Reviewed-by: mbaesken, shade

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

PR: https://git.openjdk.org/jdk/pull/26513


More information about the hotspot-gc-dev mailing list