RFR(S): 8239072: subtype check macro node causes node budget to be exhausted

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Wed Mar 11 08:46:57 UTC 2020


Hi Roland,

The problem doesn't look specific to subtype checks, though new 
SubTypeCheck node exacerbates it.

The fix you propose adds an adhoc pass specifically for subtype checks 
to force expansion for simple cases.

Can we try to improve the situation for all macro nodes instead?

Assuming worst case scenario (200 + 50%) for every macro node does look 
too conservative.

IMO the root cause of the problem is not in macro expansion but 
preceding optimizations/inlining which don't take into account macro 
nodes and just treat them as ordinary ideal nodes when deciding whether 
to expand the graph or not and by how much.

But, as a stop-the-gap solution, can we relax the problematic check and 
perform it repeatedly during macro node expansion instead (possibly, 
interleaved with some optimization passes akin to what we do during 
incremental inlining [1]) in an attempt to squeeze expanded nodes into 
the graph? The chance to hit the hard node limit won't completely go 
away, but its likelihood should be much lower.

What do you think?

Best regards,
Vladimir Ivanov

[1] 
http://hg.openjdk.java.net/jdk/jdk/file/tip/src/hotspot/share/opto/compile.cpp#l2116

On 09.03.2020 16:15, Roland Westrelin wrote:
> 
> http://cr.openjdk.java.net/~roland/8239072/webrev.00/
> 
> Running Box2D with nashorn, I sometimes see that C2 bails out from
> compilation of the hottest method in the benchmark. It happens at macro
> nodes expansion time when C2 verifies it has enough room for macro
> expansion:
> 
>    if (C->check_node_count(C->macro_count() * 300, "out of nodes before macro expansion" ) )
>      return true;
> 
> For this particular method, C2 has hundreds of subtype checks to
> expand. Most of them expands to a simple comparison so the 300 factor
> above is quite pessimistic in this particular case. I propose
> transforming subtype checks to a simpler pattern when possible in
> SubTypeCheckNode::Ideal() instead of waiting for macro expansion. I
> would like to delay it until loop opts are over because a
> SubTypeCheckNode alone rather than a subgraph that feeds into a CmpP is
> more suitable for loop opts (split if in particular).
> 
> Roland.
> 


More information about the hotspot-compiler-dev mailing list