Constructing indexed var handles using the `MemoryLayout` API produces 
`VarHandle` which do not check the input indices for out-of-bounds conditions.
While this can never result in a VM crash (after all the memory segment will 
protect against "true" OOB access), it is still possible for an access 
expression to refer to parts of a segment that are logically unrelated.

This patch adds a "logical" bound check to all indexed var handles generated 
using the layout API.
Benchmarks are not affected by the check. Users are still able to create custom 
"unchecked" var handles, using the combinator API in `MethodHandles`.

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

Commit messages:
 - Tweak javadoc
 - Merge branch 'master' into vh_bound_checks
 - Initial push

Changes: https://git.openjdk.java.net/jdk/pull/8868/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8868&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8287244
  Stats: 73 lines in 3 files changed: 54 ins; 4 del; 15 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8868.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8868/head:pull/8868

PR: https://git.openjdk.java.net/jdk/pull/8868

Reply via email to