< prev index next >

src/hotspot/share/memory/metachunk.cpp

Print this page
rev 50036 : imported patch 8202634-simplify-spacemanager


  90   st->print_cr("Metachunk:"
  91                " bottom " PTR_FORMAT " top " PTR_FORMAT
  92                " end " PTR_FORMAT " size " SIZE_FORMAT " (%s)",
  93                p2i(bottom()), p2i(_top), p2i(end()), word_size(),
  94                chunk_size_name(get_chunk_type()));
  95   if (Verbose) {
  96     st->print_cr("    used " SIZE_FORMAT " free " SIZE_FORMAT,
  97                  used_word_size(), free_word_size());
  98   }
  99 }
 100 
 101 #ifdef ASSERT
 102 void Metachunk::mangle(juint word_value) {
 103   // Overwrite the payload of the chunk and not the links that
 104   // maintain list of chunks.
 105   HeapWord* start = (HeapWord*)initial_top();
 106   size_t size = word_size() - overhead();
 107   Copy::fill_to_words(start, size, word_value);
 108 }
 109 
 110 void Metachunk::verify() {
 111   assert(is_valid_sentinel(), "Chunk " PTR_FORMAT ": sentinel invalid", p2i(this));
 112   const ChunkIndex chunk_type = get_chunk_type();
 113   assert(is_valid_chunktype(chunk_type), "Chunk " PTR_FORMAT ": Invalid chunk type.", p2i(this));
 114   if (chunk_type != HumongousIndex) {
 115     assert(word_size() == get_size_for_nonhumongous_chunktype(chunk_type, is_class()),
 116            "Chunk " PTR_FORMAT ": wordsize " SIZE_FORMAT " does not fit chunk type %s.",
 117            p2i(this), word_size(), chunk_size_name(chunk_type));
 118   }
 119   assert(is_valid_chunkorigin(get_origin()), "Chunk " PTR_FORMAT ": Invalid chunk origin.", p2i(this));
 120   assert(bottom() <= _top && _top <= (MetaWord*)end(),
 121          "Chunk " PTR_FORMAT ": Chunk top out of chunk bounds.", p2i(this));
 122 
 123   // For non-humongous chunks, starting address shall be aligned
 124   // to its chunk size. Humongous chunks start address is
 125   // aligned to specialized chunk size.
 126   const size_t required_alignment =
 127     (chunk_type != HumongousIndex ? word_size() : get_size_for_nonhumongous_chunktype(SpecializedIndex, is_class())) * sizeof(MetaWord);
 128   assert(is_aligned((address)this, required_alignment),
 129          "Chunk " PTR_FORMAT ": (size " SIZE_FORMAT ") not aligned to " SIZE_FORMAT ".",
 130          p2i(this), word_size() * sizeof(MetaWord), required_alignment);


  90   st->print_cr("Metachunk:"
  91                " bottom " PTR_FORMAT " top " PTR_FORMAT
  92                " end " PTR_FORMAT " size " SIZE_FORMAT " (%s)",
  93                p2i(bottom()), p2i(_top), p2i(end()), word_size(),
  94                chunk_size_name(get_chunk_type()));
  95   if (Verbose) {
  96     st->print_cr("    used " SIZE_FORMAT " free " SIZE_FORMAT,
  97                  used_word_size(), free_word_size());
  98   }
  99 }
 100 
 101 #ifdef ASSERT
 102 void Metachunk::mangle(juint word_value) {
 103   // Overwrite the payload of the chunk and not the links that
 104   // maintain list of chunks.
 105   HeapWord* start = (HeapWord*)initial_top();
 106   size_t size = word_size() - overhead();
 107   Copy::fill_to_words(start, size, word_value);
 108 }
 109 
 110 void Metachunk::verify() const {
 111   assert(is_valid_sentinel(), "Chunk " PTR_FORMAT ": sentinel invalid", p2i(this));
 112   const ChunkIndex chunk_type = get_chunk_type();
 113   assert(is_valid_chunktype(chunk_type), "Chunk " PTR_FORMAT ": Invalid chunk type.", p2i(this));
 114   if (chunk_type != HumongousIndex) {
 115     assert(word_size() == get_size_for_nonhumongous_chunktype(chunk_type, is_class()),
 116            "Chunk " PTR_FORMAT ": wordsize " SIZE_FORMAT " does not fit chunk type %s.",
 117            p2i(this), word_size(), chunk_size_name(chunk_type));
 118   }
 119   assert(is_valid_chunkorigin(get_origin()), "Chunk " PTR_FORMAT ": Invalid chunk origin.", p2i(this));
 120   assert(bottom() <= _top && _top <= (MetaWord*)end(),
 121          "Chunk " PTR_FORMAT ": Chunk top out of chunk bounds.", p2i(this));
 122 
 123   // For non-humongous chunks, starting address shall be aligned
 124   // to its chunk size. Humongous chunks start address is
 125   // aligned to specialized chunk size.
 126   const size_t required_alignment =
 127     (chunk_type != HumongousIndex ? word_size() : get_size_for_nonhumongous_chunktype(SpecializedIndex, is_class())) * sizeof(MetaWord);
 128   assert(is_aligned((address)this, required_alignment),
 129          "Chunk " PTR_FORMAT ": (size " SIZE_FORMAT ") not aligned to " SIZE_FORMAT ".",
 130          p2i(this), word_size() * sizeof(MetaWord), required_alignment);
< prev index next >