hotspot/src/share/vm/memory/binaryTreeDictionary.cpp
changeset 14581 8427edf5a77b
parent 14475 4c094dfbbb99
child 15086 2bfd799e9147
equal deleted inserted replaced
14580:3e2316663327 14581:8427edf5a77b
   288 void TreeList<Chunk_t, FreeList_t>::return_chunk_at_tail(TreeChunk<Chunk_t, FreeList_t>* chunk) {
   288 void TreeList<Chunk_t, FreeList_t>::return_chunk_at_tail(TreeChunk<Chunk_t, FreeList_t>* chunk) {
   289   assert(chunk != NULL, "returning NULL chunk");
   289   assert(chunk != NULL, "returning NULL chunk");
   290   assert(chunk->list() == this, "list should be set for chunk");
   290   assert(chunk->list() == this, "list should be set for chunk");
   291   assert(tail() != NULL, "The tree list is embedded in the first chunk");
   291   assert(tail() != NULL, "The tree list is embedded in the first chunk");
   292   // which means that the list can never be empty.
   292   // which means that the list can never be empty.
   293   assert(!verify_chunk_in_free_list(chunk), "Double entry");
   293   assert(!this->verify_chunk_in_free_list(chunk), "Double entry");
   294   assert(head() == NULL || head()->prev() == NULL, "list invariant");
   294   assert(head() == NULL || head()->prev() == NULL, "list invariant");
   295   assert(tail() == NULL || tail()->next() == NULL, "list invariant");
   295   assert(tail() == NULL || tail()->next() == NULL, "list invariant");
   296 
   296 
   297   Chunk_t* fc = tail();
   297   Chunk_t* fc = tail();
   298   fc->link_after(chunk);
   298   fc->link_after(chunk);
   299   this->link_tail(chunk);
   299   this->link_tail(chunk);
   300 
   300 
   301   assert(!tail() || size() == tail()->size(), "Wrong sized chunk in list");
   301   assert(!tail() || size() == tail()->size(), "Wrong sized chunk in list");
   302   FreeList_t<Chunk_t>::increment_count();
   302   FreeList_t<Chunk_t>::increment_count();
   303   debug_only(increment_returned_bytes_by(chunk->size()*sizeof(HeapWord));)
   303   debug_only(this->increment_returned_bytes_by(chunk->size()*sizeof(HeapWord));)
   304   assert(head() == NULL || head()->prev() == NULL, "list invariant");
   304   assert(head() == NULL || head()->prev() == NULL, "list invariant");
   305   assert(tail() == NULL || tail()->next() == NULL, "list invariant");
   305   assert(tail() == NULL || tail()->next() == NULL, "list invariant");
   306 }
   306 }
   307 
   307 
   308 // Add this chunk at the head of the list.  "At the head of the list"
   308 // Add this chunk at the head of the list.  "At the head of the list"
   312 template <class Chunk_t, template <class> class FreeList_t>
   312 template <class Chunk_t, template <class> class FreeList_t>
   313 void TreeList<Chunk_t, FreeList_t>::return_chunk_at_head(TreeChunk<Chunk_t, FreeList_t>* chunk) {
   313 void TreeList<Chunk_t, FreeList_t>::return_chunk_at_head(TreeChunk<Chunk_t, FreeList_t>* chunk) {
   314   assert(chunk->list() == this, "list should be set for chunk");
   314   assert(chunk->list() == this, "list should be set for chunk");
   315   assert(head() != NULL, "The tree list is embedded in the first chunk");
   315   assert(head() != NULL, "The tree list is embedded in the first chunk");
   316   assert(chunk != NULL, "returning NULL chunk");
   316   assert(chunk != NULL, "returning NULL chunk");
   317   assert(!verify_chunk_in_free_list(chunk), "Double entry");
   317   assert(!this->verify_chunk_in_free_list(chunk), "Double entry");
   318   assert(head() == NULL || head()->prev() == NULL, "list invariant");
   318   assert(head() == NULL || head()->prev() == NULL, "list invariant");
   319   assert(tail() == NULL || tail()->next() == NULL, "list invariant");
   319   assert(tail() == NULL || tail()->next() == NULL, "list invariant");
   320 
   320 
   321   Chunk_t* fc = head()->next();
   321   Chunk_t* fc = head()->next();
   322   if (fc != NULL) {
   322   if (fc != NULL) {
   326     this->link_tail(chunk);
   326     this->link_tail(chunk);
   327   }
   327   }
   328   head()->link_after(chunk);
   328   head()->link_after(chunk);
   329   assert(!head() || size() == head()->size(), "Wrong sized chunk in list");
   329   assert(!head() || size() == head()->size(), "Wrong sized chunk in list");
   330   FreeList_t<Chunk_t>::increment_count();
   330   FreeList_t<Chunk_t>::increment_count();
   331   debug_only(increment_returned_bytes_by(chunk->size()*sizeof(HeapWord));)
   331   debug_only(this->increment_returned_bytes_by(chunk->size()*sizeof(HeapWord));)
   332   assert(head() == NULL || head()->prev() == NULL, "list invariant");
   332   assert(head() == NULL || head()->prev() == NULL, "list invariant");
   333   assert(tail() == NULL || tail()->next() == NULL, "list invariant");
   333   assert(tail() == NULL || tail()->next() == NULL, "list invariant");
   334 }
   334 }
   335 
   335 
   336 template <class Chunk_t, template <class> class FreeList_t>
   336 template <class Chunk_t, template <class> class FreeList_t>