8199656: Make slow metaspace verifications switchable in debug builds
authorstuefe
Thu, 15 Mar 2018 07:43:07 +0100
changeset 49405 e88237c5ac83
parent 49404 911e32d49f76
child 49406 f654b37c58a1
8199656: Make slow metaspace verifications switchable in debug builds Reviewed-by: dholmes, coleenp
src/hotspot/share/memory/metaspace.cpp
src/hotspot/share/runtime/globals.hpp
--- a/src/hotspot/share/memory/metaspace.cpp	Thu Mar 15 12:44:27 2018 +0100
+++ b/src/hotspot/share/memory/metaspace.cpp	Thu Mar 15 07:43:07 2018 +0100
@@ -55,9 +55,6 @@
 typedef BinaryTreeDictionary<Metablock, FreeList<Metablock> > BlockTreeDictionary;
 typedef BinaryTreeDictionary<Metachunk, FreeList<Metachunk> > ChunkTreeDictionary;
 
-// Set this constant to enable slow integrity checking of the free chunk lists
-const bool metaspace_slow_verify = false;
-
 // Helper function that does a bunch of checks for a chunk.
 DEBUG_ONLY(static void do_verify_chunk(Metachunk* chunk);)
 
@@ -207,13 +204,13 @@
 
   void locked_verify_free_chunks_total();
   void slow_locked_verify_free_chunks_total() {
-    if (metaspace_slow_verify) {
+    if (VerifyMetaspace) {
       locked_verify_free_chunks_total();
     }
   }
   void locked_verify_free_chunks_count();
   void slow_locked_verify_free_chunks_count() {
-    if (metaspace_slow_verify) {
+    if (VerifyMetaspace) {
       locked_verify_free_chunks_count();
     }
   }
@@ -346,13 +343,13 @@
   // Debug support
   void verify();
   void slow_verify() {
-    if (metaspace_slow_verify) {
+    if (VerifyMetaspace) {
       verify();
     }
   }
   void locked_verify();
   void slow_locked_verify() {
-    if (metaspace_slow_verify) {
+    if (VerifyMetaspace) {
       locked_verify();
     }
   }
@@ -1694,7 +1691,7 @@
 
   inc_container_count();
 
-  if (metaspace_slow_verify) {
+  if (VerifyMetaspace) {
     DEBUG_ONLY(chunk_manager->locked_verify());
     DEBUG_ONLY(this->verify());
   }
@@ -1949,7 +1946,7 @@
   // should not affect that count.
 
   // At the end of a chunk merge, run verification tests.
-  if (metaspace_slow_verify) {
+  if (VerifyMetaspace) {
     DEBUG_ONLY(this->locked_verify());
     DEBUG_ONLY(vsn->verify());
   }
@@ -2971,7 +2968,7 @@
 
   // Run some verifications (some more if we did a chunk split)
 #ifdef ASSERT
-  if (metaspace_slow_verify) {
+  if (VerifyMetaspace) {
     locked_verify();
     VirtualSpaceNode* const vsn = chunk->container();
     vsn->verify();
--- a/src/hotspot/share/runtime/globals.hpp	Thu Mar 15 12:44:27 2018 +0100
+++ b/src/hotspot/share/runtime/globals.hpp	Thu Mar 15 07:43:07 2018 +0100
@@ -4057,7 +4057,12 @@
                                                                             \
   product(ccstr, AllocateHeapAt, NULL,                                      \
           "Path to the directoy where a temporary file will be created "    \
-          "to use as the backing store for Java Heap.")
+          "to use as the backing store for Java Heap.")                     \
+                                                                            \
+  develop(bool, VerifyMetaspace, false,                                     \
+          "Verify metaspace on chunk movements.")                           \
+                                                                            \
+
 
 
 /*