Helpers for MethodHandles.byteArrayViewVarHandle VarHandle

Paul Sandoz paul.sandoz at oracle.com
Thu May 19 16:06:42 UTC 2016


> On 19 May 2016, at 16:26, Jaroslav Kameník <jaroslav at kamenik.cz> wrote:
> 
> 
> There certainly is in nio buffer sources (and may be for encoding/decoding in other areas, i am speculating as i have not looked), but for buffer sources we can actually remove much if not all of Bits.java via use of the internal Unsafe unaligned accessors.
> 
>  I made some notes when I was looking at it, I am attaching it if you want look at it.
> 

Thanks, that is helpful.


> > getLongFrom[LE/BE](byte[] data, int firstByteIndex)                                  - for direct access
> > getLongFrom[LE/BE](byte[] data, int firstByteOffset, int longArrayIndex)     - for loops/shifted array access
> >
> > etc.
> 
> I was proposing just the latter, and just for VarHandles :-) it’s not just for loops but also to bring alignment issues to the foreground. (It also it fits in with something we have been pondering about for the unsafe unaligned accessors on systems that don’t support unaligned access, such as SPARC).
> 
> What do you mean by 'just for VarHandles'? Add it between VarHandle methods?
> 

I meant change the shape of the VarHandle produced by:

  MethodHandles.byteArrayViewVarHandle
  MethodHandles.byteBufferViewVarHandle

The problem is feature complete is very close and it will be hard, but not impossible, to make changes afterwards.

Paul.

> 
> Jaroslav
> 
> 
> 
> <xxs.log>




More information about the core-libs-dev mailing list