On Mon, 6 Nov 2023 08:19:19 GMT, Chen Liang <li...@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