hotspot/src/share/vm/memory/metaspaceShared.hpp
changeset 41182 dbd59c1da636
parent 39714 976b97b59d87
child 46324 8764956ec928
--- a/hotspot/src/share/vm/memory/metaspaceShared.hpp	Tue Sep 06 13:01:27 2016 +0200
+++ b/hotspot/src/share/vm/memory/metaspaceShared.hpp	Sun Sep 18 21:10:48 2016 -0400
@@ -132,6 +132,7 @@
   // Used only during dumping.
   static SharedMiscRegion _md;
   static SharedMiscRegion _mc;
+  static SharedMiscRegion _od;
  public:
   enum {
     vtbl_list_size         = DEFAULT_VTBL_LIST_SIZE,
@@ -148,7 +149,10 @@
     max_strings = 2, // max number of string regions in string space
     num_non_strings = 4, // number of non-string regions
     first_string = num_non_strings, // index of first string region
-    n_regions = max_strings + num_non_strings // total number of regions
+    // The optional data region is the last region.
+    // Currently it only contains class file data.
+    od = max_strings + num_non_strings,
+    n_regions = od + 1 // total number of regions
   };
 
   // Accessor functions to save shared space created for metadata, which has
@@ -222,9 +226,10 @@
   static int count_class(const char* classlist_file);
   static void estimate_regions_size() NOT_CDS_RETURN;
 
-  // Allocate a block of memory from the "mc" or "md" regions.
+  // Allocate a block of memory from the "mc", "md", or "od" regions.
   static char* misc_code_space_alloc(size_t num_bytes) {  return _mc.alloc(num_bytes); }
   static char* misc_data_space_alloc(size_t num_bytes) {  return _md.alloc(num_bytes); }
+  static char* optional_data_space_alloc(size_t num_bytes) { return _od.alloc(num_bytes); }
 
   static address cds_i2i_entry_code_buffers(size_t total_size);
 
@@ -243,5 +248,9 @@
     assert(DumpSharedSpaces, "used during dumping only");
     return &_md;
   }
+  static SharedMiscRegion* optional_data_region() {
+    assert(DumpSharedSpaces, "used during dumping only");
+    return &_od;
+  }
 };
 #endif // SHARE_VM_MEMORY_METASPACESHARED_HPP