RFR: 8284848: C2: Compiler blackhole arguments should be treated as globally escaping

Vladimir Kozlov kvn at openjdk.java.net
Wed Apr 13 19:11:15 UTC 2022


On Wed, 13 Apr 2022 17:40:40 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> src/hotspot/share/opto/escape.cpp line 825:
>> 
>>> 823:           set_escape_state(ptn, PointsToNode::GlobalEscape NOT_PRODUCT(COMMA "blackhole"));
>>> 824:         }
>>> 825:         add_edge(n_ptn, ptn);
>> 
>> Why not use `add_local_var_and_edge()` here?
>
> Because the input for the node might not be a `LocalVar` already, but rather `Field`, `Arraycopy`, etc.  `add_local_var_and_edge` checks this and fails on asserts. AFAICS, this is only safe to do for the node "output", but here we handle the node inputs. Maybe I should instead do what `Op_Phi` does?

No, Phi assumes similar type of inputs. You need to do similar to `call` node in its worst case:
https://github.com/openjdk/jdk/blob/master/src/hotspot/share/opto/escape.cpp#L1228
And you should not do `add_edge()` here since there are no data flow through Blackhole node.

-------------

PR: https://git.openjdk.java.net/jdk/pull/8228


More information about the hotspot-compiler-dev mailing list