/* * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. *
*/
// To understand the layout of the CDS archive file: // // java -Xlog:cds+map=info:file=cds.map:none:filesize=0 // java -Xlog:cds+map=debug:file=cds.map:none:filesize=0 // java -Xlog:cds+map=trace:file=cds.map:none:filesize=0
staticconstint JVM_IDENT_MAX = 256;
class BitMapView; class CHeapBitMap; class ClassFileStream; class ClassLoaderData; class ClassPathEntry; class outputStream;
u1 _type; bool _is_module_path; bool _from_class_path_attr;
time_t _timestamp; // jar timestamp, 0 if is directory, modules image or other
int64_t _filesize; // jar/jimage file size, -1 if is directory, -2 if other
Array<char>* _name;
Array<u1>* _manifest;
struct ArchiveHeapBitmapInfo {
address _map; // bitmap for relocating embedded oops
size_t _bm_region_offset; // this bitmap is stored at this offset from the bottom of the BM region
size_t _size_in_bits;
size_t _size_in_bytes;
};
class SharedPathTable {
Array<u8>* _table; int _size; public:
SharedPathTable() : _table(NULL), _size(0) {}
SharedPathTable(Array<u8>* table, int size) : _table(table), _size(size) {}
void print(outputStream* st, int region_index);
};
class FileMapHeader: private CDSFileMapHeaderBase { friendclass CDSConstants; friendclass VMStructs;
private: // The following fields record the states of the VM during dump time. // They are compared with the runtime states to see if the archive // can be used.
size_t _core_region_alignment; // how shared archive should be aligned int _obj_alignment; // value of ObjectAlignmentInBytes
address _narrow_oop_base; // compressed oop encoding base int _narrow_oop_shift; // compressed oop encoding shift bool _compact_strings; // value of CompactStrings
uintx _max_heap_size; // java max heap size during dumping
CompressedOops::Mode _narrow_oop_mode; // compressed oop encoding mode int _narrow_klass_shift; // save narrow klass base and shift bool _compressed_oops; // save the flag UseCompressedOops bool _compressed_class_ptrs; // save the flag UseCompressedClassPointers
size_t _cloned_vtables_offset; // The address of the first cloned vtable
size_t _serialized_data_offset; // Data accessed using {ReadClosure,WriteClosure}::serialize()
address _heap_begin; // heap begin at dump time.
address _heap_end; // heap end at dump time. bool _has_non_jar_in_classpath; // non-jar file entry exists in classpath unsignedint _common_app_classpath_prefix_size; // size of the common prefix of app class paths // 0 if no common prefix exists
// The following fields are all sanity checks for whether this archive // will function correctly with this JVM and the bootclasspath it's // invoked with. char _jvm_ident[JVM_IDENT_MAX]; // identifier string of the jvm that created this dump
// The following is a table of all the boot/app/module path entries that were used // during dumping. At run time, we validate these entries according to their // SharedClassPathEntry::_type. See: // check_nonempty_dir_in_shared_path_table() // validate_shared_path_table() // validate_non_existent_class_paths()
size_t _shared_path_table_offset; int _shared_path_table_size;
jshort _app_class_paths_start_index; // Index of first app classpath entry
jshort _app_module_paths_start_index; // Index of first module path entry
jshort _num_module_paths; // number of module path entries
jshort _max_used_path_index; // max path index referenced during CDS dump bool _verify_local; // BytecodeVerificationLocal setting bool _verify_remote; // BytecodeVerificationRemote setting bool _has_platform_or_app_classes; // Archive contains app classes char* _requested_base_address; // Archive relocation is not necessary if we map with this base address. char* _mapped_base_address; // Actual base address where archive is mapped.
bool _allow_archiving_with_java_agent; // setting of the AllowArchivingWithJavaAgent option bool _use_optimized_module_handling;// No module-relation VM options were specified, so we can skip // some expensive operations. bool _use_full_module_graph; // Can we use the full archived module graph?
size_t _ptrmap_size_in_bits; // Size of pointer relocation bitmap char* from_mapped_offset(size_t offset) const { return mapped_base_address() + offset;
} void set_as_offset(char* p, size_t *offset); public: // Accessors -- fields declared in GenericCDSFileMapHeader unsignedint magic() const { return _generic_header._magic; } int crc() const { return _generic_header._crc; } int version() const { return _generic_header._version; } unsignedint header_size() const { return _generic_header._header_size; } unsignedint base_archive_name_offset() const { return _generic_header._base_archive_name_offset; } unsignedint base_archive_name_size() const { return _generic_header._base_archive_name_size; } unsignedint common_app_classpath_prefix_size() const { return _common_app_classpath_prefix_size; }
// TODO: Probably change the following to be non-static static SharedPathTable _shared_path_table; static SharedPathTable _saved_shared_path_table; static Array<u8>* _saved_shared_path_table_array; // remember the table array for cleanup staticbool _validating_shared_path_table;
// FileMapHeader describes the shared space data in the file to be // mapped. This structure gets written to a file. It is not a class, so // that the compilers don't add any compiler-private data to it.
// The offset of the first core region in the archive, relative to SharedBaseAddress
size_t mapping_base_offset() const { return first_core_region()->mapping_offset(); } // The offset of the (exclusive) end of the last core region in this archive, relative to SharedBaseAddress
size_t mapping_end_offset() const { return last_core_region()->mapping_end_offset(); }
// Non-zero if the archive needs to be mapped a non-default location due to ASLR.
intx relocation_delta() const { return header()->mapped_base_address() - header()->requested_base_address();
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.