src/share/vm/memory/metaspace.cpp

changeset 5708
8c5e6482cbfc
parent 5707
8227700da288
child 5770
9361de86a50f
equal deleted inserted replaced
5707:8227700da288 5708:8c5e6482cbfc
879 MetaWord* chunk_limit = top(); 879 MetaWord* chunk_limit = top();
880 assert(chunk_limit != NULL, "Not safe to call this method"); 880 assert(chunk_limit != NULL, "Not safe to call this method");
881 881
882 if (!is_available(chunk_word_size)) { 882 if (!is_available(chunk_word_size)) {
883 if (TraceMetadataChunkAllocation) { 883 if (TraceMetadataChunkAllocation) {
884 tty->print("VirtualSpaceNode::take_from_committed() not available %d words ", chunk_word_size); 884 gclog_or_tty->print("VirtualSpaceNode::take_from_committed() not available %d words ", chunk_word_size);
885 // Dump some information about the virtual space that is nearly full 885 // Dump some information about the virtual space that is nearly full
886 print_on(tty); 886 print_on(gclog_or_tty);
887 } 887 }
888 return NULL; 888 return NULL;
889 } 889 }
890 890
891 // Take the space (bump top on the current virtual space). 891 // Take the space (bump top on the current virtual space).
902 size_t bytes = words * BytesPerWord; 902 size_t bytes = words * BytesPerWord;
903 bool result = virtual_space()->expand_by(bytes, pre_touch); 903 bool result = virtual_space()->expand_by(bytes, pre_touch);
904 if (TraceMetavirtualspaceAllocation && !result) { 904 if (TraceMetavirtualspaceAllocation && !result) {
905 gclog_or_tty->print_cr("VirtualSpaceNode::expand_by() failed " 905 gclog_or_tty->print_cr("VirtualSpaceNode::expand_by() failed "
906 "for byte size " SIZE_FORMAT, bytes); 906 "for byte size " SIZE_FORMAT, bytes);
907 virtual_space()->print(); 907 virtual_space()->print_on(gclog_or_tty);
908 } 908 }
909 return result; 909 return result;
910 } 910 }
911 911
912 Metachunk* VirtualSpaceNode::get_chunk_vs(size_t chunk_word_size) { 912 Metachunk* VirtualSpaceNode::get_chunk_vs(size_t chunk_word_size) {
1171 #ifdef ASSERT 1171 #ifdef ASSERT
1172 new_entry->mangle(); 1172 new_entry->mangle();
1173 #endif 1173 #endif
1174 if (TraceMetavirtualspaceAllocation && Verbose) { 1174 if (TraceMetavirtualspaceAllocation && Verbose) {
1175 VirtualSpaceNode* vsl = current_virtual_space(); 1175 VirtualSpaceNode* vsl = current_virtual_space();
1176 vsl->print_on(tty); 1176 vsl->print_on(gclog_or_tty);
1177 } 1177 }
1178 } 1178 }
1179 1179
1180 bool VirtualSpaceList::expand_by(VirtualSpaceNode* node, size_t word_size, bool pre_touch) { 1180 bool VirtualSpaceList::expand_by(VirtualSpaceNode* node, size_t word_size, bool pre_touch) {
1181 size_t before = node->committed_words(); 1181 size_t before = node->committed_words();
1731 // lock. 1731 // lock.
1732 assert(chunk != NULL, "Deallocating NULL"); 1732 assert(chunk != NULL, "Deallocating NULL");
1733 assert_lock_strong(SpaceManager::expand_lock()); 1733 assert_lock_strong(SpaceManager::expand_lock());
1734 slow_locked_verify(); 1734 slow_locked_verify();
1735 if (TraceMetadataChunkAllocation) { 1735 if (TraceMetadataChunkAllocation) {
1736 tty->print_cr("ChunkManager::chunk_freelist_deallocate: chunk " 1736 gclog_or_tty->print_cr("ChunkManager::chunk_freelist_deallocate: chunk "
1737 PTR_FORMAT " size " SIZE_FORMAT, 1737 PTR_FORMAT " size " SIZE_FORMAT,
1738 chunk, chunk->word_size()); 1738 chunk, chunk->word_size());
1739 } 1739 }
1740 free_chunks_put(chunk); 1740 free_chunks_put(chunk);
1741 } 1741 }
1742 1742
1743 Metachunk* ChunkManager::free_chunks_get(size_t word_size) { 1743 Metachunk* ChunkManager::free_chunks_get(size_t word_size) {
1762 1762
1763 // Chunk is being removed from the chunks free list. 1763 // Chunk is being removed from the chunks free list.
1764 dec_free_chunks_total(chunk->capacity_word_size()); 1764 dec_free_chunks_total(chunk->capacity_word_size());
1765 1765
1766 if (TraceMetadataChunkAllocation && Verbose) { 1766 if (TraceMetadataChunkAllocation && Verbose) {
1767 tty->print_cr("ChunkManager::free_chunks_get: free_list " 1767 gclog_or_tty->print_cr("ChunkManager::free_chunks_get: free_list "
1768 PTR_FORMAT " head " PTR_FORMAT " size " SIZE_FORMAT, 1768 PTR_FORMAT " head " PTR_FORMAT " size " SIZE_FORMAT,
1769 free_list, chunk, chunk->word_size()); 1769 free_list, chunk, chunk->word_size());
1770 } 1770 }
1771 } else { 1771 } else {
1772 chunk = humongous_dictionary()->get_chunk( 1772 chunk = humongous_dictionary()->get_chunk(
1773 word_size, 1773 word_size,
1774 FreeBlockDictionary<Metachunk>::atLeast); 1774 FreeBlockDictionary<Metachunk>::atLeast);
1775 1775
1776 if (chunk != NULL) { 1776 if (chunk != NULL) {
1777 if (TraceMetadataHumongousAllocation) { 1777 if (TraceMetadataHumongousAllocation) {
1778 size_t waste = chunk->word_size() - word_size; 1778 size_t waste = chunk->word_size() - word_size;
1779 tty->print_cr("Free list allocate humongous chunk size " SIZE_FORMAT 1779 gclog_or_tty->print_cr("Free list allocate humongous chunk size "
1780 " for requested size " SIZE_FORMAT 1780 SIZE_FORMAT " for requested size " SIZE_FORMAT
1781 " waste " SIZE_FORMAT, 1781 " waste " SIZE_FORMAT,
1782 chunk->word_size(), word_size, waste); 1782 chunk->word_size(), word_size, waste);
1783 } 1783 }
1784 // Chunk is being removed from the chunks free list. 1784 // Chunk is being removed from the chunks free list.
1785 dec_free_chunks_total(chunk->capacity_word_size()); 1785 dec_free_chunks_total(chunk->capacity_word_size());
1786 } else { 1786 } else {
1787 return NULL; 1787 return NULL;
1819 ChunkList* list = find_free_chunks_list(word_size); 1819 ChunkList* list = find_free_chunks_list(word_size);
1820 list_count = list->count(); 1820 list_count = list->count();
1821 } else { 1821 } else {
1822 list_count = humongous_dictionary()->total_count(); 1822 list_count = humongous_dictionary()->total_count();
1823 } 1823 }
1824 tty->print("ChunkManager::chunk_freelist_allocate: " PTR_FORMAT " chunk " 1824 gclog_or_tty->print("ChunkManager::chunk_freelist_allocate: " PTR_FORMAT " chunk "
1825 PTR_FORMAT " size " SIZE_FORMAT " count " SIZE_FORMAT " ", 1825 PTR_FORMAT " size " SIZE_FORMAT " count " SIZE_FORMAT " ",
1826 this, chunk, chunk->word_size(), list_count); 1826 this, chunk, chunk->word_size(), list_count);
1827 locked_print_free_chunks(tty); 1827 locked_print_free_chunks(gclog_or_tty);
1828 } 1828 }
1829 1829
1830 return chunk; 1830 return chunk;
1831 } 1831 }
1832 1832
2342 if (TraceMetadataChunkAllocation && Verbose) { 2342 if (TraceMetadataChunkAllocation && Verbose) {
2343 gclog_or_tty->print("SpaceManager::add_chunk: %d) ", 2343 gclog_or_tty->print("SpaceManager::add_chunk: %d) ",
2344 sum_count_in_chunks_in_use()); 2344 sum_count_in_chunks_in_use());
2345 new_chunk->print_on(gclog_or_tty); 2345 new_chunk->print_on(gclog_or_tty);
2346 if (vs_list() != NULL) { 2346 if (vs_list() != NULL) {
2347 vs_list()->chunk_manager()->locked_print_free_chunks(tty); 2347 vs_list()->chunk_manager()->locked_print_free_chunks(gclog_or_tty);
2348 } 2348 }
2349 } 2349 }
2350 } 2350 }
2351 2351
2352 void SpaceManager::retire_current_chunk() { 2352 void SpaceManager::retire_current_chunk() {

mercurial