RFR: 8324641: [IR Framework] Add Setup method to provide custom arguments and set fields
Emanuel Peter
epeter at openjdk.org
Thu Feb 1 11:23:21 UTC 2024
**Bigger goal**
I am tired of always writing IR tests where I have to write elaborate code in the `@Run` method to create inputs, and then run the test method to create `gold` output values in (hopefully) interpreter mode, and then later verify the results of the compiled method.
Hence, I now introduce the "Setup" method, which can create custom argument values.
In a later RFE, I will implement automatic result verification, which implicitly intercepts the inputs and outputs of the test method, and compares the behaviour of the interpreter and the compiled code. That way, the pattern will be:
@Setup
... specify your arguments and fields ...
-> intercept arguments, cache them
@Test
... write a test with arbitrary inputs and outputs...
-> interpreter mode: intercept outputs and cache them (i.e. gold values)
-> compiled mode: intercept outputs and compare them to the gold values.
(optional)
@Check
.. do custom verification...
**In this RFE: the Setup Method**
The first step is the setup method.
Example:
https://github.com/openjdk/jdk/blob/08670a5d45b1c45e954e2dc85eb8c92e11e48fb2/test/hotspot/jtreg/testlibrary_tests/ir_framework/examples/SetupExample.java#L49-L87
-------------
Commit messages:
- fix add and comma
- fix up some tests
- add SetupInfo class
- update readme
- fix trailing whitespaces
- make invocationCounter optional for Setup method
- SetupExample.java
- index -> invocationCounter
- improve formatting and comments
- improve some comments
- ... and 5 more: https://git.openjdk.org/jdk/compare/c9cacfb2...24eb09d2
Changes: https://git.openjdk.org/jdk/pull/17557/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=17557&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8324641
Stats: 672 lines in 26 files changed: 410 ins; 44 del; 218 mod
Patch: https://git.openjdk.org/jdk/pull/17557.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/17557/head:pull/17557
PR: https://git.openjdk.org/jdk/pull/17557
More information about the hotspot-compiler-dev
mailing list