[foreign-memaccess+abi] RFR: 8301803: Rename MemorySegment::array
Maurizio Cimadamore
mcimadamore at openjdk.org
Mon Mar 6 14:33:33 UTC 2023
This patch picks up a loose end from Java 20: the name of `MemorySegment::array` is potentially too specific and will not scale when memory segment will be able to cover parts of Java objects contained flattened value types. The method is renamed here to `heapBase`, which is more general.
As I was fixing this, I realized that the behavior of this method was undocumented - that is, the method returns an empty optional for native segments. Also, I realized that for heap segments we did not check the reado-only status. The ByteBuffer does this, to prevent the contents of a read-only buffer to be written using the array. We should do the same here.
-------------
Commit messages:
- Initial push
Changes: https://git.openjdk.org/panama-foreign/pull/809/files
Webrev: https://webrevs.openjdk.org/?repo=panama-foreign&pr=809&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8301803
Stats: 19 lines in 6 files changed: 8 ins; 2 del; 9 mod
Patch: https://git.openjdk.org/panama-foreign/pull/809.diff
Fetch: git fetch https://git.openjdk.org/panama-foreign pull/809/head:pull/809
PR: https://git.openjdk.org/panama-foreign/pull/809
More information about the panama-dev
mailing list