Mercurial > hg > truffle
annotate test/gc/arguments/TestUseCompressedOopsErgoTools.java @ 18710:4836c2abc884
mx: removed hard-coded -Xms setting for the 'build' and 'checkstyle' commands to try and avoid unnecessary swapping on low(er) memory machines
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 18 Dec 2014 12:12:04 +1000 |
parents | 2f426063daea |
children |
rev | line source |
---|---|
12233
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
1 /* |
40136aa2cdb1
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. |
40136aa2cdb1
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. |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
4 * |
40136aa2cdb1
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 |
40136aa2cdb1
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 |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
8 * |
40136aa2cdb1
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 |
40136aa2cdb1
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 |
40136aa2cdb1
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 |
40136aa2cdb1
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 |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
13 * accompanied this code). |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
14 * |
40136aa2cdb1
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 |
40136aa2cdb1
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, |
40136aa2cdb1
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. |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
18 * |
40136aa2cdb1
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 |
40136aa2cdb1
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 |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
21 * questions. |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
22 */ |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
23 |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
24 import sun.management.ManagementFactoryHelper; |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
25 import com.sun.management.HotSpotDiagnosticMXBean; |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
26 import com.sun.management.VMOption; |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
27 |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
28 import java.util.regex.Matcher; |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
29 import java.util.regex.Pattern; |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
30 import java.util.ArrayList; |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
31 import java.util.Arrays; |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
32 |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
33 import com.oracle.java.testlibrary.*; |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
34 import sun.hotspot.WhiteBox; |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
35 |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
36 class DetermineMaxHeapForCompressedOops { |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
37 public static void main(String[] args) throws Exception { |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
38 WhiteBox wb = WhiteBox.getWhiteBox(); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
39 System.out.print(wb.getCompressedOopsMaxHeapSize()); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
40 } |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
41 } |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
42 |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
43 class TestUseCompressedOopsErgoTools { |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
44 |
12249
2f426063daea
8024662: gc/arguments/TestUseCompressedOopsErgo.java does not compile.
tschatzl
parents:
12233
diff
changeset
|
45 private static long getCompressedClassSpaceSize() { |
12233
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
46 HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean(); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
47 |
12249
2f426063daea
8024662: gc/arguments/TestUseCompressedOopsErgo.java does not compile.
tschatzl
parents:
12233
diff
changeset
|
48 VMOption option = diagnostic.getVMOption("CompressedClassSpaceSize"); |
12233
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
49 return Long.parseLong(option.getValue()); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
50 } |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
51 |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
52 |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
53 public static long getMaxHeapForCompressedOops(String[] vmargs) throws Exception { |
40136aa2cdb1
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); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
55 return Long.parseLong(output.getStdout()); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
56 } |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
57 |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
58 public static boolean is64bitVM() { |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
59 String val = System.getProperty("sun.arch.data.model"); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
60 if (val == null) { |
40136aa2cdb1
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"); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
62 } |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
63 if (val.equals("64")) { |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
64 return true; |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
65 } else if (val.equals("32")) { |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
66 return false; |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
67 } |
40136aa2cdb1
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"); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
69 } |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
70 |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
71 /** |
40136aa2cdb1
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. |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
73 * @param vmargs Arguments to the VM to run |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
74 * @param classname Name of the class to run |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
75 * @param arguments Arguments to the class |
40136aa2cdb1
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 |
40136aa2cdb1
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. |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
78 */ |
40136aa2cdb1
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 { |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
80 ArrayList<String> finalargs = new ArrayList<String>(); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
81 |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
82 String[] whiteboxOpts = new String[] { |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
83 "-Xbootclasspath/a:.", |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
84 "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
85 "-cp", System.getProperty("java.class.path"), |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
86 }; |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
87 |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
88 if (useTestDotJavaDotOpts) { |
40136aa2cdb1
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, |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
90 // we need to skip such a result |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
91 String[] externalVMOpts = new String[0]; |
40136aa2cdb1
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) { |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
93 externalVMOpts = System.getProperty("test.java.opts").split(" "); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
94 } |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
95 finalargs.addAll(Arrays.asList(externalVMOpts)); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
96 } |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
97 |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
98 finalargs.addAll(Arrays.asList(vmargs)); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
99 finalargs.addAll(Arrays.asList(whiteboxOpts)); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
100 finalargs.add(classname); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
101 finalargs.addAll(Arrays.asList(arguments)); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
102 |
40136aa2cdb1
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])); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
104 OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
105 output.shouldHaveExitValue(0); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
106 return output; |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
107 } |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
108 |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
109 private static String[] join(String[] part1, String part2) { |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
110 ArrayList<String> result = new ArrayList<String>(); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
111 result.addAll(Arrays.asList(part1)); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
112 result.add(part2); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
113 return result.toArray(new String[0]); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
114 } |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
115 |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
116 public static void checkCompressedOopsErgo(String[] gcflags) throws Exception { |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
117 long maxHeapForCompressedOops = getMaxHeapForCompressedOops(gcflags); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
118 |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
119 checkUseCompressedOops(gcflags, maxHeapForCompressedOops, true); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
120 checkUseCompressedOops(gcflags, maxHeapForCompressedOops - 1, true); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
121 checkUseCompressedOops(gcflags, maxHeapForCompressedOops + 1, false); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
122 |
40136aa2cdb1
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 |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
124 checkUseCompressedOops(join(gcflags, "-XX:HeapBaseMinAddress=32G"), maxHeapForCompressedOops, true); |
40136aa2cdb1
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); |
40136aa2cdb1
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); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
127 |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
128 // use a different object alignment |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
129 maxHeapForCompressedOops = getMaxHeapForCompressedOops(join(gcflags, "-XX:ObjectAlignmentInBytes=16")); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
130 |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
131 checkUseCompressedOops(join(gcflags, "-XX:ObjectAlignmentInBytes=16"), maxHeapForCompressedOops, true); |
40136aa2cdb1
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); |
40136aa2cdb1
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); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
134 |
12249
2f426063daea
8024662: gc/arguments/TestUseCompressedOopsErgo.java does not compile.
tschatzl
parents:
12233
diff
changeset
|
135 // use a different CompressedClassSpaceSize |
2f426063daea
8024662: gc/arguments/TestUseCompressedOopsErgo.java does not compile.
tschatzl
parents:
12233
diff
changeset
|
136 String compressedClassSpaceSizeArg = "-XX:CompressedClassSpaceSize=" + 2 * getCompressedClassSpaceSize(); |
2f426063daea
8024662: gc/arguments/TestUseCompressedOopsErgo.java does not compile.
tschatzl
parents:
12233
diff
changeset
|
137 maxHeapForCompressedOops = getMaxHeapForCompressedOops(join(gcflags, compressedClassSpaceSizeArg)); |
12233
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
138 |
12249
2f426063daea
8024662: gc/arguments/TestUseCompressedOopsErgo.java does not compile.
tschatzl
parents:
12233
diff
changeset
|
139 checkUseCompressedOops(join(gcflags, compressedClassSpaceSizeArg), maxHeapForCompressedOops, true); |
2f426063daea
8024662: gc/arguments/TestUseCompressedOopsErgo.java does not compile.
tschatzl
parents:
12233
diff
changeset
|
140 checkUseCompressedOops(join(gcflags, compressedClassSpaceSizeArg), maxHeapForCompressedOops - 1, true); |
2f426063daea
8024662: gc/arguments/TestUseCompressedOopsErgo.java does not compile.
tschatzl
parents:
12233
diff
changeset
|
141 checkUseCompressedOops(join(gcflags, compressedClassSpaceSizeArg), maxHeapForCompressedOops + 1, false); |
12233
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
142 } |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
143 |
40136aa2cdb1
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 { |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
145 ArrayList<String> finalargs = new ArrayList<String>(); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
146 finalargs.addAll(Arrays.asList(args)); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
147 finalargs.add("-Xmx" + heapsize); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
148 finalargs.add("-XX:+PrintFlagsFinal"); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
149 finalargs.add("-version"); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
150 |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
151 String output = expectValid(finalargs.toArray(new String[0])); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
152 |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
153 boolean actualUseCompressedOops = getFlagBoolValue(" UseCompressedOops", output); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
154 |
12249
2f426063daea
8024662: gc/arguments/TestUseCompressedOopsErgo.java does not compile.
tschatzl
parents:
12233
diff
changeset
|
155 Asserts.assertEQ(expectUseCompressedOops, actualUseCompressedOops); |
12233
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
156 } |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
157 |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
158 private static boolean getFlagBoolValue(String flag, String where) { |
40136aa2cdb1
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); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
160 if (!m.find()) { |
40136aa2cdb1
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"); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
162 } |
12249
2f426063daea
8024662: gc/arguments/TestUseCompressedOopsErgo.java does not compile.
tschatzl
parents:
12233
diff
changeset
|
163 return m.group(1).equals("true"); |
12233
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
164 } |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
165 |
40136aa2cdb1
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 { |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
167 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(flags); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
168 OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
169 output.shouldHaveExitValue(errorcode); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
170 return output.getStdout(); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
171 } |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
172 |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
173 private static String expectValid(String[] flags) throws Exception { |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
174 return expect(flags, false, false, 0); |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
175 } |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
176 } |
40136aa2cdb1
8010722: assert: failed: heap size is too big for compressed oops
tschatzl
parents:
diff
changeset
|
177 |