< prev index next >

src/hotspot/share/cds/filemap.hpp

Print this page

123   size_t  _serialized_data_offset;                // Data accessed using {ReadClosure,WriteClosure}::serialize()
124 
125   // The following fields are all sanity checks for whether this archive
126   // will function correctly with this JVM and the bootclasspath it's
127   // invoked with.
128   char  _jvm_ident[JVM_IDENT_MAX];  // identifier string of the jvm that created this dump
129 
130   size_t _class_location_config_offset;
131 
132   bool   _verify_local;                 // BytecodeVerificationLocal setting
133   bool   _verify_remote;                // BytecodeVerificationRemote setting
134   bool   _has_platform_or_app_classes;  // Archive contains app or platform classes
135   char*  _requested_base_address;       // Archive relocation is not necessary if we map with this base address.
136   char*  _mapped_base_address;          // Actual base address where archive is mapped.
137 
138   bool   _allow_archiving_with_java_agent; // setting of the AllowArchivingWithJavaAgent option
139   bool   _use_optimized_module_handling;// No module-relation VM options were specified, so we can skip
140                                         // some expensive operations.
141   bool   _has_aot_linked_classes;       // Was the CDS archive created with -XX:+AOTClassLinking
142   bool   _has_full_module_graph;        // Does this CDS archive contain the full archived module graph?





143   HeapRootSegments _heap_root_segments; // Heap root segments info
144   size_t _heap_oopmap_start_pos;        // The first bit in the oopmap corresponds to this position in the heap.
145   size_t _heap_ptrmap_start_pos;        // The first bit in the ptrmap corresponds to this position in the heap.
146   size_t _rw_ptrmap_start_pos;          // The first bit in the ptrmap corresponds to this position in the rw region
147   size_t _ro_ptrmap_start_pos;          // The first bit in the ptrmap corresponds to this position in the ro region
148 
149   // The following are parameters that affect MethodData layout.
150   u1      _compiler_type;
151   uint    _type_profile_level;
152   int     _type_profile_args_limit;
153   int     _type_profile_parms_limit;
154   intx    _type_profile_width;
155   intx    _bci_profile_width;
156   bool    _profile_traps;
157   bool    _type_profile_casts;
158   int     _spec_trap_limit_extra_entries;
159 
160   template <typename T> T from_mapped_offset(size_t offset) const {
161     return (T)(mapped_base_address() + offset);
162   }

181   void set_base_archive_name_offset(unsigned int s)         { _generic_header._base_archive_name_offset = s; }
182   void set_base_archive_name_size(unsigned int s)           { _generic_header._base_archive_name_size = s;   }
183 
184   bool is_static()                         const { return magic() == CDS_ARCHIVE_MAGIC; }
185   size_t core_region_alignment()           const { return _core_region_alignment; }
186   int obj_alignment()                      const { return _obj_alignment; }
187   address narrow_oop_base()                const { return _narrow_oop_base; }
188   int narrow_oop_shift()                   const { return _narrow_oop_shift; }
189   bool compact_strings()                   const { return _compact_strings; }
190   bool compact_headers()                   const { return _compact_headers; }
191   uintx max_heap_size()                    const { return _max_heap_size; }
192   CompressedOops::Mode narrow_oop_mode()   const { return _narrow_oop_mode; }
193   char* cloned_vtables()                   const { return from_mapped_offset<char*>(_cloned_vtables_offset); }
194   char* early_serialized_data()            const { return from_mapped_offset<char*>(_early_serialized_data_offset); }
195   char* serialized_data()                  const { return from_mapped_offset<char*>(_serialized_data_offset); }
196   const char* jvm_ident()                  const { return _jvm_ident; }
197   char* requested_base_address()           const { return _requested_base_address; }
198   char* mapped_base_address()              const { return _mapped_base_address; }
199   bool has_platform_or_app_classes()       const { return _has_platform_or_app_classes; }
200   bool has_aot_linked_classes()            const { return _has_aot_linked_classes; }



201   bool compressed_oops()                   const { return _compressed_oops; }
202   bool compressed_class_pointers()         const { return _compressed_class_ptrs; }
203   int narrow_klass_pointer_bits()          const { return _narrow_klass_pointer_bits; }
204   int narrow_klass_shift()                 const { return _narrow_klass_shift; }
205   HeapRootSegments heap_root_segments()    const { return _heap_root_segments; }
206   bool has_full_module_graph()             const { return _has_full_module_graph; }
207   size_t heap_oopmap_start_pos()           const { return _heap_oopmap_start_pos; }
208   size_t heap_ptrmap_start_pos()           const { return _heap_ptrmap_start_pos; }
209   size_t rw_ptrmap_start_pos()             const { return _rw_ptrmap_start_pos; }
210   size_t ro_ptrmap_start_pos()             const { return _ro_ptrmap_start_pos; }
211 
212   void set_has_platform_or_app_classes(bool v)   { _has_platform_or_app_classes = v; }
213   void set_cloned_vtables(char* p)               { set_as_offset(p, &_cloned_vtables_offset); }
214   void set_early_serialized_data(char* p)        { set_as_offset(p, &_early_serialized_data_offset); }
215   void set_serialized_data(char* p)              { set_as_offset(p, &_serialized_data_offset); }
216   void set_mapped_base_address(char* p)          { _mapped_base_address = p; }
217   void set_heap_root_segments(HeapRootSegments segments) { _heap_root_segments = segments; }
218   void set_heap_oopmap_start_pos(size_t n)       { _heap_oopmap_start_pos = n; }
219   void set_heap_ptrmap_start_pos(size_t n)       { _heap_ptrmap_start_pos = n; }
220   void set_rw_ptrmap_start_pos(size_t n)         { _rw_ptrmap_start_pos = n; }

347   }
348 
349   static void set_current_info(FileMapInfo* info) {
350     CDS_ONLY(_current_info = info;)
351   }
352 
353   static FileMapInfo* dynamic_info() {
354     CDS_ONLY(return _dynamic_archive_info;)
355     NOT_CDS(return nullptr;)
356   }
357 
358   static void assert_mark(bool check);
359 
360   // File manipulation.
361   bool  open_as_input() NOT_CDS_RETURN_(false);
362   void  open_as_output();
363   void  write_header();
364   void  write_region(int region, char* base, size_t size,
365                      bool read_only, bool allow_exec);
366   size_t remove_bitmap_zeros(CHeapBitMap* map);
367   char* write_bitmap_region(CHeapBitMap* rw_ptrmap, CHeapBitMap* ro_ptrmap, ArchiveHeapInfo* heap_info,

368                             size_t &size_in_bytes);
369   size_t write_heap_region(ArchiveHeapInfo* heap_info);
370   void  write_bytes(const void* buffer, size_t count);
371   void  write_bytes_aligned(const void* buffer, size_t count);
372   size_t  read_bytes(void* buffer, size_t count);
373   static size_t readonly_total();
374   MapArchiveResult map_regions(int regions[], int num_regions, char* mapped_base_address, ReservedSpace rs);
375   void  unmap_regions(int regions[], int num_regions);
376   void  map_or_load_heap_region() NOT_CDS_JAVA_HEAP_RETURN;
377   void  fixup_mapped_heap_region() NOT_CDS_JAVA_HEAP_RETURN;
378   void  patch_heap_embedded_pointers() NOT_CDS_JAVA_HEAP_RETURN;
379   bool  has_heap_region()  NOT_CDS_JAVA_HEAP_RETURN_(false);
380   MemRegion get_heap_region_requested_range() NOT_CDS_JAVA_HEAP_RETURN_(MemRegion());
381   bool  read_region(int i, char* base, size_t size, bool do_commit);
382   char* map_bitmap_region();
383   bool  map_aot_code_region(ReservedSpace rs);
384   void  unmap_region(int i);
385   void  close();
386   bool  is_open() { return _file_open; }
387 

430   BitMapView oopmap_view(int region_index);
431   BitMapView ptrmap_view(int region_index);
432 
433   void print(outputStream* st) const;
434 
435   const char* vm_version() {
436     return header()->jvm_ident();
437   }
438 
439  private:
440   bool  open_for_read();
441   void  seek_to_position(size_t pos);
442   bool  map_heap_region_impl() NOT_CDS_JAVA_HEAP_RETURN_(false);
443   void  dealloc_heap_region() NOT_CDS_JAVA_HEAP_RETURN;
444   bool  can_use_heap_region();
445   bool  load_heap_region() NOT_CDS_JAVA_HEAP_RETURN_(false);
446   bool  map_heap_region() NOT_CDS_JAVA_HEAP_RETURN_(false);
447   void  init_heap_region_relocation();
448   MapArchiveResult map_region(int i, intx addr_delta, char* mapped_base_address, ReservedSpace rs);
449   bool  relocate_pointers_in_core_regions(intx addr_delta);
450 
451   static MemRegion _mapped_heap_memregion;
452 
453 public:
454   address heap_region_dumptime_address() NOT_CDS_JAVA_HEAP_RETURN_(nullptr);
455   address heap_region_requested_address() NOT_CDS_JAVA_HEAP_RETURN_(nullptr);
456   narrowOop encoded_heap_region_dumptime_address();
457 
458 private:
459 
460 #if INCLUDE_JVMTI
461   static ClassPathEntry** _classpath_entries_for_jvmti;
462   static ClassPathEntry* get_classpath_entry_for_jvmti(int i, TRAPS);
463 #endif
464 };
465 
466 #endif // SHARE_CDS_FILEMAP_HPP

123   size_t  _serialized_data_offset;                // Data accessed using {ReadClosure,WriteClosure}::serialize()
124 
125   // The following fields are all sanity checks for whether this archive
126   // will function correctly with this JVM and the bootclasspath it's
127   // invoked with.
128   char  _jvm_ident[JVM_IDENT_MAX];  // identifier string of the jvm that created this dump
129 
130   size_t _class_location_config_offset;
131 
132   bool   _verify_local;                 // BytecodeVerificationLocal setting
133   bool   _verify_remote;                // BytecodeVerificationRemote setting
134   bool   _has_platform_or_app_classes;  // Archive contains app or platform classes
135   char*  _requested_base_address;       // Archive relocation is not necessary if we map with this base address.
136   char*  _mapped_base_address;          // Actual base address where archive is mapped.
137 
138   bool   _allow_archiving_with_java_agent; // setting of the AllowArchivingWithJavaAgent option
139   bool   _use_optimized_module_handling;// No module-relation VM options were specified, so we can skip
140                                         // some expensive operations.
141   bool   _has_aot_linked_classes;       // Was the CDS archive created with -XX:+AOTClassLinking
142   bool   _has_full_module_graph;        // Does this CDS archive contain the full archived module graph?
143   bool   _has_archived_packages;
144   bool   _has_archived_protection_domains;
145   int    _gc_kind;                      // Universe::heap()->kind();
146   char   _gc_name[32];                  // Universe::heap()->name();
147   size_t _ptrmap_size_in_bits;          // Size of pointer relocation bitmap
148   HeapRootSegments _heap_root_segments; // Heap root segments info
149   size_t _heap_oopmap_start_pos;        // The first bit in the oopmap corresponds to this position in the heap.
150   size_t _heap_ptrmap_start_pos;        // The first bit in the ptrmap corresponds to this position in the heap.
151   size_t _rw_ptrmap_start_pos;          // The first bit in the ptrmap corresponds to this position in the rw region
152   size_t _ro_ptrmap_start_pos;          // The first bit in the ptrmap corresponds to this position in the ro region
153 
154   // The following are parameters that affect MethodData layout.
155   u1      _compiler_type;
156   uint    _type_profile_level;
157   int     _type_profile_args_limit;
158   int     _type_profile_parms_limit;
159   intx    _type_profile_width;
160   intx    _bci_profile_width;
161   bool    _profile_traps;
162   bool    _type_profile_casts;
163   int     _spec_trap_limit_extra_entries;
164 
165   template <typename T> T from_mapped_offset(size_t offset) const {
166     return (T)(mapped_base_address() + offset);
167   }

186   void set_base_archive_name_offset(unsigned int s)         { _generic_header._base_archive_name_offset = s; }
187   void set_base_archive_name_size(unsigned int s)           { _generic_header._base_archive_name_size = s;   }
188 
189   bool is_static()                         const { return magic() == CDS_ARCHIVE_MAGIC; }
190   size_t core_region_alignment()           const { return _core_region_alignment; }
191   int obj_alignment()                      const { return _obj_alignment; }
192   address narrow_oop_base()                const { return _narrow_oop_base; }
193   int narrow_oop_shift()                   const { return _narrow_oop_shift; }
194   bool compact_strings()                   const { return _compact_strings; }
195   bool compact_headers()                   const { return _compact_headers; }
196   uintx max_heap_size()                    const { return _max_heap_size; }
197   CompressedOops::Mode narrow_oop_mode()   const { return _narrow_oop_mode; }
198   char* cloned_vtables()                   const { return from_mapped_offset<char*>(_cloned_vtables_offset); }
199   char* early_serialized_data()            const { return from_mapped_offset<char*>(_early_serialized_data_offset); }
200   char* serialized_data()                  const { return from_mapped_offset<char*>(_serialized_data_offset); }
201   const char* jvm_ident()                  const { return _jvm_ident; }
202   char* requested_base_address()           const { return _requested_base_address; }
203   char* mapped_base_address()              const { return _mapped_base_address; }
204   bool has_platform_or_app_classes()       const { return _has_platform_or_app_classes; }
205   bool has_aot_linked_classes()            const { return _has_aot_linked_classes; }
206   int gc_kind()                            const { return _gc_kind; }
207   const char* gc_name()                    const { return _gc_name; }
208   size_t ptrmap_size_in_bits()             const { return _ptrmap_size_in_bits; }
209   bool compressed_oops()                   const { return _compressed_oops; }
210   bool compressed_class_pointers()         const { return _compressed_class_ptrs; }
211   int narrow_klass_pointer_bits()          const { return _narrow_klass_pointer_bits; }
212   int narrow_klass_shift()                 const { return _narrow_klass_shift; }
213   HeapRootSegments heap_root_segments()    const { return _heap_root_segments; }
214   bool has_full_module_graph()             const { return _has_full_module_graph; }
215   size_t heap_oopmap_start_pos()           const { return _heap_oopmap_start_pos; }
216   size_t heap_ptrmap_start_pos()           const { return _heap_ptrmap_start_pos; }
217   size_t rw_ptrmap_start_pos()             const { return _rw_ptrmap_start_pos; }
218   size_t ro_ptrmap_start_pos()             const { return _ro_ptrmap_start_pos; }
219 
220   void set_has_platform_or_app_classes(bool v)   { _has_platform_or_app_classes = v; }
221   void set_cloned_vtables(char* p)               { set_as_offset(p, &_cloned_vtables_offset); }
222   void set_early_serialized_data(char* p)        { set_as_offset(p, &_early_serialized_data_offset); }
223   void set_serialized_data(char* p)              { set_as_offset(p, &_serialized_data_offset); }
224   void set_mapped_base_address(char* p)          { _mapped_base_address = p; }
225   void set_heap_root_segments(HeapRootSegments segments) { _heap_root_segments = segments; }
226   void set_heap_oopmap_start_pos(size_t n)       { _heap_oopmap_start_pos = n; }
227   void set_heap_ptrmap_start_pos(size_t n)       { _heap_ptrmap_start_pos = n; }
228   void set_rw_ptrmap_start_pos(size_t n)         { _rw_ptrmap_start_pos = n; }

355   }
356 
357   static void set_current_info(FileMapInfo* info) {
358     CDS_ONLY(_current_info = info;)
359   }
360 
361   static FileMapInfo* dynamic_info() {
362     CDS_ONLY(return _dynamic_archive_info;)
363     NOT_CDS(return nullptr;)
364   }
365 
366   static void assert_mark(bool check);
367 
368   // File manipulation.
369   bool  open_as_input() NOT_CDS_RETURN_(false);
370   void  open_as_output();
371   void  write_header();
372   void  write_region(int region, char* base, size_t size,
373                      bool read_only, bool allow_exec);
374   size_t remove_bitmap_zeros(CHeapBitMap* map);
375   char* write_bitmap_region(CHeapBitMap* rw_ptrmap, CHeapBitMap* ro_ptrmap,
376                             CHeapBitMap* cc_ptrmap, ArchiveHeapInfo* heap_info,
377                             size_t &size_in_bytes);
378   size_t write_heap_region(ArchiveHeapInfo* heap_info);
379   void  write_bytes(const void* buffer, size_t count);
380   void  write_bytes_aligned(const void* buffer, size_t count);
381   size_t  read_bytes(void* buffer, size_t count);
382   static size_t readonly_total();
383   MapArchiveResult map_regions(int regions[], int num_regions, char* mapped_base_address, ReservedSpace rs);
384   void  unmap_regions(int regions[], int num_regions);
385   void  map_or_load_heap_region() NOT_CDS_JAVA_HEAP_RETURN;
386   void  fixup_mapped_heap_region() NOT_CDS_JAVA_HEAP_RETURN;
387   void  patch_heap_embedded_pointers() NOT_CDS_JAVA_HEAP_RETURN;
388   bool  has_heap_region()  NOT_CDS_JAVA_HEAP_RETURN_(false);
389   MemRegion get_heap_region_requested_range() NOT_CDS_JAVA_HEAP_RETURN_(MemRegion());
390   bool  read_region(int i, char* base, size_t size, bool do_commit);
391   char* map_bitmap_region();
392   bool  map_aot_code_region(ReservedSpace rs);
393   void  unmap_region(int i);
394   void  close();
395   bool  is_open() { return _file_open; }
396 

439   BitMapView oopmap_view(int region_index);
440   BitMapView ptrmap_view(int region_index);
441 
442   void print(outputStream* st) const;
443 
444   const char* vm_version() {
445     return header()->jvm_ident();
446   }
447 
448  private:
449   bool  open_for_read();
450   void  seek_to_position(size_t pos);
451   bool  map_heap_region_impl() NOT_CDS_JAVA_HEAP_RETURN_(false);
452   void  dealloc_heap_region() NOT_CDS_JAVA_HEAP_RETURN;
453   bool  can_use_heap_region();
454   bool  load_heap_region() NOT_CDS_JAVA_HEAP_RETURN_(false);
455   bool  map_heap_region() NOT_CDS_JAVA_HEAP_RETURN_(false);
456   void  init_heap_region_relocation();
457   MapArchiveResult map_region(int i, intx addr_delta, char* mapped_base_address, ReservedSpace rs);
458   bool  relocate_pointers_in_core_regions(intx addr_delta);
459   void  relocate_pointers_in_aot_code_region();
460   static MemRegion _mapped_heap_memregion;
461 
462 public:
463   address heap_region_dumptime_address() NOT_CDS_JAVA_HEAP_RETURN_(nullptr);
464   address heap_region_requested_address() NOT_CDS_JAVA_HEAP_RETURN_(nullptr);
465   narrowOop encoded_heap_region_dumptime_address();
466 
467 private:
468 
469 #if INCLUDE_JVMTI
470   static ClassPathEntry** _classpath_entries_for_jvmti;
471   static ClassPathEntry* get_classpath_entry_for_jvmti(int i, TRAPS);
472 #endif
473 };
474 
475 #endif // SHARE_CDS_FILEMAP_HPP
< prev index next >