1714 // Link the class to cause the bytecodes to be rewritten and the 1715 // cpcache to be created. The linking is done as soon as classes 1716 // are loaded in order that the related data structures (klass and 1717 // cpCache) are located together. 1718 try_link_class(ik, THREAD); 1719 guarantee(!HAS_PENDING_EXCEPTION, "exception in link_class"); 1720 } 1721 1722 class_count++; 1723 } 1724 } 1725 1726 return class_count; 1727 } 1728 1729 // Returns true if the class's status has changed 1730 bool MetaspaceShared::try_link_class(InstanceKlass* ik, TRAPS) { 1731 assert(DumpSharedSpaces, "should only be called during dumping"); 1732 if (ik->init_state() < InstanceKlass::linked) { 1733 bool saved = BytecodeVerificationLocal; 1734 if (!(ik->is_shared_boot_class())) { 1735 // The verification decision is based on BytecodeVerificationRemote 1736 // for non-system classes. Since we are using the NULL classloader 1737 // to load non-system classes during dumping, we need to temporarily 1738 // change BytecodeVerificationLocal to be the same as 1739 // BytecodeVerificationRemote. Note this can cause the parent system 1740 // classes also being verified. The extra overhead is acceptable during 1741 // dumping. 1742 BytecodeVerificationLocal = BytecodeVerificationRemote; 1743 } 1744 ik->link_class(THREAD); 1745 if (HAS_PENDING_EXCEPTION) { 1746 ResourceMark rm; 1747 tty->print_cr("Preload Warning: Verification failed for %s", 1748 ik->external_name()); 1749 CLEAR_PENDING_EXCEPTION; 1750 ik->set_in_error_state(); 1751 _has_error_classes = true; 1752 } 1753 BytecodeVerificationLocal = saved; 1754 return true; 1755 } else { 1756 return false; 1757 } 1758 } | 1714 // Link the class to cause the bytecodes to be rewritten and the 1715 // cpcache to be created. The linking is done as soon as classes 1716 // are loaded in order that the related data structures (klass and 1717 // cpCache) are located together. 1718 try_link_class(ik, THREAD); 1719 guarantee(!HAS_PENDING_EXCEPTION, "exception in link_class"); 1720 } 1721 1722 class_count++; 1723 } 1724 } 1725 1726 return class_count; 1727 } 1728 1729 // Returns true if the class's status has changed 1730 bool MetaspaceShared::try_link_class(InstanceKlass* ik, TRAPS) { 1731 assert(DumpSharedSpaces, "should only be called during dumping"); 1732 if (ik->init_state() < InstanceKlass::linked) { 1733 bool saved = BytecodeVerificationLocal; 1734 if (ik->loader_type() == 0 && ik->class_loader() == NULL) { 1735 // The verification decision is based on BytecodeVerificationRemote 1736 // for non-system classes. Since we are using the NULL classloader 1737 // to load non-system classes for customized class loaders during dumping, 1738 // we need to temporarily change BytecodeVerificationLocal to be the same as 1739 // BytecodeVerificationRemote. Note this can cause the parent system 1740 // classes also being verified. The extra overhead is acceptable during 1741 // dumping. 1742 BytecodeVerificationLocal = BytecodeVerificationRemote; 1743 } 1744 ik->link_class(THREAD); 1745 if (HAS_PENDING_EXCEPTION) { 1746 ResourceMark rm; 1747 tty->print_cr("Preload Warning: Verification failed for %s", 1748 ik->external_name()); 1749 CLEAR_PENDING_EXCEPTION; 1750 ik->set_in_error_state(); 1751 _has_error_classes = true; 1752 } 1753 BytecodeVerificationLocal = saved; 1754 return true; 1755 } else { 1756 return false; 1757 } 1758 } |