author | ccheung |
Fri, 04 Oct 2013 21:00:43 -0700 | |
changeset 20384 | 49bfb2ec8f8f |
parent 20002 | a81f45903813 |
child 30247 | 9925b07bba5b |
permissions | -rw-r--r-- |
19986
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
1 |
/* |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
2 |
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
4 |
* |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
8 |
* |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
13 |
* accompanied this code). |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
14 |
* |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
18 |
* |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
21 |
* questions. |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
22 |
*/ |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
23 |
|
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
24 |
import sun.management.ManagementFactoryHelper; |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
25 |
import com.sun.management.HotSpotDiagnosticMXBean; |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
26 |
import com.sun.management.VMOption; |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
27 |
|
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
28 |
import java.util.regex.Matcher; |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
29 |
import java.util.regex.Pattern; |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
30 |
import java.util.ArrayList; |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
31 |
import java.util.Arrays; |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
32 |
|
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
33 |
import com.oracle.java.testlibrary.*; |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
34 |
import sun.hotspot.WhiteBox; |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
35 |
|
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
36 |
class DetermineMaxHeapForCompressedOops { |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
37 |
public static void main(String[] args) throws Exception { |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
38 |
WhiteBox wb = WhiteBox.getWhiteBox(); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
39 |
System.out.print(wb.getCompressedOopsMaxHeapSize()); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
40 |
} |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
41 |
} |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
42 |
|
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
43 |
class TestUseCompressedOopsErgoTools { |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
44 |
|
20002
a81f45903813
8024662: gc/arguments/TestUseCompressedOopsErgo.java does not compile.
tschatzl
parents:
19986
diff
changeset
|
45 |
private static long getCompressedClassSpaceSize() { |
19986
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
46 |
HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean(); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
47 |
|
20002
a81f45903813
8024662: gc/arguments/TestUseCompressedOopsErgo.java does not compile.
tschatzl
parents:
19986
diff
changeset
|
48 |
VMOption option = diagnostic.getVMOption("CompressedClassSpaceSize"); |
19986
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
49 |
return Long.parseLong(option.getValue()); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
50 |
} |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
51 |
|
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
52 |
|
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
53 |
public static long getMaxHeapForCompressedOops(String[] vmargs) throws Exception { |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
54 |
OutputAnalyzer output = runWhiteBoxTest(vmargs, DetermineMaxHeapForCompressedOops.class.getName(), new String[] {}, false); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
55 |
return Long.parseLong(output.getStdout()); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
56 |
} |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
57 |
|
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
58 |
public static boolean is64bitVM() { |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
59 |
String val = System.getProperty("sun.arch.data.model"); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
60 |
if (val == null) { |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
61 |
throw new RuntimeException("Could not read sun.arch.data.model"); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
62 |
} |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
63 |
if (val.equals("64")) { |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
64 |
return true; |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
65 |
} else if (val.equals("32")) { |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
66 |
return false; |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
67 |
} |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
68 |
throw new RuntimeException("Unexpected value " + val + " of sun.arch.data.model"); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
69 |
} |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
70 |
|
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
71 |
/** |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
72 |
* Executes a new VM process with the given class and parameters. |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
73 |
* @param vmargs Arguments to the VM to run |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
74 |
* @param classname Name of the class to run |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
75 |
* @param arguments Arguments to the class |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
76 |
* @param useTestDotJavaDotOpts Use test.java.opts as part of the VM argument string |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
77 |
* @return The OutputAnalyzer with the results for the invocation. |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
78 |
*/ |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
79 |
public static OutputAnalyzer runWhiteBoxTest(String[] vmargs, String classname, String[] arguments, boolean useTestDotJavaDotOpts) throws Exception { |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
80 |
ArrayList<String> finalargs = new ArrayList<String>(); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
81 |
|
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
82 |
String[] whiteboxOpts = new String[] { |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
83 |
"-Xbootclasspath/a:.", |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
84 |
"-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
85 |
"-cp", System.getProperty("java.class.path"), |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
86 |
}; |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
87 |
|
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
88 |
if (useTestDotJavaDotOpts) { |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
89 |
// System.getProperty("test.java.opts") is '' if no options is set, |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
90 |
// we need to skip such a result |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
91 |
String[] externalVMOpts = new String[0]; |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
92 |
if (System.getProperty("test.java.opts") != null && System.getProperty("test.java.opts").length() != 0) { |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
93 |
externalVMOpts = System.getProperty("test.java.opts").split(" "); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
94 |
} |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
95 |
finalargs.addAll(Arrays.asList(externalVMOpts)); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
96 |
} |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
97 |
|
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
98 |
finalargs.addAll(Arrays.asList(vmargs)); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
99 |
finalargs.addAll(Arrays.asList(whiteboxOpts)); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
100 |
finalargs.add(classname); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
101 |
finalargs.addAll(Arrays.asList(arguments)); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
102 |
|
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
103 |
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(finalargs.toArray(new String[0])); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
104 |
OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
105 |
output.shouldHaveExitValue(0); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
106 |
return output; |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
107 |
} |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
108 |
|
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
109 |
private static String[] join(String[] part1, String part2) { |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
110 |
ArrayList<String> result = new ArrayList<String>(); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
111 |
result.addAll(Arrays.asList(part1)); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
112 |
result.add(part2); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
113 |
return result.toArray(new String[0]); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
114 |
} |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
115 |
|
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
116 |
public static void checkCompressedOopsErgo(String[] gcflags) throws Exception { |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
117 |
long maxHeapForCompressedOops = getMaxHeapForCompressedOops(gcflags); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
118 |
|
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
119 |
checkUseCompressedOops(gcflags, maxHeapForCompressedOops, true); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
120 |
checkUseCompressedOops(gcflags, maxHeapForCompressedOops - 1, true); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
121 |
checkUseCompressedOops(gcflags, maxHeapForCompressedOops + 1, false); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
122 |
|
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
123 |
// the use of HeapBaseMinAddress should not change the outcome |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
124 |
checkUseCompressedOops(join(gcflags, "-XX:HeapBaseMinAddress=32G"), maxHeapForCompressedOops, true); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
125 |
checkUseCompressedOops(join(gcflags, "-XX:HeapBaseMinAddress=32G"), maxHeapForCompressedOops - 1, true); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
126 |
checkUseCompressedOops(join(gcflags, "-XX:HeapBaseMinAddress=32G"), maxHeapForCompressedOops + 1, false); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
127 |
|
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
128 |
// use a different object alignment |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
129 |
maxHeapForCompressedOops = getMaxHeapForCompressedOops(join(gcflags, "-XX:ObjectAlignmentInBytes=16")); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
130 |
|
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
131 |
checkUseCompressedOops(join(gcflags, "-XX:ObjectAlignmentInBytes=16"), maxHeapForCompressedOops, true); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
132 |
checkUseCompressedOops(join(gcflags, "-XX:ObjectAlignmentInBytes=16"), maxHeapForCompressedOops - 1, true); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
133 |
checkUseCompressedOops(join(gcflags, "-XX:ObjectAlignmentInBytes=16"), maxHeapForCompressedOops + 1, false); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
134 |
|
20002
a81f45903813
8024662: gc/arguments/TestUseCompressedOopsErgo.java does not compile.
tschatzl
parents:
19986
diff
changeset
|
135 |
// use a different CompressedClassSpaceSize |
a81f45903813
8024662: gc/arguments/TestUseCompressedOopsErgo.java does not compile.
tschatzl
parents:
19986
diff
changeset
|
136 |
String compressedClassSpaceSizeArg = "-XX:CompressedClassSpaceSize=" + 2 * getCompressedClassSpaceSize(); |
a81f45903813
8024662: gc/arguments/TestUseCompressedOopsErgo.java does not compile.
tschatzl
parents:
19986
diff
changeset
|
137 |
maxHeapForCompressedOops = getMaxHeapForCompressedOops(join(gcflags, compressedClassSpaceSizeArg)); |
19986
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
138 |
|
20002
a81f45903813
8024662: gc/arguments/TestUseCompressedOopsErgo.java does not compile.
tschatzl
parents:
19986
diff
changeset
|
139 |
checkUseCompressedOops(join(gcflags, compressedClassSpaceSizeArg), maxHeapForCompressedOops, true); |
a81f45903813
8024662: gc/arguments/TestUseCompressedOopsErgo.java does not compile.
tschatzl
parents:
19986
diff
changeset
|
140 |
checkUseCompressedOops(join(gcflags, compressedClassSpaceSizeArg), maxHeapForCompressedOops - 1, true); |
a81f45903813
8024662: gc/arguments/TestUseCompressedOopsErgo.java does not compile.
tschatzl
parents:
19986
diff
changeset
|
141 |
checkUseCompressedOops(join(gcflags, compressedClassSpaceSizeArg), maxHeapForCompressedOops + 1, false); |
19986
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
142 |
} |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
143 |
|
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
144 |
private static void checkUseCompressedOops(String[] args, long heapsize, boolean expectUseCompressedOops) throws Exception { |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
145 |
ArrayList<String> finalargs = new ArrayList<String>(); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
146 |
finalargs.addAll(Arrays.asList(args)); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
147 |
finalargs.add("-Xmx" + heapsize); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
148 |
finalargs.add("-XX:+PrintFlagsFinal"); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
149 |
finalargs.add("-version"); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
150 |
|
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
151 |
String output = expectValid(finalargs.toArray(new String[0])); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
152 |
|
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
153 |
boolean actualUseCompressedOops = getFlagBoolValue(" UseCompressedOops", output); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
154 |
|
20002
a81f45903813
8024662: gc/arguments/TestUseCompressedOopsErgo.java does not compile.
tschatzl
parents:
19986
diff
changeset
|
155 |
Asserts.assertEQ(expectUseCompressedOops, actualUseCompressedOops); |
19986
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
156 |
} |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
157 |
|
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
158 |
private static boolean getFlagBoolValue(String flag, String where) { |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
159 |
Matcher m = Pattern.compile(flag + "\\s+:?= (true|false)").matcher(where); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
160 |
if (!m.find()) { |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
161 |
throw new RuntimeException("Could not find value for flag " + flag + " in output string"); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
162 |
} |
20002
a81f45903813
8024662: gc/arguments/TestUseCompressedOopsErgo.java does not compile.
tschatzl
parents:
19986
diff
changeset
|
163 |
return m.group(1).equals("true"); |
19986
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
164 |
} |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
165 |
|
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
166 |
private static String expect(String[] flags, boolean hasWarning, boolean hasError, int errorcode) throws Exception { |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
167 |
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(flags); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
168 |
OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
169 |
output.shouldHaveExitValue(errorcode); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
170 |
return output.getStdout(); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
171 |
} |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
172 |
|
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
173 |
private static String expectValid(String[] flags) throws Exception { |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
174 |
return expect(flags, false, false, 0); |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
175 |
} |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
176 |
} |
33d188c66ed9
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
177 |