[lworld] RFR: 8348215: [lworld] Unsafe.getValue() and Unsafe.putValue() need nullable flat layout support

Frederic Parain fparain at openjdk.org
Tue Jan 21 21:58:27 UTC 2025


Quick fix to Unsafe.getValue() and Unsafe.putValue() in order to support nullable flat fields and elements. This will fix the substitutability test when values have nullable flat fields.

This is a temporary implementation, the call to find_field_from_offset() being too costly for an Unsafe method. A better fix would be to allow Unsafe to get the layout kind of the field, to cache it and to pass it back to the VM when calling getValue() or putValue(), the same way it proceeds with the field offset.

But this would imply changing all the JDK codes and tests currently using getValue() or putValue(). So this following step will be addressed in a different CR (fixing the substitutability test being more urgent).

The changeset also fixes several bugs encountered while fixing Unsafe.

Fred

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

Commit messages:
 - Add nullable layout support to  Unsafe.getValue() and Unsage.putValue()

Changes: https://git.openjdk.org/valhalla/pull/1334/files
  Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=1334&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8348215
  Stats: 176 lines in 4 files changed: 157 ins; 16 del; 3 mod
  Patch: https://git.openjdk.org/valhalla/pull/1334.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/1334/head:pull/1334

PR: https://git.openjdk.org/valhalla/pull/1334


More information about the valhalla-dev mailing list