RFR: 8350118: Simplify the layout access VarHandle [v5]

Chen Liang liach at openjdk.org
Fri Feb 28 13:35:06 UTC 2025


On Fri, 28 Feb 2025 10:38:28 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Chen Liang has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   noStride -> constantOffset, optimize VH classes to have only 2 instead of 3 classes for each type
>
> src/java.base/share/classes/java/lang/invoke/X-VarHandleSegmentView.java.template line 120:
> 
>> 118: 
>> 119: // This class must be accessed through non-aligned VarHandleSegmentAs$Type$s
>> 120: final class VarHandleSegmentAs$Type$sAligned extends VarHandleSegmentAs$Type$s {
> 
> I kind of liked the nested classes -- why the change?

Nesting means we need to define 3 classes: AsXxx, Unaligned, Aligned. I wish to reduce class loading by merging AsXxx and Unaligned. The Aligned still works as if it is nested, but I put it out to make the indentation beautiful for boolean and byte.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23720#discussion_r1975417166


More information about the core-libs-dev mailing list