[foreign-abi] RFR: JDK-8248809: Consider supporting address dereference/allocation for platforms where pointers are not 64 bits
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Fri Sep 4 17:51:15 UTC 2020
This patch makes support for addresses more uniform, in a way that scales to platforms whose pointer size might be !=
64 bits. After considering a number of alternatives, we settled on something which, I think is pleasing for a number of
rteasons.
First, we added a new layout, namely `MemoryLayouts.ADDRESS`. This is the layout of a machine pointer, in the platform
in which the JVM runs. This is a useful piece of information to have regardless.
This new layout is then used in two places:
* In MemoryAccess, to decide whether we need a 32 or a 64 dereference handle to get/set addresses
* In NativeScope, again, to decide to which NativeScope factory we should delegate (the long vs. the int one)
This should slightly generalize what we have and also adds some extra helper methods to NativeScope which were dropped
in an earlier iteration, waiting for this issue to be addressed.
I've tweaked the NativeScope test in order to stress the new address-accepting factories.
-------------
Commit messages:
- Add better treatment for pointer sizes
Changes: https://git.openjdk.java.net/panama-foreign/pull/308/files
Webrev: https://webrevs.openjdk.java.net/?repo=panama-foreign&pr=308&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8248809
Stats: 125 lines in 5 files changed: 121 ins; 0 del; 4 mod
Patch: https://git.openjdk.java.net/panama-foreign/pull/308.diff
Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/308/head:pull/308
PR: https://git.openjdk.java.net/panama-foreign/pull/308
More information about the panama-dev
mailing list