RFR: 8318678: Vector access on heap MemorySegments only works for byte[]
Maurizio Cimadamore
mcimadamore at openjdk.org
Wed Oct 25 14:00:38 UTC 2023
On Wed, 25 Oct 2023 13:08:06 GMT, Per Minborg <pminborg at openjdk.org> wrote:
> This PR proposes removing the restriction that only heap `MemorySegment` wrapping a `byte` array can be accessed by Vectors. Now any array type can be used provided the element alignment constraints are respected.
src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java line 3284:
> 3282: * for any lane {@code N} in the vector
> 3283: * @throws IllegalArgumentException if the memory segment is a heap segment that is
> 3284: * not backed by a {@code byte[]} array and if access to the backing array
This seems backwards - e.g. a ByteVector requires an alignment of 1. So I would expect to be able to pass _any_ segment?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16360#discussion_r1371810795
More information about the core-libs-dev
mailing list