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

Tobias Hartmann thartmann at openjdk.java.net
Mon Sep 7 14:17:04 UTC 2020

> 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.

Tobias Hartmann has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev
excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since
the last revision:

 - Merge branch 'lworld' into JDK-8252506
 - Fixed bug in generate_generic_copy stub: Non-array src is not detected
 - Merge branch 'lworld' into JDK-8252506
 - 8252506: [lworld] Multiple issues with C2's arraycopy intrinsic


  - all: https://git.openjdk.java.net/valhalla/pull/178/files
  - new: https://git.openjdk.java.net/valhalla/pull/178/files/d72baa76..361770b9

 - full: https://webrevs.openjdk.java.net/?repo=valhalla&pr=178&range=03
 - incr: https://webrevs.openjdk.java.net/?repo=valhalla&pr=178&range=02-03

  Stats: 10 lines in 2 files changed: 7 ins; 2 del; 1 mod
  Patch: https://git.openjdk.java.net/valhalla/pull/178.diff
  Fetch: git fetch https://git.openjdk.java.net/valhalla pull/178/head:pull/178

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

More information about the valhalla-dev mailing list