[aarch64-port-dev ] RFR: 8242029: AArch64: skip G1 array copy pre-barrier if marking not active

Nick Gasson nick.gasson at arm.com
Wed Apr 8 06:22:49 UTC 2020


On 04/07/20 17:55 pm, Andrew Haley wrote:
>
> The patch looks good, thanks.
>

Thanks, pushed it.

>> 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.
>
> Indeed not. I don't quite remember the history of this, but I guess
> that this optimization was added to x86 after we did AArch64.

I'm wondering if it's possible to optimise the array copy post-barrier
in some cases as well. That VM call ends up in G1BarrierSet::invalidate
which has a loop:

  // skip initial young cards
  for (; byte <= last_byte && *byte == G1CardTable::g1_young_card_val(); byte++);

If the card table entries for the whole array are
G1CardTable::g1_young_card_val() then it's a no-op. I tried replicating
this loop in the barrier set assembly as a filter and only calling into
the runtime when we know it has work to do. This seems to work, and
gives a similar magnitude speed-up on the ArrayCopy microbenchmarks to
the above patch. Removing the ISB on leaf calls helps too but skipping
the call entirely is a bigger win.

Do you think this is safe and worth doing?


Thanks,
Nick


More information about the aarch64-port-dev mailing list