Skip to content

Commit

Permalink
Review version 2 (2020-09-04)
Browse files Browse the repository at this point in the history
  • Loading branch information
tstuefe committed Sep 24, 2020
1 parent bf442c5 commit a7dc085
Show file tree
Hide file tree
Showing 175 changed files with 16,704 additions and 8,735 deletions.
3 changes: 3 additions & 0 deletions src/hotspot/share/classfile/classLoaderData.cpp
Expand Up @@ -59,6 +59,7 @@
#include "logging/logStream.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/metadataFactory.hpp"
#include "memory/metaspace.hpp"
#include "memory/resourceArea.hpp"
#include "memory/universe.hpp"
#include "oops/access.inline.hpp"
Expand Down Expand Up @@ -953,9 +954,11 @@ void ClassLoaderData::verify() {
guarantee(cl != NULL || this == ClassLoaderData::the_null_class_loader_data() || has_class_mirror_holder(), "must be");

// Verify the integrity of the allocated space.
#ifdef ASSERT
if (metaspace_or_null() != NULL) {
metaspace_or_null()->verify();
}
#endif

for (Klass* k = _klasses; k != NULL; k = k->next_link()) {
guarantee(k->class_loader_data() == this, "Must be the same");
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/classfile/classLoaderData.hpp
Expand Up @@ -62,6 +62,7 @@ class ModuleEntryTable;
class PackageEntryTable;
class DictionaryEntry;
class Dictionary;
class ClassLoaderMetaspace;

// ClassLoaderData class

Expand Down
18 changes: 0 additions & 18 deletions src/hotspot/share/classfile/classLoaderDataGraph.cpp
Expand Up @@ -661,24 +661,6 @@ Klass* ClassLoaderDataGraphKlassIteratorAtomic::next_klass() {
return NULL;
}

ClassLoaderDataGraphMetaspaceIterator::ClassLoaderDataGraphMetaspaceIterator() {
assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
_data = ClassLoaderDataGraph::_head;
}

ClassLoaderDataGraphMetaspaceIterator::~ClassLoaderDataGraphMetaspaceIterator() {}

ClassLoaderMetaspace* ClassLoaderDataGraphMetaspaceIterator::get_next() {
assert(_data != NULL, "Should not be NULL in call to the iterator");
ClassLoaderMetaspace* result = _data->metaspace_or_null();
_data = _data->next();
// This result might be NULL for class loaders without metaspace
// yet. It would be nice to return only non-null results but
// there is no guarantee that there will be a non-null result
// down the list so the caller is going to have to check.
return result;
}

void ClassLoaderDataGraph::verify() {
ClassLoaderDataGraphIterator iter;
while (ClassLoaderData* cld = iter.get_next()) {
Expand Down
8 changes: 0 additions & 8 deletions src/hotspot/share/classfile/classLoaderDataGraph.hpp
Expand Up @@ -162,12 +162,4 @@ class ClassLoaderDataGraphKlassIteratorAtomic : public StackObj {
static Klass* next_klass_in_cldg(Klass* klass);
};

class ClassLoaderDataGraphMetaspaceIterator : public StackObj {
ClassLoaderData* _data;
public:
ClassLoaderDataGraphMetaspaceIterator();
~ClassLoaderDataGraphMetaspaceIterator();
bool repeat() { return _data != NULL; }
ClassLoaderMetaspace* get_next();
};
#endif // SHARE_CLASSFILE_CLASSLOADERDATAGRAPH_HPP
15 changes: 9 additions & 6 deletions src/hotspot/share/classfile/classLoaderStats.cpp
Expand Up @@ -26,6 +26,7 @@
#include "classfile/classLoaderData.inline.hpp"
#include "classfile/classLoaderDataGraph.hpp"
#include "classfile/classLoaderStats.hpp"
#include "memory/metaspace.hpp"
#include "oops/objArrayKlass.hpp"
#include "oops/oop.inline.hpp"
#include "utilities/globalDefinitions.hpp"
Expand Down Expand Up @@ -80,15 +81,17 @@ void ClassLoaderStatsClosure::do_cld(ClassLoaderData* cld) {

ClassLoaderMetaspace* ms = cld->metaspace_or_null();
if (ms != NULL) {
size_t used_bytes, capacity_bytes;
ms->calculate_jfr_stats(&used_bytes, &capacity_bytes);
if(cld->has_class_mirror_holder()) {
cls->_hidden_chunk_sz += ms->allocated_chunks_bytes();
cls->_hidden_block_sz += ms->allocated_blocks_bytes();
cls->_hidden_chunk_sz += capacity_bytes;
cls->_hidden_block_sz += used_bytes;
} else {
cls->_chunk_sz = ms->allocated_chunks_bytes();
cls->_block_sz = ms->allocated_blocks_bytes();
cls->_chunk_sz = capacity_bytes;
cls->_block_sz = used_bytes;
}
_total_chunk_sz += ms->allocated_chunks_bytes();
_total_block_sz += ms->allocated_blocks_bytes();
_total_chunk_sz += capacity_bytes;
_total_block_sz += used_bytes;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/g1/g1CollectedHeap.cpp
Expand Up @@ -1034,7 +1034,7 @@ void G1CollectedHeap::prepare_heap_for_mutators() {

// Delete metaspaces for unloaded class loaders and clean up loader_data graph
ClassLoaderDataGraph::purge(/*at_safepoint*/true);
MetaspaceUtils::verify_metrics();
DEBUG_ONLY(MetaspaceUtils::verify();)

// Prepare heap for normal collections.
assert(num_free_regions() == 0, "we should not have added any free regions");
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/parallel/psParallelCompact.cpp
Expand Up @@ -1058,7 +1058,7 @@ void PSParallelCompact::post_compact()

// Delete metaspaces for unloaded class loaders and clean up loader_data graph
ClassLoaderDataGraph::purge(/*at_safepoint*/true);
MetaspaceUtils::verify_metrics();
DEBUG_ONLY(MetaspaceUtils::verify();)

heap->prune_scavengable_nmethods();

Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/gc/shared/collectedHeap.hpp
Expand Up @@ -30,6 +30,7 @@
#include "gc/shared/verifyOption.hpp"
#include "memory/allocation.hpp"
#include "memory/heapInspection.hpp"
#include "memory/metaspace.hpp"
#include "memory/universe.hpp"
#include "runtime/handles.hpp"
#include "runtime/perfData.hpp"
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/gc/shared/gcVMOperations.hpp
Expand Up @@ -28,6 +28,7 @@
#include "gc/shared/collectedHeap.hpp"
#include "gc/shared/genCollectedHeap.hpp"
#include "memory/heapInspection.hpp"
#include "memory/metaspace.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/handles.hpp"
#include "runtime/jniHandles.hpp"
Expand Down
3 changes: 2 additions & 1 deletion src/hotspot/share/gc/shared/genCollectedHeap.cpp
Expand Up @@ -59,6 +59,7 @@
#include "memory/filemap.hpp"
#include "memory/iterator.hpp"
#include "memory/metaspaceCounters.hpp"
#include "memory/metaspace/metaspaceSizesSnapshot.hpp"
#include "memory/resourceArea.hpp"
#include "memory/universe.hpp"
#include "oops/oop.inline.hpp"
Expand Down Expand Up @@ -662,7 +663,7 @@ void GenCollectedHeap::do_collection(bool full,

// Delete metaspaces for unloaded class loaders and clean up loader_data graph
ClassLoaderDataGraph::purge(/*at_safepoint*/true);
MetaspaceUtils::verify_metrics();
DEBUG_ONLY(MetaspaceUtils::verify();)
// Resize the metaspace capacity after full collections
MetaspaceGC::compute_new_size();
update_full_collections_completed();
Expand Down
3 changes: 1 addition & 2 deletions src/hotspot/share/gc/shared/generationSpec.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 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
Expand All @@ -25,7 +25,6 @@
#include "precompiled.hpp"
#include "gc/shared/cardTableRS.hpp"
#include "gc/shared/generationSpec.hpp"
#include "memory/binaryTreeDictionary.hpp"
#include "memory/filemap.hpp"
#include "runtime/java.hpp"
#include "utilities/macros.hpp"
Expand Down
14 changes: 1 addition & 13 deletions src/hotspot/share/gc/shared/jvmFlagConstraintsGC.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
Expand Down Expand Up @@ -262,18 +262,6 @@ JVMFlag::Error GCPauseIntervalMillisConstraintFunc(uintx value, bool verbose) {
return JVMFlag::SUCCESS;
}

JVMFlag::Error InitialBootClassLoaderMetaspaceSizeConstraintFunc(size_t value, bool verbose) {
size_t aligned_max = align_down(max_uintx/2, Metaspace::reserve_alignment_words());
if (value > aligned_max) {
JVMFlag::printError(verbose,
"InitialBootClassLoaderMetaspaceSize (" SIZE_FORMAT ") must be "
"less than or equal to aligned maximum value (" SIZE_FORMAT ")\n",
value, aligned_max);
return JVMFlag::VIOLATES_CONSTRAINT;
}
return JVMFlag::SUCCESS;
}

// To avoid an overflow by 'align_up(value, alignment)'.
static JVMFlag::Error MaxSizeForAlignment(const char* name, size_t value, size_t alignment, bool verbose) {
size_t aligned_max = ((max_uintx - alignment) & ~(alignment-1));
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
Expand Up @@ -2385,7 +2385,7 @@ void ShenandoahHeap::stw_unload_classes(bool full_gc) {
}
// Resize and verify metaspace
MetaspaceGC::compute_new_size();
MetaspaceUtils::verify_metrics();
DEBUG_ONLY(MetaspaceUtils::verify();)
}

// Weak roots are either pre-evacuated (final mark) or updated (final updaterefs),
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp
Expand Up @@ -35,6 +35,7 @@
#include "gc/shenandoah/shenandoahPadding.hpp"
#include "gc/shenandoah/shenandoahSharedVariables.hpp"
#include "gc/shenandoah/shenandoahUnload.hpp"
#include "memory/metaspace.hpp"
#include "services/memoryManager.hpp"
#include "utilities/globalDefinitions.hpp"
#include "utilities/stack.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/shenandoah/shenandoahUnload.cpp
Expand Up @@ -197,5 +197,5 @@ void ShenandoahUnload::unload() {

void ShenandoahUnload::finish() {
MetaspaceGC::compute_new_size();
MetaspaceUtils::verify_metrics();
DEBUG_ONLY(MetaspaceUtils::verify();)
}
1 change: 1 addition & 0 deletions src/hotspot/share/gc/z/zCollectedHeap.hpp
Expand Up @@ -30,6 +30,7 @@
#include "gc/z/zHeap.hpp"
#include "gc/z/zInitialize.hpp"
#include "gc/z/zRuntimeWorkers.hpp"
#include "memory/metaspace.hpp"

class ZDirector;
class ZDriver;
Expand Down
3 changes: 1 addition & 2 deletions src/hotspot/share/gc/z/zStat.cpp
Expand Up @@ -1175,10 +1175,9 @@ void ZStatNMethods::print() {
//
void ZStatMetaspace::print() {
log_info(gc, metaspace)("Metaspace: "
SIZE_FORMAT "M used, " SIZE_FORMAT "M capacity, "
SIZE_FORMAT "M used, "
SIZE_FORMAT "M committed, " SIZE_FORMAT "M reserved",
MetaspaceUtils::used_bytes() / M,
MetaspaceUtils::capacity_bytes() / M,
MetaspaceUtils::committed_bytes() / M,
MetaspaceUtils::reserved_bytes() / M);
}
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/z/zUnload.cpp
Expand Up @@ -164,5 +164,5 @@ void ZUnload::purge() {
void ZUnload::finish() {
// Resize and verify metaspace
MetaspaceGC::compute_new_size();
MetaspaceUtils::verify_metrics();
DEBUG_ONLY(MetaspaceUtils::verify();)
}
Expand Up @@ -41,7 +41,7 @@
#include "jfr/writers/jfrJavaEventWriter.hpp"
#include "jfr/utilities/jfrThreadIterator.hpp"
#include "memory/iterator.hpp"
#include "memory/metaspaceGCThresholdUpdater.hpp"
#include "memory/metaspace.hpp"
#include "memory/referenceType.hpp"
#include "memory/universe.hpp"
#include "oops/compressedOops.hpp"
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/jvmci/jvmciCompilerToVM.hpp
Expand Up @@ -25,6 +25,7 @@
#define SHARE_JVMCI_JVMCICOMPILERTOVM_HPP

#include "gc/shared/cardTable.hpp"
#include "gc/shared/collectedHeap.hpp"
#include "jvmci/jvmciExceptions.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/signature.hpp"
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/memory/allocation.hpp
Expand Up @@ -142,6 +142,7 @@ class AllocatedObj {
f(mtSafepoint, "Safepoint") \
f(mtSynchronizer, "Synchronization") \
f(mtServiceability, "Serviceability") \
f(mtMetaspace, "Metaspace") \
f(mtNone, "Unknown") \
//end

Expand Down

0 comments on commit a7dc085

Please sign in to comment.