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

Aleksey Shipilev shade at openjdk.java.net
Thu Apr 14 09:12:03 UTC 2022


On Wed, 13 Apr 2022 19:08:12 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

>> 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.

I massaged the code a bit: we only need to take care of pointer inputs to `Blackhole`, which was the issue about creating local vars before. In new code, we do the same thing as other nodes: expect the inputs to be registered already. 

Regarding `add_edge` and friends. It seems we still have to map the `Blackhole` node with `add_local_var` initially, because final processing would barf on unregistered `Blackhole` node. This forces our hand further with `add_edge`-ing its inputs, because EA further barfs when encountering the node with zero edges. This could have been avoided if we managed to process all inputs to `Blackhole` at the initial construction, but EA barfs on some of its inputs not yet registered. So we delay processing and process all inputs at final step, like AFAICS we do with call arguments. Makes sense?

Also added two IR tests.

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

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


More information about the hotspot-compiler-dev mailing list