RFR: 8269119: C2: Avoid redundant memory barriers in Unsafe.copyMemory0 intrinsic

Vladimir Ivanov vlivanov at openjdk.java.net
Wed Aug 25 22:28:39 UTC 2021


`Unsafe::copyMemory0` intrinsic unconditionally inserts barriers arounds the call to `unsafe_arraycopy` stub.
It is a conservative approach and barriers can be avoided in most common cases (similar to what is done for scalar unsafe accesses).

`Unsafe::copyMemory()` performs argument validation which limits inputs either
to off-heap location (null + absolute address) or primitive on-heap array.

The only cases when barriers are still needed are:
 * mixed (on-/off-heap) accesses;
 * mismatched access due to lack of type info on base oop (`Object:NotNull+offset` shape). 

Testing: hs-tier1 - hs-tier6

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

Commit messages:
 - 8269119: C2: Avoid redundant memory barriers in Unsafe.copyMemory0 intrinsic

Changes: https://git.openjdk.java.net/jdk/pull/5259/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=5259&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8269119
  Stats: 411 lines in 3 files changed: 404 ins; 0 del; 7 mod
  Patch: https://git.openjdk.java.net/jdk/pull/5259.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/5259/head:pull/5259

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


More information about the hotspot-compiler-dev mailing list