1633 ClassLoaderDataGraph::unlocked_loaded_classes_do(&link_closure);
1634 guarantee(!HAS_PENDING_EXCEPTION, "exception in link_class");
1635 } while (link_closure.made_progress());
1636
1637 if (_has_error_classes) {
1638 // Mark all classes whose super class or interfaces failed verification.
1639 CheckSharedClassesClosure check_closure;
1640 do {
1641 // Not completely sure if we need to do this iteratively. Anyway,
1642 // we should come here only if there are unverifiable classes, which
1643 // shouldn't happen in normal cases. So better safe than sorry.
1644 check_closure.reset();
1645 ClassLoaderDataGraph::unlocked_loaded_classes_do(&check_closure);
1646 } while (check_closure.made_progress());
1647
1648 if (IgnoreUnverifiableClassesDuringDump) {
1649 // This is useful when running JCK or SQE tests. You should not
1650 // enable this when running real apps.
1651 SystemDictionary::remove_classes_in_error_state();
1652 } else {
1653 tty->print_cr("Please remove the unverifiable classes from your class list and try again");
1654 exit(1);
1655 }
1656 }
1657 }
1658
1659 void MetaspaceShared::prepare_for_dumping() {
1660 Arguments::check_unsupported_dumping_properties();
1661 ClassLoader::initialize_shared_path();
1662 }
1663
1664 // Preload classes from a list, populate the shared spaces and dump to a
1665 // file.
1666 void MetaspaceShared::preload_and_dump(TRAPS) {
1667 { TraceTime timer("Dump Shared Spaces", TRACETIME_LOG(Info, startuptime));
1668 ResourceMark rm;
1669 char class_list_path_str[JVM_MAXPATHLEN];
1670 // Preload classes to be shared.
1671 // Should use some os:: method rather than fopen() here. aB.
1672 const char* class_list_path;
1673 if (SharedClassListFile == NULL) {
2012 int len = *(intptr_t*)buffer; // skip over shared dictionary entries
2013 buffer += sizeof(intptr_t);
2014 buffer += len;
2015
2016 // Verify various attributes of the archive, plus initialize the
2017 // shared string/symbol tables
2018 intptr_t* array = (intptr_t*)buffer;
2019 ReadClosure rc(&array);
2020 serialize(&rc);
2021
2022 // Initialize the run-time symbol table.
2023 SymbolTable::create_table();
2024
2025 mapinfo->patch_archived_heap_embedded_pointers();
2026
2027 // Close the mapinfo file
2028 mapinfo->close();
2029
2030 if (PrintSharedArchiveAndExit) {
2031 if (PrintSharedDictionary) {
2032 tty->print_cr("\nShared classes:\n");
2033 SystemDictionary::print_shared(tty);
2034 }
2035 if (_archive_loading_failed) {
2036 tty->print_cr("archive is invalid");
2037 vm_exit(1);
2038 } else {
2039 tty->print_cr("archive is valid");
2040 vm_exit(0);
2041 }
2042 }
2043 }
2044
2045 // JVM/TI RedefineClasses() support:
2046 bool MetaspaceShared::remap_shared_readonly_as_readwrite() {
2047 assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
2048
2049 if (UseSharedSpaces) {
2050 // remap the shared readonly space to shared readwrite, private
2051 FileMapInfo* mapinfo = FileMapInfo::current_info();
2052 if (!mapinfo->remap_shared_readonly_as_readwrite()) {
2053 return false;
2054 }
2055 _remapped_readwrite = true;
2056 }
2057 return true;
2058 }
2059
|
1633 ClassLoaderDataGraph::unlocked_loaded_classes_do(&link_closure);
1634 guarantee(!HAS_PENDING_EXCEPTION, "exception in link_class");
1635 } while (link_closure.made_progress());
1636
1637 if (_has_error_classes) {
1638 // Mark all classes whose super class or interfaces failed verification.
1639 CheckSharedClassesClosure check_closure;
1640 do {
1641 // Not completely sure if we need to do this iteratively. Anyway,
1642 // we should come here only if there are unverifiable classes, which
1643 // shouldn't happen in normal cases. So better safe than sorry.
1644 check_closure.reset();
1645 ClassLoaderDataGraph::unlocked_loaded_classes_do(&check_closure);
1646 } while (check_closure.made_progress());
1647
1648 if (IgnoreUnverifiableClassesDuringDump) {
1649 // This is useful when running JCK or SQE tests. You should not
1650 // enable this when running real apps.
1651 SystemDictionary::remove_classes_in_error_state();
1652 } else {
1653 log_error(cds)("Please remove the unverifiable classes from your class list and try again");
1654 exit(1);
1655 }
1656 }
1657 }
1658
1659 void MetaspaceShared::prepare_for_dumping() {
1660 Arguments::check_unsupported_dumping_properties();
1661 ClassLoader::initialize_shared_path();
1662 }
1663
1664 // Preload classes from a list, populate the shared spaces and dump to a
1665 // file.
1666 void MetaspaceShared::preload_and_dump(TRAPS) {
1667 { TraceTime timer("Dump Shared Spaces", TRACETIME_LOG(Info, startuptime));
1668 ResourceMark rm;
1669 char class_list_path_str[JVM_MAXPATHLEN];
1670 // Preload classes to be shared.
1671 // Should use some os:: method rather than fopen() here. aB.
1672 const char* class_list_path;
1673 if (SharedClassListFile == NULL) {
2012 int len = *(intptr_t*)buffer; // skip over shared dictionary entries
2013 buffer += sizeof(intptr_t);
2014 buffer += len;
2015
2016 // Verify various attributes of the archive, plus initialize the
2017 // shared string/symbol tables
2018 intptr_t* array = (intptr_t*)buffer;
2019 ReadClosure rc(&array);
2020 serialize(&rc);
2021
2022 // Initialize the run-time symbol table.
2023 SymbolTable::create_table();
2024
2025 mapinfo->patch_archived_heap_embedded_pointers();
2026
2027 // Close the mapinfo file
2028 mapinfo->close();
2029
2030 if (PrintSharedArchiveAndExit) {
2031 if (PrintSharedDictionary) {
2032 log_info(cds)("\nShared classes:\n");
2033 SystemDictionary::print_shared(tty);
2034 }
2035 if (_archive_loading_failed) {
2036 log_error(cds)("archive is invalid");
2037 vm_exit(1);
2038 } else {
2039 log_info(cds)("archive is valid");
2040 vm_exit(0);
2041 }
2042 }
2043 }
2044
2045 // JVM/TI RedefineClasses() support:
2046 bool MetaspaceShared::remap_shared_readonly_as_readwrite() {
2047 assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
2048
2049 if (UseSharedSpaces) {
2050 // remap the shared readonly space to shared readwrite, private
2051 FileMapInfo* mapinfo = FileMapInfo::current_info();
2052 if (!mapinfo->remap_shared_readonly_as_readwrite()) {
2053 return false;
2054 }
2055 _remapped_readwrite = true;
2056 }
2057 return true;
2058 }
2059
|