29 #include "classfile/classLoaderData.inline.hpp" |
29 #include "classfile/classLoaderData.inline.hpp" |
30 #include "classfile/defaultMethods.hpp" |
30 #include "classfile/defaultMethods.hpp" |
31 #include "classfile/javaClasses.hpp" |
31 #include "classfile/javaClasses.hpp" |
32 #include "classfile/symbolTable.hpp" |
32 #include "classfile/symbolTable.hpp" |
33 #include "classfile/systemDictionary.hpp" |
33 #include "classfile/systemDictionary.hpp" |
|
34 #if INCLUDE_CDS |
|
35 #include "classfile/systemDictionaryShared.hpp" |
|
36 #endif |
34 #include "classfile/verificationType.hpp" |
37 #include "classfile/verificationType.hpp" |
35 #include "classfile/verifier.hpp" |
38 #include "classfile/verifier.hpp" |
36 #include "classfile/vmSymbols.hpp" |
39 #include "classfile/vmSymbols.hpp" |
37 #include "memory/allocation.hpp" |
40 #include "memory/allocation.hpp" |
38 #include "memory/gcLocker.hpp" |
41 #include "memory/gcLocker.hpp" |
58 #include "runtime/timer.hpp" |
61 #include "runtime/timer.hpp" |
59 #include "services/classLoadingService.hpp" |
62 #include "services/classLoadingService.hpp" |
60 #include "services/threadService.hpp" |
63 #include "services/threadService.hpp" |
61 #include "utilities/array.hpp" |
64 #include "utilities/array.hpp" |
62 #include "utilities/globalDefinitions.hpp" |
65 #include "utilities/globalDefinitions.hpp" |
|
66 #include "utilities/ostream.hpp" |
63 |
67 |
64 // We generally try to create the oops directly when parsing, rather than |
68 // We generally try to create the oops directly when parsing, rather than |
65 // allocating temporary data structures and copying the bytes twice. A |
69 // allocating temporary data structures and copying the bytes twice. A |
66 // temporary area is only needed when parsing utf8 entries in the constant |
70 // temporary area is only needed when parsing utf8 entries in the constant |
67 // pool and when parsing line number tables. |
71 // pool and when parsing line number tables. |
3735 _cp_patches = cp_patches; |
3739 _cp_patches = cp_patches; |
3736 |
3740 |
3737 instanceKlassHandle nullHandle; |
3741 instanceKlassHandle nullHandle; |
3738 |
3742 |
3739 // Figure out whether we can skip format checking (matching classic VM behavior) |
3743 // Figure out whether we can skip format checking (matching classic VM behavior) |
3740 _need_verify = Verifier::should_verify_for(class_loader(), verify); |
3744 if (DumpSharedSpaces) { |
|
3745 // verify == true means it's a 'remote' class (i.e., non-boot class) |
|
3746 // Verification decision is based on BytecodeVerificationRemote flag |
|
3747 // for those classes. |
|
3748 _need_verify = (verify) ? BytecodeVerificationRemote : |
|
3749 BytecodeVerificationLocal; |
|
3750 } else { |
|
3751 _need_verify = Verifier::should_verify_for(class_loader(), verify); |
|
3752 } |
3741 |
3753 |
3742 // Set the verify flag in stream |
3754 // Set the verify flag in stream |
3743 cfs->set_verify(_need_verify); |
3755 cfs->set_verify(_need_verify); |
3744 |
3756 |
3745 // Save the class file name for easier error message printing. |
3757 // Save the class file name for easier error message printing. |
3753 magic, CHECK_(nullHandle)); |
3765 magic, CHECK_(nullHandle)); |
3754 |
3766 |
3755 // Version numbers |
3767 // Version numbers |
3756 u2 minor_version = cfs->get_u2_fast(); |
3768 u2 minor_version = cfs->get_u2_fast(); |
3757 u2 major_version = cfs->get_u2_fast(); |
3769 u2 major_version = cfs->get_u2_fast(); |
|
3770 |
|
3771 if (DumpSharedSpaces && major_version < JAVA_1_5_VERSION) { |
|
3772 ResourceMark rm; |
|
3773 warning("Pre JDK 1.5 class not supported by CDS: %u.%u %s", |
|
3774 major_version, minor_version, name->as_C_string()); |
|
3775 Exceptions::fthrow( |
|
3776 THREAD_AND_LOCATION, |
|
3777 vmSymbols::java_lang_UnsupportedClassVersionError(), |
|
3778 "Unsupported major.minor version for dump time %u.%u", |
|
3779 major_version, |
|
3780 minor_version); |
|
3781 } |
3758 |
3782 |
3759 // Check version numbers - we check this even with verifier off |
3783 // Check version numbers - we check this even with verifier off |
3760 if (!is_supported_version(major_version, minor_version)) { |
3784 if (!is_supported_version(major_version, minor_version)) { |
3761 if (name == NULL) { |
3785 if (name == NULL) { |
3762 Exceptions::fthrow( |
3786 Exceptions::fthrow( |
3861 if (TraceClassLoadingPreorder) { |
3885 if (TraceClassLoadingPreorder) { |
3862 tty->print("[Loading %s", (name != NULL) ? name->as_klass_external_name() : "NoName"); |
3886 tty->print("[Loading %s", (name != NULL) ? name->as_klass_external_name() : "NoName"); |
3863 if (cfs->source() != NULL) tty->print(" from %s", cfs->source()); |
3887 if (cfs->source() != NULL) tty->print(" from %s", cfs->source()); |
3864 tty->print_cr("]"); |
3888 tty->print_cr("]"); |
3865 } |
3889 } |
|
3890 #if INCLUDE_CDS |
|
3891 if (DumpLoadedClassList != NULL && cfs->source() != NULL && classlist_file->is_open()) { |
|
3892 // Only dump the classes that can be stored into CDS archive |
|
3893 if (SystemDictionaryShared::is_sharing_possible(loader_data)) { |
|
3894 if (name != NULL) { |
|
3895 ResourceMark rm(THREAD); |
|
3896 classlist_file->print_cr("%s", name->as_C_string()); |
|
3897 classlist_file->flush(); |
|
3898 } |
|
3899 } |
|
3900 } |
|
3901 #endif |
3866 |
3902 |
3867 u2 super_class_index = cfs->get_u2_fast(); |
3903 u2 super_class_index = cfs->get_u2_fast(); |
3868 instanceKlassHandle super_klass = parse_super_class(super_class_index, |
3904 instanceKlassHandle super_klass = parse_super_class(super_class_index, |
3869 CHECK_NULL); |
3905 CHECK_NULL); |
3870 |
3906 |