--- old/src/hotspot/share/memory/metaspace/spaceManager.cpp 2020-03-26 15:59:07.000000000 -0700 +++ new/src/hotspot/share/memory/metaspace/spaceManager.cpp 2020-03-26 15:59:06.000000000 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -75,14 +75,14 @@ if (is_class()) { switch (type) { case Metaspace::BootMetaspaceType: requested = Metaspace::first_class_chunk_word_size(); break; - case Metaspace::UnsafeAnonymousMetaspaceType: requested = ClassSpecializedChunk; break; + case Metaspace::ClassMirrorHolderMetaspaceType: requested = ClassSpecializedChunk; break; case Metaspace::ReflectionMetaspaceType: requested = ClassSpecializedChunk; break; default: requested = ClassSmallChunk; break; } } else { switch (type) { case Metaspace::BootMetaspaceType: requested = Metaspace::first_chunk_word_size(); break; - case Metaspace::UnsafeAnonymousMetaspaceType: requested = SpecializedChunk; break; + case Metaspace::ClassMirrorHolderMetaspaceType: requested = SpecializedChunk; break; case Metaspace::ReflectionMetaspaceType: requested = SpecializedChunk; break; default: requested = SmallChunk; break; } @@ -114,15 +114,15 @@ // After that a medium chunk is preferred. size_t chunk_word_size; - // Special case for unsafe anonymous metadata space. - // UnsafeAnonymous metadata space is usually small since it is used for - // class loader data's whose life cycle is governed by one class such as an - // unsafe anonymous class. The majority within 1K - 2K range and + // Special case for hidden metadata space. + // ClassMirrorHolder metadata space is usually small since it is used for + // class loader data's whose life cycle is governed by one class such as a + // weak hidden or unsafe anonymous class. The majority within 1K - 2K range and // rarely about 4K (64-bits JVM). // Instead of jumping to SmallChunk after initial chunk exhausted, keeping allocation // from SpecializeChunk up to _anon_or_delegating_metadata_specialize_chunk_limit (4) // reduces space waste from 60+% to around 30%. - if ((_space_type == Metaspace::UnsafeAnonymousMetaspaceType || _space_type == Metaspace::ReflectionMetaspaceType) && + if ((_space_type == Metaspace::ClassMirrorHolderMetaspaceType || _space_type == Metaspace::ReflectionMetaspaceType) && _mdtype == Metaspace::NonClassType && num_chunks_by_type(SpecializedIndex) < anon_and_delegating_metadata_specialize_chunk_limit && word_size + Metachunk::overhead() <= SpecializedChunk) {