[code-reflection] Integrated: Unreachable method or lambda exit

Paul Sandoz psandoz at openjdk.org
Fri Oct 18 21:06:45 UTC 2024


On Thu, 17 Oct 2024 22:48:13 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:

> Incorrect code models are generated for cases where a return operation (with no operand) is inserted for an unreachable area of code. This is ambiguous when the method or lambda body returns a value.
> 
> For such cases we can instead insert an unreachable operation. Transformations can more easily ignore that.
> 
> We could take this further and replace a yield or java.continue operation with an unreachable operation e.g. for say
> 
>         {
>             {
>                 return;
>             }
>             // unreachable
>         }
>         // unreachable
> ``` 
> or 
> 
> 
>         while (true) {
>             while(true) {
> 
>             }
>             // unreachable
>         }
>         // unreachable
> 
> 
> However, in such cases there is no ambiguity regarding the yield or java.continue operation since they never accept an operand in such cases and transformations can more easily ignore them if need be. For now i have left this as is.

This pull request has now been integrated.

Changeset: d04447d4
Author:    Paul Sandoz <psandoz at openjdk.org>
URL:       https://git.openjdk.org/babylon/commit/d04447d4b0aa9cb0eca60a6758f6e38edcaa77a4
Stats:     227 lines in 7 files changed: 216 ins; 2 del; 9 mod

Unreachable method or lambda exit

Reviewed-by: mcimadamore

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

PR: https://git.openjdk.org/babylon/pull/257


More information about the babylon-dev mailing list