Integrated: 8337102: JITTester: Fix breaks in static initialization blocks
Evgeny Nikitin
enikitin at openjdk.org
Thu Aug 15 05:38:53 UTC 2024
On Wed, 24 Jul 2024 10:28:54 GMT, Evgeny Nikitin <enikitin at openjdk.org> wrote:
> Static initialisation blocks (SIBs) should not have `break`s in their code, as well as their descendants. Currently, StaticConstructorDefinitionFactory allows them, causing non-compilable constructions like this:
>
>
> class Test_0 {
> static {
> if (true) {
> break; // <- compilation error here
> }
> }
> }
>
>
> It seems like previously an attempt have been made to resolve this by disabling SIBs whatsoever.
>
> Currently, out of 100 generated tests we have 2-3 compilation errors.
> Allowing SIBs raises this to 80 out of 100 tests failing due to erroneous 'break' blocks.
> Disabling breaks in StaticConstructorDefinition gives us SIBs, and returns failure rate to the same 2-3%.
> Disabling breaks in StaticConstructorDefinition doesn't prevent breaks from happening, as loop factories (`ForFactory`, `WhileFactory`, etc.) explicitly allow for breaks in their descendant trees.
>
> Testing:
> 1. 200-300 generations in various setups to get the numbers mentioned above;
> 2. I checked manually that breaks do not disappear from code,
> 3. ... and appear in loops' (for, while, do-while) descendants.
This pull request has now been integrated.
Changeset: 4669e7b7
Author: Evgeny Nikitin <enikitin at openjdk.org>
Committer: Tobias Hartmann <thartmann at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/4669e7b7b02636a8bd7381a9d401aaaf0c1d7294
Stats: 3 lines in 2 files changed: 0 ins; 0 del; 3 mod
8337102: JITTester: Fix breaks in static initialization blocks
Reviewed-by: kvn, iveresov
-------------
PR: https://git.openjdk.org/jdk/pull/20310
More information about the hotspot-compiler-dev
mailing list