< 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   uint    _type_profile_level;
151   int     _type_profile_args_limit;
152   int     _type_profile_parms_limit;
153   intx    _type_profile_width;
154   intx    _bci_profile_width;
155   bool    _profile_traps;
156   bool    _type_profile_casts;
157   int     _spec_trap_limit_extra_entries;
158 
159   template <typename T> T from_mapped_offset(size_t offset) const {
160     return (T)(mapped_base_address() + offset);
161   }
162   void set_as_offset(char* p, size_t *offset);

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



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

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

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

429   BitMapView oopmap_view(int region_index);
430   BitMapView ptrmap_view(int region_index);
431 
432   void print(outputStream* st) const;
433 
434   const char* vm_version() {
435     return header()->jvm_ident();
436   }
437 
438  private:
439   bool  open_for_read();
440   void  seek_to_position(size_t pos);
441   bool  map_heap_region_impl() NOT_CDS_JAVA_HEAP_RETURN_(false);
442   void  dealloc_heap_region() NOT_CDS_JAVA_HEAP_RETURN;
443   bool  can_use_heap_region();
444   bool  load_heap_region() NOT_CDS_JAVA_HEAP_RETURN_(false);
445   bool  map_heap_region() NOT_CDS_JAVA_HEAP_RETURN_(false);
446   void  init_heap_region_relocation();
447   MapArchiveResult map_region(int i, intx addr_delta, char* mapped_base_address, ReservedSpace rs);
448   bool  relocate_pointers_in_core_regions(intx addr_delta);
449 
450   static MemRegion _mapped_heap_memregion;
451 
452 public:
453   address heap_region_dumptime_address() NOT_CDS_JAVA_HEAP_RETURN_(nullptr);
454   address heap_region_requested_address() NOT_CDS_JAVA_HEAP_RETURN_(nullptr);
455   narrowOop encoded_heap_region_dumptime_address();
456 
457 private:
458 
459 #if INCLUDE_JVMTI
460   static ClassPathEntry** _classpath_entries_for_jvmti;
461   static ClassPathEntry* get_classpath_entry_for_jvmti(int i, TRAPS);
462 #endif
463 };
464 
465 #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   uint    _type_profile_level;
156   int     _type_profile_args_limit;
157   int     _type_profile_parms_limit;
158   intx    _type_profile_width;
159   intx    _bci_profile_width;
160   bool    _profile_traps;
161   bool    _type_profile_casts;
162   int     _spec_trap_limit_extra_entries;
163 
164   template <typename T> T from_mapped_offset(size_t offset) const {
165     return (T)(mapped_base_address() + offset);
166   }
167   void set_as_offset(char* p, size_t *offset);

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

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

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