[lworld] RFR: 8369923: [lworld] Hot call to Unsafe.isFlatField in serialization

Rémi Forax forax at openjdk.org
Wed Oct 15 15:39:40 UTC 2025


On Mon, 13 Oct 2025 19:53:27 GMT, Chen Liang <liach at openjdk.org> wrote:

> There's a spike of calls to `Unsafe.isFlatField` in serialzation workloads. The layout information can be prepared with FieldReflector and cached. CI looks good, need to verify the regression is fixed.
> 
> The old perfasm profile was:
> ....[Hottest Regions]...............................................................................
>    4.66% libjvm.so Unsafe_IsFlatField
>    4.13% c2, level 4 java.io.ObjectOutputStream::writeObject0, version 6, compile id 2698
>    3.72% c2, level 4 java.io.ObjectInputStream$BlockDataInputStream::readUTFSpan, version 2, compile id 1878
>    3.61% c2, level 4 java.io.ObjectInputStream$PeekInputStream::readFully, version 2, compile id 1902

The long term fix is to have a value class `FieldLayout` with an int field inside jdk.internal.misc that represent a field layout.

Obviously, it can not be done until Valhalla is out of preview.

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

PR Comment: https://git.openjdk.org/valhalla/pull/1676#issuecomment-3407073614


More information about the valhalla-dev mailing list