[foreign] RFR 8217414: Remove bounds check in BoundedPointer constructor
Jorn Vernee
jbvernee at xs4all.nl
Mon Jan 21 16:39:12 UTC 2019
All good points, thanks.
I moved the checkAlive() and checkInBounds() calls to addr() and have
equals/hashCode/isNull use effectiveAddress() which doesn't do the
checks. So, I'm now allowing dead pointers to be used in those 3 methods
as well, since it seemed cleaner to either do all checks in addr() or
none of the checks in effectiveAddress(), instead of doing just the
bounds check in addr() and the liveliness check in effectiveAddress().
Is that okay?
Updated webrev:
http://cr.openjdk.java.net/~jvernee/panama/webrevs/8217414/webrev.03/
Jorn
Maurizio Cimadamore schreef op 2019-01-21 17:12:
> On 21/01/2019 15:54, Maurizio Cimadamore wrote:
>> Also, addr() is also where the liveness check takes place, so that's
>> already how the code works.
>
> Also, there doesn't seem to be much point in restricting the passing
> of a dead/out of bound pointer to a native function when the user can
> simply workaround by calling addr() on that pointer and pass the
> resulting long.
>
> I'm not saying that we should make the API bullet proof (with native
> code I think that would be hard to achieve), but we should at least
> try to make it hard for people to use the API in ways it is not
> intended to.
>
> Maurizio
More information about the panama-dev
mailing list