< prev index next >

src/hotspot/share/memory/filemap.hpp

Print this page


 136   CompressedOops::Mode _narrow_oop_mode; // compressed oop encoding mode
 137   int     _narrow_klass_shift;      // save narrow klass base and shift
 138   address _narrow_klass_base;
 139   char*   _misc_data_patching_start;
 140   char*   _read_only_tables_start;
 141   address _cds_i2i_entry_code_buffers;
 142   size_t  _cds_i2i_entry_code_buffers_size;
 143   size_t  _core_spaces_size;        // number of bytes allocated by the core spaces
 144                                     // (mc, md, ro, rw and od).
 145   MemRegion _heap_reserved;         // reserved region for the entire heap at dump time.
 146   bool _base_archive_is_default;    // indicates if the base archive is the system default one
 147 
 148   // The following fields are all sanity checks for whether this archive
 149   // will function correctly with this JVM and the bootclasspath it's
 150   // invoked with.
 151   char  _jvm_ident[JVM_IDENT_MAX];      // identifier for jvm
 152 
 153   // size of the base archive name including NULL terminator
 154   int _base_archive_name_size;
 155 
 156   // The following is a table of all the class path entries that were used
 157   // during dumping. At run time, we require these files to exist and have the same
 158   // size/modification time, or else the archive will refuse to load.
 159   //
 160   // All of these entries must be JAR files. The dumping process would fail if a non-empty
 161   // directory was specified in the classpaths. If an empty directory was specified
 162   // it is checked by the _paths_misc_info as described above.
 163   //
 164   // FIXME -- if JAR files in the tail of the list were specified but not used during dumping,
 165   // they should be removed from this table, to save space and to avoid spurious
 166   // loading failures during runtime.
 167   SharedPathTable _shared_path_table;
 168 
 169   jshort _app_class_paths_start_index;  // Index of first app classpath entry
 170   jshort _app_module_paths_start_index; // Index of first module path entry
 171   jshort _num_module_paths;             // number of module path entries
 172   jshort _max_used_path_index;          // max path index referenced during CDS dump
 173   bool   _verify_local;                 // BytecodeVerificationLocal setting
 174   bool   _verify_remote;                // BytecodeVerificationRemote setting
 175   bool   _has_platform_or_app_classes;  // Archive contains app classes
 176   size_t _shared_base_address;          // SharedBaseAddress used at dump time
 177   bool   _allow_archiving_with_java_agent; // setting of the AllowArchivingWithJavaAgent option
 178 
 179   void set_has_platform_or_app_classes(bool v) {
 180     _has_platform_or_app_classes = v;
 181   }
 182   bool has_platform_or_app_classes() { return _has_platform_or_app_classes; }
 183   jshort max_used_path_index()       { return _max_used_path_index; }
 184   jshort app_module_paths_start_index() { return _app_module_paths_start_index; }
 185 
 186   bool validate();


 208 private:
 209   // TODO: Probably change the following to be non-static
 210   static SharedPathTable       _shared_path_table;
 211   static bool                  _validating_shared_path_table;
 212 
 213   // FileMapHeader describes the shared space data in the file to be
 214   // mapped.  This structure gets written to a file.  It is not a class, so
 215   // that the compilers don't add any compiler-private data to it.
 216 
 217 public:
 218   struct FileMapHeaderBase : public CHeapObj<mtClass> {
 219     // Need to put something here. Otherwise, in product build, because CHeapObj has no virtual
 220     // methods, we would get sizeof(FileMapHeaderBase) == 1 with gcc.
 221     intx _dummy;
 222   };
 223 
 224 
 225   FileMapHeader * _header;
 226 
 227   const char* _full_path;
 228   char* _paths_misc_info;
 229   char* _base_archive_name;
 230 
 231   static FileMapInfo* _current_info;
 232   static FileMapInfo* _dynamic_archive_info;
 233   static bool _heap_pointers_need_patching;
 234   static bool _memory_mapping_failed;
 235   static GrowableArray<const char*>* _non_existent_class_paths;
 236 
 237   static bool get_base_archive_name_from_header(const char* archive_name,
 238                                                 int* size, char** base_archive_name);
 239   static bool check_archive(const char* archive_name, bool is_static);
 240   void restore_shared_path_table();
 241   bool  init_from_file(int fd, bool is_static);
 242   static void metaspace_pointers_do(MetaspaceClosure* it);
 243 
 244   void log_paths(const char* msg, int start_idx, int end_idx);
 245 
 246 public:
 247   FileMapInfo(bool is_static);
 248   ~FileMapInfo();


 336   // JVM/TI RedefineClasses() support:
 337   // Remap the shared readonly space to shared readwrite, private.
 338   bool  remap_shared_readonly_as_readwrite();
 339 
 340   // Errors.
 341   static void fail_stop(const char *msg, ...) ATTRIBUTE_PRINTF(1, 2);
 342   static void fail_continue(const char *msg, ...) ATTRIBUTE_PRINTF(1, 2);
 343   static bool memory_mapping_failed() {
 344     CDS_ONLY(return _memory_mapping_failed;)
 345     NOT_CDS(return false;)
 346   }
 347   bool is_in_shared_region(const void* p, int idx) NOT_CDS_RETURN_(false);
 348 
 349   // Stop CDS sharing and unmap CDS regions.
 350   static void stop_sharing_and_unmap(const char* msg);
 351 
 352   static void allocate_shared_path_table();
 353   static int add_shared_classpaths(int i, const char* which, ClassPathEntry *cpe, TRAPS);
 354   static void check_nonempty_dir_in_shared_path_table();
 355   bool validate_shared_path_table();
 356   bool validate_non_existent_class_paths() const;
 357   static void update_jar_manifest(ClassPathEntry *cpe, SharedClassPathEntry* ent, TRAPS);
 358   static int num_non_existent_class_paths();
 359   static void record_non_existent_class_path_entry(const char* path);
 360 
 361 #if INCLUDE_JVMTI
 362   static ClassFileStream* open_stream_for_jvmti(InstanceKlass* ik, Handle class_loader, TRAPS);
 363 #endif
 364 
 365   static SharedClassPathEntry* shared_path(int index) {
 366     return _shared_path_table.path_at(index);
 367   }
 368 
 369   static const char* shared_path_name(int index) {
 370     assert(index >= 0, "Sanity");
 371     return shared_path(index)->name();
 372   }
 373 
 374   static int get_number_of_shared_paths() {
 375     return _shared_path_table.size();
 376   }




 136   CompressedOops::Mode _narrow_oop_mode; // compressed oop encoding mode
 137   int     _narrow_klass_shift;      // save narrow klass base and shift
 138   address _narrow_klass_base;
 139   char*   _misc_data_patching_start;
 140   char*   _read_only_tables_start;
 141   address _cds_i2i_entry_code_buffers;
 142   size_t  _cds_i2i_entry_code_buffers_size;
 143   size_t  _core_spaces_size;        // number of bytes allocated by the core spaces
 144                                     // (mc, md, ro, rw and od).
 145   MemRegion _heap_reserved;         // reserved region for the entire heap at dump time.
 146   bool _base_archive_is_default;    // indicates if the base archive is the system default one
 147 
 148   // The following fields are all sanity checks for whether this archive
 149   // will function correctly with this JVM and the bootclasspath it's
 150   // invoked with.
 151   char  _jvm_ident[JVM_IDENT_MAX];      // identifier for jvm
 152 
 153   // size of the base archive name including NULL terminator
 154   int _base_archive_name_size;
 155 
 156   // The following is a table of all the boot/app/module path entries that were used
 157   // during dumping. At run time, we we validate these entries according to their
 158   // SharedClassPathEntry::_type. See:
 159   //      check_nonempty_dir_in_shared_path_table()
 160   //      validate_shared_path_table()
 161   //      validate_non_existent_class_paths()





 162   SharedPathTable _shared_path_table;
 163 
 164   jshort _app_class_paths_start_index;  // Index of first app classpath entry
 165   jshort _app_module_paths_start_index; // Index of first module path entry
 166   jshort _num_module_paths;             // number of module path entries
 167   jshort _max_used_path_index;          // max path index referenced during CDS dump
 168   bool   _verify_local;                 // BytecodeVerificationLocal setting
 169   bool   _verify_remote;                // BytecodeVerificationRemote setting
 170   bool   _has_platform_or_app_classes;  // Archive contains app classes
 171   size_t _shared_base_address;          // SharedBaseAddress used at dump time
 172   bool   _allow_archiving_with_java_agent; // setting of the AllowArchivingWithJavaAgent option
 173 
 174   void set_has_platform_or_app_classes(bool v) {
 175     _has_platform_or_app_classes = v;
 176   }
 177   bool has_platform_or_app_classes() { return _has_platform_or_app_classes; }
 178   jshort max_used_path_index()       { return _max_used_path_index; }
 179   jshort app_module_paths_start_index() { return _app_module_paths_start_index; }
 180 
 181   bool validate();


 203 private:
 204   // TODO: Probably change the following to be non-static
 205   static SharedPathTable       _shared_path_table;
 206   static bool                  _validating_shared_path_table;
 207 
 208   // FileMapHeader describes the shared space data in the file to be
 209   // mapped.  This structure gets written to a file.  It is not a class, so
 210   // that the compilers don't add any compiler-private data to it.
 211 
 212 public:
 213   struct FileMapHeaderBase : public CHeapObj<mtClass> {
 214     // Need to put something here. Otherwise, in product build, because CHeapObj has no virtual
 215     // methods, we would get sizeof(FileMapHeaderBase) == 1 with gcc.
 216     intx _dummy;
 217   };
 218 
 219 
 220   FileMapHeader * _header;
 221 
 222   const char* _full_path;

 223   char* _base_archive_name;
 224 
 225   static FileMapInfo* _current_info;
 226   static FileMapInfo* _dynamic_archive_info;
 227   static bool _heap_pointers_need_patching;
 228   static bool _memory_mapping_failed;
 229   static GrowableArray<const char*>* _non_existent_class_paths;
 230 
 231   static bool get_base_archive_name_from_header(const char* archive_name,
 232                                                 int* size, char** base_archive_name);
 233   static bool check_archive(const char* archive_name, bool is_static);
 234   void restore_shared_path_table();
 235   bool  init_from_file(int fd, bool is_static);
 236   static void metaspace_pointers_do(MetaspaceClosure* it);
 237 
 238   void log_paths(const char* msg, int start_idx, int end_idx);
 239 
 240 public:
 241   FileMapInfo(bool is_static);
 242   ~FileMapInfo();


 330   // JVM/TI RedefineClasses() support:
 331   // Remap the shared readonly space to shared readwrite, private.
 332   bool  remap_shared_readonly_as_readwrite();
 333 
 334   // Errors.
 335   static void fail_stop(const char *msg, ...) ATTRIBUTE_PRINTF(1, 2);
 336   static void fail_continue(const char *msg, ...) ATTRIBUTE_PRINTF(1, 2);
 337   static bool memory_mapping_failed() {
 338     CDS_ONLY(return _memory_mapping_failed;)
 339     NOT_CDS(return false;)
 340   }
 341   bool is_in_shared_region(const void* p, int idx) NOT_CDS_RETURN_(false);
 342 
 343   // Stop CDS sharing and unmap CDS regions.
 344   static void stop_sharing_and_unmap(const char* msg);
 345 
 346   static void allocate_shared_path_table();
 347   static int add_shared_classpaths(int i, const char* which, ClassPathEntry *cpe, TRAPS);
 348   static void check_nonempty_dir_in_shared_path_table();
 349   bool validate_shared_path_table();
 350   void validate_non_existent_class_paths();
 351   static void update_jar_manifest(ClassPathEntry *cpe, SharedClassPathEntry* ent, TRAPS);
 352   static int num_non_existent_class_paths();
 353   static void record_non_existent_class_path_entry(const char* path);
 354 
 355 #if INCLUDE_JVMTI
 356   static ClassFileStream* open_stream_for_jvmti(InstanceKlass* ik, Handle class_loader, TRAPS);
 357 #endif
 358 
 359   static SharedClassPathEntry* shared_path(int index) {
 360     return _shared_path_table.path_at(index);
 361   }
 362 
 363   static const char* shared_path_name(int index) {
 364     assert(index >= 0, "Sanity");
 365     return shared_path(index)->name();
 366   }
 367 
 368   static int get_number_of_shared_paths() {
 369     return _shared_path_table.size();
 370   }


< prev index next >