[foreign-memaccess+abi] RFR: 8301803: Rename MemorySegment::array

Jorn Vernee jvernee at openjdk.org
Mon Mar 6 14:33:33 UTC 2023


On Mon, 6 Mar 2023 14:18:52 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> 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.

Marked as reviewed by jvernee (Committer).

-------------

PR: https://git.openjdk.org/panama-foreign/pull/809


More information about the panama-dev mailing list