< prev index next >
src/share/vm/memory/metaspace.cpp
Print this page
rev 13113 : imported patch 8181917-refactor-ul-logstream
*** 25,34 ****
--- 25,35 ----
#include "aot/aotLoader.hpp"
#include "gc/shared/collectedHeap.hpp"
#include "gc/shared/collectorPolicy.hpp"
#include "gc/shared/gcLocker.hpp"
#include "logging/log.hpp"
+ #include "logging/logStream.hpp"
#include "memory/allocation.hpp"
#include "memory/binaryTreeDictionary.hpp"
#include "memory/filemap.hpp"
#include "memory/freeList.hpp"
#include "memory/metachunk.hpp"
*** 1012,1026 ****
// Without this the is_available check will not work correctly.
assert(_virtual_space.committed_size() == _virtual_space.actual_committed_size(),
"The committed memory doesn't match the expanded memory.");
if (!is_available(chunk_word_size)) {
! Log(gc, metaspace, freelist) log;
! log.debug("VirtualSpaceNode::take_from_committed() not available " SIZE_FORMAT " words ", chunk_word_size);
// Dump some information about the virtual space that is nearly full
! ResourceMark rm;
! print_on(log.debug_stream());
return NULL;
}
// Take the space (bump top on the current virtual space).
inc_top(chunk_word_size);
--- 1013,1029 ----
// Without this the is_available check will not work correctly.
assert(_virtual_space.committed_size() == _virtual_space.actual_committed_size(),
"The committed memory doesn't match the expanded memory.");
if (!is_available(chunk_word_size)) {
! LogTarget(Debug, gc, metaspace, freelist) lt;
! if (lt.is_enabled()) {
! LogStream ls(lt);
! ls.print("VirtualSpaceNode::take_from_committed() not available " SIZE_FORMAT " words ", chunk_word_size);
// Dump some information about the virtual space that is nearly full
! print_on(&ls);
! }
return NULL;
}
// Take the space (bump top on the current virtual space).
inc_top(chunk_word_size);
*** 1351,1365 ****
inc_committed_words(new_entry->committed_words());
inc_virtual_space_count();
#ifdef ASSERT
new_entry->mangle();
#endif
! if (log_is_enabled(Trace, gc, metaspace)) {
! Log(gc, metaspace) log;
VirtualSpaceNode* vsl = current_virtual_space();
ResourceMark rm;
! vsl->print_on(log.trace_stream());
}
}
bool VirtualSpaceList::expand_node_by(VirtualSpaceNode* node,
size_t min_words,
--- 1354,1369 ----
inc_committed_words(new_entry->committed_words());
inc_virtual_space_count();
#ifdef ASSERT
new_entry->mangle();
#endif
! LogTarget(Trace, gc, metaspace) lt;
! if (lt.is_enabled()) {
! LogStream ls(lt);
VirtualSpaceNode* vsl = current_virtual_space();
ResourceMark rm;
! vsl->print_on(&ls);
}
}
bool VirtualSpaceList::expand_node_by(VirtualSpaceNode* node,
size_t min_words,
*** 1957,1979 ****
}
assert((word_size <= chunk->word_size()) ||
(list_index(chunk->word_size()) == HumongousIndex),
"Non-humongous variable sized chunk");
! Log(gc, metaspace, freelist) log;
! if (log.is_debug()) {
size_t list_count;
if (list_index(word_size) < HumongousIndex) {
ChunkList* list = find_free_chunks_list(word_size);
list_count = list->count();
} else {
list_count = humongous_dictionary()->total_count();
}
! log.debug("ChunkManager::chunk_freelist_allocate: " PTR_FORMAT " chunk " PTR_FORMAT " size " SIZE_FORMAT " count " SIZE_FORMAT " ",
p2i(this), p2i(chunk), chunk->word_size(), list_count);
ResourceMark rm;
! locked_print_free_chunks(log.debug_stream());
}
return chunk;
}
--- 1961,1984 ----
}
assert((word_size <= chunk->word_size()) ||
(list_index(chunk->word_size()) == HumongousIndex),
"Non-humongous variable sized chunk");
! LogTarget(Debug, gc, metaspace, freelist) lt;
! if (lt.is_enabled()) {
size_t list_count;
if (list_index(word_size) < HumongousIndex) {
ChunkList* list = find_free_chunks_list(word_size);
list_count = list->count();
} else {
list_count = humongous_dictionary()->total_count();
}
! LogStream ls(lt);
! ls.print("ChunkManager::chunk_freelist_allocate: " PTR_FORMAT " chunk " PTR_FORMAT " size " SIZE_FORMAT " count " SIZE_FORMAT " ",
p2i(this), p2i(chunk), chunk->word_size(), list_count);
ResourceMark rm;
! locked_print_free_chunks(&ls);
}
return chunk;
}
*** 2396,2408 ****
Log(gc, metaspace, freelist) log;
if (log.is_trace()) {
log.trace("~SpaceManager(): " PTR_FORMAT, p2i(this));
ResourceMark rm;
! locked_print_chunks_in_use_on(log.trace_stream());
if (block_freelists() != NULL) {
! block_freelists()->print_on(log.trace_stream());
}
}
// Add all the chunks in use by this space manager
// to the global list of free chunks.
--- 2401,2414 ----
Log(gc, metaspace, freelist) log;
if (log.is_trace()) {
log.trace("~SpaceManager(): " PTR_FORMAT, p2i(this));
ResourceMark rm;
! LogStream ls(log.trace());
! locked_print_chunks_in_use_on(&ls);
if (block_freelists() != NULL) {
! block_freelists()->print_on(&ls);
}
}
// Add all the chunks in use by this space manager
// to the global list of free chunks.
*** 2475,2487 ****
assert(new_chunk->is_empty(), "Not ready for reuse");
Log(gc, metaspace, freelist) log;
if (log.is_trace()) {
log.trace("SpaceManager::add_chunk: " SIZE_FORMAT ") ", sum_count_in_chunks_in_use());
ResourceMark rm;
! outputStream* out = log.trace_stream();
! new_chunk->print_on(out);
! chunk_manager()->locked_print_free_chunks(out);
}
}
void SpaceManager::retire_current_chunk() {
if (current_chunk() != NULL) {
--- 2481,2493 ----
assert(new_chunk->is_empty(), "Not ready for reuse");
Log(gc, metaspace, freelist) log;
if (log.is_trace()) {
log.trace("SpaceManager::add_chunk: " SIZE_FORMAT ") ", sum_count_in_chunks_in_use());
ResourceMark rm;
! LogStream ls(log.trace());
! new_chunk->print_on(&ls);
! chunk_manager()->locked_print_free_chunks(&ls);
}
}
void SpaceManager::retire_current_chunk() {
if (current_chunk() != NULL) {
*** 3207,3220 ****
set_narrow_klass_base_and_shift((address)metaspace_rs.base(),
UseSharedSpaces ? (address)cds_base : 0);
initialize_class_space(metaspace_rs);
! if (log_is_enabled(Trace, gc, metaspace)) {
! Log(gc, metaspace) log;
ResourceMark rm;
! print_compressed_class_space(log.trace_stream(), requested_addr);
}
}
void Metaspace::print_compressed_class_space(outputStream* st, const char* requested_addr) {
st->print_cr("Narrow klass base: " PTR_FORMAT ", Narrow klass shift: %d",
--- 3213,3227 ----
set_narrow_klass_base_and_shift((address)metaspace_rs.base(),
UseSharedSpaces ? (address)cds_base : 0);
initialize_class_space(metaspace_rs);
! LogTarget(Trace, gc, metaspace) lt;
! if (lt.is_enabled()) {
ResourceMark rm;
! LogStream ls(lt);
! print_compressed_class_space(&ls, requested_addr);
}
}
void Metaspace::print_compressed_class_space(outputStream* st, const char* requested_addr) {
st->print_cr("Narrow klass base: " PTR_FORMAT ", Narrow klass shift: %d",
*** 3664,3678 ****
Log(gc, metaspace, freelist) log;
if (log.is_info()) {
log.info("Metaspace (%s) allocation failed for size " SIZE_FORMAT,
is_class_space_allocation(mdtype) ? "class" : "data", word_size);
ResourceMark rm;
! outputStream* out = log.info_stream();
if (loader_data->metaspace_or_null() != NULL) {
! loader_data->dump(out);
}
! MetaspaceAux::dump(out);
}
bool out_of_compressed_class_space = false;
if (is_class_space_allocation(mdtype)) {
Metaspace* metaspace = loader_data->metaspace_non_null();
--- 3671,3685 ----
Log(gc, metaspace, freelist) log;
if (log.is_info()) {
log.info("Metaspace (%s) allocation failed for size " SIZE_FORMAT,
is_class_space_allocation(mdtype) ? "class" : "data", word_size);
ResourceMark rm;
! LogStream ls(log.info());
if (loader_data->metaspace_or_null() != NULL) {
! loader_data->dump(&ls);
}
! MetaspaceAux::dump(&ls);
}
bool out_of_compressed_class_space = false;
if (is_class_space_allocation(mdtype)) {
Metaspace* metaspace = loader_data->metaspace_non_null();
< prev index next >