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

Tobias Hartmann thartmann at openjdk.org
Mon Oct 20 05:25:35 UTC 2025


On Mon, 20 Oct 2025 04:01:16 GMT, Chen Liang <liach 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.
>
> I wonder if the work to constant fold Unsafe.arrayLayout is similar to this - this is currently a bottleneck in core libraries.

@liach That one ([JDK-8369835](https://bugs.openjdk.org/browse/JDK-8369835)) requires an intrinsic for the Unsafe method which is currently implemented in C++ code (there's no Java code that could be optimized/folded).

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

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


More information about the valhalla-dev mailing list