< prev index next >

src/hotspot/share/cds/filemap.hpp

Print this page

214   //      validate_shared_path_table()
215   //      validate_non_existent_class_paths()
216   size_t _shared_path_table_offset;
217 
218   jshort _app_class_paths_start_index;  // Index of first app classpath entry
219   jshort _app_module_paths_start_index; // Index of first module path entry
220   jshort _max_used_path_index;          // max path index referenced during CDS dump
221   int    _num_module_paths;             // number of module path entries
222   bool   _verify_local;                 // BytecodeVerificationLocal setting
223   bool   _verify_remote;                // BytecodeVerificationRemote setting
224   bool   _has_platform_or_app_classes;  // Archive contains app classes
225   char*  _requested_base_address;       // Archive relocation is not necessary if we map with this base address.
226   char*  _mapped_base_address;          // Actual base address where archive is mapped.
227 
228   bool   _allow_archiving_with_java_agent; // setting of the AllowArchivingWithJavaAgent option
229   bool   _use_optimized_module_handling;// No module-relation VM options were specified, so we can skip
230                                         // some expensive operations.
231   bool   _has_aot_linked_classes;       // Was the CDS archive created with -XX:+AOTClassLinking
232   bool   _has_full_module_graph;        // Does this CDS archive contain the full archived module graph?
233   bool   _has_archived_invokedynamic;   // Does the archive have aot-linked invokedynamic CP entries?





234   HeapRootSegments _heap_root_segments; // Heap root segments info
235   size_t _heap_oopmap_start_pos;        // The first bit in the oopmap corresponds to this position in the heap.
236   size_t _heap_ptrmap_start_pos;        // The first bit in the ptrmap corresponds to this position in the heap.
237   size_t _rw_ptrmap_start_pos;          // The first bit in the ptrmap corresponds to this position in the rw region
238   size_t _ro_ptrmap_start_pos;          // The first bit in the ptrmap corresponds to this position in the ro region
239   char* from_mapped_offset(size_t offset) const {
240     return mapped_base_address() + offset;
241   }
242   void set_as_offset(char* p, size_t *offset);
243 public:
244   // Accessors -- fields declared in GenericCDSFileMapHeader
245   unsigned int magic()                            const { return _generic_header._magic;                    }
246   int crc()                                       const { return _generic_header._crc;                      }
247   int version()                                   const { return _generic_header._version;                  }
248   unsigned int header_size()                      const { return _generic_header._header_size;              }
249   unsigned int base_archive_name_offset()         const { return _generic_header._base_archive_name_offset; }
250   unsigned int base_archive_name_size()           const { return _generic_header._base_archive_name_size;   }
251   unsigned int common_app_classpath_prefix_size() const { return _common_app_classpath_prefix_size;         }
252 
253   void set_magic(unsigned int m)                            { _generic_header._magic = m;                    }

259   void set_common_app_classpath_prefix_size(unsigned int s) { _common_app_classpath_prefix_size = s;         }
260 
261   bool is_static()                         const { return magic() == CDS_ARCHIVE_MAGIC; }
262   size_t core_region_alignment()           const { return _core_region_alignment; }
263   int obj_alignment()                      const { return _obj_alignment; }
264   address narrow_oop_base()                const { return _narrow_oop_base; }
265   int narrow_oop_shift()                   const { return _narrow_oop_shift; }
266   bool compact_strings()                   const { return _compact_strings; }
267   bool compact_headers()                   const { return _compact_headers; }
268   uintx max_heap_size()                    const { return _max_heap_size; }
269   CompressedOops::Mode narrow_oop_mode()   const { return _narrow_oop_mode; }
270   char* cloned_vtables()                   const { return from_mapped_offset(_cloned_vtables_offset); }
271   char* early_serialized_data()            const { return from_mapped_offset(_early_serialized_data_offset); }
272   char* serialized_data()                  const { return from_mapped_offset(_serialized_data_offset); }
273   const char* jvm_ident()                  const { return _jvm_ident; }
274   char* requested_base_address()           const { return _requested_base_address; }
275   char* mapped_base_address()              const { return _mapped_base_address; }
276   bool has_platform_or_app_classes()       const { return _has_platform_or_app_classes; }
277   bool has_non_jar_in_classpath()          const { return _has_non_jar_in_classpath; }
278   bool has_aot_linked_classes()            const { return _has_aot_linked_classes; }



279   bool compressed_oops()                   const { return _compressed_oops; }
280   bool compressed_class_pointers()         const { return _compressed_class_ptrs; }
281   int narrow_klass_pointer_bits()          const { return _narrow_klass_pointer_bits; }
282   int narrow_klass_shift()                 const { return _narrow_klass_shift; }
283   HeapRootSegments heap_root_segments()    const { return _heap_root_segments; }
284   bool has_full_module_graph()             const { return _has_full_module_graph; }
285   size_t heap_oopmap_start_pos()           const { return _heap_oopmap_start_pos; }
286   size_t heap_ptrmap_start_pos()           const { return _heap_ptrmap_start_pos; }
287   size_t rw_ptrmap_start_pos()             const { return _rw_ptrmap_start_pos; }
288   size_t ro_ptrmap_start_pos()             const { return _ro_ptrmap_start_pos; }
289   // FIXME: These should really return int
290   jshort max_used_path_index()             const { return _max_used_path_index; }
291   jshort app_module_paths_start_index()    const { return _app_module_paths_start_index; }
292   jshort app_class_paths_start_index()     const { return _app_class_paths_start_index; }
293   int    num_module_paths()                const { return _num_module_paths; }
294 
295   void set_has_platform_or_app_classes(bool v)   { _has_platform_or_app_classes = v; }
296   void set_cloned_vtables(char* p)               { set_as_offset(p, &_cloned_vtables_offset); }
297   void set_early_serialized_data(char* p)        { set_as_offset(p, &_early_serialized_data_offset); }
298   void set_serialized_data(char* p)              { set_as_offset(p, &_serialized_data_offset); }

443 
444   static void set_current_info(FileMapInfo* info) {
445     CDS_ONLY(_current_info = info;)
446   }
447 
448   static FileMapInfo* dynamic_info() {
449     CDS_ONLY(return _dynamic_archive_info;)
450     NOT_CDS(return nullptr;)
451   }
452 
453   static void assert_mark(bool check);
454 
455   // File manipulation.
456   bool  initialize() NOT_CDS_RETURN_(false);
457   bool  open_for_read();
458   void  open_for_write();
459   void  write_header();
460   void  write_region(int region, char* base, size_t size,
461                      bool read_only, bool allow_exec);
462   size_t remove_bitmap_zeros(CHeapBitMap* map);
463   char* write_bitmap_region(CHeapBitMap* rw_ptrmap, CHeapBitMap* ro_ptrmap, ArchiveHeapInfo* heap_info,

464                             size_t &size_in_bytes);
465   size_t write_heap_region(ArchiveHeapInfo* heap_info);
466   void  write_bytes(const void* buffer, size_t count);
467   void  write_bytes_aligned(const void* buffer, size_t count);
468   size_t  read_bytes(void* buffer, size_t count);
469   static size_t readonly_total();
470   MapArchiveResult map_regions(int regions[], int num_regions, char* mapped_base_address, ReservedSpace rs);
471   void  unmap_regions(int regions[], int num_regions);
472   void  map_or_load_heap_region() NOT_CDS_JAVA_HEAP_RETURN;
473   void  fixup_mapped_heap_region() NOT_CDS_JAVA_HEAP_RETURN;
474   void  patch_heap_embedded_pointers() NOT_CDS_JAVA_HEAP_RETURN;
475   bool  has_heap_region()  NOT_CDS_JAVA_HEAP_RETURN_(false);
476   MemRegion get_heap_region_requested_range() NOT_CDS_JAVA_HEAP_RETURN_(MemRegion());
477   bool  read_region(int i, char* base, size_t size, bool do_commit);
478   char* map_bitmap_region();

479   void  unmap_region(int i);
480   void  close();
481   bool  is_open() { return _file_open; }
482   ReservedSpace reserve_shared_memory();
483 
484   // JVM/TI RedefineClasses() support:
485   // Remap the shared readonly space to shared readwrite, private.
486   bool  remap_shared_readonly_as_readwrite();
487 
488   static bool memory_mapping_failed() {
489     CDS_ONLY(return _memory_mapping_failed;)
490     NOT_CDS(return false;)
491   }
492 
493   static void allocate_shared_path_table(TRAPS);
494   static int add_shared_classpaths(int i, const char* which, ClassPathEntry *cpe, TRAPS);
495   static void check_nonempty_dir_in_shared_path_table();
496   bool check_module_paths();
497   bool validate_shared_path_table();
498   bool validate_non_existent_class_paths();

563   GrowableArray<const char*>* create_path_array(const char* path) NOT_CDS_RETURN_(nullptr);
564   bool  classpath_failure(const char* msg, const char* name) NOT_CDS_RETURN_(false);
565   unsigned int longest_common_app_classpath_prefix_len(int num_paths,
566                                                        GrowableArray<const char*>* rp_array)
567                                                        NOT_CDS_RETURN_(0);
568   bool  check_paths(int shared_path_start_idx, int num_paths,
569                     GrowableArray<const char*>* rp_array,
570                     unsigned int dumptime_prefix_len,
571                     unsigned int runtime_prefix_len) NOT_CDS_RETURN_(false);
572   void  extract_module_paths(const char* runtime_path, GrowableArray<const char*>* module_paths);
573   bool  validate_boot_class_paths() NOT_CDS_RETURN_(false);
574   bool  validate_app_class_paths(int shared_app_paths_len) NOT_CDS_RETURN_(false);
575   bool  map_heap_region_impl() NOT_CDS_JAVA_HEAP_RETURN_(false);
576   void  dealloc_heap_region() NOT_CDS_JAVA_HEAP_RETURN;
577   bool  can_use_heap_region();
578   bool  load_heap_region() NOT_CDS_JAVA_HEAP_RETURN_(false);
579   bool  map_heap_region() NOT_CDS_JAVA_HEAP_RETURN_(false);
580   void  init_heap_region_relocation();
581   MapArchiveResult map_region(int i, intx addr_delta, char* mapped_base_address, ReservedSpace rs);
582   bool  relocate_pointers_in_core_regions(intx addr_delta);
583 
584   static MemRegion _mapped_heap_memregion;
585 
586 public:
587   address heap_region_dumptime_address() NOT_CDS_JAVA_HEAP_RETURN_(nullptr);
588   address heap_region_requested_address() NOT_CDS_JAVA_HEAP_RETURN_(nullptr);
589   narrowOop encoded_heap_region_dumptime_address();
590 
591 private:
592 
593 #if INCLUDE_JVMTI
594   static ClassPathEntry** _classpath_entries_for_jvmti;
595   static ClassPathEntry* get_classpath_entry_for_jvmti(int i, TRAPS);
596 #endif
597 };
598 
599 #endif // SHARE_CDS_FILEMAP_HPP

214   //      validate_shared_path_table()
215   //      validate_non_existent_class_paths()
216   size_t _shared_path_table_offset;
217 
218   jshort _app_class_paths_start_index;  // Index of first app classpath entry
219   jshort _app_module_paths_start_index; // Index of first module path entry
220   jshort _max_used_path_index;          // max path index referenced during CDS dump
221   int    _num_module_paths;             // number of module path entries
222   bool   _verify_local;                 // BytecodeVerificationLocal setting
223   bool   _verify_remote;                // BytecodeVerificationRemote setting
224   bool   _has_platform_or_app_classes;  // Archive contains app classes
225   char*  _requested_base_address;       // Archive relocation is not necessary if we map with this base address.
226   char*  _mapped_base_address;          // Actual base address where archive is mapped.
227 
228   bool   _allow_archiving_with_java_agent; // setting of the AllowArchivingWithJavaAgent option
229   bool   _use_optimized_module_handling;// No module-relation VM options were specified, so we can skip
230                                         // some expensive operations.
231   bool   _has_aot_linked_classes;       // Was the CDS archive created with -XX:+AOTClassLinking
232   bool   _has_full_module_graph;        // Does this CDS archive contain the full archived module graph?
233   bool   _has_archived_invokedynamic;   // Does the archive have aot-linked invokedynamic CP entries?
234   bool   _has_archived_packages;
235   bool   _has_archived_protection_domains;
236   int    _gc_kind;                      // Universe::heap()->kind();
237   char   _gc_name[32];                  // Universe::heap()->name();
238   size_t _ptrmap_size_in_bits;          // Size of pointer relocation bitmap
239   HeapRootSegments _heap_root_segments; // Heap root segments info
240   size_t _heap_oopmap_start_pos;        // The first bit in the oopmap corresponds to this position in the heap.
241   size_t _heap_ptrmap_start_pos;        // The first bit in the ptrmap corresponds to this position in the heap.
242   size_t _rw_ptrmap_start_pos;          // The first bit in the ptrmap corresponds to this position in the rw region
243   size_t _ro_ptrmap_start_pos;          // The first bit in the ptrmap corresponds to this position in the ro region
244   char* from_mapped_offset(size_t offset) const {
245     return mapped_base_address() + offset;
246   }
247   void set_as_offset(char* p, size_t *offset);
248 public:
249   // Accessors -- fields declared in GenericCDSFileMapHeader
250   unsigned int magic()                            const { return _generic_header._magic;                    }
251   int crc()                                       const { return _generic_header._crc;                      }
252   int version()                                   const { return _generic_header._version;                  }
253   unsigned int header_size()                      const { return _generic_header._header_size;              }
254   unsigned int base_archive_name_offset()         const { return _generic_header._base_archive_name_offset; }
255   unsigned int base_archive_name_size()           const { return _generic_header._base_archive_name_size;   }
256   unsigned int common_app_classpath_prefix_size() const { return _common_app_classpath_prefix_size;         }
257 
258   void set_magic(unsigned int m)                            { _generic_header._magic = m;                    }

264   void set_common_app_classpath_prefix_size(unsigned int s) { _common_app_classpath_prefix_size = s;         }
265 
266   bool is_static()                         const { return magic() == CDS_ARCHIVE_MAGIC; }
267   size_t core_region_alignment()           const { return _core_region_alignment; }
268   int obj_alignment()                      const { return _obj_alignment; }
269   address narrow_oop_base()                const { return _narrow_oop_base; }
270   int narrow_oop_shift()                   const { return _narrow_oop_shift; }
271   bool compact_strings()                   const { return _compact_strings; }
272   bool compact_headers()                   const { return _compact_headers; }
273   uintx max_heap_size()                    const { return _max_heap_size; }
274   CompressedOops::Mode narrow_oop_mode()   const { return _narrow_oop_mode; }
275   char* cloned_vtables()                   const { return from_mapped_offset(_cloned_vtables_offset); }
276   char* early_serialized_data()            const { return from_mapped_offset(_early_serialized_data_offset); }
277   char* serialized_data()                  const { return from_mapped_offset(_serialized_data_offset); }
278   const char* jvm_ident()                  const { return _jvm_ident; }
279   char* requested_base_address()           const { return _requested_base_address; }
280   char* mapped_base_address()              const { return _mapped_base_address; }
281   bool has_platform_or_app_classes()       const { return _has_platform_or_app_classes; }
282   bool has_non_jar_in_classpath()          const { return _has_non_jar_in_classpath; }
283   bool has_aot_linked_classes()            const { return _has_aot_linked_classes; }
284   int gc_kind()                            const { return _gc_kind; }
285   const char* gc_name()                    const { return _gc_name; }
286   size_t ptrmap_size_in_bits()             const { return _ptrmap_size_in_bits; }
287   bool compressed_oops()                   const { return _compressed_oops; }
288   bool compressed_class_pointers()         const { return _compressed_class_ptrs; }
289   int narrow_klass_pointer_bits()          const { return _narrow_klass_pointer_bits; }
290   int narrow_klass_shift()                 const { return _narrow_klass_shift; }
291   HeapRootSegments heap_root_segments()    const { return _heap_root_segments; }
292   bool has_full_module_graph()             const { return _has_full_module_graph; }
293   size_t heap_oopmap_start_pos()           const { return _heap_oopmap_start_pos; }
294   size_t heap_ptrmap_start_pos()           const { return _heap_ptrmap_start_pos; }
295   size_t rw_ptrmap_start_pos()             const { return _rw_ptrmap_start_pos; }
296   size_t ro_ptrmap_start_pos()             const { return _ro_ptrmap_start_pos; }
297   // FIXME: These should really return int
298   jshort max_used_path_index()             const { return _max_used_path_index; }
299   jshort app_module_paths_start_index()    const { return _app_module_paths_start_index; }
300   jshort app_class_paths_start_index()     const { return _app_class_paths_start_index; }
301   int    num_module_paths()                const { return _num_module_paths; }
302 
303   void set_has_platform_or_app_classes(bool v)   { _has_platform_or_app_classes = v; }
304   void set_cloned_vtables(char* p)               { set_as_offset(p, &_cloned_vtables_offset); }
305   void set_early_serialized_data(char* p)        { set_as_offset(p, &_early_serialized_data_offset); }
306   void set_serialized_data(char* p)              { set_as_offset(p, &_serialized_data_offset); }

451 
452   static void set_current_info(FileMapInfo* info) {
453     CDS_ONLY(_current_info = info;)
454   }
455 
456   static FileMapInfo* dynamic_info() {
457     CDS_ONLY(return _dynamic_archive_info;)
458     NOT_CDS(return nullptr;)
459   }
460 
461   static void assert_mark(bool check);
462 
463   // File manipulation.
464   bool  initialize() NOT_CDS_RETURN_(false);
465   bool  open_for_read();
466   void  open_for_write();
467   void  write_header();
468   void  write_region(int region, char* base, size_t size,
469                      bool read_only, bool allow_exec);
470   size_t remove_bitmap_zeros(CHeapBitMap* map);
471   char* write_bitmap_region(CHeapBitMap* rw_ptrmap, CHeapBitMap* ro_ptrmap,
472                             CHeapBitMap* cc_ptrmap, ArchiveHeapInfo* heap_info,
473                             size_t &size_in_bytes);
474   size_t write_heap_region(ArchiveHeapInfo* heap_info);
475   void  write_bytes(const void* buffer, size_t count);
476   void  write_bytes_aligned(const void* buffer, size_t count);
477   size_t  read_bytes(void* buffer, size_t count);
478   static size_t readonly_total();
479   MapArchiveResult map_regions(int regions[], int num_regions, char* mapped_base_address, ReservedSpace rs);
480   void  unmap_regions(int regions[], int num_regions);
481   void  map_or_load_heap_region() NOT_CDS_JAVA_HEAP_RETURN;
482   void  fixup_mapped_heap_region() NOT_CDS_JAVA_HEAP_RETURN;
483   void  patch_heap_embedded_pointers() NOT_CDS_JAVA_HEAP_RETURN;
484   bool  has_heap_region()  NOT_CDS_JAVA_HEAP_RETURN_(false);
485   MemRegion get_heap_region_requested_range() NOT_CDS_JAVA_HEAP_RETURN_(MemRegion());
486   bool  read_region(int i, char* base, size_t size, bool do_commit);
487   char* map_bitmap_region();
488   bool map_cached_code_region(ReservedSpace rs);
489   void  unmap_region(int i);
490   void  close();
491   bool  is_open() { return _file_open; }
492   ReservedSpace reserve_shared_memory();
493 
494   // JVM/TI RedefineClasses() support:
495   // Remap the shared readonly space to shared readwrite, private.
496   bool  remap_shared_readonly_as_readwrite();
497 
498   static bool memory_mapping_failed() {
499     CDS_ONLY(return _memory_mapping_failed;)
500     NOT_CDS(return false;)
501   }
502 
503   static void allocate_shared_path_table(TRAPS);
504   static int add_shared_classpaths(int i, const char* which, ClassPathEntry *cpe, TRAPS);
505   static void check_nonempty_dir_in_shared_path_table();
506   bool check_module_paths();
507   bool validate_shared_path_table();
508   bool validate_non_existent_class_paths();

573   GrowableArray<const char*>* create_path_array(const char* path) NOT_CDS_RETURN_(nullptr);
574   bool  classpath_failure(const char* msg, const char* name) NOT_CDS_RETURN_(false);
575   unsigned int longest_common_app_classpath_prefix_len(int num_paths,
576                                                        GrowableArray<const char*>* rp_array)
577                                                        NOT_CDS_RETURN_(0);
578   bool  check_paths(int shared_path_start_idx, int num_paths,
579                     GrowableArray<const char*>* rp_array,
580                     unsigned int dumptime_prefix_len,
581                     unsigned int runtime_prefix_len) NOT_CDS_RETURN_(false);
582   void  extract_module_paths(const char* runtime_path, GrowableArray<const char*>* module_paths);
583   bool  validate_boot_class_paths() NOT_CDS_RETURN_(false);
584   bool  validate_app_class_paths(int shared_app_paths_len) NOT_CDS_RETURN_(false);
585   bool  map_heap_region_impl() NOT_CDS_JAVA_HEAP_RETURN_(false);
586   void  dealloc_heap_region() NOT_CDS_JAVA_HEAP_RETURN;
587   bool  can_use_heap_region();
588   bool  load_heap_region() NOT_CDS_JAVA_HEAP_RETURN_(false);
589   bool  map_heap_region() NOT_CDS_JAVA_HEAP_RETURN_(false);
590   void  init_heap_region_relocation();
591   MapArchiveResult map_region(int i, intx addr_delta, char* mapped_base_address, ReservedSpace rs);
592   bool  relocate_pointers_in_core_regions(intx addr_delta);
593   void  relocate_pointers_in_cached_code_region();
594   static MemRegion _mapped_heap_memregion;
595 
596 public:
597   address heap_region_dumptime_address() NOT_CDS_JAVA_HEAP_RETURN_(nullptr);
598   address heap_region_requested_address() NOT_CDS_JAVA_HEAP_RETURN_(nullptr);
599   narrowOop encoded_heap_region_dumptime_address();
600 
601 private:
602 
603 #if INCLUDE_JVMTI
604   static ClassPathEntry** _classpath_entries_for_jvmti;
605   static ClassPathEntry* get_classpath_entry_for_jvmti(int i, TRAPS);
606 #endif
607 };
608 
609 #endif // SHARE_CDS_FILEMAP_HPP
< prev index next >