--- a/src/hotspot/share/classfile/classLoaderData.hpp Tue Nov 26 11:29:20 2019 +0100
+++ b/src/hotspot/share/classfile/classLoaderData.hpp Tue Nov 26 16:21:29 2019 +0100
@@ -27,6 +27,7 @@
#include "memory/allocation.hpp"
#include "memory/memRegion.hpp"
+#include "memory/metaspace.hpp"
#include "oops/oopHandle.hpp"
#include "oops/weakHandle.hpp"
#include "runtime/atomic.hpp"
--- a/src/hotspot/share/gc/shared/collectedHeap.cpp Tue Nov 26 11:29:20 2019 +0100
+++ b/src/hotspot/share/gc/shared/collectedHeap.cpp Tue Nov 26 16:21:29 2019 +0100
@@ -106,18 +106,18 @@
MetaspaceUtils::used_bytes(),
MetaspaceUtils::reserved_bytes());
const MetaspaceSizes data_space(
- MetaspaceUtils::committed_bytes(metaspace::NonClassType),
- MetaspaceUtils::used_bytes(metaspace::NonClassType),
- MetaspaceUtils::reserved_bytes(metaspace::NonClassType));
+ MetaspaceUtils::committed_bytes(Metaspace::NonClassType),
+ MetaspaceUtils::used_bytes(Metaspace::NonClassType),
+ MetaspaceUtils::reserved_bytes(Metaspace::NonClassType));
const MetaspaceSizes class_space(
- MetaspaceUtils::committed_bytes(metaspace::ClassType),
- MetaspaceUtils::used_bytes(metaspace::ClassType),
- MetaspaceUtils::reserved_bytes(metaspace::ClassType));
+ MetaspaceUtils::committed_bytes(Metaspace::ClassType),
+ MetaspaceUtils::used_bytes(Metaspace::ClassType),
+ MetaspaceUtils::reserved_bytes(Metaspace::ClassType));
const MetaspaceChunkFreeListSummary& ms_chunk_free_list_summary =
- MetaspaceUtils::chunk_free_list_summary(metaspace::NonClassType);
+ MetaspaceUtils::chunk_free_list_summary(Metaspace::NonClassType);
const MetaspaceChunkFreeListSummary& class_chunk_free_list_summary =
- MetaspaceUtils::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,
ms_chunk_free_list_summary, class_chunk_free_list_summary);
@@ -256,7 +256,7 @@
MetaWord* CollectedHeap::satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
size_t word_size,
- metaspace::MetadataType mdtype) {
+ Metaspace::MetadataType mdtype) {
uint loop_count = 0;
uint gc_count = 0;
uint full_gc_count = 0;
--- a/src/hotspot/share/gc/shared/collectedHeap.hpp Tue Nov 26 11:29:20 2019 +0100
+++ b/src/hotspot/share/gc/shared/collectedHeap.hpp Tue Nov 26 16:21:29 2019 +0100
@@ -29,7 +29,7 @@
#include "gc/shared/gcWhen.hpp"
#include "gc/shared/verifyOption.hpp"
#include "memory/allocation.hpp"
-#include "memory/metaspace/metaspaceEnums.hpp"
+#include "memory/metaspace.hpp"
#include "runtime/handles.hpp"
#include "runtime/perfData.hpp"
#include "runtime/safepoint.hpp"
@@ -358,7 +358,7 @@
virtual MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
size_t size,
- metaspace::MetadataType mdtype);
+ Metaspace::MetadataType mdtype);
// Returns "true" iff there is a stop-world GC in progress. (I assume
// that it should answer "false" for the concurrent part of a concurrent
--- a/src/hotspot/share/gc/shared/gcTrace.cpp Tue Nov 26 11:29:20 2019 +0100
+++ b/src/hotspot/share/gc/shared/gcTrace.cpp Tue Nov 26 16:21:29 2019 +0100
@@ -30,7 +30,7 @@
#include "gc/shared/gcTrace.hpp"
#include "gc/shared/objectCountEventSender.hpp"
#include "gc/shared/referenceProcessorStats.hpp"
-#include "memory/metaspace/metaspaceEnums.hpp"
+#include "memory/metaspace.hpp"
#include "memory/heapInspection.hpp"
#include "memory/resourceArea.hpp"
#include "runtime/os.hpp"
@@ -117,9 +117,9 @@
void GCTracer::report_metaspace_summary(GCWhen::Type when, const MetaspaceSummary& summary) const {
send_meta_space_summary_event(when, summary);
- send_metaspace_chunk_free_list_summary(when, metaspace::NonClassType, summary.metaspace_chunk_free_list_summary());
+ send_metaspace_chunk_free_list_summary(when, Metaspace::NonClassType, summary.metaspace_chunk_free_list_summary());
if (UseCompressedClassPointers) {
- send_metaspace_chunk_free_list_summary(when, metaspace::ClassType, summary.class_chunk_free_list_summary());
+ send_metaspace_chunk_free_list_summary(when, Metaspace::ClassType, summary.class_chunk_free_list_summary());
}
}
--- a/src/hotspot/share/gc/shared/gcTrace.hpp Tue Nov 26 11:29:20 2019 +0100
+++ b/src/hotspot/share/gc/shared/gcTrace.hpp Tue Nov 26 16:21:29 2019 +0100
@@ -30,7 +30,7 @@
#include "gc/shared/gcId.hpp"
#include "gc/shared/gcName.hpp"
#include "gc/shared/gcWhen.hpp"
-#include "memory/metaspace/metaspaceEnums.hpp"
+#include "memory/metaspace.hpp"
#include "memory/referenceType.hpp"
#include "utilities/macros.hpp"
#include "utilities/ticks.hpp"
@@ -112,7 +112,7 @@
void send_garbage_collection_event() const;
void send_gc_heap_summary_event(GCWhen::Type when, const GCHeapSummary& heap_summary) const;
void send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const;
- void send_metaspace_chunk_free_list_summary(GCWhen::Type when, metaspace::MetadataType mdtype, const MetaspaceChunkFreeListSummary& summary) const;
+ void send_metaspace_chunk_free_list_summary(GCWhen::Type when, Metaspace::MetadataType mdtype, const MetaspaceChunkFreeListSummary& summary) const;
void send_reference_stats_event(ReferenceType type, size_t count) const;
void send_phase_events(TimePartitions* time_partitions) const;
};
--- a/src/hotspot/share/gc/shared/gcTraceSend.cpp Tue Nov 26 11:29:20 2019 +0100
+++ b/src/hotspot/share/gc/shared/gcTraceSend.cpp Tue Nov 26 16:21:29 2019 +0100
@@ -60,7 +60,7 @@
}
}
-void GCTracer::send_metaspace_chunk_free_list_summary(GCWhen::Type when, metaspace::MetadataType mdtype,
+void GCTracer::send_metaspace_chunk_free_list_summary(GCWhen::Type when, Metaspace::MetadataType mdtype,
const MetaspaceChunkFreeListSummary& summary) const {
EventMetaspaceChunkFreeListSummary e;
if (e.should_commit()) {
--- a/src/hotspot/share/gc/shared/gcVMOperations.cpp Tue Nov 26 11:29:20 2019 +0100
+++ b/src/hotspot/share/gc/shared/gcVMOperations.cpp Tue Nov 26 16:21:29 2019 +0100
@@ -33,7 +33,6 @@
#include "interpreter/oopMapCache.hpp"
#include "logging/log.hpp"
#include "memory/metaspace/classLoaderMetaspace.hpp"
-#include "memory/metaspace/metaspaceEnums.hpp"
#include "memory/oopFactory.hpp"
#include "memory/universe.hpp"
#include "runtime/handles.inline.hpp"
@@ -182,7 +181,7 @@
VM_CollectForMetadataAllocation::VM_CollectForMetadataAllocation(ClassLoaderData* loader_data,
size_t size,
- metaspace::MetadataType mdtype,
+ Metaspace::MetadataType mdtype,
uint gc_count_before,
uint full_gc_count_before,
GCCause::Cause gc_cause)
--- a/src/hotspot/share/gc/shared/gcVMOperations.hpp Tue Nov 26 11:29:20 2019 +0100
+++ b/src/hotspot/share/gc/shared/gcVMOperations.hpp Tue Nov 26 16:21:29 2019 +0100
@@ -28,7 +28,7 @@
#include "gc/shared/collectedHeap.hpp"
#include "gc/shared/genCollectedHeap.hpp"
#include "memory/heapInspection.hpp"
-#include "memory/metaspace/metaspaceEnums.hpp"
+#include "memory/metaspace.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/handles.hpp"
#include "runtime/jniHandles.hpp"
@@ -207,13 +207,13 @@
private:
MetaWord* _result;
size_t _size; // size of object to be allocated
- metaspace::MetadataType _mdtype;
+ Metaspace::MetadataType _mdtype;
ClassLoaderData* _loader_data;
public:
VM_CollectForMetadataAllocation(ClassLoaderData* loader_data,
size_t size,
- metaspace::MetadataType mdtype,
+ Metaspace::MetadataType mdtype,
uint gc_count_before,
uint full_gc_count_before,
GCCause::Cause gc_cause);
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Tue Nov 26 11:29:20 2019 +0100
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Tue Nov 26 16:21:29 2019 +0100
@@ -882,7 +882,7 @@
MetaWord* ShenandoahHeap::satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
size_t size,
- metaspace::MetadataType mdtype) {
+ Metaspace::MetadataType mdtype) {
MetaWord* result;
// Inform metaspace OOM to GC heuristics if class unloading is possible.
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp Tue Nov 26 11:29:20 2019 +0100
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp Tue Nov 26 16:21:29 2019 +0100
@@ -32,7 +32,7 @@
#include "gc/shenandoah/shenandoahLock.hpp"
#include "gc/shenandoah/shenandoahEvacOOMHandler.hpp"
#include "gc/shenandoah/shenandoahSharedVariables.hpp"
-#include "memory/metaspace/metaspaceEnums.hpp"
+#include "memory/metaspace.hpp"
#include "services/memoryManager.hpp"
class ConcurrentGCTimer;
@@ -593,7 +593,7 @@
HeapWord* mem_allocate(size_t size, bool* what);
MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
size_t size,
- metaspace::MetadataType mdtype);
+ Metaspace::MetadataType mdtype);
void notify_mutator_alloc_words(size_t words, bool waste);
--- a/src/hotspot/share/gc/z/zCollectedHeap.cpp Tue Nov 26 11:29:20 2019 +0100
+++ b/src/hotspot/share/gc/z/zCollectedHeap.cpp Tue Nov 26 16:21:29 2019 +0100
@@ -34,7 +34,6 @@
#include "gc/z/zStat.hpp"
#include "gc/z/zUtils.inline.hpp"
#include "memory/metaspace/classLoaderMetaspace.hpp"
-#include "memory/metaspace/metaspaceEnums.hpp"
#include "memory/universe.hpp"
#include "runtime/mutexLocker.hpp"
#include "utilities/align.hpp"
@@ -147,7 +146,7 @@
MetaWord* ZCollectedHeap::satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
size_t size,
- metaspace::MetadataType mdtype) {
+ Metaspace::MetadataType mdtype) {
MetaWord* result;
// Start asynchronous GC
--- a/src/hotspot/share/gc/z/zCollectedHeap.hpp Tue Nov 26 11:29:20 2019 +0100
+++ b/src/hotspot/share/gc/z/zCollectedHeap.hpp Tue Nov 26 16:21:29 2019 +0100
@@ -34,7 +34,7 @@
#include "gc/z/zRuntimeWorkers.hpp"
#include "gc/z/zStat.hpp"
#include "gc/z/zUncommitter.hpp"
-#include "memory/metaspace/metaspaceEnums.hpp"
+#include "memory/metaspace.hpp"
class ZCollectedHeap : public CollectedHeap {
friend class VMStructs;
@@ -80,7 +80,7 @@
virtual HeapWord* mem_allocate(size_t size, bool* gc_overhead_limit_was_exceeded);
virtual MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
size_t size,
- metaspace::MetadataType mdtype);
+ Metaspace::MetadataType mdtype);
virtual void collect(GCCause::Cause cause);
virtual void collect_as_vm_thread(GCCause::Cause cause);
virtual void do_full_collection(bool clear_all_soft_refs);
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp Tue Nov 26 11:29:20 2019 +0100
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp Tue Nov 26 16:21:29 2019 +0100
@@ -191,11 +191,11 @@
}
void MetadataTypeConstant::serialize(JfrCheckpointWriter& writer) {
- static const u4 nof_entries = metaspace::MetadataTypeCount;
+ static const u4 nof_entries = Metaspace::MetadataTypeCount;
writer.write_count(nof_entries);
for (u4 i = 0; i < nof_entries; ++i) {
writer.write_key(i);
- writer.write(metaspace::describe_mdtype((metaspace::MetadataType)i));
+ writer.write(metaspace::describe_mdtype((Metaspace::MetadataType)i));
}
}
--- a/src/hotspot/share/memory/metaspace.cpp Tue Nov 26 11:29:20 2019 +0100
+++ b/src/hotspot/share/memory/metaspace.cpp Tue Nov 26 16:21:29 2019 +0100
@@ -22,7 +22,6 @@
*
*/
-#include <memory/metaspace/settings.hpp>
#include "precompiled.hpp"
#include "aot/aotLoader.hpp"
@@ -41,6 +40,7 @@
#include "memory/metaspace/metaspaceReport.hpp"
#include "memory/metaspace/metaspaceSizesSnapshot.hpp"
#include "memory/metaspace/runningCounters.hpp"
+#include "memory/metaspace/settings.hpp"
#include "memory/metaspace/virtualSpaceList.hpp"
#include "memory/universe.hpp"
#include "oops/compressedOops.hpp"
@@ -58,39 +58,38 @@
using metaspace::ClassLoaderMetaspace;
using metaspace::CommitLimiter;
using metaspace::MetaspaceType;
-using metaspace::MetadataType;
using metaspace::MetaspaceReporter;
using metaspace::RunningCounters;
using metaspace::VirtualSpaceList;
// Used by MetaspaceCounters
-size_t MetaspaceUtils::free_chunks_total_words(MetadataType mdtype) {
- return is_class(mdtype) ? RunningCounters::free_chunks_words_class() : RunningCounters::free_chunks_words_nonclass();
+size_t MetaspaceUtils::free_chunks_total_words(Metaspace::MetadataType mdtype) {
+ return metaspace::is_class(mdtype) ? RunningCounters::free_chunks_words_class() : RunningCounters::free_chunks_words_nonclass();
}
size_t MetaspaceUtils::used_words() {
return RunningCounters::used_words();
}
-size_t MetaspaceUtils::used_words(MetadataType mdtype) {
- return is_class(mdtype) ? RunningCounters::used_words_class() : RunningCounters::used_words_nonclass();
+size_t MetaspaceUtils::used_words(Metaspace::MetadataType mdtype) {
+ return metaspace::is_class(mdtype) ? RunningCounters::used_words_class() : RunningCounters::used_words_nonclass();
}
size_t MetaspaceUtils::reserved_words() {
return RunningCounters::reserved_words();
}
-size_t MetaspaceUtils::reserved_words(MetadataType mdtype) {
- return is_class(mdtype) ? RunningCounters::reserved_words_class() : RunningCounters::reserved_words_nonclass();
+size_t MetaspaceUtils::reserved_words(Metaspace::MetadataType mdtype) {
+ return metaspace::is_class(mdtype) ? RunningCounters::reserved_words_class() : RunningCounters::reserved_words_nonclass();
}
size_t MetaspaceUtils::committed_words() {
return RunningCounters::committed_words();
}
-size_t MetaspaceUtils::committed_words(MetadataType mdtype) {
- return is_class(mdtype) ? RunningCounters::committed_words_class() : RunningCounters::committed_words_nonclass();
+size_t MetaspaceUtils::committed_words(Metaspace::MetadataType mdtype) {
+ return metaspace::is_class(mdtype) ? RunningCounters::committed_words_class() : RunningCounters::committed_words_nonclass();
}
@@ -139,7 +138,7 @@
// Prints an ASCII representation of the given space.
-void MetaspaceUtils::print_metaspace_map(outputStream* out, MetadataType mdtype) {
+void MetaspaceUtils::print_metaspace_map(outputStream* out, Metaspace::MetadataType mdtype) {
out->print_cr("-- not yet implemented ---");
}
@@ -174,7 +173,7 @@
reserved_bytes()/K);
if (Metaspace::using_class_space()) {
- const MetadataType ct = metaspace::ClassType;
+ const Metaspace::MetadataType ct = Metaspace::ClassType;
out->print_cr(" class space "
"used " SIZE_FORMAT "K, "
"committed " SIZE_FORMAT "K, "
@@ -337,7 +336,7 @@
bool MetaspaceGC::can_expand(size_t word_size, bool is_class) {
// Check if the compressed class space is full.
if (is_class && Metaspace::using_class_space()) {
- size_t class_committed = MetaspaceUtils::committed_bytes(metaspace::ClassType);
+ size_t class_committed = MetaspaceUtils::committed_bytes(Metaspace::ClassType);
if (class_committed + word_size * BytesPerWord > CompressedClassSpaceSize) {
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));
@@ -862,7 +861,7 @@
assert(loader_data != NULL, "Should never pass around a NULL loader_data. "
"ClassLoaderData::the_null_class_loader_data() should have been used.");
- MetadataType mdtype = (type == MetaspaceObj::ClassType) ? metaspace::ClassType : metaspace::NonClassType;
+ Metaspace::MetadataType mdtype = (type == MetaspaceObj::ClassType) ? Metaspace::ClassType : Metaspace::NonClassType;
// Try to allocate metadata.
MetaWord* result = loader_data->metaspace_non_null()->allocate(word_size, mdtype);
@@ -907,7 +906,7 @@
Log(gc, metaspace, freelist, oom) log;
if (log.is_info()) {
log.info("Metaspace (%s) allocation failed for size " SIZE_FORMAT,
- is_class(mdtype) ? "class" : "data", word_size);
+ metaspace::is_class(mdtype) ? "class" : "data", word_size);
ResourceMark rm;
if (log.is_debug()) {
if (loader_data->metaspace_or_null() != NULL) {
@@ -922,10 +921,10 @@
// Which limit did we hit? CompressedClassSpaceSize or MaxMetaspaceSize?
bool out_of_compressed_class_space = false;
- if (is_class(mdtype)) {
+ if (metaspace::is_class(mdtype)) {
ClassLoaderMetaspace* metaspace = loader_data->metaspace_non_null();
out_of_compressed_class_space =
- MetaspaceUtils::committed_bytes(metaspace::ClassType) +
+ MetaspaceUtils::committed_bytes(Metaspace::ClassType) +
// TODO: Okay this is just cheesy.
// Of course this may fail and return incorrect results.
// Think this over - we need some clean way to remember which limit
--- a/src/hotspot/share/memory/metaspace.hpp Tue Nov 26 11:29:20 2019 +0100
+++ b/src/hotspot/share/memory/metaspace.hpp Tue Nov 26 16:21:29 2019 +0100
@@ -26,7 +26,6 @@
#include "memory/allocation.hpp"
#include "memory/memRegion.hpp"
-#include "memory/metaspace/metaspaceEnums.hpp"
#include "memory/metaspaceChunkFreeListSummary.hpp"
#include "memory/virtualspace.hpp"
#include "runtime/globals.hpp"
@@ -86,7 +85,16 @@
// Namespace for important central static functions
// (auxiliary stuff goes into MetaspaceUtils)
class Metaspace : public AllStatic {
+public:
+ // Will eventually be moved to metaspaceEnums.hpp and into the metaspace::.. namespace;
+ // for now keep here to keep diff in non-metaspace coding small.
+ enum MetadataType {
+ ClassType,
+ NonClassType,
+ MetadataTypeCount
+ };
+private:
friend class MetaspaceShared;
// Base and size of the compressed class space.
@@ -153,7 +161,7 @@
static void purge();
static void report_metadata_oome(ClassLoaderData* loader_data, size_t word_size,
- MetaspaceObj::Type type, metaspace::MetadataType mdtype, TRAPS);
+ MetaspaceObj::Type type, Metaspace::MetadataType mdtype, TRAPS);
static void print_compressed_class_space(outputStream* st, const char* requested_addr = 0) NOT_LP64({});
@@ -249,34 +257,34 @@
// Committed space actually in use by Metadata
static size_t used_words();
- static size_t used_words(metaspace::MetadataType mdtype);
+ static size_t used_words(Metaspace::MetadataType mdtype);
// Space committed for Metaspace
static size_t committed_words();
- static size_t committed_words(metaspace::MetadataType mdtype);
+ static size_t committed_words(Metaspace::MetadataType mdtype);
// Space reserved for Metaspace
static size_t reserved_words();
- static size_t reserved_words(metaspace::MetadataType mdtype);
+ static size_t reserved_words(Metaspace::MetadataType mdtype);
// _bytes() variants for convenience...
static size_t used_bytes() { return used_words() * BytesPerWord; }
- static size_t used_bytes(metaspace::MetadataType mdtype) { return used_words(mdtype) * BytesPerWord; }
+ static size_t used_bytes(Metaspace::MetadataType mdtype) { return used_words(mdtype) * BytesPerWord; }
static size_t committed_bytes() { return committed_words() * BytesPerWord; }
- static size_t committed_bytes(metaspace::MetadataType mdtype) { return committed_words(mdtype) * BytesPerWord; }
+ static size_t committed_bytes(Metaspace::MetadataType mdtype) { return committed_words(mdtype) * BytesPerWord; }
static size_t reserved_bytes() { return reserved_words() * BytesPerWord; }
- static size_t reserved_bytes(metaspace::MetadataType mdtype) { return reserved_words(mdtype) * BytesPerWord; }
+ static size_t reserved_bytes(Metaspace::MetadataType mdtype) { return reserved_words(mdtype) * BytesPerWord; }
// TODO. Do we need this really? This number is kind of uninformative.
static size_t capacity_bytes() { return 0; }
- static size_t capacity_bytes(metaspace::MetadataType mdtype) { return 0; }
+ static size_t capacity_bytes(Metaspace::MetadataType mdtype) { return 0; }
// Todo. Consolidate.
// Committed space in freelists
- static size_t free_chunks_total_words(metaspace::MetadataType mdtype);
+ static size_t free_chunks_total_words(Metaspace::MetadataType mdtype);
// Todo. Implement or Consolidate.
- static MetaspaceChunkFreeListSummary chunk_free_list_summary(metaspace::MetadataType mdtype) {
+ static MetaspaceChunkFreeListSummary chunk_free_list_summary(Metaspace::MetadataType mdtype) {
return MetaspaceChunkFreeListSummary(0,0,0,0,0,0,0,0);
}
@@ -284,7 +292,7 @@
static void print_metaspace_change(const metaspace::MetaspaceSizesSnapshot& pre_meta_values);
// Prints an ASCII representation of the given space.
- static void print_metaspace_map(outputStream* out, metaspace::MetadataType mdtype);
+ static void print_metaspace_map(outputStream* out, Metaspace::MetadataType mdtype);
// This will print out a basic metaspace usage report but
// unlike print_report() is guaranteed not to lock or to walk the CLDG.
--- a/src/hotspot/share/memory/metaspace/classLoaderMetaspace.cpp Tue Nov 26 11:29:20 2019 +0100
+++ b/src/hotspot/share/memory/metaspace/classLoaderMetaspace.cpp Tue Nov 26 16:21:29 2019 +0100
@@ -48,7 +48,7 @@
return false;
}
-static bool use_class_space(MetadataType mdType) {
+static bool use_class_space(Metaspace::MetadataType mdType) {
return use_class_space(is_class(mdType));
}
@@ -107,7 +107,7 @@
}
// Allocate word_size words from Metaspace.
-MetaWord* ClassLoaderMetaspace::allocate(size_t word_size, MetadataType mdType) {
+MetaWord* ClassLoaderMetaspace::allocate(size_t word_size, Metaspace::MetadataType mdType) {
Metaspace::assert_not_frozen();
if (use_class_space(mdType)) {
return class_space_manager()->allocate(word_size);
@@ -118,7 +118,7 @@
// Attempt to expand the GC threshold to be good for at least another word_size words
// and allocate. Returns NULL if failure. Used during Metaspace GC.
-MetaWord* ClassLoaderMetaspace::expand_and_allocate(size_t word_size, MetadataType mdType) {
+MetaWord* ClassLoaderMetaspace::expand_and_allocate(size_t word_size, Metaspace::MetadataType mdType) {
Metaspace::assert_not_frozen();
size_t delta_bytes = MetaspaceGC::delta_capacity_until_GC(word_size * BytesPerWord);
assert(delta_bytes > 0, "Must be");
--- a/src/hotspot/share/memory/metaspace/classLoaderMetaspace.hpp Tue Nov 26 11:29:20 2019 +0100
+++ b/src/hotspot/share/memory/metaspace/classLoaderMetaspace.hpp Tue Nov 26 16:21:29 2019 +0100
@@ -69,11 +69,11 @@
MetaspaceType space_type() const { return _space_type; }
// Allocate word_size words from Metaspace.
- MetaWord* allocate(size_t word_size, MetadataType mdType);
+ MetaWord* allocate(size_t word_size, Metaspace::MetadataType mdType);
// Attempt to expand the GC threshold to be good for at least another word_size words
// and allocate. Returns NULL if failure. Used during Metaspace GC.
- MetaWord* expand_and_allocate(size_t word_size, MetadataType mdType);
+ MetaWord* expand_and_allocate(size_t word_size, Metaspace::MetadataType mdType);
// Prematurely returns a metaspace allocation to the _block_freelists
// because it is not needed anymore.
--- a/src/hotspot/share/memory/metaspace/metaspaceEnums.cpp Tue Nov 26 11:29:20 2019 +0100
+++ b/src/hotspot/share/memory/metaspace/metaspaceEnums.cpp Tue Nov 26 16:21:29 2019 +0100
@@ -40,11 +40,11 @@
return s;
}
-const char* describe_mdtype(MetadataType md) {
+const char* describe_mdtype(Metaspace::MetadataType md) {
const char* s = NULL;
switch (md) {
- case NonClassType: s = "nonclass"; break;
- case ClassType: s = "class"; break;
+ case Metaspace::NonClassType: s = "nonclass"; break;
+ case Metaspace::ClassType: s = "class"; break;
default: ShouldNotReachHere();
}
return s;
--- a/src/hotspot/share/memory/metaspace/metaspaceEnums.hpp Tue Nov 26 11:29:20 2019 +0100
+++ b/src/hotspot/share/memory/metaspace/metaspaceEnums.hpp Tue Nov 26 16:21:29 2019 +0100
@@ -25,6 +25,7 @@
#ifndef SHARE_MEMORY_METASPACEENUMS_HPP
#define SHARE_MEMORY_METASPACEENUMS_HPP
+#include "memory/metaspace.hpp"
#include "utilities/debug.hpp"
// MetadataType and MetaspaceType, as well as some convenience functions surrounding them.
@@ -32,23 +33,28 @@
///////////////////////
-enum MetadataType {
- ClassType,
- NonClassType,
- MetadataTypeCount
-};
+/* Moved to metaspace.hpp to keep diff in non-metaspace coding
+ * small. Would like to have this here and in metaspace:: namespace,
+ * eventually.
+ *
+ * enum MetadataType {
+ * ClassType,
+ * NonClassType,
+ * MetadataTypeCount
+ * };
+ */
-inline bool is_class(MetadataType md) { return md == ClassType; }
+inline bool is_class(Metaspace::MetadataType md) { return md == Metaspace::ClassType; }
-inline MetadataType mdtype_from_bool(bool is_class) { return is_class ? ClassType : NonClassType; }
+inline Metaspace::MetadataType mdtype_from_bool(bool is_class) { return is_class ? Metaspace::ClassType : Metaspace::NonClassType; }
-const char* describe_mdtype(MetadataType md);
+const char* describe_mdtype(Metaspace::MetadataType md);
#ifdef ASSERT
-inline bool is_valid_mdtype(MetadataType md) {
- return (int)md >= 0 && (int)md < MetadataTypeCount;
+inline bool is_valid_mdtype(Metaspace::MetadataType md) {
+ return (int)md >= 0 && (int)md < Metaspace::MetadataTypeCount;
}
-inline void check_valid_mdtype(MetadataType md) {
+inline void check_valid_mdtype(Metaspace::MetadataType md) {
assert(is_valid_mdtype(md), "Wrong value for MetadataType: %d", (int) md);
}
#endif // ASSERT
--- a/src/hotspot/share/memory/metaspace/metaspaceReport.cpp Tue Nov 26 11:29:20 2019 +0100
+++ b/src/hotspot/share/memory/metaspace/metaspaceReport.cpp Tue Nov 26 16:21:29 2019 +0100
@@ -124,14 +124,14 @@
// for Usage stats (statistics over in-use chunks) all we can print is the
// used words. We cannot print committed areas, or free/waste areas, of in-use chunks require
// walking.
- const size_t used_nc = MetaspaceUtils::used_words(metaspace::NonClassType);
+ const size_t used_nc = MetaspaceUtils::used_words(Metaspace::NonClassType);
print_scaled_words(out, used_nc, scale, 5);
out->print(" used.");
out->cr();
if (Metaspace::using_class_space()) {
- const size_t used_c = MetaspaceUtils::used_words(metaspace::ClassType);
+ const size_t used_c = MetaspaceUtils::used_words(Metaspace::ClassType);
out->print(" Class: ");
print_scaled_words(out, used_c, scale, 5);
out->print(" used.");
--- a/src/hotspot/share/memory/metaspace/metaspaceSizesSnapshot.cpp Tue Nov 26 11:29:20 2019 +0100
+++ b/src/hotspot/share/memory/metaspace/metaspaceSizesSnapshot.cpp Tue Nov 26 16:21:29 2019 +0100
@@ -26,7 +26,7 @@
#include "precompiled.hpp"
#include "memory/metaspace.hpp"
-#include "memory/metaspace/metaspaceEnums.hpp"
+#include "memory/metaspace.hpp"
#include "memory/metaspace/metaspaceSizesSnapshot.hpp"
namespace metaspace {
@@ -34,9 +34,9 @@
MetaspaceSizesSnapshot::MetaspaceSizesSnapshot()
: _used(MetaspaceUtils::used_bytes()),
_committed(MetaspaceUtils::committed_bytes()),
- _non_class_used(MetaspaceUtils::used_bytes(metaspace::NonClassType)),
- _non_class_committed(MetaspaceUtils::committed_bytes(metaspace::NonClassType)),
- _class_used(MetaspaceUtils::used_bytes(metaspace::ClassType)),
- _class_committed(MetaspaceUtils::committed_bytes(metaspace::ClassType)) { }
+ _non_class_used(MetaspaceUtils::used_bytes(Metaspace::NonClassType)),
+ _non_class_committed(MetaspaceUtils::committed_bytes(Metaspace::NonClassType)),
+ _class_used(MetaspaceUtils::used_bytes(Metaspace::ClassType)),
+ _class_committed(MetaspaceUtils::committed_bytes(Metaspace::ClassType)) { }
} // namespace metaspace
--- a/src/hotspot/share/memory/metaspaceCounters.cpp Tue Nov 26 11:29:20 2019 +0100
+++ b/src/hotspot/share/memory/metaspaceCounters.cpp Tue Nov 26 16:21:29 2019 +0100
@@ -98,15 +98,15 @@
MetaspacePerfCounters* CompressedClassSpaceCounters::_perf_counters = NULL;
size_t CompressedClassSpaceCounters::used() {
- return MetaspaceUtils::used_bytes(metaspace::ClassType);
+ return MetaspaceUtils::used_bytes(Metaspace::ClassType);
}
size_t CompressedClassSpaceCounters::capacity() {
- return MetaspaceUtils::committed_bytes(metaspace::ClassType);
+ return MetaspaceUtils::committed_bytes(Metaspace::ClassType);
}
size_t CompressedClassSpaceCounters::max_capacity() {
- return MetaspaceUtils::reserved_bytes(metaspace::ClassType);
+ return MetaspaceUtils::reserved_bytes(Metaspace::ClassType);
}
void CompressedClassSpaceCounters::update_performance_counters() {
--- a/src/hotspot/share/memory/metaspaceTracer.cpp Tue Nov 26 11:29:20 2019 +0100
+++ b/src/hotspot/share/memory/metaspaceTracer.cpp Tue Nov 26 16:21:29 2019 +0100
@@ -43,14 +43,14 @@
void MetaspaceTracer::report_metaspace_allocation_failure(ClassLoaderData *cld,
size_t word_size,
MetaspaceObj::Type objtype,
- metaspace::MetadataType mdtype) const {
+ Metaspace::MetadataType mdtype) const {
send_allocation_failure_event<EventMetaspaceAllocationFailure>(cld, word_size, objtype, mdtype);
}
void MetaspaceTracer::report_metadata_oom(ClassLoaderData *cld,
size_t word_size,
MetaspaceObj::Type objtype,
- metaspace::MetadataType mdtype) const {
+ Metaspace::MetadataType mdtype) const {
send_allocation_failure_event<EventMetaspaceOOM>(cld, word_size, objtype, mdtype);
}
@@ -58,7 +58,7 @@
void MetaspaceTracer::send_allocation_failure_event(ClassLoaderData *cld,
size_t word_size,
MetaspaceObj::Type objtype,
- metaspace::MetadataType mdtype) const {
+ Metaspace::MetadataType mdtype) const {
E event;
if (event.should_commit()) {
event.set_classLoader(cld);
--- a/src/hotspot/share/memory/metaspaceTracer.hpp Tue Nov 26 11:29:20 2019 +0100
+++ b/src/hotspot/share/memory/metaspaceTracer.hpp Tue Nov 26 16:21:29 2019 +0100
@@ -36,7 +36,7 @@
void send_allocation_failure_event(ClassLoaderData *cld,
size_t word_size,
MetaspaceObj::Type objtype,
- metaspace::MetadataType mdtype) const;
+ Metaspace::MetadataType mdtype) const;
public:
void report_gc_threshold(size_t old_val,
size_t new_val,
@@ -44,11 +44,11 @@
void report_metaspace_allocation_failure(ClassLoaderData *cld,
size_t word_size,
MetaspaceObj::Type objtype,
- metaspace::MetadataType mdtype) const;
+ Metaspace::MetadataType mdtype) const;
void report_metadata_oom(ClassLoaderData *cld,
size_t word_size,
MetaspaceObj::Type objtype,
- metaspace::MetadataType mdtype) const;
+ Metaspace::MetadataType mdtype) const;
};
--- a/src/hotspot/share/services/memReporter.cpp Tue Nov 26 11:29:20 2019 +0100
+++ b/src/hotspot/share/services/memReporter.cpp Tue Nov 26 16:21:29 2019 +0100
@@ -23,7 +23,10 @@
*/
#include "precompiled.hpp"
+
#include "memory/allocation.hpp"
+#include "memory/metaspace.hpp"
+#include "memory/metaspace/metaspaceEnums.hpp"
#include "services/mallocTracker.hpp"
#include "services/memReporter.hpp"
#include "services/threadStackTracker.hpp"
@@ -200,16 +203,16 @@
amount_in_current_scale(_malloc_snapshot->malloc_overhead()->size()), scale);
} else if (flag == mtClass) {
// Metadata information
- report_metadata(metaspace::NonClassType);
+ report_metadata(Metaspace::NonClassType);
if (Metaspace::using_class_space()) {
- report_metadata(metaspace::ClassType);
+ report_metadata(Metaspace::ClassType);
}
}
out->print_cr(" ");
}
}
-void MemSummaryReporter::report_metadata(metaspace::MetadataType mdType) const {
+void MemSummaryReporter::report_metadata(Metaspace::MetadataType mdType) const {
DEBUG_ONLY(metaspace::check_valid_mdtype(mdType));
const char* const name = metaspace::describe_mdtype(mdType);
@@ -593,13 +596,13 @@
void MemSummaryDiffReporter::print_metaspace_diff(const MetaspaceSnapshot* current_ms,
const MetaspaceSnapshot* early_ms) const {
- print_metaspace_diff(metaspace::NonClassType, current_ms, early_ms);
+ print_metaspace_diff(Metaspace::NonClassType, current_ms, early_ms);
if (Metaspace::using_class_space()) {
- print_metaspace_diff(metaspace::ClassType, current_ms, early_ms);
+ print_metaspace_diff(Metaspace::ClassType, current_ms, early_ms);
}
}
-void MemSummaryDiffReporter::print_metaspace_diff(metaspace::MetadataType mdType,
+void MemSummaryDiffReporter::print_metaspace_diff(Metaspace::MetadataType mdType,
const MetaspaceSnapshot* current_ms,
const MetaspaceSnapshot* early_ms) const {
DEBUG_ONLY(metaspace::check_valid_mdtype(mdType));
--- a/src/hotspot/share/services/memReporter.hpp Tue Nov 26 11:29:20 2019 +0100
+++ b/src/hotspot/share/services/memReporter.hpp Tue Nov 26 16:21:29 2019 +0100
@@ -27,7 +27,7 @@
#if INCLUDE_NMT
-#include "memory/metaspace/metaspaceEnums.hpp"
+#include "memory/metaspace.hpp"
#include "oops/instanceKlass.hpp"
#include "services/memBaseline.hpp"
#include "services/nmtCommon.hpp"
@@ -114,7 +114,7 @@
void report_summary_of_type(MEMFLAGS type, MallocMemory* malloc_memory,
VirtualMemory* virtual_memory);
- void report_metadata(metaspace::MetadataType type) const;
+ void report_metadata(Metaspace::MetadataType type) const;
};
/*
@@ -189,7 +189,7 @@
void print_metaspace_diff(const MetaspaceSnapshot* current_ms,
const MetaspaceSnapshot* early_ms) const;
- void print_metaspace_diff(metaspace::MetadataType type,
+ void print_metaspace_diff(Metaspace::MetadataType type,
const MetaspaceSnapshot* current_ms, const MetaspaceSnapshot* early_ms) const;
};
--- a/src/hotspot/share/services/memoryPool.cpp Tue Nov 26 11:29:20 2019 +0100
+++ b/src/hotspot/share/services/memoryPool.cpp Tue Nov 26 16:21:29 2019 +0100
@@ -25,7 +25,6 @@
#include "precompiled.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp"
-#include "memory/metaspace/metaspaceEnums.hpp"
#include "memory/metaspace.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/handles.inline.hpp"
@@ -212,10 +211,10 @@
MemoryPool("Compressed Class Space", NonHeap, 0, CompressedClassSpaceSize, true, false) { }
size_t CompressedKlassSpacePool::used_in_bytes() {
- return MetaspaceUtils::used_bytes(metaspace::ClassType);
+ return MetaspaceUtils::used_bytes(Metaspace::ClassType);
}
MemoryUsage CompressedKlassSpacePool::get_memory_usage() {
- size_t committed = MetaspaceUtils::committed_bytes(metaspace::ClassType);
+ size_t committed = MetaspaceUtils::committed_bytes(Metaspace::ClassType);
return MemoryUsage(initial_size(), used_in_bytes(), committed, max_size());
}
--- a/src/hotspot/share/services/virtualMemoryTracker.cpp Tue Nov 26 11:29:20 2019 +0100
+++ b/src/hotspot/share/services/virtualMemoryTracker.cpp Tue Nov 26 16:21:29 2019 +0100
@@ -602,8 +602,8 @@
// Metaspace Support
MetaspaceSnapshot::MetaspaceSnapshot() {
- for (int index = (int)metaspace::ClassType; index < (int)metaspace::MetadataTypeCount; index ++) {
- metaspace::MetadataType type = (metaspace::MetadataType)index;
+ for (int index = (int)Metaspace::ClassType; index < (int)Metaspace::MetadataTypeCount; index ++) {
+ Metaspace::MetadataType type = (Metaspace::MetadataType)index;
assert_valid_metadata_type(type);
_reserved_in_bytes[type] = 0;
_committed_in_bytes[type] = 0;
@@ -612,7 +612,7 @@
}
}
-void MetaspaceSnapshot::snapshot(metaspace::MetadataType type, MetaspaceSnapshot& mss) {
+void MetaspaceSnapshot::snapshot(Metaspace::MetadataType type, MetaspaceSnapshot& mss) {
assert_valid_metadata_type(type);
mss._reserved_in_bytes[type] = MetaspaceUtils::reserved_bytes(type);
@@ -626,8 +626,8 @@
}
void MetaspaceSnapshot::snapshot(MetaspaceSnapshot& mss) {
- snapshot(metaspace::ClassType, mss);
+ snapshot(Metaspace::ClassType, mss);
if (Metaspace::using_class_space()) {
- snapshot(metaspace::NonClassType, mss);
+ snapshot(Metaspace::NonClassType, mss);
}
}
--- a/src/hotspot/share/services/virtualMemoryTracker.hpp Tue Nov 26 11:29:20 2019 +0100
+++ b/src/hotspot/share/services/virtualMemoryTracker.hpp Tue Nov 26 16:21:29 2019 +0100
@@ -28,7 +28,7 @@
#if INCLUDE_NMT
#include "memory/allocation.hpp"
-#include "memory/metaspace/metaspaceEnums.hpp"
+#include "memory/metaspace.hpp"
#include "services/allocationSite.hpp"
#include "services/nmtCommon.hpp"
#include "utilities/linkedlist.hpp"
@@ -420,25 +420,25 @@
class MetaspaceSnapshot : public ResourceObj {
private:
- size_t _reserved_in_bytes[metaspace::MetadataTypeCount];
- size_t _committed_in_bytes[metaspace::MetadataTypeCount];
- size_t _used_in_bytes[metaspace::MetadataTypeCount];
- size_t _free_in_bytes[metaspace::MetadataTypeCount];
+ size_t _reserved_in_bytes[Metaspace::MetadataTypeCount];
+ size_t _committed_in_bytes[Metaspace::MetadataTypeCount];
+ size_t _used_in_bytes[Metaspace::MetadataTypeCount];
+ size_t _free_in_bytes[Metaspace::MetadataTypeCount];
public:
MetaspaceSnapshot();
- size_t reserved_in_bytes(metaspace::MetadataType type) const { assert_valid_metadata_type(type); return _reserved_in_bytes[type]; }
- size_t committed_in_bytes(metaspace::MetadataType type) const { assert_valid_metadata_type(type); return _committed_in_bytes[type]; }
- size_t used_in_bytes(metaspace::MetadataType type) const { assert_valid_metadata_type(type); return _used_in_bytes[type]; }
- size_t free_in_bytes(metaspace::MetadataType type) const { assert_valid_metadata_type(type); return _free_in_bytes[type]; }
+ size_t reserved_in_bytes(Metaspace::MetadataType type) const { assert_valid_metadata_type(type); return _reserved_in_bytes[type]; }
+ size_t committed_in_bytes(Metaspace::MetadataType type) const { assert_valid_metadata_type(type); return _committed_in_bytes[type]; }
+ size_t used_in_bytes(Metaspace::MetadataType type) const { assert_valid_metadata_type(type); return _used_in_bytes[type]; }
+ size_t free_in_bytes(Metaspace::MetadataType type) const { assert_valid_metadata_type(type); return _free_in_bytes[type]; }
static void snapshot(MetaspaceSnapshot& s);
private:
- static void snapshot(metaspace::MetadataType type, MetaspaceSnapshot& s);
+ static void snapshot(Metaspace::MetadataType type, MetaspaceSnapshot& s);
- static void assert_valid_metadata_type(metaspace::MetadataType type) {
- assert(type == metaspace::ClassType || type == metaspace::NonClassType,
+ static void assert_valid_metadata_type(Metaspace::MetadataType type) {
+ assert(type == Metaspace::ClassType || type == Metaspace::NonClassType,
"Invalid metadata type");
}
};
--- a/test/hotspot/gtest/metaspace/test_is_metaspace_obj.cpp Tue Nov 26 11:29:20 2019 +0100
+++ b/test/hotspot/gtest/metaspace/test_is_metaspace_obj.cpp Tue Nov 26 16:21:29 2019 +0100
@@ -50,7 +50,7 @@
delete _lock;
}
- void do_test(MetadataType mdType) {
+ void do_test(Metaspace::MetadataType mdType) {
_lock = new Mutex(Monitor::native, "gtest-IsMetaspaceObjTest-lock", false, Monitor::_safepoint_check_never);
{
MutexLocker ml(_lock, Mutex::_no_safepoint_check_flag);
@@ -68,7 +68,7 @@
// Test VirtualSpaceList::contains
const VirtualSpaceList* const vslist =
- (mdType == ClassType && Metaspace::using_class_space()) ?
+ (mdType == Metaspace::ClassType && Metaspace::using_class_space()) ?
VirtualSpaceList::vslist_class() : VirtualSpaceList::vslist_nonclass();
ASSERT_TRUE(vslist->contains((MetaWord*)p));
@@ -104,11 +104,11 @@
TEST_VM(metaspace, is_metaspace_obj_non_class) {
MetaspaceIsMetaspaceObjTest test;
- test.do_test(NonClassType);
+ test.do_test(Metaspace::NonClassType);
}
TEST_VM(metaspace, is_metaspace_obj_class) {
MetaspaceIsMetaspaceObjTest test;
- test.do_test(ClassType);
+ test.do_test(Metaspace::ClassType);
}
--- a/test/hotspot/gtest/metaspace/test_metaspaceUtils.cpp Tue Nov 26 11:29:20 2019 +0100
+++ b/test/hotspot/gtest/metaspace/test_metaspaceUtils.cpp Tue Nov 26 16:21:29 2019 +0100
@@ -31,7 +31,7 @@
size_t reserved = MetaspaceUtils::reserved_bytes();
EXPECT_GT(reserved, 0UL);
- size_t reserved_metadata = MetaspaceUtils::reserved_bytes(metaspace::NonClassType);
+ size_t reserved_metadata = MetaspaceUtils::reserved_bytes(Metaspace::NonClassType);
EXPECT_GT(reserved_metadata, 0UL);
EXPECT_LE(reserved_metadata, reserved);
}
@@ -43,7 +43,7 @@
size_t reserved = MetaspaceUtils::reserved_bytes();
EXPECT_GT(reserved, 0UL);
- size_t reserved_class = MetaspaceUtils::reserved_bytes(metaspace::ClassType);
+ size_t reserved_class = MetaspaceUtils::reserved_bytes(Metaspace::ClassType);
EXPECT_GT(reserved_class, 0UL);
EXPECT_LE(reserved_class, reserved);
}
@@ -55,7 +55,7 @@
size_t reserved = MetaspaceUtils::reserved_bytes();
EXPECT_LE(committed, reserved);
- size_t committed_metadata = MetaspaceUtils::committed_bytes(metaspace::NonClassType);
+ size_t committed_metadata = MetaspaceUtils::committed_bytes(Metaspace::NonClassType);
EXPECT_GT(committed_metadata, 0UL);
EXPECT_LE(committed_metadata, committed);
}
@@ -67,7 +67,7 @@
size_t committed = MetaspaceUtils::committed_bytes();
EXPECT_GT(committed, 0UL);
- size_t committed_class = MetaspaceUtils::committed_bytes(metaspace::ClassType);
+ size_t committed_class = MetaspaceUtils::committed_bytes(Metaspace::ClassType);
EXPECT_GT(committed_class, 0UL);
EXPECT_LE(committed_class, committed);
}