Integrated: 8317336: Assertion error thrown during 'this' escape analysis
Archie Cobbs
acobbs at openjdk.org
Thu Oct 12 16:54:51 UTC 2023
On Sun, 1 Oct 2023 19:48:46 GMT, Archie Cobbs <acobbs at openjdk.org> wrote:
> The 'this' escape analyzer was assuming that lambas could always be treated like blocks, in the sense that we can assume a block can never end in a plain expression. This assumption is not true for lambda's of the form `() -> foo` which do exactly that. In the case that `foo` was `this`, an assertion failure would ensue.
>
> This patch explicitly clears any leftover `ExprRef`'s after evaluating a lambda body; this restores the asserted invariant when the lambda body is an expression.
>
> This also fixes another variant of the same bug caused by certain enhanced `for()` loops. In this case, the leftover `ExprRef` was from evaluating the loop expression. This was just a side-effect of the analyzer failing to override `TreeScanner` to actually assign the loop expression to the loop variable (that will be fixed later in another patch).
This pull request has now been integrated.
Changeset: a8473b70
Author: Archie Cobbs <acobbs at openjdk.org>
Committer: Vicente Romero <vromero at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/a8473b70797ef8fa0704774bfadbd84cb33a1d53
Stats: 25 lines in 2 files changed: 23 ins; 0 del; 2 mod
8317336: Assertion error thrown during 'this' escape analysis
Reviewed-by: vromero
-------------
PR: https://git.openjdk.org/jdk/pull/16001
More information about the compiler-dev
mailing list