Support for 64-bit pointers
Radosław Smogura
mail at smogura.eu
Fri Jan 1 08:37:02 UTC 2021
Hi all,
I hope this message finds you well & first of all thank you all for wonderful implementation this can be major addition to JDK.
I was working / checking JDK 16 foreign implementation, and realised that it may not support all 64bit pointers.
In current version of implementation (many places), there’s a lot of range checks. However longs in Java are signed, and C pointers are unsigned so, at least for x86-64 architectures this should be taken on account, otherwise we would not be able to address whole memory in straightforward way (largest block size is 2^31, can directly address upper half of memory).
Can I suggest:
* The range checks using comparison operators should be replaced by Long.compareUnsigned;
* Remove checks if lower bound / upper bound is negative - negative values represent upper half of memory
* Remove checks and usage of Long.MAX_VALUE - i.e. MemorySegment.allocateRestricted uses EVRYTING which is bounded to (0, Long.MAX), but should be to (0, -1), or (0, 0xFFFFFFFF_FFFFFFFF).
Kind regards,
Rado
More information about the panama-dev
mailing list