[foreign] RFR 8224835: Pointer validity checks are applied inconsistently

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Wed May 29 12:54:01 UTC 2019


Looks very good - the changes to Pointer:addr alone (and associated 
cleanups) are worth :-)

I understand the choice with respect to liveness checks for structs and 
arrays - this reflects our big type vs. small type distinction. The sore 
point to note there is that you'd only get notified of a failure if the 
element you are accessing is, again, not a struct or an array. What if 
we added a call to checkAlive in the struct and array constructors?

Maurizio

On 29/05/2019 13:26, Jorn Vernee wrote:
> Hi,
>
> Please review the following:
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8224835
> Webrev: 
> http://cr.openjdk.java.net/~jvernee/panama/webrevs/8224835/webrev.00/
>
> This replaces the various public checkXXX methods on BoundedPointer 
> with a single public checkAccess(AccessMode) method, which is then 
> used everywhere outside of BoundedPointer. This makes sure that every 
> place does all the needed checks, and not only one or the other.
>
> I've also checked all the use sites, and noticed that the 
> IllegalAccessException that Pointer::addr declared as being thrown was 
> never actually thrown. Instead an AccessControlException was being 
> thrown. So I've updated the relevant signatures as well, and this 
> allowed for the removal of a bunch of try/catch blocks.
>
> I've also removed the checks in References.OfStruct::get and 
> References.OfArray::get, since we're not actually dereferencing the 
> pointer at that point, only wrapping it. The checks will still happen 
> later on when accessing a field or element (i.e. when actually 
> dereferencing the pointer).
>
> Thanks,
> Jorn


More information about the panama-dev mailing list