JDK-8080594 : VarHandles for ByteBuffers
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: java.lang.invoke
  • Affected Version: 9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2015-05-18
  • Updated: 2016-02-09
  • Resolved: 2016-02-09
Description
Support VarHandles for variables that are elements of array view over a ByteBuffer .

Heap and off-heap (direct) ByteBuffers should be supported.

A data structure should be defined representing the region of memory covered by a ByteBuffer. An instance of that structure is utilized as the receiver type, rather than the associated ByteBuffer instance itself. This indirection ensures certain computations are avoided per-access. The structure will ensure the associated ByteBuffer will not be GC'ed until the structure is. 

Int and long array views over the memory region covered by a ByteBuffer should be supported, as permitted by the required sub-range into the buffer and it's size. 

For unaligned architectures fenced and atomic operations can be supported at aligned and unaligned offsets into the region of memory.
  
For aligned architectures fenced and atomic operations can be supported *only* for aligned offsets into the region of memory.

Support for big, little and natural (Java) endian should be considered.

Bounds checks are performed before access.