8231278: Rename FileMapHeader::_read_only_tables_start to _serialized_data_start
authoriklam
Mon, 23 Sep 2019 19:55:26 -0700
changeset 58278 e47b459b315c
parent 58277 00a98f0aa1b3
child 58279 448fe2bfd505
8231278: Rename FileMapHeader::_read_only_tables_start to _serialized_data_start Reviewed-by: ccheung
src/hotspot/share/memory/dynamicArchive.cpp
src/hotspot/share/memory/filemap.hpp
src/hotspot/share/memory/metaspaceShared.cpp
--- a/src/hotspot/share/memory/dynamicArchive.cpp	Mon Sep 23 19:54:37 2019 -0700
+++ b/src/hotspot/share/memory/dynamicArchive.cpp	Mon Sep 23 19:55:26 2019 -0700
@@ -470,7 +470,7 @@
   void sort_methods(InstanceKlass* ik) const;
   void set_symbols_permanent();
   void relocate_buffer_to_target();
-  void write_archive(char* read_only_tables_start);
+  void write_archive(char* serialized_data_start);
   void write_regions(FileMapInfo* dynamic_info);
 
   void init_first_dump_space(address reserved_bottom) {
@@ -596,7 +596,7 @@
 
     verify_estimate_size(_estimated_metsapceobj_bytes, "MetaspaceObjs");
 
-    char* read_only_tables_start;
+    char* serialized_data_start;
     {
       set_symbols_permanent();
 
@@ -609,7 +609,7 @@
       SymbolTable::write_to_archive(false);
       SystemDictionaryShared::write_to_archive(false);
 
-      read_only_tables_start = ro_space->top();
+      serialized_data_start = ro_space->top();
       WriteClosure wc(ro_space);
       SymbolTable::serialize_shared_table_header(&wc, false);
       SystemDictionaryShared::serialize_dictionary_headers(&wc, false);
@@ -635,7 +635,7 @@
       relocate_buffer_to_target();
     }
 
-    write_archive(read_only_tables_start);
+    write_archive(serialized_data_start);
 
     assert(_num_dump_regions_used == _total_dump_regions, "must be");
     verify_universe("After CDS dynamic dump");
@@ -927,11 +927,11 @@
                              /*read_only=*/false,/*allow_exec=*/true);
 }
 
-void DynamicArchiveBuilder::write_archive(char* read_only_tables_start) {
+void DynamicArchiveBuilder::write_archive(char* serialized_data_start) {
   int num_klasses = _klasses->length();
   int num_symbols = _symbols->length();
 
-  _header->set_read_only_tables_start(to_target(read_only_tables_start));
+  _header->set_serialized_data_start(to_target(serialized_data_start));
 
   FileMapInfo* dynamic_info = FileMapInfo::dynamic_info();
   assert(dynamic_info != NULL, "Sanity");
@@ -1102,7 +1102,7 @@
     return NULL;
   }
 
-  intptr_t* buffer = (intptr_t*)_dynamic_header->read_only_tables_start();
+  intptr_t* buffer = (intptr_t*)_dynamic_header->serialized_data_start();
   ReadClosure rc(&buffer);
   SymbolTable::serialize_shared_table_header(&rc, false);
   SystemDictionaryShared::serialize_dictionary_headers(&rc, false);
--- a/src/hotspot/share/memory/filemap.hpp	Mon Sep 23 19:54:37 2019 -0700
+++ b/src/hotspot/share/memory/filemap.hpp	Mon Sep 23 19:55:26 2019 -0700
@@ -179,10 +179,8 @@
   CompressedOops::Mode _narrow_oop_mode; // compressed oop encoding mode
   int     _narrow_klass_shift;      // save narrow klass base and shift
   address _narrow_klass_base;
-
-
   char*   _misc_data_patching_start;
-  char*   _read_only_tables_start;
+  char*   _serialized_data_start;  // Data accessed using {ReadClosure,WriteClosure}::serialize()
   address _i2i_entry_code_buffers;
   size_t  _i2i_entry_code_buffers_size;
   size_t  _core_spaces_size;        // number of bytes allocated by the core spaces
@@ -238,7 +236,7 @@
   int narrow_klass_shift()                 const { return _narrow_klass_shift; }
   address narrow_klass_base()              const { return _narrow_klass_base; }
   char* misc_data_patching_start()         const { return _misc_data_patching_start; }
-  char* read_only_tables_start()           const { return _read_only_tables_start; }
+  char* serialized_data_start()            const { return _serialized_data_start; }
   address i2i_entry_code_buffers()         const { return _i2i_entry_code_buffers; }
   size_t i2i_entry_code_buffers_size()     const { return _i2i_entry_code_buffers_size; }
   size_t core_spaces_size()                const { return _core_spaces_size; }
@@ -259,7 +257,7 @@
   void set_core_spaces_size(size_t s)            { _core_spaces_size = s; }
   void set_has_platform_or_app_classes(bool v)   { _has_platform_or_app_classes = v; }
   void set_misc_data_patching_start(char* p)     { _misc_data_patching_start = p; }
-  void set_read_only_tables_start(char* p)       { _read_only_tables_start   = p; }
+  void set_serialized_data_start(char* p)        { _serialized_data_start   = p; }
   void set_base_archive_name_size(size_t s)      { _base_archive_name_size = s; }
   void set_base_archive_is_default(bool b)       { _base_archive_is_default = b; }
   void set_header_size(size_t s)                 { _header_size = s; }
@@ -360,8 +358,8 @@
 
   char* misc_data_patching_start()            const { return header()->misc_data_patching_start(); }
   void  set_misc_data_patching_start(char* p) const { header()->set_misc_data_patching_start(p); }
-  char* read_only_tables_start()              const { return header()->read_only_tables_start(); }
-  void  set_read_only_tables_start(char* p)   const { header()->set_read_only_tables_start(p); }
+  char* serialized_data_start()               const { return header()->serialized_data_start(); }
+  void  set_serialized_data_start(char* p)    const { header()->set_serialized_data_start(p); }
 
   bool  is_file_position_aligned() const;
   void  align_file_position();
--- a/src/hotspot/share/memory/metaspaceShared.cpp	Mon Sep 23 19:54:37 2019 -0700
+++ b/src/hotspot/share/memory/metaspaceShared.cpp	Mon Sep 23 19:55:26 2019 -0700
@@ -1427,12 +1427,11 @@
 
   SystemDictionaryShared::write_to_archive();
 
-  char* start = _ro_region.top();
-
   size_t vtptrs_bytes = _num_cloned_vtable_kinds * sizeof(intptr_t*);
   _cloned_cpp_vtptrs = (intptr_t**)_ro_region.allocate(vtptrs_bytes, sizeof(intptr_t*));
 
   // Write the other data to the output array.
+  char* start = _ro_region.top();
   WriteClosure wc(&_ro_region);
   MetaspaceShared::serialize(&wc);
 
@@ -1515,7 +1514,7 @@
 
   ArchiveCompactor::relocate_well_known_klasses();
 
-  char* read_only_tables_start = dump_read_only_tables();
+  char* serialized_data_start = dump_read_only_tables();
   _ro_region.pack(&_md_region);
 
   char* vtbl_list = _md_region.top();
@@ -1540,7 +1539,7 @@
 
   FileMapInfo* mapinfo = new FileMapInfo(true);
   mapinfo->populate_header(os::vm_allocation_granularity());
-  mapinfo->set_read_only_tables_start(read_only_tables_start);
+  mapinfo->set_serialized_data_start(serialized_data_start);
   mapinfo->set_misc_data_patching_start(vtbl_list);
   mapinfo->set_i2i_entry_code_buffers(MetaspaceShared::i2i_entry_code_buffers(),
                                       MetaspaceShared::i2i_entry_code_buffers_size());
@@ -2033,14 +2032,9 @@
   char* buffer = mapinfo->misc_data_patching_start();
   clone_cpp_vtables((intptr_t*)buffer);
 
-  // The rest of the data is now stored in the RW region
-  buffer = mapinfo->read_only_tables_start();
-
-  // Skip over _cloned_cpp_vtptrs;
-  buffer += _num_cloned_vtable_kinds * sizeof(intptr_t*);
-
   // Verify various attributes of the archive, plus initialize the
   // shared string/symbol tables
+  buffer = mapinfo->serialized_data_start();
   intptr_t* array = (intptr_t*)buffer;
   ReadClosure rc(&array);
   serialize(&rc);