changeset 4022:59a58e20dc60

8006537: Assert when dumping archive with default methods Reviewed-by: coleenp
author jmasa
date Thu, 17 Jan 2013 19:04:48 -0800
parents 2dce7c34c564
children f422634e5828
files src/share/vm/classfile/classLoaderData.cpp src/share/vm/memory/metadataFactory.hpp
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/classfile/classLoaderData.cpp	Thu Jan 17 11:39:48 2013 +0100
+++ b/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/src/share/vm/memory/metadataFactory.hpp	Thu Jan 17 11:39:48 2013 +0100
+++ b/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());