提交 e7fb36ac 编写于 作者: E ehelin

8038934: Remove prefix allocated_ from methods and variables in Metaspace

Reviewed-by: jmasa, coleenp
上级 60490749
......@@ -1288,7 +1288,7 @@ bool G1CollectedHeap::do_collection(bool explicit_gc,
print_heap_before_gc();
trace_heap_before_gc(gc_tracer);
size_t metadata_prev_used = MetaspaceAux::allocated_used_bytes();
size_t metadata_prev_used = MetaspaceAux::used_bytes();
verify_region_sets_optional();
......
......@@ -1204,7 +1204,7 @@ void G1CollectorPolicy::record_heap_size_info_at_start(bool full) {
(_young_list_target_length * HeapRegion::GrainBytes) - _survivor_used_bytes_before_gc;
if (full) {
_metaspace_used_bytes_before_gc = MetaspaceAux::allocated_used_bytes();
_metaspace_used_bytes_before_gc = MetaspaceAux::used_bytes();
}
}
......
......@@ -184,7 +184,7 @@ bool PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) {
size_t prev_used = heap->used();
// Capture metadata size before collection for sizing.
size_t metadata_prev_used = MetaspaceAux::allocated_used_bytes();
size_t metadata_prev_used = MetaspaceAux::used_bytes();
// For PrintGCDetails
size_t old_gen_prev_used = old_gen->used_in_bytes();
......
......@@ -927,7 +927,7 @@ public:
_heap_used = heap->used();
_young_gen_used = heap->young_gen()->used_in_bytes();
_old_gen_used = heap->old_gen()->used_in_bytes();
_metadata_used = MetaspaceAux::allocated_used_bytes();
_metadata_used = MetaspaceAux::used_bytes();
};
size_t heap_used() const { return _heap_used; }
......
......@@ -86,15 +86,15 @@ GCHeapSummary CollectedHeap::create_heap_summary() {
MetaspaceSummary CollectedHeap::create_metaspace_summary() {
const MetaspaceSizes meta_space(
MetaspaceAux::committed_bytes(),
MetaspaceAux::allocated_used_bytes(),
MetaspaceAux::used_bytes(),
MetaspaceAux::reserved_bytes());
const MetaspaceSizes data_space(
MetaspaceAux::committed_bytes(Metaspace::NonClassType),
MetaspaceAux::allocated_used_bytes(Metaspace::NonClassType),
MetaspaceAux::used_bytes(Metaspace::NonClassType),
MetaspaceAux::reserved_bytes(Metaspace::NonClassType));
const MetaspaceSizes class_space(
MetaspaceAux::committed_bytes(Metaspace::ClassType),
MetaspaceAux::allocated_used_bytes(Metaspace::ClassType),
MetaspaceAux::used_bytes(Metaspace::ClassType),
MetaspaceAux::reserved_bytes(Metaspace::ClassType));
const MetaspaceChunkFreeListSummary& ms_chunk_free_list_summary =
......
......@@ -374,7 +374,7 @@ void GenCollectedHeap::do_collection(bool full,
ClearedAllSoftRefs casr(do_clear_all_soft_refs, collector_policy());
const size_t metadata_prev_used = MetaspaceAux::allocated_used_bytes();
const size_t metadata_prev_used = MetaspaceAux::used_bytes();
print_heap_before_gc();
......
......@@ -1447,7 +1447,7 @@ void MetaspaceGC::compute_new_size() {
uint current_shrink_factor = _shrink_factor;
_shrink_factor = 0;
const size_t used_after_gc = MetaspaceAux::allocated_capacity_bytes();
const size_t used_after_gc = MetaspaceAux::capacity_bytes();
const size_t capacity_until_GC = MetaspaceGC::capacity_until_GC();
const double minimum_free_percentage = MinMetaspaceFreeRatio / 100.0;
......@@ -2537,8 +2537,8 @@ void SpaceManager::mangle_freed_chunks() {
// MetaspaceAux
size_t MetaspaceAux::_allocated_capacity_words[] = {0, 0};
size_t MetaspaceAux::_allocated_used_words[] = {0, 0};
size_t MetaspaceAux::_capacity_words[] = {0, 0};
size_t MetaspaceAux::_used_words[] = {0, 0};
size_t MetaspaceAux::free_bytes(Metaspace::MetadataType mdtype) {
VirtualSpaceList* list = Metaspace::get_space_list(mdtype);
......@@ -2551,38 +2551,38 @@ size_t MetaspaceAux::free_bytes() {
void MetaspaceAux::dec_capacity(Metaspace::MetadataType mdtype, size_t words) {
assert_lock_strong(SpaceManager::expand_lock());
assert(words <= allocated_capacity_words(mdtype),
assert(words <= capacity_words(mdtype),
err_msg("About to decrement below 0: words " SIZE_FORMAT
" is greater than _allocated_capacity_words[%u] " SIZE_FORMAT,
words, mdtype, allocated_capacity_words(mdtype)));
_allocated_capacity_words[mdtype] -= words;
" is greater than _capacity_words[%u] " SIZE_FORMAT,
words, mdtype, capacity_words(mdtype)));
_capacity_words[mdtype] -= words;
}
void MetaspaceAux::inc_capacity(Metaspace::MetadataType mdtype, size_t words) {
assert_lock_strong(SpaceManager::expand_lock());
// Needs to be atomic
_allocated_capacity_words[mdtype] += words;
_capacity_words[mdtype] += words;
}
void MetaspaceAux::dec_used(Metaspace::MetadataType mdtype, size_t words) {
assert(words <= allocated_used_words(mdtype),
assert(words <= used_words(mdtype),
err_msg("About to decrement below 0: words " SIZE_FORMAT
" is greater than _allocated_used_words[%u] " SIZE_FORMAT,
words, mdtype, allocated_used_words(mdtype)));
" is greater than _used_words[%u] " SIZE_FORMAT,
words, mdtype, used_words(mdtype)));
// For CMS deallocation of the Metaspaces occurs during the
// sweep which is a concurrent phase. Protection by the expand_lock()
// is not enough since allocation is on a per Metaspace basis
// and protected by the Metaspace lock.
jlong minus_words = (jlong) - (jlong) words;
Atomic::add_ptr(minus_words, &_allocated_used_words[mdtype]);
Atomic::add_ptr(minus_words, &_used_words[mdtype]);
}
void MetaspaceAux::inc_used(Metaspace::MetadataType mdtype, size_t words) {
// _allocated_used_words tracks allocations for
// _used_words tracks allocations for
// each piece of metadata. Those allocations are
// generally done concurrently by different application
// threads so must be done atomically.
Atomic::add_ptr(words, &_allocated_used_words[mdtype]);
Atomic::add_ptr(words, &_used_words[mdtype]);
}
size_t MetaspaceAux::used_bytes_slow(Metaspace::MetadataType mdtype) {
......@@ -2629,16 +2629,16 @@ size_t MetaspaceAux::capacity_bytes_slow(Metaspace::MetadataType mdtype) {
size_t MetaspaceAux::capacity_bytes_slow() {
#ifdef PRODUCT
// Use allocated_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");
#endif
size_t class_capacity = capacity_bytes_slow(Metaspace::ClassType);
size_t non_class_capacity = capacity_bytes_slow(Metaspace::NonClassType);
assert(allocated_capacity_bytes() == class_capacity + non_class_capacity,
err_msg("bad accounting: allocated_capacity_bytes() " SIZE_FORMAT
assert(capacity_bytes() == class_capacity + non_class_capacity,
err_msg("bad accounting: capacity_bytes() " SIZE_FORMAT
" class_capacity + non_class_capacity " SIZE_FORMAT
" class_capacity " SIZE_FORMAT " non_class_capacity " SIZE_FORMAT,
allocated_capacity_bytes(), class_capacity + non_class_capacity,
capacity_bytes(), class_capacity + non_class_capacity,
class_capacity, non_class_capacity));
return class_capacity + non_class_capacity;
......@@ -2698,14 +2698,14 @@ void MetaspaceAux::print_metaspace_change(size_t prev_metadata_used) {
"->" SIZE_FORMAT
"(" SIZE_FORMAT ")",
prev_metadata_used,
allocated_used_bytes(),
used_bytes(),
reserved_bytes());
} else {
gclog_or_tty->print(" " SIZE_FORMAT "K"
"->" SIZE_FORMAT "K"
"(" SIZE_FORMAT "K)",
prev_metadata_used/K,
allocated_used_bytes()/K,
used_bytes()/K,
reserved_bytes()/K);
}
......@@ -2721,8 +2721,8 @@ void MetaspaceAux::print_on(outputStream* out) {
"capacity " SIZE_FORMAT "K, "
"committed " SIZE_FORMAT "K, "
"reserved " SIZE_FORMAT "K",
allocated_used_bytes()/K,
allocated_capacity_bytes()/K,
used_bytes()/K,
capacity_bytes()/K,
committed_bytes()/K,
reserved_bytes()/K);
......@@ -2733,8 +2733,8 @@ void MetaspaceAux::print_on(outputStream* out) {
"capacity " SIZE_FORMAT "K, "
"committed " SIZE_FORMAT "K, "
"reserved " SIZE_FORMAT "K",
allocated_used_bytes(ct)/K,
allocated_capacity_bytes(ct)/K,
used_bytes(ct)/K,
capacity_bytes(ct)/K,
committed_bytes(ct)/K,
reserved_bytes(ct)/K);
}
......@@ -2836,42 +2836,42 @@ void MetaspaceAux::verify_free_chunks() {
void MetaspaceAux::verify_capacity() {
#ifdef ASSERT
size_t running_sum_capacity_bytes = allocated_capacity_bytes();
size_t running_sum_capacity_bytes = capacity_bytes();
// For purposes of the running sum of capacity, verify against capacity
size_t capacity_in_use_bytes = capacity_bytes_slow();
assert(running_sum_capacity_bytes == capacity_in_use_bytes,
err_msg("allocated_capacity_words() * BytesPerWord " SIZE_FORMAT
err_msg("capacity_words() * BytesPerWord " SIZE_FORMAT
" capacity_bytes_slow()" SIZE_FORMAT,
running_sum_capacity_bytes, capacity_in_use_bytes));
for (Metaspace::MetadataType i = Metaspace::ClassType;
i < Metaspace:: MetadataTypeCount;
i = (Metaspace::MetadataType)(i + 1)) {
size_t capacity_in_use_bytes = capacity_bytes_slow(i);
assert(allocated_capacity_bytes(i) == capacity_in_use_bytes,
err_msg("allocated_capacity_bytes(%u) " SIZE_FORMAT
assert(capacity_bytes(i) == capacity_in_use_bytes,
err_msg("capacity_bytes(%u) " SIZE_FORMAT
" capacity_bytes_slow(%u)" SIZE_FORMAT,
i, allocated_capacity_bytes(i), i, capacity_in_use_bytes));
i, capacity_bytes(i), i, capacity_in_use_bytes));
}
#endif
}
void MetaspaceAux::verify_used() {
#ifdef ASSERT
size_t running_sum_used_bytes = allocated_used_bytes();
size_t running_sum_used_bytes = used_bytes();
// For purposes of the running sum of used, verify against used
size_t used_in_use_bytes = used_bytes_slow();
assert(allocated_used_bytes() == used_in_use_bytes,
err_msg("allocated_used_bytes() " SIZE_FORMAT
assert(used_bytes() == used_in_use_bytes,
err_msg("used_bytes() " SIZE_FORMAT
" used_bytes_slow()" SIZE_FORMAT,
allocated_used_bytes(), used_in_use_bytes));
used_bytes(), used_in_use_bytes));
for (Metaspace::MetadataType i = Metaspace::ClassType;
i < Metaspace:: MetadataTypeCount;
i = (Metaspace::MetadataType)(i + 1)) {
size_t used_in_use_bytes = used_bytes_slow(i);
assert(allocated_used_bytes(i) == used_in_use_bytes,
err_msg("allocated_used_bytes(%u) " SIZE_FORMAT
assert(used_bytes(i) == used_in_use_bytes,
err_msg("used_bytes(%u) " SIZE_FORMAT
" used_bytes_slow(%u)" SIZE_FORMAT,
i, allocated_used_bytes(i), i, used_in_use_bytes));
i, used_bytes(i), i, used_in_use_bytes));
}
#endif
}
......
......@@ -280,11 +280,11 @@ class MetaspaceAux : AllStatic {
// allocated to a Metaspace. This is used instead of
// iterating over all the classloaders. One for each
// type of Metadata
static size_t _allocated_capacity_words[Metaspace:: MetadataTypeCount];
// Running sum of space in all Metachunks that have
static size_t _capacity_words[Metaspace:: MetadataTypeCount];
// Running sum of space in all Metachunks that
// are being used for metadata. One for each
// type of Metadata.
static size_t _allocated_used_words[Metaspace:: MetadataTypeCount];
static size_t _used_words[Metaspace:: MetadataTypeCount];
public:
// Decrement and increment _allocated_capacity_words
......@@ -308,32 +308,32 @@ class MetaspaceAux : AllStatic {
static size_t free_chunks_total_bytes();
static size_t free_chunks_total_bytes(Metaspace::MetadataType mdtype);
static size_t allocated_capacity_words(Metaspace::MetadataType mdtype) {
return _allocated_capacity_words[mdtype];
static size_t capacity_words(Metaspace::MetadataType mdtype) {
return _capacity_words[mdtype];
}
static size_t allocated_capacity_words() {
return allocated_capacity_words(Metaspace::NonClassType) +
allocated_capacity_words(Metaspace::ClassType);
static size_t capacity_words() {
return capacity_words(Metaspace::NonClassType) +
capacity_words(Metaspace::ClassType);
}
static size_t allocated_capacity_bytes(Metaspace::MetadataType mdtype) {
return allocated_capacity_words(mdtype) * BytesPerWord;
static size_t capacity_bytes(Metaspace::MetadataType mdtype) {
return capacity_words(mdtype) * BytesPerWord;
}
static size_t allocated_capacity_bytes() {
return allocated_capacity_words() * BytesPerWord;
static size_t capacity_bytes() {
return capacity_words() * BytesPerWord;
}
static size_t allocated_used_words(Metaspace::MetadataType mdtype) {
return _allocated_used_words[mdtype];
static size_t used_words(Metaspace::MetadataType mdtype) {
return _used_words[mdtype];
}
static size_t allocated_used_words() {
return allocated_used_words(Metaspace::NonClassType) +
allocated_used_words(Metaspace::ClassType);
static size_t used_words() {
return used_words(Metaspace::NonClassType) +
used_words(Metaspace::ClassType);
}
static size_t allocated_used_bytes(Metaspace::MetadataType mdtype) {
return allocated_used_words(mdtype) * BytesPerWord;
static size_t used_bytes(Metaspace::MetadataType mdtype) {
return used_words(mdtype) * BytesPerWord;
}
static size_t allocated_used_bytes() {
return allocated_used_words() * BytesPerWord;
static size_t used_bytes() {
return used_words() * BytesPerWord;
}
static size_t free_bytes();
......
......@@ -66,7 +66,7 @@ class MetaspacePerfCounters: public CHeapObj<mtInternal> {
MetaspacePerfCounters* MetaspaceCounters::_perf_counters = NULL;
size_t MetaspaceCounters::used() {
return MetaspaceAux::allocated_used_bytes();
return MetaspaceAux::used_bytes();
}
size_t MetaspaceCounters::capacity() {
......@@ -98,7 +98,7 @@ void MetaspaceCounters::update_performance_counters() {
MetaspacePerfCounters* CompressedClassSpaceCounters::_perf_counters = NULL;
size_t CompressedClassSpaceCounters::used() {
return MetaspaceAux::allocated_used_bytes(Metaspace::ClassType);
return MetaspaceAux::used_bytes(Metaspace::ClassType);
}
size_t CompressedClassSpaceCounters::capacity() {
......
......@@ -268,7 +268,7 @@ MemoryUsage MetaspacePool::get_memory_usage() {
}
size_t MetaspacePool::used_in_bytes() {
return MetaspaceAux::allocated_used_bytes();
return MetaspaceAux::used_bytes();
}
size_t MetaspacePool::calculate_max_size() const {
......@@ -280,7 +280,7 @@ CompressedKlassSpacePool::CompressedKlassSpacePool() :
MemoryPool("Compressed Class Space", NonHeap, 0, CompressedClassSpaceSize, true, false) { }
size_t CompressedKlassSpacePool::used_in_bytes() {
return MetaspaceAux::allocated_used_bytes(Metaspace::ClassType);
return MetaspaceAux::used_bytes(Metaspace::ClassType);
}
MemoryUsage CompressedKlassSpacePool::get_memory_usage() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册