< prev index next >

src/hotspot/share/cds/filemap.hpp

Print this page

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





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

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

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

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

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

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

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

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

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