Skip to content

Commit 2bea858

Browse files
committed
8330631: Lilliput: Modify runtime/CompressedOops/CompressedClassPointers for tinycp
Reviewed-by: stefank, stuefe
1 parent a599676 commit 2bea858

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/hotspot/share/oops/compressedKlass.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,17 +186,11 @@ char* CompressedKlassPointers::reserve_address_space_X(uintptr_t from, uintptr_t
186186
}
187187

188188
char* CompressedKlassPointers::reserve_address_space_for_unscaled_encoding(size_t size, bool aslr) {
189-
if (tiny_classpointer_mode()) {
190-
return nullptr;
191-
}
192189
const size_t unscaled_max = nth_bit(narrow_klass_pointer_bits());
193190
return reserve_address_space_X(0, unscaled_max, size, Metaspace::reserve_alignment(), aslr);
194191
}
195192

196193
char* CompressedKlassPointers::reserve_address_space_for_zerobased_encoding(size_t size, bool aslr) {
197-
if (tiny_classpointer_mode()) {
198-
return nullptr;
199-
}
200194
const size_t unscaled_max = nth_bit(narrow_klass_pointer_bits());
201195
const size_t zerobased_max = nth_bit(narrow_klass_pointer_bits() + max_shift());
202196
return reserve_address_space_X(unscaled_max, zerobased_max, size, Metaspace::reserve_alignment(), aslr);

test/hotspot/jtreg/runtime/CompressedOops/CompressedClassPointers.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public class CompressedClassPointers {
4646

4747
static final String logging_option = "-Xlog:gc+metaspace=trace,metaspace=info,cds=trace";
4848
static final String reserveCCSAnywhere = "Reserving compressed class space anywhere";
49+
static final String usesCompactObjectHeadersPat = "UseCompactObjectHeaders 1";
4950

5051
// Returns true if we are to test the narrow klass base; we only do this on
5152
// platforms where we can be reasonably shure that we get reproducable placement).
@@ -57,6 +58,11 @@ static boolean testNarrowKlassBase() {
5758

5859
}
5960

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+
6066
// Returns true if the output indicates that the ccs is reserved anywhere.
6167
static boolean isCCSReservedAnywhere(OutputAnalyzer output) {
6268
if (output.getOutput().contains(reserveCCSAnywhere)) {
@@ -221,7 +227,7 @@ public static void smallHeapTestNoCoop() throws Exception {
221227
"-Xlog:cds=trace",
222228
"-XX:+VerifyBeforeGC", "-version");
223229
OutputAnalyzer output = new OutputAnalyzer(pb.start());
224-
if (!isCCSReservedAnywhere(output)) {
230+
if (!isCCSReservedAnywhere(output) && !usesCompactObjectHeaders(output)) {
225231
output.shouldContain("Narrow klass base: 0x0000000000000000");
226232
}
227233
output.shouldHaveExitValue(0);
@@ -239,10 +245,10 @@ public static void smallHeapTestWith1GNoCoop() throws Exception {
239245
"-Xlog:cds=trace",
240246
"-XX:+VerifyBeforeGC", "-version");
241247
OutputAnalyzer output = new OutputAnalyzer(pb.start());
242-
if (!isCCSReservedAnywhere(output)) {
248+
if (!isCCSReservedAnywhere(output) && !usesCompactObjectHeaders(output)) {
243249
output.shouldContain("Narrow klass base: 0x0000000000000000");
244250
}
245-
if (!Platform.isAArch64() && !Platform.isPPC()) {
251+
if (!Platform.isAArch64() && !usesCompactObjectHeaders(output) && !Platform.isPPC()) {
246252
// Currently relax this test for Aarch64 and ppc.
247253
output.shouldContain("Narrow klass shift: 0");
248254
}
@@ -261,10 +267,10 @@ public static void largeHeapTestNoCoop() throws Exception {
261267
"-Xlog:cds=trace",
262268
"-XX:+VerifyBeforeGC", "-version");
263269
OutputAnalyzer output = new OutputAnalyzer(pb.start());
264-
if (!isCCSReservedAnywhere(output)) {
270+
if (!isCCSReservedAnywhere(output) && !usesCompactObjectHeaders(output)) {
265271
output.shouldContain("Narrow klass base: 0x0000000000000000");
266272
}
267-
if (!Platform.isAArch64() && !Platform.isPPC()) {
273+
if (!Platform.isAArch64() && !usesCompactObjectHeaders(output) && !Platform.isPPC()) {
268274
// Currently relax this test for Aarch64 and ppc.
269275
output.shouldContain("Narrow klass shift: 0");
270276
}

0 commit comments

Comments
 (0)