On Fri, 13 Jan 2023 17:49:05 GMT, Archie L. Cobbs <d...@openjdk.org> wrote:
>> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ThisEscapeAnalyzer.java >> line 685: >> >>> 683: >>> 684: @Override >>> 685: public void visitDoLoop(JCDoWhileLoop tree) { >> >> I was thinking, code can also loop using labels and `break` / `continue`, >> not something we need to cover as part of this prototype but could be a >> future TODO that we can document > > Hah - I didn't think of that. But actually I don't think we would miss > anything (see if you agree). > > The code "executes" every loop, in a sort-of simulation, adding references > until the set of references converges. Moreover, that reference set is > "append only" while this is happening. > > Therefore, during actual execution, a break or continue may cause less code > to be executed than in our simulation, but never more code than our > simulation. So during actual execution it might be that fewer actual 'this' > references are created, but never more. > > Therefore, this effect might cause false positives (which of course we > already have with loops and code in general because we take all possible > branches), but never false negatives. yep I agree ------------- PR: https://git.openjdk.org/jdk/pull/11874