Fri, 13 Sep 2013 22:25:27 +0200
8024752: Log TraceMetadata* output to gclog_or_tty instead of tty
Reviewed-by: brutisso, mgerdin, coleenp
1.1 --- a/src/share/vm/memory/metaspace.cpp Fri Sep 13 22:23:48 2013 +0200 1.2 +++ b/src/share/vm/memory/metaspace.cpp Fri Sep 13 22:25:27 2013 +0200 1.3 @@ -881,9 +881,9 @@ 1.4 1.5 if (!is_available(chunk_word_size)) { 1.6 if (TraceMetadataChunkAllocation) { 1.7 - tty->print("VirtualSpaceNode::take_from_committed() not available %d words ", chunk_word_size); 1.8 + gclog_or_tty->print("VirtualSpaceNode::take_from_committed() not available %d words ", chunk_word_size); 1.9 // Dump some information about the virtual space that is nearly full 1.10 - print_on(tty); 1.11 + print_on(gclog_or_tty); 1.12 } 1.13 return NULL; 1.14 } 1.15 @@ -904,7 +904,7 @@ 1.16 if (TraceMetavirtualspaceAllocation && !result) { 1.17 gclog_or_tty->print_cr("VirtualSpaceNode::expand_by() failed " 1.18 "for byte size " SIZE_FORMAT, bytes); 1.19 - virtual_space()->print(); 1.20 + virtual_space()->print_on(gclog_or_tty); 1.21 } 1.22 return result; 1.23 } 1.24 @@ -1173,7 +1173,7 @@ 1.25 #endif 1.26 if (TraceMetavirtualspaceAllocation && Verbose) { 1.27 VirtualSpaceNode* vsl = current_virtual_space(); 1.28 - vsl->print_on(tty); 1.29 + vsl->print_on(gclog_or_tty); 1.30 } 1.31 } 1.32 1.33 @@ -1733,9 +1733,9 @@ 1.34 assert_lock_strong(SpaceManager::expand_lock()); 1.35 slow_locked_verify(); 1.36 if (TraceMetadataChunkAllocation) { 1.37 - tty->print_cr("ChunkManager::chunk_freelist_deallocate: chunk " 1.38 - PTR_FORMAT " size " SIZE_FORMAT, 1.39 - chunk, chunk->word_size()); 1.40 + gclog_or_tty->print_cr("ChunkManager::chunk_freelist_deallocate: chunk " 1.41 + PTR_FORMAT " size " SIZE_FORMAT, 1.42 + chunk, chunk->word_size()); 1.43 } 1.44 free_chunks_put(chunk); 1.45 } 1.46 @@ -1764,9 +1764,9 @@ 1.47 dec_free_chunks_total(chunk->capacity_word_size()); 1.48 1.49 if (TraceMetadataChunkAllocation && Verbose) { 1.50 - tty->print_cr("ChunkManager::free_chunks_get: free_list " 1.51 - PTR_FORMAT " head " PTR_FORMAT " size " SIZE_FORMAT, 1.52 - free_list, chunk, chunk->word_size()); 1.53 + gclog_or_tty->print_cr("ChunkManager::free_chunks_get: free_list " 1.54 + PTR_FORMAT " head " PTR_FORMAT " size " SIZE_FORMAT, 1.55 + free_list, chunk, chunk->word_size()); 1.56 } 1.57 } else { 1.58 chunk = humongous_dictionary()->get_chunk( 1.59 @@ -1776,10 +1776,10 @@ 1.60 if (chunk != NULL) { 1.61 if (TraceMetadataHumongousAllocation) { 1.62 size_t waste = chunk->word_size() - word_size; 1.63 - tty->print_cr("Free list allocate humongous chunk size " SIZE_FORMAT 1.64 - " for requested size " SIZE_FORMAT 1.65 - " waste " SIZE_FORMAT, 1.66 - chunk->word_size(), word_size, waste); 1.67 + gclog_or_tty->print_cr("Free list allocate humongous chunk size " 1.68 + SIZE_FORMAT " for requested size " SIZE_FORMAT 1.69 + " waste " SIZE_FORMAT, 1.70 + chunk->word_size(), word_size, waste); 1.71 } 1.72 // Chunk is being removed from the chunks free list. 1.73 dec_free_chunks_total(chunk->capacity_word_size()); 1.74 @@ -1821,10 +1821,10 @@ 1.75 } else { 1.76 list_count = humongous_dictionary()->total_count(); 1.77 } 1.78 - tty->print("ChunkManager::chunk_freelist_allocate: " PTR_FORMAT " chunk " 1.79 - PTR_FORMAT " size " SIZE_FORMAT " count " SIZE_FORMAT " ", 1.80 - this, chunk, chunk->word_size(), list_count); 1.81 - locked_print_free_chunks(tty); 1.82 + gclog_or_tty->print("ChunkManager::chunk_freelist_allocate: " PTR_FORMAT " chunk " 1.83 + PTR_FORMAT " size " SIZE_FORMAT " count " SIZE_FORMAT " ", 1.84 + this, chunk, chunk->word_size(), list_count); 1.85 + locked_print_free_chunks(gclog_or_tty); 1.86 } 1.87 1.88 return chunk; 1.89 @@ -2344,7 +2344,7 @@ 1.90 sum_count_in_chunks_in_use()); 1.91 new_chunk->print_on(gclog_or_tty); 1.92 if (vs_list() != NULL) { 1.93 - vs_list()->chunk_manager()->locked_print_free_chunks(tty); 1.94 + vs_list()->chunk_manager()->locked_print_free_chunks(gclog_or_tty); 1.95 } 1.96 } 1.97 }
2.1 --- a/src/share/vm/runtime/virtualspace.cpp Fri Sep 13 22:23:48 2013 +0200 2.2 +++ b/src/share/vm/runtime/virtualspace.cpp Fri Sep 13 22:25:27 2013 +0200 2.3 @@ -754,16 +754,19 @@ 2.4 assert(high() <= upper_high(), "upper high"); 2.5 } 2.6 2.7 -void VirtualSpace::print() { 2.8 - tty->print ("Virtual space:"); 2.9 - if (special()) tty->print(" (pinned in memory)"); 2.10 - tty->cr(); 2.11 - tty->print_cr(" - committed: " SIZE_FORMAT, committed_size()); 2.12 - tty->print_cr(" - reserved: " SIZE_FORMAT, reserved_size()); 2.13 - tty->print_cr(" - [low, high]: [" INTPTR_FORMAT ", " INTPTR_FORMAT "]", low(), high()); 2.14 - tty->print_cr(" - [low_b, high_b]: [" INTPTR_FORMAT ", " INTPTR_FORMAT "]", low_boundary(), high_boundary()); 2.15 +void VirtualSpace::print_on(outputStream* out) { 2.16 + out->print ("Virtual space:"); 2.17 + if (special()) out->print(" (pinned in memory)"); 2.18 + out->cr(); 2.19 + out->print_cr(" - committed: " SIZE_FORMAT, committed_size()); 2.20 + out->print_cr(" - reserved: " SIZE_FORMAT, reserved_size()); 2.21 + out->print_cr(" - [low, high]: [" INTPTR_FORMAT ", " INTPTR_FORMAT "]", low(), high()); 2.22 + out->print_cr(" - [low_b, high_b]: [" INTPTR_FORMAT ", " INTPTR_FORMAT "]", low_boundary(), high_boundary()); 2.23 } 2.24 2.25 +void VirtualSpace::print() { 2.26 + print_on(tty); 2.27 +} 2.28 2.29 /////////////// Unit tests /////////////// 2.30
3.1 --- a/src/share/vm/runtime/virtualspace.hpp Fri Sep 13 22:23:48 2013 +0200 3.2 +++ b/src/share/vm/runtime/virtualspace.hpp Fri Sep 13 22:25:27 2013 +0200 3.3 @@ -203,7 +203,8 @@ 3.4 void check_for_contiguity() PRODUCT_RETURN; 3.5 3.6 // Debugging 3.7 - void print() PRODUCT_RETURN; 3.8 + void print_on(outputStream* out) PRODUCT_RETURN; 3.9 + void print(); 3.10 }; 3.11 3.12 #endif // SHARE_VM_RUNTIME_VIRTUALSPACE_HPP