RFR (L): 7173584: Implement arraycopy as a macro node (original) (raw)

Roland Westrelin roland.westrelin at oracle.com
Fri Sep 28 07:51:37 PDT 2012


Vladimir,

Thanks for taking a look at this.

I am not comfortable with this predicate change. The check come from generatelimitguard() :

if (a.length u< offset+copylength) uncommontrap; else arraycopy; which is reversed by igvn to if (offset+copylength u< a.length) arraycopy; else uncommontrap; So it should not be IfFalse projection. Can you explain the case which you hit?

This is the java code that triggers this:

   for (int i=0; i<a1.length; i++) {

        a2 = new …[a3.length+a1.length-i-1];

        System.arraycopy(a3, 0, a2, 0, a3.length);
        System.arraycopy(a1, i+1, a2, a3.length, a1.length-i-1);
    }

For the first arraycopy, one of the check is:

if (a2.length < a3.length) uncommon_trap; else arraycopy;

if (a3.length + a1.length-i-1 < a3.length) uncommon_trap; else arraycopy;

a1.length is 5

if (a3.length + 4 - i < a3.length) uncommon_trap; else arraycopy;

a3.length is a loop invariant.

Also instead of duplicating gensubtypecheck() in macroArrayCopy.cpp can you modify the original one to work for you (by passing additional flag)?

Ok I'll do that.

Roland.



More information about the hotspot-compiler-dev mailing list