RFR: 8345474: Translation for instanceof is not triggered when patterns are not used in the compilation unit [v2]

Maurizio Cimadamore mcimadamore at openjdk.org
Wed Dec 4 11:06:37 UTC 2024


On Wed, 4 Dec 2024 11:01:54 GMT, Aggelos Biboudis <abimpoudis at openjdk.org> wrote:

>> Our tests for #21539 covered the case of using `instanceof` as both a type comparison operator and a pattern matching operator in a single compilation unit. That concealed the fact that the translation is getting triggered only when the compilation unit `hasPatterns`. This was evident/reproducible also by experimentation using jshell. This PR addresses this issue.
>
> Aggelos Biboudis has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:
> 
>   8345474: Translation for instanceof is not triggered when patterns are not used in the compilation unit

We should *really* assess whether these complex checks to decide whether a pipeline step is needed or not are really required. The general feeling when they were added was that skipping a translation step (e.g. for lambdas) might be advantageous for performance, but we never really collected hard evidence. As this PR shows, this logic can backfire badly.

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

PR Comment: https://git.openjdk.org/jdk/pull/22541#issuecomment-2516990017


More information about the compiler-dev mailing list