RFR: 8361363: ShenandoahAsserts::print_obj() does not work for forwarded objects and UseCompactObjectHeaders

Aleksey Shipilev shade at openjdk.org
Tue Jul 8 08:56:42 UTC 2025


On Thu, 3 Jul 2025 14:22:32 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

> `ShenandoahAsserts::print_obj()` does not work for COH if the object is forwarded, since the mark word is overwritten with a forwarding pointer.
> 
> Depending on the size of the non-null bits of the forwardee (whether it spills into the nKlass bits), nKlass is either zero or garbage. So we get either an "assert(!is_null(v)) failed: narrow klass value can never be zero", or a SIGSEGV. 
> 
> Fix is trivial: don't use obj->klass() directly but get it from ShenandoahForwarding.

There are two peculiarities in this method. It is normally called from diagnostics code, and so we are not 100% sure it it is even safe to reach through the fwdptr for klass. Second, we should be printing the raw header at least in some cases, because again, diagnostics.

Let me think about it...

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

PR Review: https://git.openjdk.org/jdk/pull/26117#pullrequestreview-2996640881


More information about the shenandoah-dev mailing list