RFR: 8316641: VarHandle template classes can share code in the base class [v8]
Jorn Vernee
jvernee at openjdk.org
Mon Dec 4 14:52:43 UTC 2023
On Mon, 6 Nov 2023 08:19:19 GMT, Chen Liang <liach at openjdk.org> wrote:
>> VarHandle implementations have many static fields and methods that can be pulled to the common superclass to avoid repeated initialization and code duplication.
>>
>> In addition, the Unsafe-based Buffer field access are replaced by usage of public methods or JavaNioAccess.
>
> Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains two commits:
>
> - Merge branch 'master' of https://github.com/openjdk/jdk into cleanup/vh-template-share
> - 8316641: VarHandle template classes can share code in the base class
Sorry, this fell off my radar.
src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template line 594:
> 592: @ForceInline
> 593: static int indexRO(ByteBuffer bb, int index) {
> 594: if (bb.isReadOnly())
I have to think that there was a reason for using unsafe access in the current code. So, I'm not sure if it's safe to switch this to a direct method/field reference.
-------------
PR Review: https://git.openjdk.org/jdk/pull/15854#pullrequestreview-1762626598
PR Review Comment: https://git.openjdk.org/jdk/pull/15854#discussion_r1414012311
More information about the core-libs-dev
mailing list