[code-reflection] RFR: Unreachable method or lambda exit
Paul Sandoz
psandoz at openjdk.org
Thu Oct 17 22:51:43 UTC 2024
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.
-------------
Commit messages:
- Unreachable method or lambda exit.
Changes: https://git.openjdk.org/babylon/pull/257/files
Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=257&range=00
Stats: 228 lines in 8 files changed: 217 ins; 2 del; 9 mod
Patch: https://git.openjdk.org/babylon/pull/257.diff
Fetch: git fetch https://git.openjdk.org/babylon.git pull/257/head:pull/257
PR: https://git.openjdk.org/babylon/pull/257
More information about the babylon-dev
mailing list