RFR: 8267726: ZGC: array_copy_requires_gc_barriers too strict

Nils Eliasson neliasso at openjdk.java.net
Tue Jun 1 09:01:19 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

I filed RFE https://bugs.openjdk.java.net/browse/JDK-8268020

Yes - all the arraycopy and clone tests should be ported to IR verification. I might do that as a part of the RFE.

Thanks for the review Tobias!

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

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


More information about the hotspot-compiler-dev mailing list