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

Thomas Stuefe stuefe at openjdk.org
Thu Jul 3 16:57:53 UTC 2025


`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 numerical address of the forwardee, 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.

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

Commit messages:
 - shenandoahAssertFix

Changes: https://git.openjdk.org/jdk/pull/26117/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26117&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8361363
  Stats: 3 lines in 1 file changed: 2 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/26117.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26117/head:pull/26117

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


More information about the hotspot-gc-dev mailing list