8006537: Assert when dumping archive with default methods
authorjmasa
Thu, 17 Jan 2013 19:04:48 -0800
changeset 15220 0c348659f626
parent 15219 7820052cb1a1
child 15221 83925f427779
8006537: Assert when dumping archive with default methods Reviewed-by: coleenp
hotspot/src/share/vm/classfile/classLoaderData.cpp
hotspot/src/share/vm/memory/metadataFactory.hpp
--- a/hotspot/src/share/vm/classfile/classLoaderData.cpp	Thu Jan 17 11:39:48 2013 +0100
+++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp	Thu Jan 17 19:04:48 2013 -0800
@@ -318,6 +318,7 @@
 }
 
 Metaspace* ClassLoaderData::metaspace_non_null() {
+  assert(!DumpSharedSpaces, "wrong metaspace!");
   // If the metaspace has not been allocated, create a new one.  Might want
   // to create smaller arena for Reflection class loaders also.
   // The reason for the delayed allocation is because some class loaders are
--- a/hotspot/src/share/vm/memory/metadataFactory.hpp	Thu Jan 17 11:39:48 2013 +0100
+++ b/hotspot/src/share/vm/memory/metadataFactory.hpp	Thu Jan 17 19:04:48 2013 -0800
@@ -66,7 +66,11 @@
     if (data != NULL) {
       assert(loader_data != NULL, "shouldn't pass null");
       int size = data->size();
-      loader_data->metaspace_non_null()->deallocate((MetaWord*)data, size, false);
+      if (DumpSharedSpaces) {
+        loader_data->ro_metaspace()->deallocate((MetaWord*)data, size, false);
+      } else {
+        loader_data->metaspace_non_null()->deallocate((MetaWord*)data, size, false);
+      }
     }
   }
 
@@ -77,6 +81,7 @@
       assert(loader_data != NULL, "shouldn't pass null");
       int size = md->size();
       // Call metadata's deallocate function which will call deallocate fields
+      assert(!DumpSharedSpaces, "cannot deallocate metadata when dumping CDS archive");
       assert(!md->on_stack(), "can't deallocate things on stack");
       md->deallocate_contents(loader_data);
       loader_data->metaspace_non_null()->deallocate((MetaWord*)md, size, md->is_klass());