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

Maurizio Cimadamore mcimadamore at openjdk.org
Tue Mar 7 10:16:59 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.

This pull request has now been integrated.

Changeset: a377942f
Author:    Maurizio Cimadamore <mcimadamore at openjdk.org>
URL:       https://git.openjdk.org/panama-foreign/commit/a377942fcffcab11fb9c7a7388a2e763720f0190
Stats:     19 lines in 6 files changed: 8 ins; 2 del; 9 mod

8301803: Rename MemorySegment::array

Reviewed-by: jvernee

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

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


More information about the panama-dev mailing list