3700 _fields,
3701 _cp,
3702 instance_size,
3703 nonstatic_fields_start,
3704 nonstatic_fields_end,
3705 static_fields_end);
3706 }
3707
3708 #endif
3709 // Pass back information needed for InstanceKlass creation
3710 info->nonstatic_oop_offsets = nonstatic_oop_offsets;
3711 info->nonstatic_oop_counts = nonstatic_oop_counts;
3712 info->nonstatic_oop_map_count = nonstatic_oop_map_count;
3713 info->total_oop_map_count = total_oop_map_count;
3714 info->instance_size = instance_size;
3715 info->static_field_size = static_field_size;
3716 info->nonstatic_field_size = nonstatic_field_size;
3717 info->has_nonstatic_fields = has_nonstatic_fields;
3718 }
3719
3720
3721 instanceKlassHandle ClassFileParser::parseClassFile(Symbol* name,
3722 ClassLoaderData* loader_data,
3723 Handle protection_domain,
3724 KlassHandle host_klass,
3725 GrowableArray<Handle>* cp_patches,
3726 TempNewSymbol& parsed_name,
3727 bool verify,
3728 TRAPS) {
3729
3730 // When a retransformable agent is attached, JVMTI caches the
3731 // class bytes that existed before the first retransformation.
3732 // If RedefineClasses() was used before the retransformable
3733 // agent attached, then the cached class bytes may not be the
3734 // original class bytes.
3735 JvmtiCachedClassFileData *cached_class_file = NULL;
3736 Handle class_loader(THREAD, loader_data->class_loader());
3737 bool has_default_methods = false;
3738 bool declares_default_methods = false;
3739 ResourceMark rm(THREAD);
3846 Exceptions::fthrow(
3847 THREAD_AND_LOCATION,
3848 vmSymbols::java_lang_UnsupportedClassVersionError(),
3849 "%s has been compiled by a more recent version of the Java Runtime (class file version %u.%u), "
3850 "this version of the Java Runtime only recognizes class file versions up to %u.%u",
3851 name->as_C_string(),
3852 major_version,
3853 minor_version,
3854 JAVA_MAX_SUPPORTED_VERSION,
3855 JAVA_MAX_SUPPORTED_MINOR_VERSION);
3856 }
3857 return nullHandle;
3858 }
3859
3860 _major_version = major_version;
3861 _minor_version = minor_version;
3862
3863
3864 // Check if verification needs to be relaxed for this class file
3865 // Do not restrict it to jdk1.0 or jdk1.1 to maintain backward compatibility (4982376)
3866 _relax_verify = Verifier::relax_verify_for(class_loader());
3867
3868 // Constant pool
3869 constantPoolHandle cp = parse_constant_pool(CHECK_(nullHandle));
3870
3871 int cp_size = cp->length();
3872
3873 cfs->guarantee_more(8, CHECK_(nullHandle)); // flags, this_class, super_class, infs_len
3874
3875 // Access flags
3876 AccessFlags access_flags;
3877 jint flags = cfs->get_u2_fast() & JVM_RECOGNIZED_CLASS_MODIFIERS;
3878
3879 if ((flags & JVM_ACC_INTERFACE) && _major_version < JAVA_6_VERSION) {
3880 // Set abstract bit for old class files for backward compatibility
3881 flags |= JVM_ACC_ABSTRACT;
3882 }
3883 verify_legal_class_modifiers(flags, CHECK_(nullHandle));
3884 access_flags.set_flags(flags);
3885
3886 // This class and superclass
|
3700 _fields,
3701 _cp,
3702 instance_size,
3703 nonstatic_fields_start,
3704 nonstatic_fields_end,
3705 static_fields_end);
3706 }
3707
3708 #endif
3709 // Pass back information needed for InstanceKlass creation
3710 info->nonstatic_oop_offsets = nonstatic_oop_offsets;
3711 info->nonstatic_oop_counts = nonstatic_oop_counts;
3712 info->nonstatic_oop_map_count = nonstatic_oop_map_count;
3713 info->total_oop_map_count = total_oop_map_count;
3714 info->instance_size = instance_size;
3715 info->static_field_size = static_field_size;
3716 info->nonstatic_field_size = nonstatic_field_size;
3717 info->has_nonstatic_fields = has_nonstatic_fields;
3718 }
3719
3720 static bool relax_format_check_for(ClassLoaderData* loader_data) {
3721 bool trusted = (loader_data->is_the_null_class_loader_data() ||
3722 SystemDictionary::is_ext_class_loader(loader_data->class_loader()));
3723 bool need_verify =
3724 // verifyAll
3725 (BytecodeVerificationLocal && BytecodeVerificationRemote) ||
3726 // verifyRemote
3727 (!BytecodeVerificationLocal && BytecodeVerificationRemote && !trusted);
3728 return !need_verify;
3729 }
3730
3731 instanceKlassHandle ClassFileParser::parseClassFile(Symbol* name,
3732 ClassLoaderData* loader_data,
3733 Handle protection_domain,
3734 KlassHandle host_klass,
3735 GrowableArray<Handle>* cp_patches,
3736 TempNewSymbol& parsed_name,
3737 bool verify,
3738 TRAPS) {
3739
3740 // When a retransformable agent is attached, JVMTI caches the
3741 // class bytes that existed before the first retransformation.
3742 // If RedefineClasses() was used before the retransformable
3743 // agent attached, then the cached class bytes may not be the
3744 // original class bytes.
3745 JvmtiCachedClassFileData *cached_class_file = NULL;
3746 Handle class_loader(THREAD, loader_data->class_loader());
3747 bool has_default_methods = false;
3748 bool declares_default_methods = false;
3749 ResourceMark rm(THREAD);
3856 Exceptions::fthrow(
3857 THREAD_AND_LOCATION,
3858 vmSymbols::java_lang_UnsupportedClassVersionError(),
3859 "%s has been compiled by a more recent version of the Java Runtime (class file version %u.%u), "
3860 "this version of the Java Runtime only recognizes class file versions up to %u.%u",
3861 name->as_C_string(),
3862 major_version,
3863 minor_version,
3864 JAVA_MAX_SUPPORTED_VERSION,
3865 JAVA_MAX_SUPPORTED_MINOR_VERSION);
3866 }
3867 return nullHandle;
3868 }
3869
3870 _major_version = major_version;
3871 _minor_version = minor_version;
3872
3873
3874 // Check if verification needs to be relaxed for this class file
3875 // Do not restrict it to jdk1.0 or jdk1.1 to maintain backward compatibility (4982376)
3876 _relax_verify = relax_format_check_for(_loader_data);
3877
3878 // Constant pool
3879 constantPoolHandle cp = parse_constant_pool(CHECK_(nullHandle));
3880
3881 int cp_size = cp->length();
3882
3883 cfs->guarantee_more(8, CHECK_(nullHandle)); // flags, this_class, super_class, infs_len
3884
3885 // Access flags
3886 AccessFlags access_flags;
3887 jint flags = cfs->get_u2_fast() & JVM_RECOGNIZED_CLASS_MODIFIERS;
3888
3889 if ((flags & JVM_ACC_INTERFACE) && _major_version < JAVA_6_VERSION) {
3890 // Set abstract bit for old class files for backward compatibility
3891 flags |= JVM_ACC_ABSTRACT;
3892 }
3893 verify_legal_class_modifiers(flags, CHECK_(nullHandle));
3894 access_flags.set_flags(flags);
3895
3896 // This class and superclass
|