< prev index next >
src/share/vm/memory/metaspace.cpp
Print this page
rev 13180 : imported patch 8181917-refactor-ul-logstream
@@ -25,10 +25,11 @@
#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,15 +1013,17 @@
// 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);
+ 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
- ResourceMark rm;
- print_on(log.debug_stream());
+ print_on(&ls);
+ }
return NULL;
}
// Take the space (bump top on the current virtual space).
inc_top(chunk_word_size);
@@ -1351,15 +1354,16 @@
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;
+ LogTarget(Trace, gc, metaspace) lt;
+ if (lt.is_enabled()) {
+ LogStream ls(lt);
VirtualSpaceNode* vsl = current_virtual_space();
ResourceMark rm;
- vsl->print_on(log.trace_stream());
+ vsl->print_on(&ls);
}
}
bool VirtualSpaceList::expand_node_by(VirtualSpaceNode* node,
size_t min_words,
@@ -1957,23 +1961,24 @@
}
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()) {
+ 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();
}
- log.debug("ChunkManager::chunk_freelist_allocate: " PTR_FORMAT " chunk " PTR_FORMAT " size " SIZE_FORMAT " count " SIZE_FORMAT " ",
+ 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(log.debug_stream());
+ locked_print_free_chunks(&ls);
}
return chunk;
}
@@ -2396,13 +2401,14 @@
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());
+ LogStream ls(log.trace());
+ locked_print_chunks_in_use_on(&ls);
if (block_freelists() != NULL) {
- block_freelists()->print_on(log.trace_stream());
+ block_freelists()->print_on(&ls);
}
}
// Add all the chunks in use by this space manager
// to the global list of free chunks.
@@ -2475,13 +2481,13 @@
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);
+ 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,14 +3213,15 @@
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;
+ LogTarget(Trace, gc, metaspace) lt;
+ if (lt.is_enabled()) {
ResourceMark rm;
- print_compressed_class_space(log.trace_stream(), requested_addr);
+ 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,15 +3671,15 @@
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();
+ LogStream ls(log.info());
if (loader_data->metaspace_or_null() != NULL) {
- loader_data->dump(out);
+ loader_data->dump(&ls);
}
- MetaspaceAux::dump(out);
+ 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 >