RFR: 8262295: C2: Out-of-Bounds Array Load from Clone Source

Richard Reingruber rrich at openjdk.java.net
Wed Mar 17 11:08:02 UTC 2021


This c2 fix makes the optimization of loads from the result array of a
Object.clone() call dependent on a compile time range check in order to prevent
out-of-bounds array loads described in JDK-8262295.

Testing: The included reproducer test. The fix passed also our CI testing: JCK
and JTREG, also in Xcomp mode, SPECjvm2008, SPECjbb2015, SAP specific tests with
fastdebug and release builds on all platforms.

Alternatively the transformed load could be made dependent on a range check at
runtime. Based on our automated benchmarking it wouldn't be worth
it. Our benchmark results include quite a bit of noise though.

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

Commit messages:
 - 8262295: C2: Out-of-Bounds Array Load (FIX)
 - 8262295: C2: Out-of-Bounds Array Load (TEST)

Changes: https://git.openjdk.java.net/jdk/pull/2708/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2708&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8262295
  Stats: 112 lines in 2 files changed: 111 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2708.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2708/head:pull/2708

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


More information about the hotspot-compiler-dev mailing list