Skip to content

Commit 2c8e411

Browse files
author
duke
committedMar 19, 2022
Automatic merge of jdk:master into master
2 parents 205bcbf + 10ccfff commit 2c8e411

File tree

2 files changed

+41
-17
lines changed

2 files changed

+41
-17
lines changed
 

‎test/hotspot/jtreg/runtime/cds/SharedBaseAddress.java

+22-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2014, 2022, 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
@@ -70,26 +70,31 @@
7070

7171
public class SharedBaseAddress {
7272

73-
// shared base address test table
74-
private static final String[] testTable = {
75-
"1g", "8g", "64g","512g", "4t",
76-
"32t", "128t", "0",
73+
// shared base address test table for {32, 64}bit VM
74+
private static final String[] testTableShared = {
75+
"1g", "0",
7776
"1", "64k", "64M",
77+
"0xfff80000", // archive top wraps around 32-bit address space
78+
"0xffffffff", // archive bottom wraps around 32-bit address space -- due to align_up()
79+
"0" // always let OS pick the base address at runtime (ASLR for CDS archive)
80+
};
81+
82+
// shared base address test table for 64bit VM only
83+
private static final String[] testTable64 = {
84+
"8g", "64g","512g", "4t",
85+
"32t", "128t",
7886
"0x800001000", // Default base address + 1 page - probably valid but unaligned to metaspace alignment, see JDK 8247522
7987
"0xfffffffffff00000", // archive top wraps around 64-bit address space
80-
"0xfff80000", // archive top wraps around 32-bit address space
8188
"0xffffffffffffffff", // archive bottom wraps around 64-bit address space -- due to align_up()
82-
"0xffffffff", // archive bottom wraps around 32-bit address space -- due to align_up()
8389
"0x00007ffffff00000", // end of archive will go past the end of user space on linux/x64
84-
"0x500000000", // (20g) below 32g at a 4g aligned address, but cannot be expressed with a logical
90+
"0x500000000" // (20g) below 32g at a 4g aligned address, but cannot be expressed with a logical
8591
// immediate on aarch64 (0x5_0000_0000) (see JDK-8265705)
86-
"0", // always let OS pick the base address at runtime (ASLR for CDS archive)
8792
};
8893

8994
// failed pattern
9095
private static String failedPattern = "os::release_memory\\(0x[0-9a-fA-F]*,\\s[0-9]*\\)\\sfailed";
9196

92-
public static void main(String[] args) throws Exception {
97+
public static void test(String[] args, String[] testTable) throws Exception {
9398
int mid = testTable.length / 2;
9499
int start = args[0].equals("0") ? 0 : mid;
95100
int end = args[0].equals("0") ? mid : testTable.length;
@@ -134,4 +139,11 @@ public static void main(String[] args) throws Exception {
134139
}
135140
}
136141
}
142+
143+
public static void main(String[] args) throws Exception {
144+
test(args, testTableShared);
145+
if (Platform.is64bit()) {
146+
test(args, testTable64);
147+
}
148+
}
137149
}

‎test/hotspot/jtreg/runtime/cds/appcds/SharedBaseAddress.java

+19-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2014, 2022, 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
@@ -33,19 +33,24 @@
3333
* @run main/timeout=240 SharedBaseAddress
3434
*/
3535

36+
import jdk.test.lib.Platform;
3637
import jdk.test.lib.process.OutputAnalyzer;
3738

3839
public class SharedBaseAddress {
3940

40-
// shared base address test table
41-
private static final String[] testTable = {
42-
"1g", "8g", "64g","512g", "4t",
43-
"32t", "128t", "0",
44-
"1", "64k", "64M", "320g",
41+
// shared base address test table for {32, 64}bit VM
42+
private static final String[] testTableShared = {
43+
"1g", "0", "1", "64k", "64M"
44+
};
45+
46+
// shared base address test table for 64bit VM only
47+
private static final String[] testTable64 = {
48+
"8g", "64g","512g", "4t",
49+
"32t", "128t", "320g",
4550
"0x800001000" // Default base address + 1 page - probably valid but unaligned to metaspace alignment, see JDK 8247522
4651
};
4752

48-
public static void main(String[] args) throws Exception {
53+
public static void test(String[] testTable) throws Exception {
4954
String appJar = JarBuilder.getOrCreateHelloJar();
5055

5156
for (String testEntry : testTable) {
@@ -62,4 +67,11 @@ public static void main(String[] args) throws Exception {
6267
TestCommon.checkExec(execOutput, "Hello World");
6368
}
6469
}
70+
71+
public static void main(String[] args) throws Exception {
72+
test(testTableShared);
73+
if (Platform.is64bit()) {
74+
test(testTable64);
75+
}
76+
}
6577
}

0 commit comments

Comments
 (0)
Please sign in to comment.