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

Tobias Hartmann thartmann at openjdk.java.net
Mon Sep 7 10:00:35 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 incrementally with one additional commit since the last revision:

  Fixed bug in generate_generic_copy stub: Non-array src is not detected


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

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

  Stats: 29 lines in 2 files changed: 26 ins; 0 del; 3 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