RFR: 8351952: [IR Framework]: allow ignoring methods that are not compilable

Christian Hagedorn chagedorn at openjdk.org
Mon Mar 17 20:50:11 UTC 2025


On Fri, 14 Mar 2025 08:48:21 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

> With the Template Framework, I'm generating IR tests randomly. But random code can always hit bailouts in compilation, and make code not compilable any more. We should have a way to disable this check, and just gracefully continue to execute the tests.
> 
> To allow a single test method to be `not compilable`:
> https://github.com/openjdk/jdk/blob/ce40f1402387f75ea8627883979e3cbf63480941/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestNotCompilable.java#L160-L161
> 
> To allow all test methods to be `not compilable`:
> https://github.com/openjdk/jdk/blob/ce40f1402387f75ea8627883979e3cbf63480941/test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestNotCompilable.java#L140-L144
> 
> See also this documentation in the code:
> https://github.com/openjdk/jdk/blob/ce40f1402387f75ea8627883979e3cbf63480941/test/hotspot/jtreg/compiler/lib/ir_framework/Test.java#L88-L94
> 
> ---------------------------------------
> 
> **Backrgound**
> 
> My random code seems to hit a bailout in the Register Allocator, and I cannot do much to predict if that bailout happens.
> See https://bugs.openjdk.org/browse/JDK-8304328

Some first comments, will continue tomorrow :-)

test/hotspot/jtreg/compiler/lib/ir_framework/TestFramework.java line 417:

> 415:      * test failure. However, if such cases are expected in a test class, this flag can be set to true, which
> 416:      * allows the all test to pass even if there is no compilation. Any associated {@link IR} rule is only executed
> 417:      * if the test method was compiled, and else it is ignored silently.

/**
     * In rare cases, methods may not be compilable because of a compilation bailout. By default, this leads to a
     * test failure. However, if such cases are expected in multiple methods in a test class, this flag can be set to
     * true, which allows any test to pass even if there is a compilation bailout. If only selected methods are prone
     * to bail out, it is preferred to use {@link Test#allowNotCompilable()} instead for more fine-grained control.
     * By setting this flag, any associated {@link IR} rule of a test is only executed if the test method was compiled, 
     * and else it is ignored silently.

test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irmethod/NotCompilableIRMethod.java line 34:

> 32: /**
> 33:  * This class represents a special IR method which was not compiled by the IR framework, but this was explicitly allowed
> 34:  * by "allowNotCompilable".

Maybe add here in what context this is used:
Suggestion:

 * by "allowNotCompilable". This happens when the compiler bails out of a compilation (i.e. no compilation) but we treat 
 * this as valid case.

test/hotspot/jtreg/compiler/lib/ir_framework/driver/irmatching/irmethod/NotCompilableIRMethodMatchResult.java line 35:

> 33: /**
> 34:  * This class represents a special matching result of an IR method where the compilation output was completely empty,
> 35:  * but this was exlicitly allowed by "allowNotCompilable".

Maybe also add the same addition from above here as well.

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

PR Review: https://git.openjdk.org/jdk/pull/24049#pullrequestreview-2692005824
PR Review Comment: https://git.openjdk.org/jdk/pull/24049#discussion_r1999625584
PR Review Comment: https://git.openjdk.org/jdk/pull/24049#discussion_r1999640690
PR Review Comment: https://git.openjdk.org/jdk/pull/24049#discussion_r1999644590


More information about the hotspot-compiler-dev mailing list