RFR: 8267726: ZGC: array_copy_requires_gc_barriers too strict
Tobias Hartmann
thartmann at openjdk.java.net
Tue Jun 1 07:11:21 UTC 2021
On Thu, 27 May 2021 19:59:59 GMT, Nils Eliasson <neliasso at openjdk.org> wrote:
> I found some cases where an arraycopy clone is eliminated with G1 but not with ZGC. This is probably something that wasn't updated fully after the transition to late gc barrier insertion.
>
> During parse and optimizaton phases array_copy_requires_gc_barriers should return false for clones of oop-arrays. Clone of oop-arrays should be treated the same way as clones of primitive-arrays. During optimization phase - only clones of instances should return true - and that's because they can't be reduced to a raw bulk copy, Clones of instances must either become deconstructed into field copies, or be handled in a special call.
>
> During expansion array_copy_requires_gc_barriers must return true - because we must use a copy with barriers.
>
> To fix this I had to add an extra field to array_copy_requires_gc_barriers to be able to handle instance clones separately. I will follow up with a cleanup. The intersection of arraycopy-kinds and array_copy_requires_gc_barriers-method is the source of much unnecessary complexity.
>
> Please review,
> Best regards,
> Nils Eliasson
Looks good to me. Please file a cleanup RFE and link it to this bug. Also, this might be a good candidate for adding a regression test once the IR verification framework is there.
-------------
Marked as reviewed by thartmann (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/4230
More information about the hotspot-compiler-dev
mailing list