< prev index next >

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

Print this page

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


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

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