Setting foreign.restricted to permit doesn't work

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Fri Apr 24 00:11:44 UTC 2020


On 23/04/2020 22:43, Ty Young wrote:
> Next question: what's going on with MemoryAddress handles? Presumably 
> you need to do:
>
>
> private static final VarHandle POINTER_HANDLE = 
> MemoryHandles.varHandle(LONG_HANDLE, ByteOrder.nativeOrder());
>
>
> To do what you could before. Is this correct and Is this because of 
> all the new fancy methods added to MethodHandles? It surely can't be 
> for type safety since VarHandles has none. 

If you want a pointer handle you can first create a long handle (like 
you did above) and then adapt it using MemoryHandles::asAddressVarHandle 
- which will give you back a VarHandle whose carrier type is 
MemoryAddress, not long.

We moved back to a combinator-based approach since this gives us more 
flexibility, and keeps the API simple. For instance, it is now possible 
to create a VarHandle which gives you a MemoryAddress, but out of a 32 
bits read (e.g. where the 'base' VarHandle is an INT var handle).

Maurizio



More information about the panama-dev mailing list