[code-reflection] RFR: Unreachable method or lambda exit [v2]

Paul Sandoz psandoz at openjdk.org
Fri Oct 18 21:01:29 UTC 2024


On Thu, 17 Oct 2024 22:56:09 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.
>
> Paul Sandoz has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Remove line number information
>  - Remove debug stuff

We should follow up with another fix for the switch expression example (presuming it is intentional and not a compiler bug?)

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

PR Comment: https://git.openjdk.org/babylon/pull/257#issuecomment-2423222800


More information about the babylon-dev mailing list