8005994: Method annotations are allocated unnecessarily during class file parsing

Also reviewed by: vitalyd@gmail.com

Reviewed-by: coleenp, acorn
This commit is contained in:
Stefan Karlsson 2013-01-15 10:09:45 +01:00
parent 67fc68ea7f
commit 9d65c6d24f
2 changed files with 34 additions and 20 deletions

View file

@ -1582,8 +1582,11 @@ JVM_ENTRY(jbyteArray, JVM_GetClassTypeAnnotations(JNIEnv *env, jclass cls))
if (!java_lang_Class::is_primitive(JNIHandles::resolve(cls))) {
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(cls));
if (k->oop_is_instance()) {
typeArrayOop a = Annotations::make_java_array(InstanceKlass::cast(k)->type_annotations()->class_annotations(), CHECK_NULL);
return (jbyteArray) JNIHandles::make_local(env, a);
Annotations* type_annotations = InstanceKlass::cast(k)->type_annotations();
if (type_annotations != NULL) {
typeArrayOop a = Annotations::make_java_array(type_annotations->class_annotations(), CHECK_NULL);
return (jbyteArray) JNIHandles::make_local(env, a);
}
}
}
return NULL;