8342561: Metaspace for generated reflection classes is no longer needed

Reviewed-by: shade, stuefe
This commit is contained in:
Coleen Phillimore 2024-10-28 13:48:23 +00:00
parent d5fb6b4a3c
commit 120a9357b3
7 changed files with 13 additions and 49 deletions

View File

@ -56,7 +56,6 @@ public:
StandardMetaspaceType = ZeroMetaspaceType,
BootMetaspaceType = StandardMetaspaceType + 1,
ClassMirrorHolderMetaspaceType = BootMetaspaceType + 1,
ReflectionMetaspaceType = ClassMirrorHolderMetaspaceType + 1,
MetaspaceTypeCount
};

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -61,17 +61,6 @@ static const chunklevel_t g_sequ_anon_class[] = {
// .. repeat last
};
static const chunklevel_t g_sequ_refl_non_class[] = {
chunklevel::CHUNK_LEVEL_2K,
chunklevel::CHUNK_LEVEL_1K
// .. repeat last
};
static const chunklevel_t g_sequ_refl_class[] = {
chunklevel::CHUNK_LEVEL_1K,
// .. repeat last
};
// Boot class loader: give it large chunks: beyond commit granule size
// (typically 64K) the costs for large chunks largely diminishes since
// they are committed on the fly.
@ -95,15 +84,12 @@ const ArenaGrowthPolicy* ArenaGrowthPolicy::policy_for_space_type(Metaspace::Met
DEFINE_CLASS_FOR_ARRAY(standard_class)
DEFINE_CLASS_FOR_ARRAY(anon_non_class)
DEFINE_CLASS_FOR_ARRAY(anon_class)
DEFINE_CLASS_FOR_ARRAY(refl_non_class)
DEFINE_CLASS_FOR_ARRAY(refl_class)
DEFINE_CLASS_FOR_ARRAY(boot_non_class)
DEFINE_CLASS_FOR_ARRAY(boot_class)
if (is_class) {
switch(space_type) {
case Metaspace::StandardMetaspaceType: return &chunk_alloc_sequence_standard_class;
case Metaspace::ReflectionMetaspaceType: return &chunk_alloc_sequence_refl_class;
case Metaspace::ClassMirrorHolderMetaspaceType: return &chunk_alloc_sequence_anon_class;
case Metaspace::BootMetaspaceType: return &chunk_alloc_sequence_boot_class;
default: ShouldNotReachHere();
@ -111,7 +97,6 @@ const ArenaGrowthPolicy* ArenaGrowthPolicy::policy_for_space_type(Metaspace::Met
} else {
switch(space_type) {
case Metaspace::StandardMetaspaceType: return &chunk_alloc_sequence_standard_non_class;
case Metaspace::ReflectionMetaspaceType: return &chunk_alloc_sequence_refl_non_class;
case Metaspace::ClassMirrorHolderMetaspaceType: return &chunk_alloc_sequence_anon_non_class;
case Metaspace::BootMetaspaceType: return &chunk_alloc_sequence_boot_non_class;
default: ShouldNotReachHere();

View File

@ -49,7 +49,6 @@ static const char* describe_spacetype(Metaspace::MetaspaceType st) {
case Metaspace::StandardMetaspaceType: s = "Standard"; break;
case Metaspace::BootMetaspaceType: s = "Boot"; break;
case Metaspace::ClassMirrorHolderMetaspaceType: s = "ClassMirrorHolder"; break;
case Metaspace::ReflectionMetaspaceType: s = "Reflection"; break;
default: ShouldNotReachHere();
}
return s;

View File

@ -1751,7 +1751,7 @@ WB_ENTRY(jlong, WB_GetTotalUsedWordsInMetaspaceTestContext(JNIEnv* env, jobject
WB_END
WB_ENTRY(jlong, WB_CreateArenaInTestContext(JNIEnv* env, jobject wb, jlong context, jboolean is_micro))
const Metaspace::MetaspaceType type = is_micro ? Metaspace::ReflectionMetaspaceType : Metaspace::StandardMetaspaceType;
const Metaspace::MetaspaceType type = is_micro ? Metaspace::ClassMirrorHolderMetaspaceType : Metaspace::StandardMetaspaceType;
metaspace::MetaspaceTestContext* context0 = (metaspace::MetaspaceTestContext*) context;
return (jlong)p2i(context0->create_arena(type));
WB_END

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -61,8 +61,6 @@ TEST_VM(metaspace, arena_growth_policy_##spacetype##_##is_class) { \
test_arena_growth_policy(Metaspace::spacetype, is_class); \
}
DEFINE_GROWTH_POLICY_TEST(ReflectionMetaspaceType, true)
DEFINE_GROWTH_POLICY_TEST(ReflectionMetaspaceType, false)
DEFINE_GROWTH_POLICY_TEST(ClassMirrorHolderMetaspaceType, true)
DEFINE_GROWTH_POLICY_TEST(ClassMirrorHolderMetaspaceType, false)
DEFINE_GROWTH_POLICY_TEST(StandardMetaspaceType, true)

View File

@ -218,7 +218,8 @@ public:
static void test_basics(size_t commit_limit, bool is_micro) {
MetaspaceGtestContext context(commit_limit);
MetaspaceArenaTestHelper helper(context, is_micro ? Metaspace::ReflectionMetaspaceType : Metaspace::StandardMetaspaceType, false);
const Metaspace::MetaspaceType type = is_micro ? Metaspace::ClassMirrorHolderMetaspaceType : Metaspace::StandardMetaspaceType;
MetaspaceArenaTestHelper helper(context, type, false);
helper.allocate_from_arena_with_tests(1);
helper.allocate_from_arena_with_tests(128);
@ -278,11 +279,11 @@ TEST_VM(metaspace, MetaspaceArena_test_enlarge_in_place_standard_nc) {
}
TEST_VM(metaspace, MetaspaceArena_test_enlarge_in_place_micro_c) {
test_chunk_enlargment_simple(Metaspace::ReflectionMetaspaceType, true);
test_chunk_enlargment_simple(Metaspace::ClassMirrorHolderMetaspaceType, true);
}
TEST_VM(metaspace, MetaspaceArena_test_enlarge_in_place_micro_nc) {
test_chunk_enlargment_simple(Metaspace::ReflectionMetaspaceType, false);
test_chunk_enlargment_simple(Metaspace::ClassMirrorHolderMetaspaceType, false);
}
// Test chunk enlargement:
@ -434,8 +435,8 @@ static void test_recover_from_commit_limit_hit() {
// The first MetaspaceArena mimicks a micro loader. This will fill the free
// chunk list with very small chunks. We allocate from them in an interleaved
// way to cause fragmentation.
MetaspaceArenaTestHelper helper1(context, Metaspace::ReflectionMetaspaceType, false);
MetaspaceArenaTestHelper helper2(context, Metaspace::ReflectionMetaspaceType, false);
MetaspaceArenaTestHelper helper1(context, Metaspace::ClassMirrorHolderMetaspaceType, false);
MetaspaceArenaTestHelper helper2(context, Metaspace::ClassMirrorHolderMetaspaceType, false);
// This MetaspaceArena should hit the limit. We use BootMetaspaceType here since
// it gets a large initial chunk which is committed
@ -495,7 +496,9 @@ static void test_controlled_growth(Metaspace::MetaspaceType type, bool is_class,
MetaspaceGtestContext context;
MetaspaceArenaTestHelper smhelper(context, type, is_class, "Grower");
MetaspaceArenaTestHelper smhelper_harrasser(context, Metaspace::ReflectionMetaspaceType, true, "Harasser");
const Metaspace::MetaspaceType other_type =
(type == Metaspace::StandardMetaspaceType) ? Metaspace::ClassMirrorHolderMetaspaceType : Metaspace::StandardMetaspaceType;
MetaspaceArenaTestHelper smhelper_harrasser(context, other_type, true, "Harasser");
size_t used = 0, committed = 0, capacity = 0;
const size_t alloc_words = 16;
@ -617,16 +620,6 @@ static void test_controlled_growth(Metaspace::MetaspaceType type, bool is_class,
}
// these numbers have to be in sync with arena policy numbers (see memory/metaspace/arenaGrowthPolicy.cpp)
TEST_VM(metaspace, MetaspaceArena_growth_refl_c_inplace) {
test_controlled_growth(Metaspace::ReflectionMetaspaceType, true,
word_size_for_level(CHUNK_LEVEL_1K), true);
}
TEST_VM(metaspace, MetaspaceArena_growth_refl_c_not_inplace) {
test_controlled_growth(Metaspace::ReflectionMetaspaceType, true,
word_size_for_level(CHUNK_LEVEL_1K), false);
}
TEST_VM(metaspace, MetaspaceArena_growth_anon_c_inplace) {
test_controlled_growth(Metaspace::ClassMirrorHolderMetaspaceType, true,
word_size_for_level(CHUNK_LEVEL_1K), true);
@ -660,16 +653,6 @@ TEST_VM(metaspace, MetaspaceArena_growth_boot_c_not_inplace) {
}
*/
TEST_VM(metaspace, MetaspaceArena_growth_refl_nc_inplace) {
test_controlled_growth(Metaspace::ReflectionMetaspaceType, false,
word_size_for_level(CHUNK_LEVEL_2K), true);
}
TEST_VM(metaspace, MetaspaceArena_growth_refl_nc_not_inplace) {
test_controlled_growth(Metaspace::ReflectionMetaspaceType, false,
word_size_for_level(CHUNK_LEVEL_2K), false);
}
TEST_VM(metaspace, MetaspaceArena_growth_anon_nc_inplace) {
test_controlled_growth(Metaspace::ClassMirrorHolderMetaspaceType, false,
word_size_for_level(CHUNK_LEVEL_1K), true);

View File

@ -227,7 +227,7 @@ class MetaspaceArenaTest {
void create_random_test_bed_at(int slotindex) {
SizeRange allocation_range(1, 100); // randomize too?
const ArenaGrowthPolicy* growth_policy = ArenaGrowthPolicy::policy_for_space_type(
(fifty_fifty() ? Metaspace::StandardMetaspaceType : Metaspace::ReflectionMetaspaceType),
(fifty_fifty() ? Metaspace::StandardMetaspaceType : Metaspace::ClassMirrorHolderMetaspaceType),
fifty_fifty());
create_new_test_bed_at(slotindex, growth_policy, allocation_range);
}