RFR: 8299576: Reimplement java.io.Bits using VarHandle access [v2]
Sergey Tsypanov
stsypanov at openjdk.org
Tue Jan 17 08:34:22 UTC 2023
On Tue, 17 Jan 2023 07:43:07 GMT, Per Minborg <pminborg at openjdk.org> wrote:
>>>
>>> Do you see any concrete examples of classes in the JDK that could benefit from a "VarHandlization"?
>>
>> `ImageOutputStreamImpl` and `ImageInputStreamImpl` in `javax.imageio.stream` have some very similar code that might benefit. Also `DataInputStream` and `DataOutpuStream`could possibly use `Bits` directly.
>
>> > Do you see any concrete examples of classes in the JDK that could benefit from a "VarHandlization"?
>>
>> `ImageOutputStreamImpl` and `ImageInputStreamImpl` in `javax.imageio.stream` have some very similar code that might benefit. Also `DataInputStream` and `DataOutpuStream`could possibly use `Bits` directly.
>
> Thanks @j3graham
@minborg I guess that the same can be done for `MethodHandles.readInt()`, `ByteBuffer.getInt()`, `AESCrypt.implEncryptBlock()`. Btw, I see that unlike original code `VarHandle.get()` returns Object, not primitive. Won't we have excessive allocation with this change?
-------------
PR: https://git.openjdk.org/jdk/pull/11840
More information about the core-libs-dev
mailing list