C2: cyclic IR for JVMS

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Thu Dec 18 16:58:53 UTC 2014


Kris, Vladimir,

As my investigations show, it's a leftover from a loop.
CallStaticJava represents loop counter increment.

The graph is as follows:
Phi (Region) (Proj #5 (CallStaticJava ... Phi(backref)...))

The Region is dead, but RegionNode::is_unreachable_region doesn't detect 
that. Node::simple_data_loop_check(Phi, Proj) doesn't find the cycle, 
because most of Proj nodes have Flag_is_dead_loop_safe set [1].
And I don't understand why it is so. Is the check in 
Node::is_dead_loop_safe() too weak or Flag_is_dead_loop_safe too 
"optimistic"? :-)

Best regards,
Vladimir Ivanov

[1] 
http://hg.openjdk.java.net/jdk9/hs-comp/hotspot/file/ff29b5858de6/src/share/vm/opto/multnode.hpp#l72

On 12/18/14, 4:07 AM, Vladimir Kozlov wrote:
> Nope, it is illegal. Except for dead code.
>
> There is code in  RegionNode::Ideal which tries to detect dead loops and
> don't do transformation.
>
>      if (this->is_Loop() && (del_it == LoopNode::EntryControl ||
>                              del_it == 0 &&
> is_unreachable_region(phase)) ||
>         !this->is_Loop() && has_phis && is_unreachable_region(phase)) {
>
> Vladimir K
>
> On 12/17/14 4:01 PM, Vladimir Ivanov wrote:
>> Hi!
>>
>> I stumbled upon the following cyclic Ideal graph shape:
>>    21580  CallStaticJava  === ... 21585 ... // some local in JVMS
>>    21585  Proj    ===  21580 #5
>>
>> Is it a legal shape? It looks broken to me.
>> Or do we fix such quirks later in the pipeline?
>>
>> It's a result of a transformation (Phi removal [1]) in RegionNode::Ideal
>> from the following shape:
>>    21580  CallStaticJava  === ... 21457 ... // some local in JVMS
>>    21585  Proj    ===  21580 #5
>>    21457  Phi     ===  21454  21585
>>
>> I'm asking because it breaks compilation during incremental inlining.
>>
>> Best regards,
>> Vladimir Ivanov
>>
>> [1]
>> http://hg.openjdk.java.net/jdk9/hs-comp/hotspot/file/ff29b5858de6/src/share/vm/opto/cfgnode.cpp#l587
>>
>>


More information about the hotspot-compiler-dev mailing list