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

Vladimir Ivanov vlivanov at openjdk.java.net
Tue Sep 7 11:38:44 UTC 2021


On Wed, 25 Aug 2021 22:17:05 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:

> `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

This pull request has now been integrated.

Changeset: 377b1867
Author:    Vladimir Ivanov <vlivanov at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/377b186724473475480b834d99c38b8161bf6917
Stats:     499 lines in 2 files changed: 482 ins; 7 del; 10 mod

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

Reviewed-by: thartmann, roland

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

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


More information about the hotspot-compiler-dev mailing list