Removed UseCCP from gtest sources

This commit is contained in:
tstuefe 2025-11-17 08:55:13 +01:00
parent 725e9772d5
commit fa1035ee9f
4 changed files with 20 additions and 87 deletions

View File

@ -38,7 +38,7 @@ TEST_VM(metaspace, MetaspaceUtils_reserved) {
}
TEST_VM(metaspace, MetaspaceUtils_reserved_compressed_class_pointers) {
if (USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE && CompressedKlassPointers::needs_class_space()) {
if (CompressedKlassPointers::needs_class_space()) {
size_t reserved = MetaspaceUtils::reserved_bytes();
EXPECT_GT(reserved, 0UL);
size_t reserved_class = MetaspaceUtils::reserved_bytes(Metaspace::ClassType);
@ -60,7 +60,7 @@ TEST_VM(metaspace, MetaspaceUtils_committed) {
}
TEST_VM(metaspace, MetaspaceUtils_committed_compressed_class_pointers) {
if (USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE && CompressedKlassPointers::needs_class_space()) {
if (CompressedKlassPointers::needs_class_space()) {
size_t committed = MetaspaceUtils::committed_bytes();
EXPECT_GT(committed, 0UL);
size_t committed_class = MetaspaceUtils::committed_bytes(Metaspace::ClassType);
@ -69,21 +69,6 @@ TEST_VM(metaspace, MetaspaceUtils_committed_compressed_class_pointers) {
}
}
TEST_VM(metaspace, MetaspaceUtils_non_compressed_class_pointers) {
if (USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE) {
return;
}
size_t committed_class = MetaspaceUtils::committed_bytes(Metaspace::ClassType);
EXPECT_EQ(committed_class, 0UL);
size_t used_class = MetaspaceUtils::used_bytes(Metaspace::ClassType);
EXPECT_EQ(used_class, 0UL);
size_t reserved_class = MetaspaceUtils::reserved_bytes(Metaspace::ClassType);
EXPECT_EQ(reserved_class, 0UL);
}
static void check_metaspace_stats_are_consistent(const MetaspaceStats& stats) {
EXPECT_LE(stats.committed(), stats.reserved());
EXPECT_LE(stats.used(), stats.committed());
@ -102,7 +87,7 @@ TEST_VM(MetaspaceUtils, MetaspaceUtils_get_statistics) {
check_metaspace_stats_are_not_null(combined_stats.non_class_space_stats());
check_metaspace_stats_are_consistent(combined_stats.non_class_space_stats());
if (CompressedKlassPointers::needs_class_space() && USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE) {
if (CompressedKlassPointers::needs_class_space()) {
check_metaspace_stats_are_not_null(combined_stats.class_space_stats());
check_metaspace_stats_are_consistent(combined_stats.class_space_stats());
} else {

View File

@ -97,7 +97,7 @@ TEST_VM(arrayOopDesc, base_offset) {
EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_OBJECT), 16);
EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_ARRAY), 16);
}
} else if (USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE) {
} else {
EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_BOOLEAN), 16);
EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_BYTE), 16);
EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_SHORT), 16);
@ -108,22 +108,6 @@ TEST_VM(arrayOopDesc, base_offset) {
EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_DOUBLE), 16);
EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_OBJECT), 16);
EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_ARRAY), 16);
} else {
EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_BOOLEAN), 20);
EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_BYTE), 20);
EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_SHORT), 20);
EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_CHAR), 20);
EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_INT), 20);
EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_FLOAT), 20);
EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_LONG), 24);
EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_DOUBLE), 24);
if (UseCompressedOops) {
EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_OBJECT), 20);
EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_ARRAY), 20);
} else {
EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_OBJECT), 24);
EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_ARRAY), 24);
}
}
#else
EXPECT_EQ(arrayOopDesc::base_offset_in_bytes(T_BOOLEAN), 12);

View File

@ -29,9 +29,6 @@
#include "unittest.hpp"
TEST_VM(CompressedKlass, basics) {
if (!USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE) {
return;
}
ASSERT_LE((address)0, CompressedKlassPointers::base());
ASSERT_LE(CompressedKlassPointers::base(), CompressedKlassPointers::klass_range_start());
ASSERT_LT(CompressedKlassPointers::klass_range_start(), CompressedKlassPointers::klass_range_end());
@ -55,22 +52,7 @@ TEST_VM(CompressedKlass, basics) {
#endif // _LP64
}
TEST_VM(CompressedKlass, ccp_off) {
if (USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE) {
return;
}
ASSERT_EQ(CompressedKlassPointers::klass_range_start(), (address)nullptr);
ASSERT_EQ(CompressedKlassPointers::klass_range_end(), (address)nullptr);
// We should be able to call CompressedKlassPointers::is_encodable, and it should
// always return false
ASSERT_FALSE(CompressedKlassPointers::is_encodable((address)0x12345));
}
TEST_VM(CompressedKlass, test_too_low_address) {
if (!USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE) {
return;
}
address really_low = (address) 32;
ASSERT_FALSE(CompressedKlassPointers::is_encodable(really_low));
address low = CompressedKlassPointers::klass_range_start() - 1;
@ -78,9 +60,6 @@ TEST_VM(CompressedKlass, test_too_low_address) {
}
TEST_VM(CompressedKlass, test_too_high_address) {
if (!USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE) {
return;
}
address really_high = (address) UINTPTR_MAX;
ASSERT_FALSE(CompressedKlassPointers::is_encodable(really_high));
address high = CompressedKlassPointers::klass_range_end();
@ -88,9 +67,6 @@ TEST_VM(CompressedKlass, test_too_high_address) {
}
TEST_VM(CompressedKlass, test_unaligned_address) {
if (!USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE) {
return;
}
const size_t alignment = CompressedKlassPointers::klass_alignment_in_bytes();
address addr = CompressedKlassPointers::klass_range_start() + alignment - 1;
ASSERT_FALSE(CompressedKlassPointers::is_encodable(addr));
@ -104,9 +80,6 @@ TEST_VM(CompressedKlass, test_unaligned_address) {
}
TEST_VM(CompressedKlass, test_good_address) {
if (!USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE) {
return;
}
const size_t alignment = CompressedKlassPointers::klass_alignment_in_bytes();
address addr = CompressedKlassPointers::klass_range_start();
ASSERT_TRUE(CompressedKlassPointers::is_encodable(addr));
@ -115,9 +88,6 @@ TEST_VM(CompressedKlass, test_good_address) {
}
TEST_VM(CompressedKlass, test_is_valid_narrow_klass) {
if (!USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE) {
return;
}
ASSERT_FALSE(CompressedKlassPointers::is_valid_narrow_klass_id(0));
narrowKlass nk_jlC = CompressedKlassPointers::encode((Klass*)vmClasses::Class_klass());
ASSERT_TRUE(CompressedKlassPointers::is_valid_narrow_klass_id(nk_jlC));

View File

@ -27,35 +27,29 @@
TEST_VM(objArrayOop, osize) {
static const struct {
int objal; bool ccp; bool coops; bool coh; int result;
int objal; bool coops; bool coh; int result;
} x[] = {
// ObjAligInB, UseCCP, UseCoops, UseCOH, object size in heap words
// ObjAligInB, UseCoops, UseCOH, object size in heap words
#ifdef _LP64
{ 8, false, false, false, 4 }, // 20 byte header, 8 byte oops
{ 8, false, true, false, 3 }, // 20 byte header, 4 byte oops
{ 8, true, false, false, 3 }, // 16 byte header, 8 byte oops
{ 8, true, true, false, 3 }, // 16 byte header, 4 byte oops
{ 8, true, false, true, 3 }, // 12 byte header, 8 byte oops
{ 8, true, true, true, 2 }, // 12 byte header, 4 byte oops
{ 16, false, false, false, 4 }, // 20 byte header, 8 byte oops, 16-byte align
{ 16, false, true, false, 4 }, // 20 byte header, 4 byte oops, 16-byte align
{ 16, true, false, false, 4 }, // 16 byte header, 8 byte oops, 16-byte align
{ 16, true, true, false, 4 }, // 16 byte header, 4 byte oops, 16-byte align
{ 16, true, false, true, 4 }, // 12 byte header, 8 byte oops, 16-byte align
{ 16, true, true, true, 2 }, // 12 byte header, 4 byte oops, 16-byte align
{ 256, false, false, false, 32 }, // 20 byte header, 8 byte oops, 256-byte align
{ 256, false, true, false, 32 }, // 20 byte header, 4 byte oops, 256-byte align
{ 256, true, false, false, 32 }, // 16 byte header, 8 byte oops, 256-byte align
{ 256, true, true, false, 32 }, // 16 byte header, 4 byte oops, 256-byte align
{ 256, true, false, true, 32 }, // 12 byte header, 8 byte oops, 256-byte align
{ 256, true, true, true, 32 }, // 12 byte header, 4 byte oops, 256-byte align
{ 8, false, false, 3 }, // 16 byte header, 8 byte oops
{ 8, true, false, 3 }, // 16 byte header, 4 byte oops
{ 8, false, true, 3 }, // 12 byte header, 8 byte oops
{ 8, true, true, 2 }, // 12 byte header, 4 byte oops
{ 16, false, false, 4 }, // 16 byte header, 8 byte oops, 16-byte align
{ 16, true, false, 4 }, // 16 byte header, 4 byte oops, 16-byte align
{ 16, false, true, 4 }, // 12 byte header, 8 byte oops, 16-byte align
{ 16, true, true, 2 }, // 12 byte header, 4 byte oops, 16-byte align
{ 256, false, false, 32 }, // 16 byte header, 8 byte oops, 256-byte align
{ 256, true, false, 32 }, // 16 byte header, 4 byte oops, 256-byte align
{ 256, false, true, 32 }, // 12 byte header, 8 byte oops, 256-byte align
{ 256, true, true, 32 }, // 12 byte header, 4 byte oops, 256-byte align
#else
{ 8, false, false, false, 4 }, // 12 byte header, 4 byte oops, wordsize 4
{ 8, false, false, 4 }, // 12 byte header, 4 byte oops, wordsize 4
#endif
{ -1, false, false, false, -1 }
};
for (int i = 0; x[i].result != -1; i++) {
if (x[i].objal == (int)ObjectAlignmentInBytes && x[i].ccp == USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE && x[i].coops == UseCompressedOops &&
if (x[i].objal == (int)ObjectAlignmentInBytes && x[i].coops == UseCompressedOops &&
x[i].coh == UseCompactObjectHeaders) {
EXPECT_EQ(objArrayOopDesc::object_size(1), (size_t)x[i].result);
}