< prev index next >

src/hotspot/share/memory/filemap.cpp

Print this page




1593 // [1] validate_header() - done here. This checks the header, including _paths_misc_info.
1594 // [2] validate_shared_path_table - this is done later, because the table is in the RW
1595 //     region of the archive, which is not mapped yet.
1596 bool FileMapInfo::initialize(bool is_static) {
1597   assert(UseSharedSpaces, "UseSharedSpaces expected.");
1598 
1599   if (JvmtiExport::should_post_class_file_load_hook() && JvmtiExport::has_early_class_hook_env()) {
1600     // CDS assumes that no classes resolved in SystemDictionary::resolve_well_known_classes
1601     // are replaced at runtime by JVMTI ClassFileLoadHook. All of those classes are resolved
1602     // during the JVMTI "early" stage, so we can still use CDS if
1603     // JvmtiExport::has_early_class_hook_env() is false.
1604     FileMapInfo::fail_continue("CDS is disabled because early JVMTI ClassFileLoadHook is in use.");
1605     return false;
1606   }
1607 
1608   if (!open_for_read()) {
1609     return false;
1610   }
1611 
1612   init_from_file(_fd, is_static);
1613   if (!validate_header(is_static)) {


1614     return false;
1615   }
1616   return true;
1617 }
1618 
1619 char* FileMapInfo::region_addr(int idx) {
1620   CDSFileMapRegion* si = space_at(idx);
1621   if (HeapShared::is_heap_region(idx)) {
1622     assert(DumpSharedSpaces, "The following doesn't work at runtime");
1623     return si->_used > 0 ?
1624           (char*)start_address_as_decoded_with_current_oop_encoding_mode(si) : NULL;
1625   } else {
1626     return si->_addr._base;
1627   }
1628 }
1629 
1630 int FileMapHeader::compute_crc() {
1631   char* start = (char*)this;
1632   // start computing from the field after _crc
1633   char* buf = (char*)&_crc + sizeof(_crc);




1593 // [1] validate_header() - done here. This checks the header, including _paths_misc_info.
1594 // [2] validate_shared_path_table - this is done later, because the table is in the RW
1595 //     region of the archive, which is not mapped yet.
1596 bool FileMapInfo::initialize(bool is_static) {
1597   assert(UseSharedSpaces, "UseSharedSpaces expected.");
1598 
1599   if (JvmtiExport::should_post_class_file_load_hook() && JvmtiExport::has_early_class_hook_env()) {
1600     // CDS assumes that no classes resolved in SystemDictionary::resolve_well_known_classes
1601     // are replaced at runtime by JVMTI ClassFileLoadHook. All of those classes are resolved
1602     // during the JVMTI "early" stage, so we can still use CDS if
1603     // JvmtiExport::has_early_class_hook_env() is false.
1604     FileMapInfo::fail_continue("CDS is disabled because early JVMTI ClassFileLoadHook is in use.");
1605     return false;
1606   }
1607 
1608   if (!open_for_read()) {
1609     return false;
1610   }
1611 
1612   init_from_file(_fd, is_static);
1613   // UseSharedSpaces could be disabled if the checking of some of the header fields in
1614   // init_from_file has failed.
1615   if (!UseSharedSpaces || !validate_header(is_static)) {
1616     return false;
1617   }
1618   return true;
1619 }
1620 
1621 char* FileMapInfo::region_addr(int idx) {
1622   CDSFileMapRegion* si = space_at(idx);
1623   if (HeapShared::is_heap_region(idx)) {
1624     assert(DumpSharedSpaces, "The following doesn't work at runtime");
1625     return si->_used > 0 ?
1626           (char*)start_address_as_decoded_with_current_oop_encoding_mode(si) : NULL;
1627   } else {
1628     return si->_addr._base;
1629   }
1630 }
1631 
1632 int FileMapHeader::compute_crc() {
1633   char* start = (char*)this;
1634   // start computing from the field after _crc
1635   char* buf = (char*)&_crc + sizeof(_crc);


< prev index next >