[foreign] RFR: 8229857: scope inference on pointer to pointer is not friendly

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Wed Aug 28 20:05:39 UTC 2019


On 28/08/2019 19:22, Henry Jen wrote:
> Of course this is silly code, but that just simulate something we pass down to native and come back. As you can see inference is still not helping here at all. My pointe is, inference need to have basis to have merit.

Just a comment on this one point; the motivation behind scope inference 
and ownership were described here [1] - the primary motivation behind 
these strategies was to make use of the Pointer API safe, as long as it 
did not touch stuff that had to do with native functions. That is, at 
the time, we thought it would have been valuable to claim that, if the 
only thing you do is to allocate a struct off heap, fill it with Java 
values and that's it - you should never run into an hard VM crash.

Of course a lot of our story has changed since then - we now have a 
low-level and fully safe off-heap API, so perhaps this removes some of 
the safety constraints from the Pointer API. But it's still important, 
for the scope of this discussion, to understand that once you attach 
random scopes to random pointers, all safety guarantees are lost.

Maurizio

[1] - http://cr.openjdk.java.net/~mcimadamore/panama/scopes.html





More information about the panama-dev mailing list