[lworld] RFR: 8252506: [lworld] Multiple issues with C2's arraycopy intrinsic

Tobias Hartmann thartmann at openjdk.java.net
Tue Sep 8 07:52:49 UTC 2020

On Fri, 4 Sep 2020 10:02:41 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:

> This patch fixes multiple issues in C2's arraycopy/copyof/clone intrinsics:
> - Flat inline type arrays containing oops might be copied without GC barriers.
> - Missing membarrier in copyOf code at macro expansion
> - We can often avoid flat/null-free checks by relying on the src <: dst subtype check
> - We often know at parse time that a flat array does not contain oops and should make use of that information
> - And more.. Hopefully the comments in the code are self-explanatory
> Other changes:
> - generic_arraycopy stub needs to handle flat/null-free inline type arrays
>   - Bail if src is flat or dst is flat/null-free
>   - Primitive array verification code is broken because array tag contains more bits
>   - The "Load layout helper" comment needs adjustment as well but I'll wait with that until we've moved bits to the mark
>     word
> - C1 arraycopy intrinsic does not need to check arguments to generic_arraycopy stub (moved checks below)
> - Added asserts and runtime verification code to catch issues earlier
> - Added lots of test for all issues I've found and new IR matching rules to verify that all arraycopy optimizations work
>   as expected
> - Some refactoring
> I've identified some remaining optimization opportunities and marked them with "TODO 8251971" in code and tests.

Thanks Roland!


PR: https://git.openjdk.java.net/valhalla/pull/178

More information about the valhalla-dev mailing list