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

Roland Westrelin rwestrel at redhat.com
Mon Nov 27 13:08:35 UTC 2017


Hi Tobias,

Thanks for reviewing this.

> arraycopynode.cpp:
> - lines 253, 257: I don't think this is necessary because src_elem/dest_elem are only used in line 261 and you can
> replace the check in line 272 by "ary_src->klass()->is_value_array_klass()"

copy_type is set to dest_elem and is returned from the method so it's
not that simple, right?

> type.cpp:
> - Could you explain why these changes are necessary? In line 4773, how can offset be < 0?

I hit that problem when running the new tests with -Xcomp. In the
address computation of:

src[i-1]

the constant part is negative (header size + (-1) * field offset).

> valuetypenode.cpp
> - line 323: Why is this required?

I think the problem was: 

when converting an arraycopy to a series of loads/stores, the memory
state is a MergeMem mm,

first load a value, without the change, memory edge is mm

store the value, memory state is one of the input of mm, mm is updated
to point to the store

and we have a cycle:

ST->LD->MM-\
^----------/

Roland.



More information about the valhalla-dev mailing list