RFR: 8289943: Simplify some object allocation merges [v13]

Vladimir Kozlov kvn at openjdk.org
Thu Oct 27 00:40:09 UTC 2022


On Wed, 26 Oct 2022 23:03:21 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:

> 
> As of now, it serves dual purpose. It (1) marks a merge point as safe to be untangled during SR; and (2) caches information about field values.

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.

> 
> I believe you can solve it in a cleaner manner without introducing placeholder nodes and connection graph adjustments. IMO it's all about keeping escape status and properly handling "safe" merges in `split_unique_types`.
> 
> One possible way to handle merge points is:
> 
> * Handle merge points in `adjust_scalar_replaceable_state` and refrain from marking relevant bases as NSR when possible.
> * After `adjust_scalar_replaceable_state` is over, every merge point should have all its inputs as either NSR or SR.
> * `split_unique_types` incrementally builds value phis to eventually replace the base phi at merge point while processing SR allocations one by one.
> * After `split_unique_types` is done, there are no merge points anymore, each allocation has a dedicated memory graph and allocation elimination can proceed as before.

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? 

> 
> Do you see any problems with such an approach?
> 
> One thing still confuses me though: the patch mentions that RAMs can merge both eliminated and not-yet-eliminated allocations. What's the intended use case? I believe it's still required to have all merged allocations to be eventually eliminated. Do you try to handle the case during allocation elimination when part of the inputs are already eliminated and the rest is pending their turn?

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.

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

PR: https://git.openjdk.org/jdk/pull/9073


More information about the hotspot-compiler-dev mailing list