|
1 | 1 | /*
|
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. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | *
|
5 | 5 | * This code is free software; you can redistribute it and/or modify it
|
|
70 | 70 |
|
71 | 71 | public class SharedBaseAddress {
|
72 | 72 |
|
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", |
77 | 76 | "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", |
78 | 86 | "0x800001000", // Default base address + 1 page - probably valid but unaligned to metaspace alignment, see JDK 8247522
|
79 | 87 | "0xfffffffffff00000", // archive top wraps around 64-bit address space
|
80 |
| - "0xfff80000", // archive top wraps around 32-bit address space |
81 | 88 | "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() |
83 | 89 | "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 |
85 | 91 | // immediate on aarch64 (0x5_0000_0000) (see JDK-8265705)
|
86 |
| - "0", // always let OS pick the base address at runtime (ASLR for CDS archive) |
87 | 92 | };
|
88 | 93 |
|
89 | 94 | // failed pattern
|
90 | 95 | private static String failedPattern = "os::release_memory\\(0x[0-9a-fA-F]*,\\s[0-9]*\\)\\sfailed";
|
91 | 96 |
|
92 |
| - public static void main(String[] args) throws Exception { |
| 97 | + public static void test(String[] args, String[] testTable) throws Exception { |
93 | 98 | int mid = testTable.length / 2;
|
94 | 99 | int start = args[0].equals("0") ? 0 : mid;
|
95 | 100 | int end = args[0].equals("0") ? mid : testTable.length;
|
@@ -134,4 +139,11 @@ public static void main(String[] args) throws Exception {
|
134 | 139 | }
|
135 | 140 | }
|
136 | 141 | }
|
| 142 | + |
| 143 | + public static void main(String[] args) throws Exception { |
| 144 | + test(args, testTableShared); |
| 145 | + if (Platform.is64bit()) { |
| 146 | + test(args, testTable64); |
| 147 | + } |
| 148 | + } |
137 | 149 | }
|
0 commit comments