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

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 generate_limit_guard() :
> 
> if (a.length u< offset+copy_length) uncommon_trap; else arraycopy;
> 
> which is reversed by igvn to
> 
> if (offset+copy_length u< a.length) arraycopy; else uncommon_trap;
> 
> 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 gen_subtype_check() 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