mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
8199430: Rename MetaspaceAux to something more meaningful
Reviewed-by: zgu, coleenp
This commit is contained in:
parent
b5ae436418
commit
da674f0d0d
22 changed files with 124 additions and 124 deletions
|
@ -1074,7 +1074,7 @@ void G1CollectedHeap::verify_before_full_collection(bool explicit_gc) {
|
||||||
void G1CollectedHeap::prepare_heap_for_mutators() {
|
void G1CollectedHeap::prepare_heap_for_mutators() {
|
||||||
// Delete metaspaces for unloaded class loaders and clean up loader_data graph
|
// Delete metaspaces for unloaded class loaders and clean up loader_data graph
|
||||||
ClassLoaderDataGraph::purge();
|
ClassLoaderDataGraph::purge();
|
||||||
MetaspaceAux::verify_metrics();
|
MetaspaceUtils::verify_metrics();
|
||||||
|
|
||||||
// Prepare heap for normal collections.
|
// Prepare heap for normal collections.
|
||||||
assert(num_free_regions() == 0, "we should not have added any free regions");
|
assert(num_free_regions() == 0, "we should not have added any free regions");
|
||||||
|
@ -2345,7 +2345,7 @@ void G1CollectedHeap::print_on(outputStream* st) const {
|
||||||
st->print("%u survivors (" SIZE_FORMAT "K)", survivor_regions,
|
st->print("%u survivors (" SIZE_FORMAT "K)", survivor_regions,
|
||||||
(size_t) survivor_regions * HeapRegion::GrainBytes / K);
|
(size_t) survivor_regions * HeapRegion::GrainBytes / K);
|
||||||
st->cr();
|
st->cr();
|
||||||
MetaspaceAux::print_on(st);
|
MetaspaceUtils::print_on(st);
|
||||||
}
|
}
|
||||||
|
|
||||||
void G1CollectedHeap::print_regions_on(outputStream* st) const {
|
void G1CollectedHeap::print_regions_on(outputStream* st) const {
|
||||||
|
|
|
@ -34,7 +34,7 @@ G1HeapTransition::Data::Data(G1CollectedHeap* g1_heap) {
|
||||||
_survivor_length = g1_heap->survivor_regions_count();
|
_survivor_length = g1_heap->survivor_regions_count();
|
||||||
_old_length = g1_heap->old_regions_count();
|
_old_length = g1_heap->old_regions_count();
|
||||||
_humongous_length = g1_heap->humongous_regions_count();
|
_humongous_length = g1_heap->humongous_regions_count();
|
||||||
_metaspace_used_bytes = MetaspaceAux::used_bytes();
|
_metaspace_used_bytes = MetaspaceUtils::used_bytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
G1HeapTransition::G1HeapTransition(G1CollectedHeap* g1_heap) : _g1_heap(g1_heap), _before(g1_heap) { }
|
G1HeapTransition::G1HeapTransition(G1CollectedHeap* g1_heap) : _g1_heap(g1_heap), _before(g1_heap) { }
|
||||||
|
@ -117,5 +117,5 @@ void G1HeapTransition::print() {
|
||||||
log_trace(gc, heap)(" Used: " SIZE_FORMAT "K, Waste: " SIZE_FORMAT "K",
|
log_trace(gc, heap)(" Used: " SIZE_FORMAT "K, Waste: " SIZE_FORMAT "K",
|
||||||
usage._humongous_used / K, ((after._humongous_length * HeapRegion::GrainBytes) - usage._humongous_used) / K);
|
usage._humongous_used / K, ((after._humongous_length * HeapRegion::GrainBytes) - usage._humongous_used) / K);
|
||||||
|
|
||||||
MetaspaceAux::print_metaspace_change(_before._metaspace_used_bytes);
|
MetaspaceUtils::print_metaspace_change(_before._metaspace_used_bytes);
|
||||||
}
|
}
|
||||||
|
|
|
@ -572,7 +572,7 @@ PSHeapSummary ParallelScavengeHeap::create_ps_heap_summary() {
|
||||||
void ParallelScavengeHeap::print_on(outputStream* st) const {
|
void ParallelScavengeHeap::print_on(outputStream* st) const {
|
||||||
young_gen()->print_on(st);
|
young_gen()->print_on(st);
|
||||||
old_gen()->print_on(st);
|
old_gen()->print_on(st);
|
||||||
MetaspaceAux::print_on(st);
|
MetaspaceUtils::print_on(st);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParallelScavengeHeap::print_on_error(outputStream* st) const {
|
void ParallelScavengeHeap::print_on_error(outputStream* st) const {
|
||||||
|
|
|
@ -267,7 +267,7 @@ public:
|
||||||
_heap_used(heap->used()),
|
_heap_used(heap->used()),
|
||||||
_young_gen_used(heap->young_gen()->used_in_bytes()),
|
_young_gen_used(heap->young_gen()->used_in_bytes()),
|
||||||
_old_gen_used(heap->old_gen()->used_in_bytes()),
|
_old_gen_used(heap->old_gen()->used_in_bytes()),
|
||||||
_metadata_used(MetaspaceAux::used_bytes()) { };
|
_metadata_used(MetaspaceUtils::used_bytes()) { };
|
||||||
|
|
||||||
size_t heap_used() const { return _heap_used; }
|
size_t heap_used() const { return _heap_used; }
|
||||||
size_t young_gen_used() const { return _young_gen_used; }
|
size_t young_gen_used() const { return _young_gen_used; }
|
||||||
|
|
|
@ -186,7 +186,7 @@ bool PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) {
|
||||||
BiasedLocking::preserve_marks();
|
BiasedLocking::preserve_marks();
|
||||||
|
|
||||||
// Capture metadata size before collection for sizing.
|
// Capture metadata size before collection for sizing.
|
||||||
size_t metadata_prev_used = MetaspaceAux::used_bytes();
|
size_t metadata_prev_used = MetaspaceUtils::used_bytes();
|
||||||
|
|
||||||
size_t old_gen_prev_used = old_gen->used_in_bytes();
|
size_t old_gen_prev_used = old_gen->used_in_bytes();
|
||||||
size_t young_gen_prev_used = young_gen->used_in_bytes();
|
size_t young_gen_prev_used = young_gen->used_in_bytes();
|
||||||
|
@ -247,7 +247,7 @@ bool PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) {
|
||||||
|
|
||||||
// Delete metaspaces for unloaded class loaders and clean up loader_data graph
|
// Delete metaspaces for unloaded class loaders and clean up loader_data graph
|
||||||
ClassLoaderDataGraph::purge();
|
ClassLoaderDataGraph::purge();
|
||||||
MetaspaceAux::verify_metrics();
|
MetaspaceUtils::verify_metrics();
|
||||||
|
|
||||||
BiasedLocking::restore_marks();
|
BiasedLocking::restore_marks();
|
||||||
CodeCache::gc_epilogue();
|
CodeCache::gc_epilogue();
|
||||||
|
@ -352,7 +352,7 @@ bool PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) {
|
||||||
|
|
||||||
young_gen->print_used_change(young_gen_prev_used);
|
young_gen->print_used_change(young_gen_prev_used);
|
||||||
old_gen->print_used_change(old_gen_prev_used);
|
old_gen->print_used_change(old_gen_prev_used);
|
||||||
MetaspaceAux::print_metaspace_change(metadata_prev_used);
|
MetaspaceUtils::print_metaspace_change(metadata_prev_used);
|
||||||
|
|
||||||
// Track memory usage and detect low memory
|
// Track memory usage and detect low memory
|
||||||
MemoryService::track_memory_usage();
|
MemoryService::track_memory_usage();
|
||||||
|
|
|
@ -1028,7 +1028,7 @@ void PSParallelCompact::post_compact()
|
||||||
|
|
||||||
// Delete metaspaces for unloaded class loaders and clean up loader_data graph
|
// Delete metaspaces for unloaded class loaders and clean up loader_data graph
|
||||||
ClassLoaderDataGraph::purge();
|
ClassLoaderDataGraph::purge();
|
||||||
MetaspaceAux::verify_metrics();
|
MetaspaceUtils::verify_metrics();
|
||||||
|
|
||||||
CodeCache::gc_epilogue();
|
CodeCache::gc_epilogue();
|
||||||
JvmtiExport::gc_epilogue();
|
JvmtiExport::gc_epilogue();
|
||||||
|
@ -1902,7 +1902,7 @@ bool PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) {
|
||||||
|
|
||||||
young_gen->print_used_change(pre_gc_values.young_gen_used());
|
young_gen->print_used_change(pre_gc_values.young_gen_used());
|
||||||
old_gen->print_used_change(pre_gc_values.old_gen_used());
|
old_gen->print_used_change(pre_gc_values.old_gen_used());
|
||||||
MetaspaceAux::print_metaspace_change(pre_gc_values.metadata_used());
|
MetaspaceUtils::print_metaspace_change(pre_gc_values.metadata_used());
|
||||||
|
|
||||||
// Track memory usage and detect low memory
|
// Track memory usage and detect low memory
|
||||||
MemoryService::track_memory_usage();
|
MemoryService::track_memory_usage();
|
||||||
|
|
|
@ -626,7 +626,7 @@ bool PSScavenge::invoke_no_policy() {
|
||||||
|
|
||||||
young_gen->print_used_change(pre_gc_values.young_gen_used());
|
young_gen->print_used_change(pre_gc_values.young_gen_used());
|
||||||
old_gen->print_used_change(pre_gc_values.old_gen_used());
|
old_gen->print_used_change(pre_gc_values.old_gen_used());
|
||||||
MetaspaceAux::print_metaspace_change(pre_gc_values.metadata_used());
|
MetaspaceUtils::print_metaspace_change(pre_gc_values.metadata_used());
|
||||||
|
|
||||||
// Track memory usage and detect low memory
|
// Track memory usage and detect low memory
|
||||||
MemoryService::track_memory_usage();
|
MemoryService::track_memory_usage();
|
||||||
|
|
|
@ -97,22 +97,22 @@ GCHeapSummary CollectedHeap::create_heap_summary() {
|
||||||
|
|
||||||
MetaspaceSummary CollectedHeap::create_metaspace_summary() {
|
MetaspaceSummary CollectedHeap::create_metaspace_summary() {
|
||||||
const MetaspaceSizes meta_space(
|
const MetaspaceSizes meta_space(
|
||||||
MetaspaceAux::committed_bytes(),
|
MetaspaceUtils::committed_bytes(),
|
||||||
MetaspaceAux::used_bytes(),
|
MetaspaceUtils::used_bytes(),
|
||||||
MetaspaceAux::reserved_bytes());
|
MetaspaceUtils::reserved_bytes());
|
||||||
const MetaspaceSizes data_space(
|
const MetaspaceSizes data_space(
|
||||||
MetaspaceAux::committed_bytes(Metaspace::NonClassType),
|
MetaspaceUtils::committed_bytes(Metaspace::NonClassType),
|
||||||
MetaspaceAux::used_bytes(Metaspace::NonClassType),
|
MetaspaceUtils::used_bytes(Metaspace::NonClassType),
|
||||||
MetaspaceAux::reserved_bytes(Metaspace::NonClassType));
|
MetaspaceUtils::reserved_bytes(Metaspace::NonClassType));
|
||||||
const MetaspaceSizes class_space(
|
const MetaspaceSizes class_space(
|
||||||
MetaspaceAux::committed_bytes(Metaspace::ClassType),
|
MetaspaceUtils::committed_bytes(Metaspace::ClassType),
|
||||||
MetaspaceAux::used_bytes(Metaspace::ClassType),
|
MetaspaceUtils::used_bytes(Metaspace::ClassType),
|
||||||
MetaspaceAux::reserved_bytes(Metaspace::ClassType));
|
MetaspaceUtils::reserved_bytes(Metaspace::ClassType));
|
||||||
|
|
||||||
const MetaspaceChunkFreeListSummary& ms_chunk_free_list_summary =
|
const MetaspaceChunkFreeListSummary& ms_chunk_free_list_summary =
|
||||||
MetaspaceAux::chunk_free_list_summary(Metaspace::NonClassType);
|
MetaspaceUtils::chunk_free_list_summary(Metaspace::NonClassType);
|
||||||
const MetaspaceChunkFreeListSummary& class_chunk_free_list_summary =
|
const MetaspaceChunkFreeListSummary& class_chunk_free_list_summary =
|
||||||
MetaspaceAux::chunk_free_list_summary(Metaspace::ClassType);
|
MetaspaceUtils::chunk_free_list_summary(Metaspace::ClassType);
|
||||||
|
|
||||||
return MetaspaceSummary(MetaspaceGC::capacity_until_GC(), meta_space, data_space, class_space,
|
return MetaspaceSummary(MetaspaceGC::capacity_until_GC(), meta_space, data_space, class_space,
|
||||||
ms_chunk_free_list_summary, class_chunk_free_list_summary);
|
ms_chunk_free_list_summary, class_chunk_free_list_summary);
|
||||||
|
|
|
@ -558,7 +558,7 @@ void GenCollectedHeap::do_collection(bool full,
|
||||||
|
|
||||||
ClearedAllSoftRefs casr(do_clear_all_soft_refs, soft_ref_policy());
|
ClearedAllSoftRefs casr(do_clear_all_soft_refs, soft_ref_policy());
|
||||||
|
|
||||||
const size_t metadata_prev_used = MetaspaceAux::used_bytes();
|
const size_t metadata_prev_used = MetaspaceUtils::used_bytes();
|
||||||
|
|
||||||
print_heap_before_gc();
|
print_heap_before_gc();
|
||||||
|
|
||||||
|
@ -644,7 +644,7 @@ void GenCollectedHeap::do_collection(bool full,
|
||||||
complete = complete || collected_old;
|
complete = complete || collected_old;
|
||||||
|
|
||||||
print_heap_change(young_prev_used, old_prev_used);
|
print_heap_change(young_prev_used, old_prev_used);
|
||||||
MetaspaceAux::print_metaspace_change(metadata_prev_used);
|
MetaspaceUtils::print_metaspace_change(metadata_prev_used);
|
||||||
|
|
||||||
// Adjust generation sizes.
|
// Adjust generation sizes.
|
||||||
if (collected_old) {
|
if (collected_old) {
|
||||||
|
@ -655,7 +655,7 @@ void GenCollectedHeap::do_collection(bool full,
|
||||||
if (complete) {
|
if (complete) {
|
||||||
// Delete metaspaces for unloaded class loaders and clean up loader_data graph
|
// Delete metaspaces for unloaded class loaders and clean up loader_data graph
|
||||||
ClassLoaderDataGraph::purge();
|
ClassLoaderDataGraph::purge();
|
||||||
MetaspaceAux::verify_metrics();
|
MetaspaceUtils::verify_metrics();
|
||||||
// Resize the metaspace capacity after full collections
|
// Resize the metaspace capacity after full collections
|
||||||
MetaspaceGC::compute_new_size();
|
MetaspaceGC::compute_new_size();
|
||||||
update_full_collections_completed();
|
update_full_collections_completed();
|
||||||
|
@ -1258,7 +1258,7 @@ void GenCollectedHeap::verify(VerifyOption option /* ignored */) {
|
||||||
void GenCollectedHeap::print_on(outputStream* st) const {
|
void GenCollectedHeap::print_on(outputStream* st) const {
|
||||||
_young_gen->print_on(st);
|
_young_gen->print_on(st);
|
||||||
_old_gen->print_on(st);
|
_old_gen->print_on(st);
|
||||||
MetaspaceAux::print_on(st);
|
MetaspaceUtils::print_on(st);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenCollectedHeap::gc_threads_do(ThreadClosure* tc) const {
|
void GenCollectedHeap::gc_threads_do(ThreadClosure* tc) const {
|
||||||
|
|
|
@ -1824,10 +1824,10 @@ void VirtualSpaceList::dec_reserved_words(size_t v) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#define assert_committed_below_limit() \
|
#define assert_committed_below_limit() \
|
||||||
assert(MetaspaceAux::committed_bytes() <= MaxMetaspaceSize, \
|
assert(MetaspaceUtils::committed_bytes() <= MaxMetaspaceSize, \
|
||||||
"Too much committed memory. Committed: " SIZE_FORMAT \
|
"Too much committed memory. Committed: " SIZE_FORMAT \
|
||||||
" limit (MaxMetaspaceSize): " SIZE_FORMAT, \
|
" limit (MaxMetaspaceSize): " SIZE_FORMAT, \
|
||||||
MetaspaceAux::committed_bytes(), MaxMetaspaceSize);
|
MetaspaceUtils::committed_bytes(), MaxMetaspaceSize);
|
||||||
|
|
||||||
void VirtualSpaceList::inc_committed_words(size_t v) {
|
void VirtualSpaceList::inc_committed_words(size_t v) {
|
||||||
assert_lock_strong(SpaceManager::expand_lock());
|
assert_lock_strong(SpaceManager::expand_lock());
|
||||||
|
@ -2424,13 +2424,13 @@ void MetaspaceGC::initialize() {
|
||||||
|
|
||||||
void MetaspaceGC::post_initialize() {
|
void MetaspaceGC::post_initialize() {
|
||||||
// Reset the high-water mark once the VM initialization is done.
|
// Reset the high-water mark once the VM initialization is done.
|
||||||
_capacity_until_GC = MAX2(MetaspaceAux::committed_bytes(), MetaspaceSize);
|
_capacity_until_GC = MAX2(MetaspaceUtils::committed_bytes(), MetaspaceSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MetaspaceGC::can_expand(size_t word_size, bool is_class) {
|
bool MetaspaceGC::can_expand(size_t word_size, bool is_class) {
|
||||||
// Check if the compressed class space is full.
|
// Check if the compressed class space is full.
|
||||||
if (is_class && Metaspace::using_class_space()) {
|
if (is_class && Metaspace::using_class_space()) {
|
||||||
size_t class_committed = MetaspaceAux::committed_bytes(Metaspace::ClassType);
|
size_t class_committed = MetaspaceUtils::committed_bytes(Metaspace::ClassType);
|
||||||
if (class_committed + word_size * BytesPerWord > CompressedClassSpaceSize) {
|
if (class_committed + word_size * BytesPerWord > CompressedClassSpaceSize) {
|
||||||
log_trace(gc, metaspace, freelist)("Cannot expand %s metaspace by " SIZE_FORMAT " words (CompressedClassSpaceSize = " SIZE_FORMAT " words)",
|
log_trace(gc, metaspace, freelist)("Cannot expand %s metaspace by " SIZE_FORMAT " words (CompressedClassSpaceSize = " SIZE_FORMAT " words)",
|
||||||
(is_class ? "class" : "non-class"), word_size, CompressedClassSpaceSize / sizeof(MetaWord));
|
(is_class ? "class" : "non-class"), word_size, CompressedClassSpaceSize / sizeof(MetaWord));
|
||||||
|
@ -2439,7 +2439,7 @@ bool MetaspaceGC::can_expand(size_t word_size, bool is_class) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the user has imposed a limit on the metaspace memory.
|
// Check if the user has imposed a limit on the metaspace memory.
|
||||||
size_t committed_bytes = MetaspaceAux::committed_bytes();
|
size_t committed_bytes = MetaspaceUtils::committed_bytes();
|
||||||
if (committed_bytes + word_size * BytesPerWord > MaxMetaspaceSize) {
|
if (committed_bytes + word_size * BytesPerWord > MaxMetaspaceSize) {
|
||||||
log_trace(gc, metaspace, freelist)("Cannot expand %s metaspace by " SIZE_FORMAT " words (MaxMetaspaceSize = " SIZE_FORMAT " words)",
|
log_trace(gc, metaspace, freelist)("Cannot expand %s metaspace by " SIZE_FORMAT " words (MaxMetaspaceSize = " SIZE_FORMAT " words)",
|
||||||
(is_class ? "class" : "non-class"), word_size, MaxMetaspaceSize / sizeof(MetaWord));
|
(is_class ? "class" : "non-class"), word_size, MaxMetaspaceSize / sizeof(MetaWord));
|
||||||
|
@ -2450,7 +2450,7 @@ bool MetaspaceGC::can_expand(size_t word_size, bool is_class) {
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t MetaspaceGC::allowed_expansion() {
|
size_t MetaspaceGC::allowed_expansion() {
|
||||||
size_t committed_bytes = MetaspaceAux::committed_bytes();
|
size_t committed_bytes = MetaspaceUtils::committed_bytes();
|
||||||
size_t capacity_until_gc = capacity_until_GC();
|
size_t capacity_until_gc = capacity_until_GC();
|
||||||
|
|
||||||
assert(capacity_until_gc >= committed_bytes,
|
assert(capacity_until_gc >= committed_bytes,
|
||||||
|
@ -2480,7 +2480,7 @@ void MetaspaceGC::compute_new_size() {
|
||||||
// Including the chunk free lists in the definition of "in use" is therefore
|
// Including the chunk free lists in the definition of "in use" is therefore
|
||||||
// necessary. Not including the chunk free lists can cause capacity_until_GC to
|
// necessary. Not including the chunk free lists can cause capacity_until_GC to
|
||||||
// shrink below committed_bytes() and this has caused serious bugs in the past.
|
// shrink below committed_bytes() and this has caused serious bugs in the past.
|
||||||
const size_t used_after_gc = MetaspaceAux::committed_bytes();
|
const size_t used_after_gc = MetaspaceUtils::committed_bytes();
|
||||||
const size_t capacity_until_GC = MetaspaceGC::capacity_until_GC();
|
const size_t capacity_until_GC = MetaspaceGC::capacity_until_GC();
|
||||||
|
|
||||||
const double minimum_free_percentage = MinMetaspaceFreeRatio / 100.0;
|
const double minimum_free_percentage = MinMetaspaceFreeRatio / 100.0;
|
||||||
|
@ -3491,27 +3491,27 @@ void SpaceManager::inc_size_metrics(size_t words) {
|
||||||
_allocated_chunks_words = _allocated_chunks_words + words;
|
_allocated_chunks_words = _allocated_chunks_words + words;
|
||||||
_allocated_chunks_count++;
|
_allocated_chunks_count++;
|
||||||
// Global total of capacity in allocated Metachunks
|
// Global total of capacity in allocated Metachunks
|
||||||
MetaspaceAux::inc_capacity(mdtype(), words);
|
MetaspaceUtils::inc_capacity(mdtype(), words);
|
||||||
// Global total of allocated Metablocks.
|
// Global total of allocated Metablocks.
|
||||||
// used_words_slow() includes the overhead in each
|
// used_words_slow() includes the overhead in each
|
||||||
// Metachunk so include it in the used when the
|
// Metachunk so include it in the used when the
|
||||||
// Metachunk is first added (so only added once per
|
// Metachunk is first added (so only added once per
|
||||||
// Metachunk).
|
// Metachunk).
|
||||||
MetaspaceAux::inc_used(mdtype(), Metachunk::overhead());
|
MetaspaceUtils::inc_used(mdtype(), Metachunk::overhead());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpaceManager::inc_used_metrics(size_t words) {
|
void SpaceManager::inc_used_metrics(size_t words) {
|
||||||
// Add to the per SpaceManager total
|
// Add to the per SpaceManager total
|
||||||
Atomic::add(words, &_allocated_blocks_words);
|
Atomic::add(words, &_allocated_blocks_words);
|
||||||
// Add to the global total
|
// Add to the global total
|
||||||
MetaspaceAux::inc_used(mdtype(), words);
|
MetaspaceUtils::inc_used(mdtype(), words);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpaceManager::dec_total_from_size_metrics() {
|
void SpaceManager::dec_total_from_size_metrics() {
|
||||||
MetaspaceAux::dec_capacity(mdtype(), allocated_chunks_words());
|
MetaspaceUtils::dec_capacity(mdtype(), allocated_chunks_words());
|
||||||
MetaspaceAux::dec_used(mdtype(), allocated_blocks_words());
|
MetaspaceUtils::dec_used(mdtype(), allocated_blocks_words());
|
||||||
// Also deduct the overhead per Metachunk
|
// Also deduct the overhead per Metachunk
|
||||||
MetaspaceAux::dec_used(mdtype(), allocated_chunks_count() * Metachunk::overhead());
|
MetaspaceUtils::dec_used(mdtype(), allocated_chunks_count() * Metachunk::overhead());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpaceManager::initialize() {
|
void SpaceManager::initialize() {
|
||||||
|
@ -3784,22 +3784,22 @@ void SpaceManager::dump(outputStream* const out) const {
|
||||||
" waste " SIZE_FORMAT, curr_total, used, free, capacity, waste);
|
" waste " SIZE_FORMAT, curr_total, used, free, capacity, waste);
|
||||||
}
|
}
|
||||||
|
|
||||||
// MetaspaceAux
|
// MetaspaceUtils
|
||||||
|
|
||||||
|
|
||||||
size_t MetaspaceAux::_capacity_words[] = {0, 0};
|
size_t MetaspaceUtils::_capacity_words[] = {0, 0};
|
||||||
volatile size_t MetaspaceAux::_used_words[] = {0, 0};
|
volatile size_t MetaspaceUtils::_used_words[] = {0, 0};
|
||||||
|
|
||||||
size_t MetaspaceAux::free_bytes(Metaspace::MetadataType mdtype) {
|
size_t MetaspaceUtils::free_bytes(Metaspace::MetadataType mdtype) {
|
||||||
VirtualSpaceList* list = Metaspace::get_space_list(mdtype);
|
VirtualSpaceList* list = Metaspace::get_space_list(mdtype);
|
||||||
return list == NULL ? 0 : list->free_bytes();
|
return list == NULL ? 0 : list->free_bytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t MetaspaceAux::free_bytes() {
|
size_t MetaspaceUtils::free_bytes() {
|
||||||
return free_bytes(Metaspace::ClassType) + free_bytes(Metaspace::NonClassType);
|
return free_bytes(Metaspace::ClassType) + free_bytes(Metaspace::NonClassType);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetaspaceAux::dec_capacity(Metaspace::MetadataType mdtype, size_t words) {
|
void MetaspaceUtils::dec_capacity(Metaspace::MetadataType mdtype, size_t words) {
|
||||||
assert_lock_strong(SpaceManager::expand_lock());
|
assert_lock_strong(SpaceManager::expand_lock());
|
||||||
assert(words <= capacity_words(mdtype),
|
assert(words <= capacity_words(mdtype),
|
||||||
"About to decrement below 0: words " SIZE_FORMAT
|
"About to decrement below 0: words " SIZE_FORMAT
|
||||||
|
@ -3808,13 +3808,13 @@ void MetaspaceAux::dec_capacity(Metaspace::MetadataType mdtype, size_t words) {
|
||||||
_capacity_words[mdtype] -= words;
|
_capacity_words[mdtype] -= words;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetaspaceAux::inc_capacity(Metaspace::MetadataType mdtype, size_t words) {
|
void MetaspaceUtils::inc_capacity(Metaspace::MetadataType mdtype, size_t words) {
|
||||||
assert_lock_strong(SpaceManager::expand_lock());
|
assert_lock_strong(SpaceManager::expand_lock());
|
||||||
// Needs to be atomic
|
// Needs to be atomic
|
||||||
_capacity_words[mdtype] += words;
|
_capacity_words[mdtype] += words;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetaspaceAux::dec_used(Metaspace::MetadataType mdtype, size_t words) {
|
void MetaspaceUtils::dec_used(Metaspace::MetadataType mdtype, size_t words) {
|
||||||
assert(words <= used_words(mdtype),
|
assert(words <= used_words(mdtype),
|
||||||
"About to decrement below 0: words " SIZE_FORMAT
|
"About to decrement below 0: words " SIZE_FORMAT
|
||||||
" is greater than _used_words[%u] " SIZE_FORMAT,
|
" is greater than _used_words[%u] " SIZE_FORMAT,
|
||||||
|
@ -3826,7 +3826,7 @@ void MetaspaceAux::dec_used(Metaspace::MetadataType mdtype, size_t words) {
|
||||||
Atomic::sub(words, &_used_words[mdtype]);
|
Atomic::sub(words, &_used_words[mdtype]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetaspaceAux::inc_used(Metaspace::MetadataType mdtype, size_t words) {
|
void MetaspaceUtils::inc_used(Metaspace::MetadataType mdtype, size_t words) {
|
||||||
// _used_words tracks allocations for
|
// _used_words tracks allocations for
|
||||||
// each piece of metadata. Those allocations are
|
// each piece of metadata. Those allocations are
|
||||||
// generally done concurrently by different application
|
// generally done concurrently by different application
|
||||||
|
@ -3834,7 +3834,7 @@ void MetaspaceAux::inc_used(Metaspace::MetadataType mdtype, size_t words) {
|
||||||
Atomic::add(words, &_used_words[mdtype]);
|
Atomic::add(words, &_used_words[mdtype]);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t MetaspaceAux::used_bytes_slow(Metaspace::MetadataType mdtype) {
|
size_t MetaspaceUtils::used_bytes_slow(Metaspace::MetadataType mdtype) {
|
||||||
size_t used = 0;
|
size_t used = 0;
|
||||||
ClassLoaderDataGraphMetaspaceIterator iter;
|
ClassLoaderDataGraphMetaspaceIterator iter;
|
||||||
while (iter.repeat()) {
|
while (iter.repeat()) {
|
||||||
|
@ -3847,7 +3847,7 @@ size_t MetaspaceAux::used_bytes_slow(Metaspace::MetadataType mdtype) {
|
||||||
return used * BytesPerWord;
|
return used * BytesPerWord;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t MetaspaceAux::free_bytes_slow(Metaspace::MetadataType mdtype) {
|
size_t MetaspaceUtils::free_bytes_slow(Metaspace::MetadataType mdtype) {
|
||||||
size_t free = 0;
|
size_t free = 0;
|
||||||
ClassLoaderDataGraphMetaspaceIterator iter;
|
ClassLoaderDataGraphMetaspaceIterator iter;
|
||||||
while (iter.repeat()) {
|
while (iter.repeat()) {
|
||||||
|
@ -3859,7 +3859,7 @@ size_t MetaspaceAux::free_bytes_slow(Metaspace::MetadataType mdtype) {
|
||||||
return free * BytesPerWord;
|
return free * BytesPerWord;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t MetaspaceAux::capacity_bytes_slow(Metaspace::MetadataType mdtype) {
|
size_t MetaspaceUtils::capacity_bytes_slow(Metaspace::MetadataType mdtype) {
|
||||||
if ((mdtype == Metaspace::ClassType) && !Metaspace::using_class_space()) {
|
if ((mdtype == Metaspace::ClassType) && !Metaspace::using_class_space()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -3876,7 +3876,7 @@ size_t MetaspaceAux::capacity_bytes_slow(Metaspace::MetadataType mdtype) {
|
||||||
return capacity * BytesPerWord;
|
return capacity * BytesPerWord;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t MetaspaceAux::capacity_bytes_slow() {
|
size_t MetaspaceUtils::capacity_bytes_slow() {
|
||||||
#ifdef PRODUCT
|
#ifdef PRODUCT
|
||||||
// Use capacity_bytes() in PRODUCT instead of this function.
|
// Use capacity_bytes() in PRODUCT instead of this function.
|
||||||
guarantee(false, "Should not call capacity_bytes_slow() in the PRODUCT");
|
guarantee(false, "Should not call capacity_bytes_slow() in the PRODUCT");
|
||||||
|
@ -3893,19 +3893,19 @@ size_t MetaspaceAux::capacity_bytes_slow() {
|
||||||
return class_capacity + non_class_capacity;
|
return class_capacity + non_class_capacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t MetaspaceAux::reserved_bytes(Metaspace::MetadataType mdtype) {
|
size_t MetaspaceUtils::reserved_bytes(Metaspace::MetadataType mdtype) {
|
||||||
VirtualSpaceList* list = Metaspace::get_space_list(mdtype);
|
VirtualSpaceList* list = Metaspace::get_space_list(mdtype);
|
||||||
return list == NULL ? 0 : list->reserved_bytes();
|
return list == NULL ? 0 : list->reserved_bytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t MetaspaceAux::committed_bytes(Metaspace::MetadataType mdtype) {
|
size_t MetaspaceUtils::committed_bytes(Metaspace::MetadataType mdtype) {
|
||||||
VirtualSpaceList* list = Metaspace::get_space_list(mdtype);
|
VirtualSpaceList* list = Metaspace::get_space_list(mdtype);
|
||||||
return list == NULL ? 0 : list->committed_bytes();
|
return list == NULL ? 0 : list->committed_bytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t MetaspaceAux::min_chunk_size_words() { return Metaspace::first_chunk_word_size(); }
|
size_t MetaspaceUtils::min_chunk_size_words() { return Metaspace::first_chunk_word_size(); }
|
||||||
|
|
||||||
size_t MetaspaceAux::free_chunks_total_words(Metaspace::MetadataType mdtype) {
|
size_t MetaspaceUtils::free_chunks_total_words(Metaspace::MetadataType mdtype) {
|
||||||
ChunkManager* chunk_manager = Metaspace::get_chunk_manager(mdtype);
|
ChunkManager* chunk_manager = Metaspace::get_chunk_manager(mdtype);
|
||||||
if (chunk_manager == NULL) {
|
if (chunk_manager == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -3914,24 +3914,24 @@ size_t MetaspaceAux::free_chunks_total_words(Metaspace::MetadataType mdtype) {
|
||||||
return chunk_manager->free_chunks_total_words();
|
return chunk_manager->free_chunks_total_words();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t MetaspaceAux::free_chunks_total_bytes(Metaspace::MetadataType mdtype) {
|
size_t MetaspaceUtils::free_chunks_total_bytes(Metaspace::MetadataType mdtype) {
|
||||||
return free_chunks_total_words(mdtype) * BytesPerWord;
|
return free_chunks_total_words(mdtype) * BytesPerWord;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t MetaspaceAux::free_chunks_total_words() {
|
size_t MetaspaceUtils::free_chunks_total_words() {
|
||||||
return free_chunks_total_words(Metaspace::ClassType) +
|
return free_chunks_total_words(Metaspace::ClassType) +
|
||||||
free_chunks_total_words(Metaspace::NonClassType);
|
free_chunks_total_words(Metaspace::NonClassType);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t MetaspaceAux::free_chunks_total_bytes() {
|
size_t MetaspaceUtils::free_chunks_total_bytes() {
|
||||||
return free_chunks_total_words() * BytesPerWord;
|
return free_chunks_total_words() * BytesPerWord;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MetaspaceAux::has_chunk_free_list(Metaspace::MetadataType mdtype) {
|
bool MetaspaceUtils::has_chunk_free_list(Metaspace::MetadataType mdtype) {
|
||||||
return Metaspace::get_chunk_manager(mdtype) != NULL;
|
return Metaspace::get_chunk_manager(mdtype) != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaspaceChunkFreeListSummary MetaspaceAux::chunk_free_list_summary(Metaspace::MetadataType mdtype) {
|
MetaspaceChunkFreeListSummary MetaspaceUtils::chunk_free_list_summary(Metaspace::MetadataType mdtype) {
|
||||||
if (!has_chunk_free_list(mdtype)) {
|
if (!has_chunk_free_list(mdtype)) {
|
||||||
return MetaspaceChunkFreeListSummary();
|
return MetaspaceChunkFreeListSummary();
|
||||||
}
|
}
|
||||||
|
@ -3940,12 +3940,12 @@ MetaspaceChunkFreeListSummary MetaspaceAux::chunk_free_list_summary(Metaspace::M
|
||||||
return cm->chunk_free_list_summary();
|
return cm->chunk_free_list_summary();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetaspaceAux::print_metaspace_change(size_t prev_metadata_used) {
|
void MetaspaceUtils::print_metaspace_change(size_t prev_metadata_used) {
|
||||||
log_info(gc, metaspace)("Metaspace: " SIZE_FORMAT "K->" SIZE_FORMAT "K(" SIZE_FORMAT "K)",
|
log_info(gc, metaspace)("Metaspace: " SIZE_FORMAT "K->" SIZE_FORMAT "K(" SIZE_FORMAT "K)",
|
||||||
prev_metadata_used/K, used_bytes()/K, reserved_bytes()/K);
|
prev_metadata_used/K, used_bytes()/K, reserved_bytes()/K);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetaspaceAux::print_on(outputStream* out) {
|
void MetaspaceUtils::print_on(outputStream* out) {
|
||||||
Metaspace::MetadataType nct = Metaspace::NonClassType;
|
Metaspace::MetadataType nct = Metaspace::NonClassType;
|
||||||
|
|
||||||
out->print_cr(" Metaspace "
|
out->print_cr(" Metaspace "
|
||||||
|
@ -3974,7 +3974,7 @@ void MetaspaceAux::print_on(outputStream* out) {
|
||||||
|
|
||||||
// Print information for class space and data space separately.
|
// Print information for class space and data space separately.
|
||||||
// This is almost the same as above.
|
// This is almost the same as above.
|
||||||
void MetaspaceAux::print_on(outputStream* out, Metaspace::MetadataType mdtype) {
|
void MetaspaceUtils::print_on(outputStream* out, Metaspace::MetadataType mdtype) {
|
||||||
size_t free_chunks_capacity_bytes = free_chunks_total_bytes(mdtype);
|
size_t free_chunks_capacity_bytes = free_chunks_total_bytes(mdtype);
|
||||||
size_t capacity_bytes = capacity_bytes_slow(mdtype);
|
size_t capacity_bytes = capacity_bytes_slow(mdtype);
|
||||||
size_t used_bytes = used_bytes_slow(mdtype);
|
size_t used_bytes = used_bytes_slow(mdtype);
|
||||||
|
@ -3995,7 +3995,7 @@ void MetaspaceAux::print_on(outputStream* out, Metaspace::MetadataType mdtype) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print total fragmentation for class metaspaces
|
// Print total fragmentation for class metaspaces
|
||||||
void MetaspaceAux::print_class_waste(outputStream* out) {
|
void MetaspaceUtils::print_class_waste(outputStream* out) {
|
||||||
assert(Metaspace::using_class_space(), "class metaspace not used");
|
assert(Metaspace::using_class_space(), "class metaspace not used");
|
||||||
size_t cls_specialized_waste = 0, cls_small_waste = 0, cls_medium_waste = 0;
|
size_t cls_specialized_waste = 0, cls_small_waste = 0, cls_medium_waste = 0;
|
||||||
size_t cls_specialized_count = 0, cls_small_count = 0, cls_medium_count = 0, cls_humongous_count = 0;
|
size_t cls_specialized_count = 0, cls_small_count = 0, cls_medium_count = 0, cls_humongous_count = 0;
|
||||||
|
@ -4022,7 +4022,7 @@ void MetaspaceAux::print_class_waste(outputStream* out) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print total fragmentation for data and class metaspaces separately
|
// Print total fragmentation for data and class metaspaces separately
|
||||||
void MetaspaceAux::print_waste(outputStream* out) {
|
void MetaspaceUtils::print_waste(outputStream* out) {
|
||||||
size_t specialized_waste = 0, small_waste = 0, medium_waste = 0;
|
size_t specialized_waste = 0, small_waste = 0, medium_waste = 0;
|
||||||
size_t specialized_count = 0, small_count = 0, medium_count = 0, humongous_count = 0;
|
size_t specialized_count = 0, small_count = 0, medium_count = 0, humongous_count = 0;
|
||||||
|
|
||||||
|
@ -4215,7 +4215,7 @@ void PrintCLDMetaspaceInfoClosure::print_summary() const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetaspaceAux::print_metadata_for_nmt(outputStream* out, size_t scale) {
|
void MetaspaceUtils::print_metadata_for_nmt(outputStream* out, size_t scale) {
|
||||||
const char* unit = scale_unit(scale);
|
const char* unit = scale_unit(scale);
|
||||||
out->print_cr("Metaspaces:");
|
out->print_cr("Metaspaces:");
|
||||||
out->print_cr(" Metadata space: reserved=" SIZE_FORMAT_W(10) "%s committed=" SIZE_FORMAT_W(10) "%s",
|
out->print_cr(" Metadata space: reserved=" SIZE_FORMAT_W(10) "%s committed=" SIZE_FORMAT_W(10) "%s",
|
||||||
|
@ -4240,7 +4240,7 @@ void MetaspaceAux::print_metadata_for_nmt(outputStream* out, size_t scale) {
|
||||||
|
|
||||||
|
|
||||||
// Dump global metaspace things from the end of ClassLoaderDataGraph
|
// Dump global metaspace things from the end of ClassLoaderDataGraph
|
||||||
void MetaspaceAux::dump(outputStream* out) {
|
void MetaspaceUtils::dump(outputStream* out) {
|
||||||
out->print_cr("All Metaspace:");
|
out->print_cr("All Metaspace:");
|
||||||
out->print("data space: "); print_on(out, Metaspace::NonClassType);
|
out->print("data space: "); print_on(out, Metaspace::NonClassType);
|
||||||
out->print("class space: "); print_on(out, Metaspace::ClassType);
|
out->print("class space: "); print_on(out, Metaspace::ClassType);
|
||||||
|
@ -4248,7 +4248,7 @@ void MetaspaceAux::dump(outputStream* out) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prints an ASCII representation of the given space.
|
// Prints an ASCII representation of the given space.
|
||||||
void MetaspaceAux::print_metaspace_map(outputStream* out, Metaspace::MetadataType mdtype) {
|
void MetaspaceUtils::print_metaspace_map(outputStream* out, Metaspace::MetadataType mdtype) {
|
||||||
MutexLockerEx cl(SpaceManager::expand_lock(), Mutex::_no_safepoint_check_flag);
|
MutexLockerEx cl(SpaceManager::expand_lock(), Mutex::_no_safepoint_check_flag);
|
||||||
const bool for_class = mdtype == Metaspace::ClassType ? true : false;
|
const bool for_class = mdtype == Metaspace::ClassType ? true : false;
|
||||||
VirtualSpaceList* const vsl = for_class ? Metaspace::class_space_list() : Metaspace::space_list();
|
VirtualSpaceList* const vsl = for_class ? Metaspace::class_space_list() : Metaspace::space_list();
|
||||||
|
@ -4272,14 +4272,14 @@ void MetaspaceAux::print_metaspace_map(outputStream* out, Metaspace::MetadataTyp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetaspaceAux::verify_free_chunks() {
|
void MetaspaceUtils::verify_free_chunks() {
|
||||||
Metaspace::chunk_manager_metadata()->verify();
|
Metaspace::chunk_manager_metadata()->verify();
|
||||||
if (Metaspace::using_class_space()) {
|
if (Metaspace::using_class_space()) {
|
||||||
Metaspace::chunk_manager_class()->verify();
|
Metaspace::chunk_manager_class()->verify();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetaspaceAux::verify_capacity() {
|
void MetaspaceUtils::verify_capacity() {
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
size_t running_sum_capacity_bytes = capacity_bytes();
|
size_t running_sum_capacity_bytes = capacity_bytes();
|
||||||
// For purposes of the running sum of capacity, verify against capacity
|
// For purposes of the running sum of capacity, verify against capacity
|
||||||
|
@ -4300,7 +4300,7 @@ void MetaspaceAux::verify_capacity() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetaspaceAux::verify_used() {
|
void MetaspaceUtils::verify_used() {
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
size_t running_sum_used_bytes = used_bytes();
|
size_t running_sum_used_bytes = used_bytes();
|
||||||
// For purposes of the running sum of used, verify against used
|
// For purposes of the running sum of used, verify against used
|
||||||
|
@ -4321,7 +4321,7 @@ void MetaspaceAux::verify_used() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetaspaceAux::verify_metrics() {
|
void MetaspaceUtils::verify_metrics() {
|
||||||
verify_capacity();
|
verify_capacity();
|
||||||
verify_used();
|
verify_used();
|
||||||
}
|
}
|
||||||
|
@ -4903,8 +4903,8 @@ void Metaspace::report_metadata_oome(ClassLoaderData* loader_data, size_t word_s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LogStream ls(log.info());
|
LogStream ls(log.info());
|
||||||
MetaspaceAux::dump(&ls);
|
MetaspaceUtils::dump(&ls);
|
||||||
MetaspaceAux::print_metaspace_map(&ls, mdtype);
|
MetaspaceUtils::print_metaspace_map(&ls, mdtype);
|
||||||
ChunkManager::print_all_chunkmanagers(&ls);
|
ChunkManager::print_all_chunkmanagers(&ls);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4912,7 +4912,7 @@ void Metaspace::report_metadata_oome(ClassLoaderData* loader_data, size_t word_s
|
||||||
if (is_class_space_allocation(mdtype)) {
|
if (is_class_space_allocation(mdtype)) {
|
||||||
Metaspace* metaspace = loader_data->metaspace_non_null();
|
Metaspace* metaspace = loader_data->metaspace_non_null();
|
||||||
out_of_compressed_class_space =
|
out_of_compressed_class_space =
|
||||||
MetaspaceAux::committed_bytes(Metaspace::ClassType) +
|
MetaspaceUtils::committed_bytes(Metaspace::ClassType) +
|
||||||
(metaspace->class_chunk_size(word_size) * BytesPerWord) >
|
(metaspace->class_chunk_size(word_size) * BytesPerWord) >
|
||||||
CompressedClassSpaceSize;
|
CompressedClassSpaceSize;
|
||||||
}
|
}
|
||||||
|
@ -5026,41 +5026,41 @@ static void do_update_in_use_info_for_chunk(Metachunk* chunk, bool inuse) {
|
||||||
|
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
|
|
||||||
class TestMetaspaceAuxTest : AllStatic {
|
class TestMetaspaceUtilsTest : AllStatic {
|
||||||
public:
|
public:
|
||||||
static void test_reserved() {
|
static void test_reserved() {
|
||||||
size_t reserved = MetaspaceAux::reserved_bytes();
|
size_t reserved = MetaspaceUtils::reserved_bytes();
|
||||||
|
|
||||||
assert(reserved > 0, "assert");
|
assert(reserved > 0, "assert");
|
||||||
|
|
||||||
size_t committed = MetaspaceAux::committed_bytes();
|
size_t committed = MetaspaceUtils::committed_bytes();
|
||||||
assert(committed <= reserved, "assert");
|
assert(committed <= reserved, "assert");
|
||||||
|
|
||||||
size_t reserved_metadata = MetaspaceAux::reserved_bytes(Metaspace::NonClassType);
|
size_t reserved_metadata = MetaspaceUtils::reserved_bytes(Metaspace::NonClassType);
|
||||||
assert(reserved_metadata > 0, "assert");
|
assert(reserved_metadata > 0, "assert");
|
||||||
assert(reserved_metadata <= reserved, "assert");
|
assert(reserved_metadata <= reserved, "assert");
|
||||||
|
|
||||||
if (UseCompressedClassPointers) {
|
if (UseCompressedClassPointers) {
|
||||||
size_t reserved_class = MetaspaceAux::reserved_bytes(Metaspace::ClassType);
|
size_t reserved_class = MetaspaceUtils::reserved_bytes(Metaspace::ClassType);
|
||||||
assert(reserved_class > 0, "assert");
|
assert(reserved_class > 0, "assert");
|
||||||
assert(reserved_class < reserved, "assert");
|
assert(reserved_class < reserved, "assert");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_committed() {
|
static void test_committed() {
|
||||||
size_t committed = MetaspaceAux::committed_bytes();
|
size_t committed = MetaspaceUtils::committed_bytes();
|
||||||
|
|
||||||
assert(committed > 0, "assert");
|
assert(committed > 0, "assert");
|
||||||
|
|
||||||
size_t reserved = MetaspaceAux::reserved_bytes();
|
size_t reserved = MetaspaceUtils::reserved_bytes();
|
||||||
assert(committed <= reserved, "assert");
|
assert(committed <= reserved, "assert");
|
||||||
|
|
||||||
size_t committed_metadata = MetaspaceAux::committed_bytes(Metaspace::NonClassType);
|
size_t committed_metadata = MetaspaceUtils::committed_bytes(Metaspace::NonClassType);
|
||||||
assert(committed_metadata > 0, "assert");
|
assert(committed_metadata > 0, "assert");
|
||||||
assert(committed_metadata <= committed, "assert");
|
assert(committed_metadata <= committed, "assert");
|
||||||
|
|
||||||
if (UseCompressedClassPointers) {
|
if (UseCompressedClassPointers) {
|
||||||
size_t committed_class = MetaspaceAux::committed_bytes(Metaspace::ClassType);
|
size_t committed_class = MetaspaceUtils::committed_bytes(Metaspace::ClassType);
|
||||||
assert(committed_class > 0, "assert");
|
assert(committed_class > 0, "assert");
|
||||||
assert(committed_class < committed, "assert");
|
assert(committed_class < committed, "assert");
|
||||||
}
|
}
|
||||||
|
@ -5083,8 +5083,8 @@ class TestMetaspaceAuxTest : AllStatic {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void TestMetaspaceAux_test() {
|
void TestMetaspaceUtils_test() {
|
||||||
TestMetaspaceAuxTest::test();
|
TestMetaspaceUtilsTest::test();
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestVirtualSpaceNodeTest {
|
class TestVirtualSpaceNodeTest {
|
||||||
|
|
|
@ -85,7 +85,7 @@ class Metaspace : public CHeapObj<mtClass> {
|
||||||
friend class SpaceManager;
|
friend class SpaceManager;
|
||||||
friend class VM_CollectForMetadataAllocation;
|
friend class VM_CollectForMetadataAllocation;
|
||||||
friend class MetaspaceGC;
|
friend class MetaspaceGC;
|
||||||
friend class MetaspaceAux;
|
friend class MetaspaceUtils;
|
||||||
friend class MetaspaceShared;
|
friend class MetaspaceShared;
|
||||||
friend class CollectedHeap;
|
friend class CollectedHeap;
|
||||||
friend class PrintCLDMetaspaceInfoClosure;
|
friend class PrintCLDMetaspaceInfoClosure;
|
||||||
|
@ -265,7 +265,7 @@ class Metaspace : public CHeapObj<mtClass> {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class MetaspaceAux : AllStatic {
|
class MetaspaceUtils : AllStatic {
|
||||||
static size_t free_chunks_total_words(Metaspace::MetadataType mdtype);
|
static size_t free_chunks_total_words(Metaspace::MetadataType mdtype);
|
||||||
|
|
||||||
// These methods iterate over the classloader data graph
|
// These methods iterate over the classloader data graph
|
||||||
|
|
|
@ -66,15 +66,15 @@ class MetaspacePerfCounters: public CHeapObj<mtInternal> {
|
||||||
MetaspacePerfCounters* MetaspaceCounters::_perf_counters = NULL;
|
MetaspacePerfCounters* MetaspaceCounters::_perf_counters = NULL;
|
||||||
|
|
||||||
size_t MetaspaceCounters::used() {
|
size_t MetaspaceCounters::used() {
|
||||||
return MetaspaceAux::used_bytes();
|
return MetaspaceUtils::used_bytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t MetaspaceCounters::capacity() {
|
size_t MetaspaceCounters::capacity() {
|
||||||
return MetaspaceAux::committed_bytes();
|
return MetaspaceUtils::committed_bytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t MetaspaceCounters::max_capacity() {
|
size_t MetaspaceCounters::max_capacity() {
|
||||||
return MetaspaceAux::reserved_bytes();
|
return MetaspaceUtils::reserved_bytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetaspaceCounters::initialize_performance_counters() {
|
void MetaspaceCounters::initialize_performance_counters() {
|
||||||
|
@ -98,15 +98,15 @@ void MetaspaceCounters::update_performance_counters() {
|
||||||
MetaspacePerfCounters* CompressedClassSpaceCounters::_perf_counters = NULL;
|
MetaspacePerfCounters* CompressedClassSpaceCounters::_perf_counters = NULL;
|
||||||
|
|
||||||
size_t CompressedClassSpaceCounters::used() {
|
size_t CompressedClassSpaceCounters::used() {
|
||||||
return MetaspaceAux::used_bytes(Metaspace::ClassType);
|
return MetaspaceUtils::used_bytes(Metaspace::ClassType);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t CompressedClassSpaceCounters::capacity() {
|
size_t CompressedClassSpaceCounters::capacity() {
|
||||||
return MetaspaceAux::committed_bytes(Metaspace::ClassType);
|
return MetaspaceUtils::committed_bytes(Metaspace::ClassType);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t CompressedClassSpaceCounters::max_capacity() {
|
size_t CompressedClassSpaceCounters::max_capacity() {
|
||||||
return MetaspaceAux::reserved_bytes(Metaspace::ClassType);
|
return MetaspaceUtils::reserved_bytes(Metaspace::ClassType);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompressedClassSpaceCounters::update_performance_counters() {
|
void CompressedClassSpaceCounters::update_performance_counters() {
|
||||||
|
|
|
@ -1162,7 +1162,7 @@ void Universe::initialize_verify_flags() {
|
||||||
} else if (strcmp(token, "classloader_data_graph") == 0) {
|
} else if (strcmp(token, "classloader_data_graph") == 0) {
|
||||||
verify_flags |= Verify_ClassLoaderDataGraph;
|
verify_flags |= Verify_ClassLoaderDataGraph;
|
||||||
} else if (strcmp(token, "metaspace") == 0) {
|
} else if (strcmp(token, "metaspace") == 0) {
|
||||||
verify_flags |= Verify_MetaspaceAux;
|
verify_flags |= Verify_MetaspaceUtils;
|
||||||
} else if (strcmp(token, "jni_handles") == 0) {
|
} else if (strcmp(token, "jni_handles") == 0) {
|
||||||
verify_flags |= Verify_JNIHandles;
|
verify_flags |= Verify_JNIHandles;
|
||||||
} else if (strcmp(token, "codecache_oops") == 0) {
|
} else if (strcmp(token, "codecache_oops") == 0) {
|
||||||
|
@ -1234,9 +1234,9 @@ void Universe::verify(VerifyOption option, const char* prefix) {
|
||||||
ClassLoaderDataGraph::verify();
|
ClassLoaderDataGraph::verify();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (should_verify_subset(Verify_MetaspaceAux)) {
|
if (should_verify_subset(Verify_MetaspaceUtils)) {
|
||||||
log_debug(gc, verify)("MetaspaceAux");
|
log_debug(gc, verify)("MetaspaceUtils");
|
||||||
MetaspaceAux::verify_free_chunks();
|
MetaspaceUtils::verify_free_chunks();
|
||||||
}
|
}
|
||||||
if (should_verify_subset(Verify_JNIHandles)) {
|
if (should_verify_subset(Verify_JNIHandles)) {
|
||||||
log_debug(gc, verify)("JNIHandles");
|
log_debug(gc, verify)("JNIHandles");
|
||||||
|
|
|
@ -489,7 +489,7 @@ class Universe: AllStatic {
|
||||||
Verify_CodeCache = 16,
|
Verify_CodeCache = 16,
|
||||||
Verify_SystemDictionary = 32,
|
Verify_SystemDictionary = 32,
|
||||||
Verify_ClassLoaderDataGraph = 64,
|
Verify_ClassLoaderDataGraph = 64,
|
||||||
Verify_MetaspaceAux = 128,
|
Verify_MetaspaceUtils = 128,
|
||||||
Verify_JNIHandles = 256,
|
Verify_JNIHandles = 256,
|
||||||
Verify_CodeCacheOops = 512,
|
Verify_CodeCacheOops = 512,
|
||||||
Verify_All = -1
|
Verify_All = -1
|
||||||
|
|
|
@ -192,7 +192,7 @@ WB_END
|
||||||
void TestReservedSpace_test();
|
void TestReservedSpace_test();
|
||||||
void TestReserveMemorySpecial_test();
|
void TestReserveMemorySpecial_test();
|
||||||
void TestVirtualSpace_test();
|
void TestVirtualSpace_test();
|
||||||
void TestMetaspaceAux_test();
|
void TestMetaspaceUtils_test();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
WB_ENTRY(void, WB_RunMemoryUnitTests(JNIEnv* env, jobject o))
|
WB_ENTRY(void, WB_RunMemoryUnitTests(JNIEnv* env, jobject o))
|
||||||
|
@ -200,7 +200,7 @@ WB_ENTRY(void, WB_RunMemoryUnitTests(JNIEnv* env, jobject o))
|
||||||
TestReservedSpace_test();
|
TestReservedSpace_test();
|
||||||
TestReserveMemorySpecial_test();
|
TestReserveMemorySpecial_test();
|
||||||
TestVirtualSpace_test();
|
TestVirtualSpace_test();
|
||||||
TestMetaspaceAux_test();
|
TestMetaspaceUtils_test();
|
||||||
#endif
|
#endif
|
||||||
WB_END
|
WB_END
|
||||||
|
|
||||||
|
|
|
@ -234,7 +234,7 @@ void VM_PrintJNI::doit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void VM_PrintMetadata::doit() {
|
void VM_PrintMetadata::doit() {
|
||||||
MetaspaceAux::print_metadata_for_nmt(_out, _scale);
|
MetaspaceUtils::print_metadata_for_nmt(_out, _scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
VM_FindDeadlocks::~VM_FindDeadlocks() {
|
VM_FindDeadlocks::~VM_FindDeadlocks() {
|
||||||
|
|
|
@ -197,18 +197,18 @@ void MemSummaryReporter::report_metadata(Metaspace::MetadataType type) const {
|
||||||
|
|
||||||
outputStream* out = output();
|
outputStream* out = output();
|
||||||
const char* scale = current_scale();
|
const char* scale = current_scale();
|
||||||
size_t committed = MetaspaceAux::committed_bytes(type);
|
size_t committed = MetaspaceUtils::committed_bytes(type);
|
||||||
size_t used = MetaspaceAux::used_bytes(type);
|
size_t used = MetaspaceUtils::used_bytes(type);
|
||||||
size_t free = (MetaspaceAux::capacity_bytes(type) - used)
|
size_t free = (MetaspaceUtils::capacity_bytes(type) - used)
|
||||||
+ MetaspaceAux::free_chunks_total_bytes(type)
|
+ MetaspaceUtils::free_chunks_total_bytes(type)
|
||||||
+ MetaspaceAux::free_bytes(type);
|
+ MetaspaceUtils::free_bytes(type);
|
||||||
|
|
||||||
assert(committed >= used + free, "Sanity");
|
assert(committed >= used + free, "Sanity");
|
||||||
size_t waste = committed - (used + free);
|
size_t waste = committed - (used + free);
|
||||||
|
|
||||||
out->print_cr("%27s ( %s)", " ", name);
|
out->print_cr("%27s ( %s)", " ", name);
|
||||||
out->print("%27s ( ", " ");
|
out->print("%27s ( ", " ");
|
||||||
print_total(MetaspaceAux::reserved_bytes(type), committed);
|
print_total(MetaspaceUtils::reserved_bytes(type), committed);
|
||||||
out->print_cr(")");
|
out->print_cr(")");
|
||||||
out->print_cr("%27s ( used=" SIZE_FORMAT "%s)", " ", amount_in_current_scale(used), scale);
|
out->print_cr("%27s ( used=" SIZE_FORMAT "%s)", " ", amount_in_current_scale(used), scale);
|
||||||
out->print_cr("%27s ( free=" SIZE_FORMAT "%s)", " ", amount_in_current_scale(free), scale);
|
out->print_cr("%27s ( free=" SIZE_FORMAT "%s)", " ", amount_in_current_scale(free), scale);
|
||||||
|
|
|
@ -194,12 +194,12 @@ MetaspacePool::MetaspacePool() :
|
||||||
MemoryPool("Metaspace", NonHeap, 0, calculate_max_size(), true, false) { }
|
MemoryPool("Metaspace", NonHeap, 0, calculate_max_size(), true, false) { }
|
||||||
|
|
||||||
MemoryUsage MetaspacePool::get_memory_usage() {
|
MemoryUsage MetaspacePool::get_memory_usage() {
|
||||||
size_t committed = MetaspaceAux::committed_bytes();
|
size_t committed = MetaspaceUtils::committed_bytes();
|
||||||
return MemoryUsage(initial_size(), used_in_bytes(), committed, max_size());
|
return MemoryUsage(initial_size(), used_in_bytes(), committed, max_size());
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t MetaspacePool::used_in_bytes() {
|
size_t MetaspacePool::used_in_bytes() {
|
||||||
return MetaspaceAux::used_bytes();
|
return MetaspaceUtils::used_bytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t MetaspacePool::calculate_max_size() const {
|
size_t MetaspacePool::calculate_max_size() const {
|
||||||
|
@ -211,10 +211,10 @@ CompressedKlassSpacePool::CompressedKlassSpacePool() :
|
||||||
MemoryPool("Compressed Class Space", NonHeap, 0, CompressedClassSpaceSize, true, false) { }
|
MemoryPool("Compressed Class Space", NonHeap, 0, CompressedClassSpaceSize, true, false) { }
|
||||||
|
|
||||||
size_t CompressedKlassSpacePool::used_in_bytes() {
|
size_t CompressedKlassSpacePool::used_in_bytes() {
|
||||||
return MetaspaceAux::used_bytes(Metaspace::ClassType);
|
return MetaspaceUtils::used_bytes(Metaspace::ClassType);
|
||||||
}
|
}
|
||||||
|
|
||||||
MemoryUsage CompressedKlassSpacePool::get_memory_usage() {
|
MemoryUsage CompressedKlassSpacePool::get_memory_usage() {
|
||||||
size_t committed = MetaspaceAux::committed_bytes(Metaspace::ClassType);
|
size_t committed = MetaspaceUtils::committed_bytes(Metaspace::ClassType);
|
||||||
return MemoryUsage(initial_size(), used_in_bytes(), committed, max_size());
|
return MemoryUsage(initial_size(), used_in_bytes(), committed, max_size());
|
||||||
}
|
}
|
||||||
|
|
|
@ -510,13 +510,13 @@ MetaspaceSnapshot::MetaspaceSnapshot() {
|
||||||
void MetaspaceSnapshot::snapshot(Metaspace::MetadataType type, MetaspaceSnapshot& mss) {
|
void MetaspaceSnapshot::snapshot(Metaspace::MetadataType type, MetaspaceSnapshot& mss) {
|
||||||
assert_valid_metadata_type(type);
|
assert_valid_metadata_type(type);
|
||||||
|
|
||||||
mss._reserved_in_bytes[type] = MetaspaceAux::reserved_bytes(type);
|
mss._reserved_in_bytes[type] = MetaspaceUtils::reserved_bytes(type);
|
||||||
mss._committed_in_bytes[type] = MetaspaceAux::committed_bytes(type);
|
mss._committed_in_bytes[type] = MetaspaceUtils::committed_bytes(type);
|
||||||
mss._used_in_bytes[type] = MetaspaceAux::used_bytes(type);
|
mss._used_in_bytes[type] = MetaspaceUtils::used_bytes(type);
|
||||||
|
|
||||||
size_t free_in_bytes = (MetaspaceAux::capacity_bytes(type) - MetaspaceAux::used_bytes(type))
|
size_t free_in_bytes = (MetaspaceUtils::capacity_bytes(type) - MetaspaceUtils::used_bytes(type))
|
||||||
+ MetaspaceAux::free_chunks_total_bytes(type)
|
+ MetaspaceUtils::free_chunks_total_bytes(type)
|
||||||
+ MetaspaceAux::free_bytes(type);
|
+ MetaspaceUtils::free_bytes(type);
|
||||||
mss._free_in_bytes[type] = free_in_bytes;
|
mss._free_in_bytes[type] = free_in_bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ void InternalVMTests::run() {
|
||||||
run_unit_test(TestReservedSpace_test);
|
run_unit_test(TestReservedSpace_test);
|
||||||
run_unit_test(TestReserveMemorySpecial_test);
|
run_unit_test(TestReserveMemorySpecial_test);
|
||||||
run_unit_test(TestVirtualSpace_test);
|
run_unit_test(TestVirtualSpace_test);
|
||||||
run_unit_test(TestMetaspaceAux_test);
|
run_unit_test(TestMetaspaceUtils_test);
|
||||||
run_unit_test(GCTimer_test);
|
run_unit_test(GCTimer_test);
|
||||||
run_unit_test(ObjectMonitor_test);
|
run_unit_test(ObjectMonitor_test);
|
||||||
run_unit_test(DirectivesParser_test);
|
run_unit_test(DirectivesParser_test);
|
||||||
|
|
|
@ -225,7 +225,7 @@ protected:
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_VERBOSE
|
#ifdef DEBUG_VERBOSE
|
||||||
tty->print_cr("Test finished. ");
|
tty->print_cr("Test finished. ");
|
||||||
MetaspaceAux::print_metaspace_map(tty, mdType);
|
MetaspaceUtils::print_metaspace_map(tty, mdType);
|
||||||
print_chunkmanager_statistics(tty, mdType);
|
print_chunkmanager_statistics(tty, mdType);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class TestVerifySubSet {
|
||||||
output.shouldContain("Heap");
|
output.shouldContain("Heap");
|
||||||
output.shouldContain("Threads");
|
output.shouldContain("Threads");
|
||||||
output.shouldContain("CodeCache");
|
output.shouldContain("CodeCache");
|
||||||
output.shouldContain("MetaspaceAux");
|
output.shouldContain("MetaspaceUtils");
|
||||||
output.shouldNotContain("SymbolTable");
|
output.shouldNotContain("SymbolTable");
|
||||||
output.shouldNotContain("StringTable");
|
output.shouldNotContain("StringTable");
|
||||||
output.shouldNotContain("SystemDictionary");
|
output.shouldNotContain("SystemDictionary");
|
||||||
|
@ -80,7 +80,7 @@ public class TestVerifySubSet {
|
||||||
output.shouldContain("memory sub-system is unknown, please correct it");
|
output.shouldContain("memory sub-system is unknown, please correct it");
|
||||||
output.shouldNotContain("Threads");
|
output.shouldNotContain("Threads");
|
||||||
output.shouldNotContain("CodeCache");
|
output.shouldNotContain("CodeCache");
|
||||||
output.shouldNotContain("MetaspaceAux");
|
output.shouldNotContain("MetaspaceUtils");
|
||||||
output.shouldHaveExitValue(1);
|
output.shouldHaveExitValue(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue