Skip to content

Commit a8bf2ac

Browse files
committed
8304888: Add dedicated VMProps for linker and fallback linker
Reviewed-by: alanb, mcimadamore
1 parent 75a4edc commit a8bf2ac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+121
-88
lines changed

test/hotspot/jtreg/TEST.ROOT

+4-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ requires.extraPropDefns.bootlibs = ../../lib/jdk/test/whitebox
4444
requires.extraPropDefns.libs = \
4545
../../lib/jdk/test/lib/Platform.java \
4646
../../lib/jdk/test/lib/Container.java
47-
requires.extraPropDefns.vmOpts = -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
47+
requires.extraPropDefns.javacOpts = --add-exports java.base/jdk.internal.foreign=ALL-UNNAMED
48+
requires.extraPropDefns.vmOpts = \
49+
-XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI \
50+
--add-exports java.base/jdk.internal.foreign=ALL-UNNAMED
4851
requires.properties= \
4952
sun.arch.data.model \
5053
vm.simpleArch \

test/jdk/TEST.ROOT

+7-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# A "headful" test requires a graphical environment to meaningfully
1313
# run. Tests that are not headful are "headless".
1414
# A test flagged with key sound needs audio devices on the system, this
15-
# may be accompanied by the headful keyword since audio device access
15+
# may be accompanied by the headful keyword since audio device access
1616
# is often linked to access to desktop resources and headful systems are
1717
# also more likely to have audio devices (ie meaning both input and output)
1818
# A test flagged with key "printer" requires a printer to succeed, else
@@ -46,7 +46,10 @@ requires.extraPropDefns.bootlibs = ../lib/jdk/test/whitebox
4646
requires.extraPropDefns.libs = \
4747
../lib/jdk/test/lib/Platform.java \
4848
../lib/jdk/test/lib/Container.java
49-
requires.extraPropDefns.vmOpts = -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
49+
requires.extraPropDefns.javacOpts = --add-exports java.base/jdk.internal.foreign=ALL-UNNAMED
50+
requires.extraPropDefns.vmOpts = \
51+
-XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI \
52+
--add-exports java.base/jdk.internal.foreign=ALL-UNNAMED
5053
requires.properties= \
5154
sun.arch.data.model \
5255
java.runtime.name \
@@ -69,7 +72,8 @@ requires.properties= \
6972
vm.jvmci \
7073
docker.support \
7174
release.implementor \
72-
jdk.containerized
75+
jdk.containerized \
76+
jdk.foreign.linker
7377

7478
# Minimum jtreg version
7579
requiredVersion=7.2+1

test/jdk/java/foreign/LibraryLookupTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
/*
3737
* @test
3838
* @enablePreview
39-
* @requires ((os.arch == "amd64" | os.arch == "x86_64") & sun.arch.data.model == "64") | os.arch == "aarch64" | os.arch == "riscv64"
39+
* @requires jdk.foreign.linker != "UNSUPPORTED"
4040
* @run testng/othervm --enable-native-access=ALL-UNNAMED LibraryLookupTest
4141
*/
4242
public class LibraryLookupTest {

test/jdk/java/foreign/SafeFunctionAccessTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
/*
2525
* @test
2626
* @enablePreview
27-
* @requires ((os.arch == "amd64" | os.arch == "x86_64") & sun.arch.data.model == "64") | os.arch == "aarch64" | os.arch == "riscv64"
27+
* @requires jdk.foreign.linker != "UNSUPPORTED"
2828
* @run testng/othervm --enable-native-access=ALL-UNNAMED SafeFunctionAccessTest
2929
*/
3030

test/jdk/java/foreign/StdLibTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
/*
2525
* @test
2626
* @enablePreview
27-
* @requires ((os.arch == "amd64" | os.arch == "x86_64") & sun.arch.data.model == "64") | os.arch == "aarch64" | os.arch == "riscv64"
27+
* @requires jdk.foreign.linker != "UNSUPPORTED"
2828
* @run testng/othervm --enable-native-access=ALL-UNNAMED StdLibTest
2929
*/
3030

test/jdk/java/foreign/TestAddressDereference.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* @test
2626
* @enablePreview
2727
* @library ../ /test/lib
28-
* @requires ((os.arch == "amd64" | os.arch == "x86_64") & sun.arch.data.model == "64") | os.arch == "aarch64" | os.arch == "riscv64"
28+
* @requires jdk.foreign.linker != "UNSUPPORTED"
2929
* @run testng/othervm --enable-native-access=ALL-UNNAMED TestAddressDereference
3030
*/
3131

test/jdk/java/foreign/TestClassLoaderFindNative.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
/*
2525
* @test
2626
* @enablePreview
27-
* @requires ((os.arch == "amd64" | os.arch == "x86_64") & sun.arch.data.model == "64") | os.arch == "aarch64" | os.arch == "riscv64"
27+
* @requires jdk.foreign.linker != "UNSUPPORTED"
2828
* @run testng/othervm --enable-native-access=ALL-UNNAMED TestClassLoaderFindNative
2929
*/
3030

test/jdk/java/foreign/TestDowncallScope.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
/*
2525
* @test
2626
* @enablePreview
27-
* @requires ((os.arch == "amd64" | os.arch == "x86_64") & sun.arch.data.model == "64") | os.arch == "aarch64" | os.arch == "riscv64"
27+
* @requires jdk.foreign.linker != "UNSUPPORTED"
2828
* @modules java.base/jdk.internal.foreign
2929
* @build NativeTestHelper CallGeneratorHelper TestDowncallBase
3030
*

test/jdk/java/foreign/TestDowncallStack.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
/*
2525
* @test
2626
* @enablePreview
27-
* @requires ((os.arch == "amd64" | os.arch == "x86_64") & sun.arch.data.model == "64") | os.arch == "aarch64" | os.arch == "riscv64"
27+
* @requires jdk.foreign.linker != "UNSUPPORTED"
2828
* @modules java.base/jdk.internal.foreign
2929
* @build NativeTestHelper CallGeneratorHelper TestDowncallBase
3030
*

test/jdk/java/foreign/TestFallbackLookup.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
/*
2525
* @test
2626
* @enablePreview
27-
* @requires ((os.arch == "amd64" | os.arch == "x86_64") & sun.arch.data.model == "64")
27+
* @requires jdk.foreign.linker != "UNSUPPORTED"
2828
* @run testng/othervm -Dos.name=Windows --enable-native-access=ALL-UNNAMED TestFallbackLookup
2929
*/
3030

test/jdk/java/foreign/TestFunctionDescriptor.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
/*
2626
* @test
2727
* @enablePreview
28-
* @requires ((os.arch == "amd64" | os.arch == "x86_64") & sun.arch.data.model == "64") | os.arch == "aarch64" | os.arch == "riscv64"
28+
* @requires jdk.foreign.linker != "UNSUPPORTED"
2929
* @run testng/othervm --enable-native-access=ALL-UNNAMED TestFunctionDescriptor
3030
*/
3131

test/jdk/java/foreign/TestHeapAlignment.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
/*
2626
* @test
2727
* @enablePreview
28-
* @requires ((os.arch == "amd64" | os.arch == "x86_64") & sun.arch.data.model == "64") | os.arch == "aarch64" | os.arch == "riscv64"
28+
* @requires jdk.foreign.linker != "UNSUPPORTED"
2929
* @run testng/othervm --enable-native-access=ALL-UNNAMED TestHeapAlignment
3030
*/
3131

test/jdk/java/foreign/TestIllegalLink.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
/*
2626
* @test
2727
* @enablePreview
28+
* @requires jdk.foreign.linker != "UNSUPPORTED"
2829
* @modules java.base/jdk.internal.foreign
29-
* @requires ((os.arch == "amd64" | os.arch == "x86_64") & sun.arch.data.model == "64") | os.arch == "aarch64" | os.arch == "riscv64"
3030
* @run testng/othervm --enable-native-access=ALL-UNNAMED TestIllegalLink
3131
*/
3232

test/jdk/java/foreign/TestIntrinsics.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
/*
2525
* @test
2626
* @enablePreview
27-
* @requires os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" | os.arch=="riscv64"
27+
* @requires jdk.foreign.linker != "UNSUPPORTED"
2828
* @run testng/othervm
2929
* -Djdk.internal.foreign.DowncallLinker.USE_SPEC=true
3030
* --enable-native-access=ALL-UNNAMED

test/jdk/java/foreign/TestLinker.java

+19-7
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,21 @@
2424
/*
2525
* @test
2626
* @enablePreview
27-
* @requires os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" | os.arch=="riscv64"
27+
* @requires jdk.foreign.linker != "UNSUPPORTED"
28+
* @modules java.base/jdk.internal.foreign
2829
* @run testng TestLinker
2930
*/
3031

32+
import jdk.internal.foreign.CABI;
3133
import org.testng.annotations.DataProvider;
3234
import org.testng.annotations.Test;
3335

3436
import java.lang.foreign.FunctionDescriptor;
3537
import java.lang.foreign.Linker;
3638
import java.lang.invoke.MethodHandle;
39+
import java.util.ArrayList;
40+
import java.util.Arrays;
41+
import java.util.List;
3742

3843
import static java.lang.foreign.MemoryLayout.*;
3944
import static java.lang.foreign.ValueLayout.JAVA_CHAR;
@@ -43,6 +48,8 @@
4348

4449
public class TestLinker extends NativeTestHelper {
4550

51+
static final boolean IS_FALLBACK_LINKER = CABI.current() == CABI.FALLBACK;
52+
4653
record LinkRequest(FunctionDescriptor descriptor, Linker.Option... options) {}
4754

4855
@Test(dataProvider = "notSameCases")
@@ -75,7 +82,7 @@ public void testNamedLinkerCache(FunctionDescriptor f1, FunctionDescriptor f2) {
7582

7683
@DataProvider
7784
public static Object[][] namedDescriptors() {
78-
return new Object[][]{
85+
List<Object[]> cases = new ArrayList<>(Arrays.asList(new Object[][]{
7986
{ FunctionDescriptor.ofVoid(C_INT),
8087
FunctionDescriptor.ofVoid(C_INT.withName("x")) },
8188
{ FunctionDescriptor.ofVoid(structLayout(C_INT)),
@@ -90,17 +97,22 @@ public static Object[][] namedDescriptors() {
9097
FunctionDescriptor.ofVoid(structLayout(sequenceLayout(1, C_INT).withName("x"))) },
9198
{ FunctionDescriptor.ofVoid(structLayout(sequenceLayout(1, C_INT))),
9299
FunctionDescriptor.ofVoid(structLayout(sequenceLayout(1, C_INT.withName("x")))) },
93-
{ FunctionDescriptor.ofVoid(unionLayout(C_INT)),
94-
FunctionDescriptor.ofVoid(unionLayout(C_INT).withName("x")) },
95-
{ FunctionDescriptor.ofVoid(unionLayout(C_INT)),
96-
FunctionDescriptor.ofVoid(unionLayout(C_INT.withName("x"))) },
97100
{ FunctionDescriptor.ofVoid(C_POINTER),
98101
FunctionDescriptor.ofVoid(C_POINTER.withName("x")) },
99102
{ FunctionDescriptor.ofVoid(C_POINTER.withTargetLayout(C_INT)),
100103
FunctionDescriptor.ofVoid(C_POINTER.withTargetLayout(C_INT.withName("x"))) },
101104
{ FunctionDescriptor.ofVoid(C_POINTER.withTargetLayout(C_INT)),
102105
FunctionDescriptor.ofVoid(C_POINTER.withName("x").withTargetLayout(C_INT.withName("x"))) },
103-
};
106+
}));
107+
108+
if (!IS_FALLBACK_LINKER) {
109+
cases.add(new Object[]{ FunctionDescriptor.ofVoid(unionLayout(C_INT)),
110+
FunctionDescriptor.ofVoid(unionLayout(C_INT).withName("x")) });
111+
cases.add(new Object[]{ FunctionDescriptor.ofVoid(unionLayout(C_INT)),
112+
FunctionDescriptor.ofVoid(unionLayout(C_INT.withName("x"))) });
113+
}
114+
115+
return cases.toArray(Object[][]::new);
104116
}
105117

106118
@DataProvider

0 commit comments

Comments
 (0)