On Fri, 13 Jan 2023 17:35:08 GMT, Vicente Romero <vrom...@openjdk.org> wrote:

>> Archie L. Cobbs has updated the pull request incrementally with 16 
>> additional commits since the last revision:
>> 
>>  - Fix bug where all but the last yeild statement were being ignored.
>>  - Add method RefSet.mapInto() and use to refactor/clean up.
>>  - Fix possible assertion failure when handling if statements.
>>  - Use Symbol methods isSubClass() and isEnclosedBy() instead of homebrew 
>> stuff.
>>    
>>    Suggested-by:   mcimadamore
>>  - Add comment regarding limitations of expresison type filtering.
>>  - Add a few more DISABLED_WARNINGS to unbreak build.
>>  - Clean up handling of switch expressions a bit.
>>  - Remove unused method variant of analyzeTree().
>>  - Avoid all caps in comments.
>>  - Clarify confusing comment.
>>  - ... and 6 more: https://git.openjdk.org/jdk/compare/6e96a7d7...edf3c3f5
>
> 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.

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

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

Reply via email to