RFR(XS): 8227384: C2 compilation fails with "graph should be schedulable" when running with -XX:-EliminateLocks

Vladimir Kozlov vladimir.kozlov at oracle.com
Tue Aug 6 21:12:40 UTC 2019

 > The mark word load for unlocking is created after the release lock
 > membar with both control and memory set to projections of the
 > membar. Because the allocation is non escaping, when the load is later
 > processed, its memory is changed to be above the membar while the
 > control is unchanged. A precedence edge is added by anti dependence
 > checking to force the load above the membar while its control is
 > below. As a result, the graph is not schedulable.

This reminds me bug Tobias is working on 8228772 [1].

On 7/24/19 4:29 AM, Roland Westrelin wrote:
> Here is a new fix:
> http://cr.openjdk.java.net/~roland/8227384/webrev.01/

Expanding Locks before Allocations is good idea. We do eliminate Locks before eliminating 
Allocations. Will a load after IGVN optimization folds with load generated in 
PhaseMacroExpand::initialize_object() ?

I don't see offset check in is_new_object_mark_load(). How it known it is load from *mark word*?

> This time the fix makes sure the load of the mark word that causes the
> graph to be unschedulable is properly eliminated. This is achieved by
> proceeding with macro expansions in 2 steps: first all macro nodes
> except allocations and then only allocations. A pass of igvn is perfomed
> between the 2 steps. That's where the load from a newly allocated object
> is eliminated by a new Ideal or Value transformation.
> Roland.


[1] https://bugs.openjdk.java.net/browse/JDK-8228772

More information about the hotspot-compiler-dev mailing list