[lworld] RFR: 8281283: Remove usages of __WithField in runtime tests

Dan Smith dlsmith at openjdk.java.net
Thu Feb 17 19:26:29 UTC 2022


On Thu, 17 Feb 2022 00:56:50 GMT, Dan Smith <dlsmith at openjdk.org> wrote:

> Modifying Valhalla runtime tests to no longer use `__WithField` as a macro for the `withfield` instruction. Most uses can be replaced with standard constructor compilation via javac. The remaining uses are rewritten in jasm.
> 
> Summary of changes:
> 
> - Remove all uses of `-XDallowWithFieldOperator`
> - Replace various `make` and `create` factory methods for primitive classes with constructors
> - Bug fixes for `JumboInline` that were exposed by this change
> - Rewrote `TestFieldNullability` to use jasm
> - Rewrote `VWithFieldTest` to use jasm, renamed `WithFieldTest`
> - Rewrote `WithFieldAccessorTest` to use jasm, made more comprehensive
> - Deleted `WithFieldNoAccessTest`, made redundant by `WithFieldAccessorTest` changes
> - Minor tweaks to `TestFieldTypeMismatch` for consistent jasm usage
> - Cleanup of some debugging output in `asmtools.JtregDriver`

test/hotspot/jtreg/runtime/valhalla/inlinetypes/TestFieldTypeMismatch.java line 32:

> 30:  * @library /test/lib
> 31:  * @build org.openjdk.asmtools.* org.openjdk.asmtools.jasm.*
> 32:  * @run driver org.openjdk.asmtools.JtregDriver jasm -strict TestFieldTypeMismatchClasses.jasm

Naming convention change: suggest putting jasm classes in a file named `[Test name]Classes.jasm`. No need for any classes declared there to actually use that name, although they should have names that won't clash with other tests in this directory.

test/hotspot/jtreg/runtime/valhalla/inlinetypes/TestValue4.java line 48:

> 46: 
> 47:     public TestValue4() {
> 48:         this((int) System.nanoTime());

Don't need the bit twiddling logic, because it's reproduced by the ByteBuffer reads in the other constructor.

test/hotspot/jtreg/runtime/valhalla/inlinetypes/WithFieldAccessorTest.java line 66:

> 64:         catchAccessError(() -> WithFieldSamePackage.withL(start, 10));
> 65:         catchAccessError(() -> WithFieldSamePackage.withD(start, 11));
> 66:         catchAccessError(() -> WithFieldSamePackage.withI(start, 12));

These calls replace the WithFieldNoAccessTest. (Not checking error messages. Should I add that?)

test/hotspot/jtreg/runtime/valhalla/inlinetypes/WithFieldAccessorTestClasses.jasm line 31:

> 29:     public final Field c:C;
> 30:     protected final Field l:J;
> 31:     final Field d:D;

Added a package-access field to test that, too.

test/hotspot/jtreg/runtime/valhalla/inlinetypes/WithFieldAccessorTestClasses.jasm line 151:

> 149: }
> 150: 
> 151: public final primitive value class runtime/valhalla/inlinetypes/WithFieldNestHost

Additional test methods here, so we can test both the nest "sibling" and the nest "parent".

test/hotspot/jtreg/runtime/valhalla/inlinetypes/WithFieldTest.java line 1:

> 1: /*

Renamed VWithFieldTest --> WithFieldTest

test/hotspot/jtreg/runtime/valhalla/inlinetypes/WithFieldTest.java line 77:

> 75:     static Point[] p_values = new Point[] { new Point(0, 0), new Point(-1, 1), new Point(1, -1)};
> 76: 
> 77:     static void allTypesTest() {

Restructured this logic to avoid managing a bunch of arrays in jasm. Same behavior, the test data just lives outside of the class now.

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

PR: https://git.openjdk.java.net/valhalla/pull/653



More information about the valhalla-dev mailing list