995 loader_data = ClassLoaderData::class_loader_data(class_loader());
996 }
997
998 assert(st != NULL, "invariant");
999 assert(st->need_verify(), "invariant");
1000
1001 // Parse stream and create a klass.
1002 // Note that we do this even though this klass might
1003 // already be present in the SystemDictionary, otherwise we would not
1004 // throw potential ClassFormatErrors.
1005
1006 InstanceKlass* k = KlassFactory::create_from_stream(st,
1007 class_name,
1008 loader_data,
1009 protection_domain,
1010 host_klass,
1011 cp_patches,
1012 CHECK_NULL);
1013
1014 if (host_klass != NULL && k != NULL) {
1015 // If it's anonymous, initialize it now, since nobody else will.
1016
1017 {
1018 MutexLocker mu_r(Compile_lock, THREAD);
1019
1020 // Add to class hierarchy, initialize vtables, and do possible
1021 // deoptimizations.
1022 add_to_hierarchy(k, CHECK_NULL); // No exception, but can block
1023
1024 // But, do not add to dictionary.
1025
1026 // compiled code dependencies need to be validated anyway
1027 notice_modification();
1028 }
1029
1030 // Rewrite and patch constant pool here.
1031 k->link_class(CHECK_NULL);
1032 if (cp_patches != NULL) {
1033 k->constants()->patch_resolved_references(cp_patches);
1034 }
1035 k->eager_initialize(CHECK_NULL);
1036
1037 // notify jvmti
1038 if (JvmtiExport::should_post_class_load()) {
1039 assert(THREAD->is_Java_thread(), "thread->is_Java_thread()");
1040 JvmtiExport::post_class_load((JavaThread *) THREAD, k);
1041 }
1042
1043 post_class_load_event(&class_load_start_event, k, loader_data);
1044 }
1045 assert(host_klass != NULL || NULL == cp_patches,
1046 "cp_patches only found with host_klass");
1047
1048 return k;
1049 }
1050
1051 // Add a klass to the system from a stream (called by jni_DefineClass and
1052 // JVM_DefineClass).
1053 // Note: class_name can be NULL. In that case we do not know the name of
1054 // the class until we have parsed the stream.
|
995 loader_data = ClassLoaderData::class_loader_data(class_loader());
996 }
997
998 assert(st != NULL, "invariant");
999 assert(st->need_verify(), "invariant");
1000
1001 // Parse stream and create a klass.
1002 // Note that we do this even though this klass might
1003 // already be present in the SystemDictionary, otherwise we would not
1004 // throw potential ClassFormatErrors.
1005
1006 InstanceKlass* k = KlassFactory::create_from_stream(st,
1007 class_name,
1008 loader_data,
1009 protection_domain,
1010 host_klass,
1011 cp_patches,
1012 CHECK_NULL);
1013
1014 if (host_klass != NULL && k != NULL) {
1015 // Anonymous classes must update ClassLoaderData holder (was host_klass loader)
1016 // so that they can be unloaded when the mirror is no longer referenced.
1017 k->class_loader_data()->update_holder(Handle(THREAD, k->java_mirror()));
1018
1019 {
1020 MutexLocker mu_r(Compile_lock, THREAD);
1021
1022 // Add to class hierarchy, initialize vtables, and do possible
1023 // deoptimizations.
1024 add_to_hierarchy(k, CHECK_NULL); // No exception, but can block
1025
1026 // But, do not add to dictionary.
1027
1028 // compiled code dependencies need to be validated anyway
1029 notice_modification();
1030 }
1031
1032 // Rewrite and patch constant pool here.
1033 k->link_class(CHECK_NULL);
1034 if (cp_patches != NULL) {
1035 k->constants()->patch_resolved_references(cp_patches);
1036 }
1037
1038 // If it's anonymous, initialize it now, since nobody else will.
1039 k->eager_initialize(CHECK_NULL);
1040
1041 // notify jvmti
1042 if (JvmtiExport::should_post_class_load()) {
1043 assert(THREAD->is_Java_thread(), "thread->is_Java_thread()");
1044 JvmtiExport::post_class_load((JavaThread *) THREAD, k);
1045 }
1046
1047 post_class_load_event(&class_load_start_event, k, loader_data);
1048 }
1049 assert(host_klass != NULL || NULL == cp_patches,
1050 "cp_patches only found with host_klass");
1051
1052 return k;
1053 }
1054
1055 // Add a klass to the system from a stream (called by jni_DefineClass and
1056 // JVM_DefineClass).
1057 // Note: class_name can be NULL. In that case we do not know the name of
1058 // the class until we have parsed the stream.
|