< prev index next >

test/hotspot/jtreg/gc/arguments/TestUseCompressedOopsErgoTools.java

Print this page

110   public static void checkCompressedOopsErgo(String[] gcflags) throws Exception {
111     long maxHeapForCompressedOops = getMaxHeapForCompressedOops(gcflags);
112 
113     checkUseCompressedOops(gcflags, maxHeapForCompressedOops, true);
114     checkUseCompressedOops(gcflags, maxHeapForCompressedOops - 1, true);
115     checkUseCompressedOops(gcflags, maxHeapForCompressedOops + 1, false);
116 
117     // the use of HeapBaseMinAddress should not change the outcome
118     checkUseCompressedOops(join(gcflags, "-XX:HeapBaseMinAddress=32G"), maxHeapForCompressedOops, true);
119     checkUseCompressedOops(join(gcflags, "-XX:HeapBaseMinAddress=32G"), maxHeapForCompressedOops - 1, true);
120     checkUseCompressedOops(join(gcflags, "-XX:HeapBaseMinAddress=32G"), maxHeapForCompressedOops + 1, false);
121 
122     // use a different object alignment
123     maxHeapForCompressedOops = getMaxHeapForCompressedOops(join(gcflags, "-XX:ObjectAlignmentInBytes=16"));
124 
125     checkUseCompressedOops(join(gcflags, "-XX:ObjectAlignmentInBytes=16"), maxHeapForCompressedOops, true);
126     checkUseCompressedOops(join(gcflags, "-XX:ObjectAlignmentInBytes=16"), maxHeapForCompressedOops - 1, true);
127     checkUseCompressedOops(join(gcflags, "-XX:ObjectAlignmentInBytes=16"), maxHeapForCompressedOops + 1, false);
128 
129     // use a different CompressedClassSpaceSize
130     String compressedClassSpaceSizeArg = "-XX:CompressedClassSpaceSize=" + 2 * getCompressedClassSpaceSize();


131     maxHeapForCompressedOops = getMaxHeapForCompressedOops(join(gcflags, compressedClassSpaceSizeArg));
132 
133     checkUseCompressedOops(join(gcflags, compressedClassSpaceSizeArg), maxHeapForCompressedOops, true);
134     checkUseCompressedOops(join(gcflags, compressedClassSpaceSizeArg), maxHeapForCompressedOops - 1, true);
135     checkUseCompressedOops(join(gcflags, compressedClassSpaceSizeArg), maxHeapForCompressedOops + 1, false);
136   }
137 
138   private static void checkUseCompressedOops(String[] args, long heapsize, boolean expectUseCompressedOops) throws Exception {
139      ArrayList<String> finalargs = new ArrayList<String>();
140      finalargs.addAll(Arrays.asList(args));
141      finalargs.add("-Xmx" + heapsize);
142      finalargs.add("-XX:+PrintFlagsFinal");
143      finalargs.add("-version");
144 
145      String output = expectValid(finalargs.toArray(new String[0]));
146 
147      boolean actualUseCompressedOops = getFlagBoolValue(" UseCompressedOops", output);
148 
149      Asserts.assertEQ(expectUseCompressedOops, actualUseCompressedOops);
150   }

110   public static void checkCompressedOopsErgo(String[] gcflags) throws Exception {
111     long maxHeapForCompressedOops = getMaxHeapForCompressedOops(gcflags);
112 
113     checkUseCompressedOops(gcflags, maxHeapForCompressedOops, true);
114     checkUseCompressedOops(gcflags, maxHeapForCompressedOops - 1, true);
115     checkUseCompressedOops(gcflags, maxHeapForCompressedOops + 1, false);
116 
117     // the use of HeapBaseMinAddress should not change the outcome
118     checkUseCompressedOops(join(gcflags, "-XX:HeapBaseMinAddress=32G"), maxHeapForCompressedOops, true);
119     checkUseCompressedOops(join(gcflags, "-XX:HeapBaseMinAddress=32G"), maxHeapForCompressedOops - 1, true);
120     checkUseCompressedOops(join(gcflags, "-XX:HeapBaseMinAddress=32G"), maxHeapForCompressedOops + 1, false);
121 
122     // use a different object alignment
123     maxHeapForCompressedOops = getMaxHeapForCompressedOops(join(gcflags, "-XX:ObjectAlignmentInBytes=16"));
124 
125     checkUseCompressedOops(join(gcflags, "-XX:ObjectAlignmentInBytes=16"), maxHeapForCompressedOops, true);
126     checkUseCompressedOops(join(gcflags, "-XX:ObjectAlignmentInBytes=16"), maxHeapForCompressedOops - 1, true);
127     checkUseCompressedOops(join(gcflags, "-XX:ObjectAlignmentInBytes=16"), maxHeapForCompressedOops + 1, false);
128 
129     // use a different CompressedClassSpaceSize
130     // Lilliput: do not assume a max. class space size, since that is subject to change. Instead, use a value slightly smaller
131     //  than what the parent VM runs with (which is the default size).
132     String compressedClassSpaceSizeArg = "-XX:CompressedClassSpaceSize=" + (getCompressedClassSpaceSize() - 1);
133     maxHeapForCompressedOops = getMaxHeapForCompressedOops(join(gcflags, compressedClassSpaceSizeArg));
134 
135     checkUseCompressedOops(join(gcflags, compressedClassSpaceSizeArg), maxHeapForCompressedOops, true);
136     checkUseCompressedOops(join(gcflags, compressedClassSpaceSizeArg), maxHeapForCompressedOops - 1, true);
137     checkUseCompressedOops(join(gcflags, compressedClassSpaceSizeArg), maxHeapForCompressedOops + 1, false);
138   }
139 
140   private static void checkUseCompressedOops(String[] args, long heapsize, boolean expectUseCompressedOops) throws Exception {
141      ArrayList<String> finalargs = new ArrayList<String>();
142      finalargs.addAll(Arrays.asList(args));
143      finalargs.add("-Xmx" + heapsize);
144      finalargs.add("-XX:+PrintFlagsFinal");
145      finalargs.add("-version");
146 
147      String output = expectValid(finalargs.toArray(new String[0]));
148 
149      boolean actualUseCompressedOops = getFlagBoolValue(" UseCompressedOops", output);
150 
151      Asserts.assertEQ(expectUseCompressedOops, actualUseCompressedOops);
152   }
< prev index next >