[foreign] RFR 8217989: Consolidate BoundedPointer implementation

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Wed Jan 30 12:19:09 UTC 2019


On 30/01/2019 12:10, Jorn Vernee wrote:
> I agree that Scope and AccessMode belong on BoundedPointer as well.
>
> The 3 new helper methods in Util are only being used by 
> BoundedPointer, should the implementation of those 3 methods be moved 
> to BoundedPointer? AFAICT that would also allow you to remove/make 
> private the toUnsafeBase and toUnsafeOffset accessors.
>
> Or at least; those 3 methods use BoundedPointer::toUnsafeBase and 
> BoundedPointer::toUnsafeOffset, so imho they should also have 'unsafe' 
> in their name since they don't add any safety. i.e.: 
> Util::copyToUnafe, Util::getBitsUnsafe, and Util::putBitsUnsafe.

Yeah - that seems like a good suggestion; I was moving them back and 
forth and I ended up there because Util already had a grab of a UNSAFE 
object.

Maurizio

>
> Cheers,
> Jorn
>
> Maurizio Cimadamore schreef op 2019-01-29 15:38:
>> Hi,
>> in the light of recent discussions re. access modes, I decided to go
>> ahead and cleanup the split between BoundedPointer and
>> BoundedMemoryRegion, to avoid duplication of functionalities.
>>
>> This patch does two things:
>>
>> * moves Scope, AccessMode on BoundedPointer (where they belong, IMHO)
>> * reduce BoundedMemoryRegion to a simple helper class used to check
>> pointer bounds (and renames it to MemoryBoundInfo)
>>
>> I also took care of minor cleanups, such as adding better
>> encapsulation for pointer/array implementation fields.
>>
>> Webrev:
>>
>> http://cr.openjdk.java.net/~mcimadamore/panama/8217989/
>>
>> Maurizio


More information about the panama-dev mailing list