RFR: 8242029: AArch64: skip G1 array copy pre-barrier if marking not active
Erik Österlund
erik.osterlund at oracle.com
Tue Apr 7 07:33:23 UTC 2020
Hi Nick,
Note that you only need ISB when returning from call_VM, not call_VM_leaf. Leaf calls can’t safepoint, and hence the ISB is redundant. Arraycopy uses leaf calls. So while this optimization is great for this case, maybe removing ISB fronleaf calls has a wider effect.
It also appears to me that with Stuart’s new nmethod entry barriers enabled, ISB is never required on returns, as oop are no longer embedded in the instruction stream then (which is what the ISB protects against).
Thanks,
/Erik
> On 7 Apr 2020, at 09:19, Nick Gasson <nick.gasson at arm.com> wrote:
>
> Hi,
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8242029
> Webrev: http://cr.openjdk.java.net/~ngasson/8242029/webrev.0/
>
> Currently on AArch64 the G1GC array copy pre-barrier unconditionally
> performs a VM call into G1BarrierSetRuntime, but this is a no-op if
> marking is not in progress.
>
> This patch adds a check to skip the call unless marking is in
> progress. X86 already has this optimisation and I can't see a reason not
> to do it on AArch64 as well.
>
> Tested jtreg hotspot_all_no_apps, jdk_core.
>
> Results of ArrayCopy.arrayCopyObject* JMH benchmarks:
>
> Before:
>
> Benchmark Mode Cnt Score Error Units
> ArrayCopy.arrayCopyObject avgt 15 117.307 ? 11.607 ns/op
> ArrayCopy.arrayCopyObjectNonConst avgt 15 107.786 ? 2.692 ns/op
> ArrayCopy.arrayCopyObjectSameArraysBackward avgt 15 76.381 ? 0.761 ns/op
> ArrayCopy.arrayCopyObjectSameArraysForward avgt 15 79.519 ? 3.433 ns/op
>
> After:
>
> Benchmark Mode Cnt Score Error Units
> ArrayCopy.arrayCopyObject avgt 15 86.161 ? 6.150 ns/op
> ArrayCopy.arrayCopyObjectNonConst avgt 15 83.539 ? 0.682 ns/op
> ArrayCopy.arrayCopyObjectSameArraysBackward avgt 15 52.388 ? 0.732 ns/op
> ArrayCopy.arrayCopyObjectSameArraysForward avgt 15 54.619 ? 1.278 ns/op
>
> The VM call overhead can be quite high on AArch64 as we insert a
> serialising ISB instruction on every native->Java return.
>
>
> Thanks,
> Nick
More information about the hotspot-gc-dev
mailing list