[foreign-abi] RFR 8236004: Memory access var handles should support MemoryAddress carrier

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Wed Dec 18 11:03:03 UTC 2019


Here's a new revision which restores erased carrier and access types:

http://cr.openjdk.java.net/~mcimadamore/panama/8236004_v3/

Thanks for taking the time of retracing the steps and explaining how 
linking is supposed to work; I feel I now have a much better 
understanding of how things are connected.

Maurizio

On 17/12/2019 19:01, Paul Sandoz wrote:
>
>
>> On Dec 17, 2019, at 10:47 AM, Maurizio Cimadamore 
>> <maurizio.cimadamore at oracle.com 
>> <mailto:maurizio.cimadamore at oracle.com>> wrote:
>>>
>>> Yes, it works fine, until you pass an instance of something that is 
>>> not of MemoryAddressProxy e.g. pass in an instance of String, which 
>>> will get spoofed as an instance of MemoryAddressProxy.  The guards 
>>> will only check if the object is a reference type.
>>
>> Ok, I see what you mean, the problem is not that linking occurs 
>> abnormally, the problem is that the underlying linkage is not sound 
>> (in the absence of Java casts)
>>
> Yes, the linkage + invocation runtime checks are not sound.
>
>> I guess this means that same treatment should also be applied to the 
>> MemoryAddressProxy parameter (e.g. of a VarHandle::set operation) right?
>>
>
> Yes, for all access modes where the arg of $type$ is 
> of MemoryAddressProxy a cast check is required (which should optimize 
> away).
>
> I think that can be performed by the addr2long method?
>>
> Paul.


More information about the panama-dev mailing list