On Tue, 17 Jan 2023 08:30:58 GMT, Sergey Tsypanov <stsypa...@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.
>> 
>> 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?

@stsypanov `VarHandle.get()` is a polymorphic signature method, which means 
that a call `(int) INT.get(b, off)` will invoke a method with a signature of 
`int VarHandle::get(byte[], int)`

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

PR: https://git.openjdk.org/jdk/pull/11840

Reply via email to