834 }
835
836 // Returns true if the class's status has changed
837 bool MetaspaceShared::try_link_class(InstanceKlass* ik, TRAPS) {
838 assert(DumpSharedSpaces, "should only be called during dumping");
839 if (ik->init_state() < InstanceKlass::linked) {
840 bool saved = BytecodeVerificationLocal;
841 if (!SharedClassUtil::is_shared_boot_class(ik)) {
842 // The verification decision is based on BytecodeVerificationRemote
843 // for non-system classes. Since we are using the NULL classloader
844 // to load non-system classes during dumping, we need to temporarily
845 // change BytecodeVerificationLocal to be the same as
846 // BytecodeVerificationRemote. Note this can cause the parent system
847 // classes also being verified. The extra overhead is acceptable during
848 // dumping.
849 BytecodeVerificationLocal = BytecodeVerificationRemote;
850 }
851 ik->link_class(THREAD);
852 if (HAS_PENDING_EXCEPTION) {
853 ResourceMark rm;
854 tty->print_cr("Preload Error: Verification failed for %s",
855 ik->external_name());
856 CLEAR_PENDING_EXCEPTION;
857 ik->set_in_error_state();
858 _has_error_classes = true;
859 }
860 BytecodeVerificationLocal = saved;
861 return true;
862 } else {
863 return false;
864 }
865 }
866
867 // Closure for serializing initialization data in from a data area
868 // (ptr_array) read from the shared file.
869
870 class ReadClosure : public SerializeClosure {
871 private:
872 intptr_t** _ptr_array;
873
874 inline intptr_t nextPtr() {
|
834 }
835
836 // Returns true if the class's status has changed
837 bool MetaspaceShared::try_link_class(InstanceKlass* ik, TRAPS) {
838 assert(DumpSharedSpaces, "should only be called during dumping");
839 if (ik->init_state() < InstanceKlass::linked) {
840 bool saved = BytecodeVerificationLocal;
841 if (!SharedClassUtil::is_shared_boot_class(ik)) {
842 // The verification decision is based on BytecodeVerificationRemote
843 // for non-system classes. Since we are using the NULL classloader
844 // to load non-system classes during dumping, we need to temporarily
845 // change BytecodeVerificationLocal to be the same as
846 // BytecodeVerificationRemote. Note this can cause the parent system
847 // classes also being verified. The extra overhead is acceptable during
848 // dumping.
849 BytecodeVerificationLocal = BytecodeVerificationRemote;
850 }
851 ik->link_class(THREAD);
852 if (HAS_PENDING_EXCEPTION) {
853 ResourceMark rm;
854 tty->print_cr("Preload Warning: Verification failed for %s",
855 ik->external_name());
856 CLEAR_PENDING_EXCEPTION;
857 ik->set_in_error_state();
858 _has_error_classes = true;
859 }
860 BytecodeVerificationLocal = saved;
861 return true;
862 } else {
863 return false;
864 }
865 }
866
867 // Closure for serializing initialization data in from a data area
868 // (ptr_array) read from the shared file.
869
870 class ReadClosure : public SerializeClosure {
871 private:
872 intptr_t** _ptr_array;
873
874 inline intptr_t nextPtr() {
|