Skip to content

Commit 991ec92

Browse files
liachMrSimms
authored andcommitted
8327214: [lworld] Valhalla compiler testing move to classfile API
Reviewed-by: dsimms
1 parent d94c589 commit 991ec92

26 files changed

+25
-6403
lines changed

test/hotspot/jtreg/compiler/valhalla/inlinetypes/TestLWorld.java

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -25,14 +25,12 @@
2525

2626
import compiler.lib.ir_framework.*;
2727
import jdk.test.lib.Asserts;
28-
import test.java.lang.invoke.lib.OldInstructionHelper;
29-
28+
import test.java.lang.invoke.lib.InstructionHelper;
3029

3130
import java.lang.invoke.MethodHandle;
3231
import java.lang.invoke.MethodHandles;
3332
import java.lang.invoke.MethodType;
3433
import java.lang.reflect.Method;
35-
import jdk.experimental.bytecode.TypeTag;
3634
import java.util.Arrays;
3735
import java.util.Objects;
3836

@@ -48,12 +46,12 @@
4846
* @test
4947
* @key randomness
5048
* @summary Test inline types in LWorld.
51-
* @library /test/lib /test/jdk/lib/testlibrary/bytecode /test/jdk/java/lang/invoke/common /
49+
* @library /test/lib /test/jdk/java/lang/invoke/common /
5250
* @requires (os.simpleArch == "x64" | os.simpleArch == "aarch64")
5351
* @enablePreview
5452
* @modules java.base/jdk.internal.value
5553
* java.base/jdk.internal.vm.annotation
56-
* @build jdk.experimental.bytecode.BasicClassBuilder test.java.lang.invoke.lib.OldInstructionHelper
54+
* @build test.java.lang.invoke.lib.InstructionHelper
5755
* @run main/othervm/timeout=450 compiler.valhalla.inlinetypes.TestLWorld
5856
*/
5957

@@ -1093,13 +1091,13 @@ public void test34_verifier() {
10931091

10941092
// Test writing constant null to a (flattened) inline type array
10951093

1096-
private static final MethodHandle setArrayElementNull = OldInstructionHelper.loadCode(MethodHandles.lookup(),
1094+
private static final MethodHandle setArrayElementNull = InstructionHelper.buildMethodHandle(MethodHandles.lookup(),
10971095
"setArrayElementNull",
10981096
MethodType.methodType(void.class, TestLWorld.class, MyValue1[].class, int.class),
10991097
CODE -> {
11001098
CODE.
1101-
aload_1().
1102-
iload_2().
1099+
aload(1).
1100+
iload(2).
11031101
aconst_null().
11041102
aastore().
11051103
return_();
@@ -1433,14 +1431,14 @@ public void test43_verifier(RunInfo info) {
14331431
}
14341432

14351433
// Tests writing an array element with a (statically known) incompatible type
1436-
private static final MethodHandle setArrayElementIncompatible = OldInstructionHelper.loadCode(MethodHandles.lookup(),
1434+
private static final MethodHandle setArrayElementIncompatible = InstructionHelper.buildMethodHandle(MethodHandles.lookup(),
14371435
"setArrayElementIncompatible",
14381436
MethodType.methodType(void.class, TestLWorld.class, MyValue1[].class, int.class, MyValue2.class),
14391437
CODE -> {
14401438
CODE.
1441-
aload_1().
1442-
iload_2().
1443-
aload_3().
1439+
aload(1).
1440+
iload(2).
1441+
aload(3).
14441442
aastore().
14451443
return_();
14461444
});
@@ -4060,14 +4058,14 @@ public void test144_verifier() {
40604058
}
40614059

40624060
// Tests writing an array element with a (statically known) incompatible type
4063-
private static final MethodHandle setArrayElementIncompatibleRef = OldInstructionHelper.loadCode(MethodHandles.lookup(),
4061+
private static final MethodHandle setArrayElementIncompatibleRef = InstructionHelper.buildMethodHandle(MethodHandles.lookup(),
40644062
"setArrayElementIncompatibleRef",
40654063
MethodType.methodType(void.class, TestLWorld.class, MyValue1[].class, int.class, MyValue2.class),
40664064
CODE -> {
40674065
CODE.
4068-
aload_1().
4069-
iload_2().
4070-
aload_3().
4066+
aload(1).
4067+
iload(2).
4068+
aload(3).
40714069
aastore().
40724070
return_();
40734071
});

test/hotspot/jtreg/compiler/valhalla/inlinetypes/TestNullableInlineTypes.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,7 @@
2525

2626
import compiler.lib.ir_framework.*;
2727
import jdk.test.lib.Asserts;
28-
import jdk.experimental.bytecode.TypeTag;
29-
import test.java.lang.invoke.lib.OldInstructionHelper;
28+
import test.java.lang.invoke.lib.InstructionHelper;
3029

3130
import java.util.Objects;
3231

@@ -47,12 +46,12 @@
4746
* @test
4847
* @key randomness
4948
* @summary Test correct handling of nullable value classes.
50-
* @library /test/lib /test/jdk/lib/testlibrary/bytecode /test/jdk/java/lang/invoke/common /
49+
* @library /test/lib /test/jdk/java/lang/invoke/common /
5150
* @requires (os.simpleArch == "x64" | os.simpleArch == "aarch64")
5251
* @enablePreview
5352
* @modules java.base/jdk.internal.value
5453
* java.base/jdk.internal.vm.annotation
55-
* @build jdk.experimental.bytecode.BasicClassBuilder test.java.lang.invoke.lib.OldInstructionHelper
54+
* @build test.java.lang.invoke.lib.InstructionHelper
5655
* @run main/othervm/timeout=300 compiler.valhalla.inlinetypes.TestNullableInlineTypes
5756
*/
5857

@@ -2578,14 +2577,14 @@ public void test92_verifier() {
25782577
Asserts.assertEQ(test92(), testValue1);
25792578
}
25802579

2581-
private static final MethodHandle refCheckCast = OldInstructionHelper.loadCode(MethodHandles.lookup(),
2580+
private static final MethodHandle refCheckCast = InstructionHelper.buildMethodHandle(MethodHandles.lookup(),
25822581
"refCheckCast",
25832582
MethodType.methodType(MyValue2.class, TestNullableInlineTypes.class, MyValue1.class),
25842583
CODE -> {
25852584
CODE.
2586-
aload_1().
2587-
checkcast(MyValue2.class).
2588-
return_(TypeTag.A);
2585+
aload(1).
2586+
checkcast(MyValue2.class.describeConstable().orElseThrow()).
2587+
areturn();
25892588
});
25902589

25912590
// Test checkcast that only passes with null

test/hotspot/jtreg/compiler/valhalla/inlinetypes/TestValueClasses.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -25,14 +25,12 @@
2525

2626
import compiler.lib.ir_framework.*;
2727
import jdk.test.lib.Asserts;
28-
import jdk.experimental.bytecode.TypeTag;
2928

3029
import java.lang.reflect.Method;
3130

3231
import static compiler.valhalla.inlinetypes.InlineTypeIRNode.*;
3332
import static compiler.valhalla.inlinetypes.InlineTypes.*;
3433

35-
import jdk.internal.value.ValueClass;
3634
import jdk.internal.vm.annotation.ImplicitlyConstructible;
3735
import jdk.internal.vm.annotation.LooselyConsistentValue;
3836
import jdk.internal.vm.annotation.NullRestricted;
@@ -41,7 +39,7 @@
4139
* @test
4240
* @key randomness
4341
* @summary Test correct handling of value classes.
44-
* @library /test/lib /test/jdk/lib/testlibrary/bytecode /test/jdk/java/lang/invoke/common /
42+
* @library /test/lib /test/jdk/java/lang/invoke/common /
4543
* @requires (os.simpleArch == "x64" | os.simpleArch == "aarch64")
4644
* @enablePreview
4745
* @modules java.base/jdk.internal.value

0 commit comments

Comments
 (0)