RFR: 8280541: remove self-recursion of ConnectionGraph::find_inst_mem() [v2]

Xin Liu xliu at openjdk.java.net
Wed Feb 2 18:12:12 UTC 2022


On Mon, 31 Jan 2022 23:52:45 GMT, Dean Long <dlong at openjdk.org> wrote:

>  Normally when converting recursive to iterative, I would expect to see both push and pop operations, but I only see push operations here.

For the self-recursion case, the invariant of find_inst_mem is "the the result is either MemNode, PhiNode, InitializeNode" and "the memslice of result is alias_idx ".  As a result, the result won't change.  We can leverage this property to backpatch all MergeMem nodes.  It's similar to tail recursion optimization. we reset the stackframe and arguments to avoid recursion.
 
> I don't think it makes sense to remove only self-recursion here.I think it makes the code less readable (see JDK-8276219). 

I agree.  I just feel this code change is easy. Please check the 2nd revision that I bring back the assertion code.  now we have iterative EA. It may give us more compilation-time pressure than before.

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

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


More information about the hotspot-compiler-dev mailing list