8149643: Remove check of counters in VirtualSpaceNode::inc_container_count
authorjmasa
Tue, 16 Feb 2016 13:20:38 -0800
changeset 36177 b2b76aba8e42
parent 36176 fe3a8d7c73e9
child 36178 9739f8c767da
child 36179 03a0d7b8450f
child 36181 3a16e8ce0abf
8149643: Remove check of counters in VirtualSpaceNode::inc_container_count Reviewed-by: brutisso, kbarrett, mgerdin Contributed-by: dmitry.dmitriev@oracle.com
hotspot/src/share/vm/memory/metaspace.cpp
--- a/hotspot/src/share/vm/memory/metaspace.cpp	Wed Feb 17 12:44:41 2016 +0000
+++ b/hotspot/src/share/vm/memory/metaspace.cpp	Tue Feb 16 13:20:38 2016 -0800
@@ -791,7 +791,6 @@
 void VirtualSpaceNode::inc_container_count() {
   assert_lock_strong(SpaceManager::expand_lock());
   _container_count++;
-  DEBUG_ONLY(verify_container_count();)
 }
 
 void VirtualSpaceNode::dec_container_count() {
@@ -1073,6 +1072,7 @@
   VirtualSpaceNode* next_vsl = prev_vsl;
   while (next_vsl != NULL) {
     VirtualSpaceNode* vsl = next_vsl;
+    DEBUG_ONLY(vsl->verify_container_count();)
     next_vsl = vsl->next();
     // Don't free the current virtual space since it will likely
     // be needed soon.
@@ -1137,19 +1137,19 @@
 }
 
 void VirtualSpaceNode::retire(ChunkManager* chunk_manager) {
+  DEBUG_ONLY(verify_container_count();)
   for (int i = (int)MediumIndex; i >= (int)ZeroIndex; --i) {
     ChunkIndex index = (ChunkIndex)i;
     size_t chunk_size = chunk_manager->free_chunks(index)->size();
 
     while (free_words_in_vs() >= chunk_size) {
-      DEBUG_ONLY(verify_container_count();)
       Metachunk* chunk = get_chunk_vs(chunk_size);
       assert(chunk != NULL, "allocation should have been successful");
 
       chunk_manager->return_chunks(index, chunk);
       chunk_manager->inc_free_chunks_total(chunk_size);
-      DEBUG_ONLY(verify_container_count();)
     }
+    DEBUG_ONLY(verify_container_count();)
   }
   assert(free_words_in_vs() == 0, "should be empty now");
 }