RFR: 8289943: Simplify some object allocation merges [v13]
Vladimir Ivanov
vlivanov at openjdk.org
Thu Oct 27 07:02:28 UTC 2022
On Thu, 27 Oct 2022 00:36:07 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
> An other important purpose of RAM is to have information at SafePoints after merge point for reallocation during deoptimization. You need Klass information. I don't think having only Phis for values is enough.
Klass information is available either from Allocation node in `split_unique_types` or ConnectionGraph instance the Phi is part of.
> I am not sure how this could be possible. Currently EA rely on IGVN to propagate fields values based on unique memory slice. What you do with memory Load or Store nodes after merge point? Which memory slice you will use for them?
My understanding of how proposed approach is expected to work: merge points have to be simple enough to still allow splitting unique types for individual allocations.
For example, `eliminate_ram_addp_use()` replaces `Load (AddP (Phi base1 ... basen) off) mem` with `Phi (val1 ... valn)` and `eliminate_reduced_allocation_merge()` performs similar transformation for `SafePoint`s.
Alternatively, corresponding `Phi`s can be build incrementally while processing each individual `base` by `split_unique_types`. Or, just by splitting `Load`s through `Phi`:
Load (AddP (Phi base_1 ... base_n) off) mem
== split-through-phi ==>
Phi ((Load (AddP base_1 off) mem) ... (Load (AddP base_n off) mem))
== split_unique_types ==>
Phi ((Load (AddP base_1 off) mem_1) ... (Load (AddP base_n off) mem_n))
== IGVN ==>
Phi (val_1 ... val_n)
```
> There is check for it in ConnectionGraph::can_reduce_this_phi(). The only supported cases is when no deoptimization point (SFP or UNCT) after merge point. It allow eliminate SR allocations even if they merge with NSR allocations. This was idea.
That's nice! Now I see `has_call_as_user`-related code.
It means that only `Load (AddP (Phi base_1 ... base_n) off) mem` shapes are allowed now.
I believe the aforementioned split-through-phi transformation should handle it well:
Load (AddP (Phi base_1 ... base_n) off) mem
== split-through-phi ==>
Phi ((Load (AddP base_1 off) mem) ... (Load (AddP base_n off) mem))
== split_unique_types ==>
Phi (... (Load (AddP base_SR_i off) mem_i) ... (Load (AddP base_NSR_n off) mem) ...)
== IGVN ==>
Phi (... val_i ... (Load (AddP base_NSR_n off) mem) ... )
-------------
PR: https://git.openjdk.org/jdk/pull/9073
More information about the hotspot-compiler-dev
mailing list