@@ -46,6 +46,7 @@ public class CompressedClassPointers {
46
46
47
47
static final String logging_option = "-Xlog:gc+metaspace=trace,metaspace=info,cds=trace" ;
48
48
static final String reserveCCSAnywhere = "Reserving compressed class space anywhere" ;
49
+ static final String usesCompactObjectHeadersPat = "UseCompactObjectHeaders 1" ;
49
50
50
51
// Returns true if we are to test the narrow klass base; we only do this on
51
52
// platforms where we can be reasonably shure that we get reproducable placement).
@@ -57,6 +58,11 @@ static boolean testNarrowKlassBase() {
57
58
58
59
}
59
60
61
+ // Returns true if the output indicates that the VM uses compact object headers
62
+ static boolean usesCompactObjectHeaders (OutputAnalyzer output ) {
63
+ return output .getOutput ().contains (usesCompactObjectHeadersPat );
64
+ }
65
+
60
66
// Returns true if the output indicates that the ccs is reserved anywhere.
61
67
static boolean isCCSReservedAnywhere (OutputAnalyzer output ) {
62
68
if (output .getOutput ().contains (reserveCCSAnywhere )) {
@@ -221,7 +227,7 @@ public static void smallHeapTestNoCoop() throws Exception {
221
227
"-Xlog:cds=trace" ,
222
228
"-XX:+VerifyBeforeGC" , "-version" );
223
229
OutputAnalyzer output = new OutputAnalyzer (pb .start ());
224
- if (!isCCSReservedAnywhere (output )) {
230
+ if (!isCCSReservedAnywhere (output ) && ! usesCompactObjectHeaders ( output ) ) {
225
231
output .shouldContain ("Narrow klass base: 0x0000000000000000" );
226
232
}
227
233
output .shouldHaveExitValue (0 );
@@ -239,10 +245,10 @@ public static void smallHeapTestWith1GNoCoop() throws Exception {
239
245
"-Xlog:cds=trace" ,
240
246
"-XX:+VerifyBeforeGC" , "-version" );
241
247
OutputAnalyzer output = new OutputAnalyzer (pb .start ());
242
- if (!isCCSReservedAnywhere (output )) {
248
+ if (!isCCSReservedAnywhere (output ) && ! usesCompactObjectHeaders ( output ) ) {
243
249
output .shouldContain ("Narrow klass base: 0x0000000000000000" );
244
250
}
245
- if (!Platform .isAArch64 () && !Platform .isPPC ()) {
251
+ if (!Platform .isAArch64 () && ! usesCompactObjectHeaders ( output ) && !Platform .isPPC ()) {
246
252
// Currently relax this test for Aarch64 and ppc.
247
253
output .shouldContain ("Narrow klass shift: 0" );
248
254
}
@@ -261,10 +267,10 @@ public static void largeHeapTestNoCoop() throws Exception {
261
267
"-Xlog:cds=trace" ,
262
268
"-XX:+VerifyBeforeGC" , "-version" );
263
269
OutputAnalyzer output = new OutputAnalyzer (pb .start ());
264
- if (!isCCSReservedAnywhere (output )) {
270
+ if (!isCCSReservedAnywhere (output ) && ! usesCompactObjectHeaders ( output ) ) {
265
271
output .shouldContain ("Narrow klass base: 0x0000000000000000" );
266
272
}
267
- if (!Platform .isAArch64 () && !Platform .isPPC ()) {
273
+ if (!Platform .isAArch64 () && ! usesCompactObjectHeaders ( output ) && !Platform .isPPC ()) {
268
274
// Currently relax this test for Aarch64 and ppc.
269
275
output .shouldContain ("Narrow klass shift: 0" );
270
276
}
0 commit comments