RFR(M): 8130847: Cloned object's fields observed as null after C2 escape analysis

Vladimir Kozlov vladimir.kozlov at oracle.com
Tue Jul 28 16:29:50 UTC 2015

The next change puzzles me:

-         if (!call->may_modify(tinst, phase)) {
+         if (call->may_modify(tinst, phase)) {
-           mem = call->in(TypeFunc::Memory);
+           assert(call->is_ArrayCopy(), "ArrayCopy is the only call 
node that doesn't make allocation escape");

Why only ArrayCopy? I think it is most of calls. What set of tests you ran?

Methods naming is confusing. membar_for_arraycopy() does not check for 
membar but for calls which can modify. handle_arraycopy() could be 

Add explicit check:
  && strcmp(_name, "unsafe_arraycopy") != 0)


On 7/28/15 7:05 AM, Roland Westrelin wrote:
> http://cr.openjdk.java.net/~roland/8130847/webrev.00/
> When an allocation which is the destination of an ArrayCopyNode is eliminated, field’s values recorded at a safepoint (to reallocate the object) do not take the ArrayCopyNode into account at all and the effect or the ArrayCopyNode is lost on a deoptimization. This fix records values from the source of the ArrayCopyNode, emitting new loads if necessary.
> I also use the opportunity to pin the loads generated in LoadNode::can_see_arraycopy_value() because they depend on all checks that validate the array copy and not only on the check that immediately dominates.
> Roland.

More information about the hotspot-compiler-dev mailing list