RFR [9] 8148117: Move sun.misc.Cleaner to jdk.internal.ref

Paul Sandoz paul.sandoz at oracle.com
Tue Jan 26 14:08:23 UTC 2016

> On 23 Jan 2016, at 21:31, Andrew Haley <aph at redhat.com> wrote:
> BTW, does anyone here know why we don't have humongous ByteBuffers
> with a long index?

Probably in part because of Java arrays. IMO we need Arrays 2.0 (+ panama i suspect).

Here’s some "shoot from the hip" thinking…

In principle a direct ByteBuffer could bound a region larger than that which can be expressed with an int limit (i suppose a heap ByteBuffer could do the same if it holds multiple instances if byte[], although that would require more work).

The direct BB can be used to access the first 2^31 - 1 values. A VarHandle could be produced that accesses the whole range since it could accept long index values and check bounds against a special long limit field. That might require some additional HotSpot work to optimize bounds checks and any loops to reduce or avoid a safe point check per iteration.


More information about the core-libs-dev mailing list