comparison src/share/vm/memory/metachunk.cpp @ 7446:e51c9860cf66

8005082: NPG: Add specialized Metachunk sizes for reflection and anonymous classloaders Reviewed-by: johnc, coleenp
author jmasa
date Mon, 03 Dec 2012 15:09:39 -0800
parents eade6b2e4782
children c23dbf0e8ab7
comparison
equal deleted inserted replaced
7445:cd962e15c08e 7446:e51c9860cf66
54 chunk->set_top(chunk_bottom); 54 chunk->set_top(chunk_bottom);
55 MetaWord* chunk_end = ptr + word_size; 55 MetaWord* chunk_end = ptr + word_size;
56 assert(chunk_end > chunk_bottom, "Chunk must be too small"); 56 assert(chunk_end > chunk_bottom, "Chunk must be too small");
57 chunk->set_end(chunk_end); 57 chunk->set_end(chunk_end);
58 chunk->set_next(NULL); 58 chunk->set_next(NULL);
59 chunk->set_prev(NULL);
59 chunk->set_word_size(word_size); 60 chunk->set_word_size(word_size);
60 #ifdef ASSERT 61 #ifdef ASSERT
61 size_t data_word_size = pointer_delta(chunk_end, chunk_bottom, sizeof(MetaWord)); 62 size_t data_word_size = pointer_delta(chunk_end, chunk_bottom, sizeof(MetaWord));
62 Copy::fill_to_words((HeapWord*) chunk_bottom, data_word_size, metadata_chunk_initialize); 63 Copy::fill_to_words((HeapWord*) chunk_bottom, data_word_size, metadata_chunk_initialize);
63 #endif 64 #endif
74 } 75 }
75 return result; 76 return result;
76 } 77 }
77 78
78 // _bottom points to the start of the chunk including the overhead. 79 // _bottom points to the start of the chunk including the overhead.
79 size_t Metachunk::used_word_size() { 80 size_t Metachunk::used_word_size() const {
80 return pointer_delta(_top, _bottom, sizeof(MetaWord)); 81 return pointer_delta(_top, _bottom, sizeof(MetaWord));
81 } 82 }
82 83
83 size_t Metachunk::free_word_size() { 84 size_t Metachunk::free_word_size() const {
84 return pointer_delta(_end, _top, sizeof(MetaWord)); 85 return pointer_delta(_end, _top, sizeof(MetaWord));
85 } 86 }
86 87
87 size_t Metachunk::capacity_word_size() { 88 size_t Metachunk::capacity_word_size() const {
88 return pointer_delta(_end, _bottom, sizeof(MetaWord)); 89 return pointer_delta(_end, _bottom, sizeof(MetaWord));
89 } 90 }
90 91
91 void Metachunk::print_on(outputStream* st) const { 92 void Metachunk::print_on(outputStream* st) const {
92 st->print_cr("Metachunk:" 93 st->print_cr("Metachunk:"
93 " bottom " PTR_FORMAT " top " PTR_FORMAT 94 " bottom " PTR_FORMAT " top " PTR_FORMAT
94 " end " PTR_FORMAT " size " SIZE_FORMAT, 95 " end " PTR_FORMAT " size " SIZE_FORMAT,
95 bottom(), top(), end(), word_size()); 96 bottom(), top(), end(), word_size());
97 if (Verbose) {
98 st->print_cr(" used " SIZE_FORMAT " free " SIZE_FORMAT,
99 used_word_size(), free_word_size());
100 }
96 } 101 }
97 102
98 #ifndef PRODUCT 103 #ifndef PRODUCT
99 void Metachunk::mangle() { 104 void Metachunk::mangle() {
100 // Mangle the payload of the chunk and not the links that 105 // Mangle the payload of the chunk and not the links that