[lworld] RFR: 8370195: [lworld] Constant-fold _layout_kind loads from constant FlatArrayKlass

Quan Anh Mai qamai at openjdk.org
Sun Oct 19 17:19:20 UTC 2025


On Sun, 19 Oct 2025 17:13:18 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

> Hi,
> 
> The load to FlatArrayKlass::_layout_kind can be constant-folded if the receiver is a constant. This eliminates all checks when the array type is known statically or speculated correctly.
> 
> Please leave your reviews, thanks a lot.

Benchmark result:

    Benchmark                          Mode  Cnt       Score      Error  Units
    HoistArrayChecks.atomicHoisted     avgt   15  358138.658 ± 4705.964  ns/op
    HoistArrayChecks.atomicNaive       avgt   15  576348.282 ± 3179.475  ns/op
    HoistArrayChecks.nonAtomicHoisted  avgt   15  292872.250 ± 9536.215  ns/op
    HoistArrayChecks.nonAtomicNaive    avgt   15  296264.018 ± 2185.786  ns/op
    HoistArrayChecks.nullableHoisted   avgt   15  479879.297 ± 1753.756  ns/op
    HoistArrayChecks.nullableNaive     avgt   15  675267.274 ± 4161.829  ns/op

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

PR Comment: https://git.openjdk.org/valhalla/pull/1687#issuecomment-3419817433


More information about the valhalla-dev mailing list