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

Vladimir Ivanov vlivanov at openjdk.java.net
Mon Sep 6 14:20:22 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 accesses (`Object+offset`);
>  * mismatched access due to lack of type info on base oop (`Object:NotNull+offset`). 
> 
> Testing: hs-tier1 - hs-tier6

Vladimir Ivanov has updated the pull request incrementally with two additional commits since the last revision:

 - Refactor has_wide_mem
 - Update the test

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/5259/files
  - new: https://git.openjdk.java.net/jdk/pull/5259/files/45cd826d..6b93db70

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=5259&range=04
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=5259&range=03-04

  Stats: 27 lines in 3 files changed: 13 ins; 4 del; 10 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