The Foreign Memory API supports viewing a `MemorySegment` as a `ByteBuffer`, an 
instance of which can then be passed to the vector load/store access methods.

Such `ByteBuffer` access requires accesses are scoped (a method annotated with 
`ScopedMemoryAccess.Scoped`) and the `ByteBuffer`'s scope (instance of 
`ScopedMemoryAccess.Scope`) checked for validity. Thereby ensuring exceptional 
failure if the underlying segment is shared and is closed. 

All Vector tests pass on linux-x64, linux-aarch64, macosx-x64, and windows-x64.

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

Commit messages:
 - Move byte buffer test data specifics to separate class
 - Move scoped methods to ScopedMemoryAccess
 - 8269246: Scoped ByteBuffer vector access

Changes: https://git.openjdk.java.net/jdk17/pull/129/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk17&pr=129&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8269246
  Stats: 455 lines in 42 files changed: 186 ins; 95 del; 174 mod
  Patch: https://git.openjdk.java.net/jdk17/pull/129.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk17 pull/129/head:pull/129

PR: https://git.openjdk.java.net/jdk17/pull/129

Reply via email to