On Sat, 8 Jun 2024 12:25:54 GMT, Sunmisc Unsafe <d...@openjdk.org> wrote:

>> Shaojin Wen has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   add comments
>
> As far as I know, ByteArrayLittleEndian uses the VarHandle mechanism, which 
> more efficiently writes different primitives into the array, unlike the basic

@sunmisc BALE uses byte array view VH which still uses Unsafe: 
https://github.com/openjdk/jdk/blob/8d2f9e57c3797c01c84df007f4d2bfdcd645d0c0/src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template#L141

Please take a look at #16245; you will see that C2 now JIT compiles these 
compatible "different primitives" like Unsafe would do, yet there's a bit of 
requirement on code shape. Thus I recommended the comment for wenshao, so 
future changes won't accidentally destroy the code shape and the optimization.

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

PR Comment: https://git.openjdk.org/jdk/pull/19610#issuecomment-2156036174

Reply via email to