On Wed, 25 Oct 2023 13:08:06 GMT, Per Minborg <[email protected]> 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.
test/jdk/jdk/incubator/vector/AbstractVectorLoadStoreTest.java line 118:
> 116: private static boolean canBeConverted(IntFunction<MemorySegment>
> function, ValueLayout elementLayout) {
> 117: // Create a sample to analyze
> 118: MemorySegment s = function.apply(Long.BYTES);
I believe that a good way to test this is the following:
* each vector type operates as having a given element layout - for instance,
you can imagine the layout for IntVector to be `JAVA_INT` and so forth
* asking whether you load a segment into a vector is the same as asking whether
you can access the segment, at offset 0L, with the layout associated with the
vector (see above) - that is if MS::get throws, then vector load should also
throw (and viceversa)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16360#discussion_r1371817499