[9] RFR(S): 8179678: ArrayCopy with same src and dst can cause incorrect execution or compiler crash

Roland Westrelin rwestrel at redhat.com
Thu May 11 08:33:46 UTC 2017


http://cr.openjdk.java.net/~roland/8179678/webrev.00/

When possible:

System.arraycopy(src, spos, dst, dpos, l);
v = dst[i];

is transformed to:

System.arraycopy(src, spos, dst, dpos, l);
v = src[i + (spos - dpos)];

So the arraycopy has a chance to be eliminated. This breaks if src and
dst are the same arrays and src[i + (spos - dpos)] is written to by the
arraycopy. We need to validate that either src[i + (spos - dpos)] is not
modified by the arraycopy or src and dst are not the same.

Roland.


More information about the hotspot-compiler-dev mailing list