RFR(S): fix System.arraycopy() C2 intrinsics with arrays of value types

Roland Westrelin rwestrel at redhat.com
Fri Dec 8 16:13:20 UTC 2017


I've rerun tests and found a number of issues. Here is a new webrev:

http://cr.openjdk.java.net/~roland/valhalla/arraycopy/webrev.01/

and the diff on top of the previous webrev:

http://cr.openjdk.java.net/~roland/valhalla/arraycopy/webrev.01/

1) TestArrays had no test for the transformation of a small clone() to a
series of loads/stores

2) In GraphKit, the array allocation code doesn't hook slices for all
fields of a flatten array. That prevents some optimizations.

3) ValueTypeNode::make_from_oop() can see a null oop (if it loads a non
flattened value field from an object that was just allocated). There's
no way to query the value klass from the oop then so I changed
ValueTypeNode::make_from_oop() so it takes the ciValueKlass* as
argument.

4) Parse::return_current() has code that, if value is not null,
allocates a new value, updating control, memory and io in the
process. But the update to control/memory/io is ignored because the code
that propagates the new control/memory/io is before:

   SafePointNode* exit_return = _exits.map();
   exit_return->in( TypeFunc::Control  )->add_req( control() );
   exit_return->in( TypeFunc::I_O      )->add_req( i_o    () );
   Node *mem = exit_return->in( TypeFunc::Memory   );

5) I also fixed a few smaller issues in the array copy code.

Roland.


More information about the valhalla-dev mailing list