@@ -3014,8 +3014,9 @@ C2V_VMENTRY_NULL(jobject, asReflectionField, (JNIEnv* env, jobject, ARGUMENT_PAI
3014
3014
return JNIHandles::make_local(THREAD, reflected);
3015
3015
C2V_END
3016
3016
3017
- static jbyteArray get_encoded_annotation_values (InstanceKlass* holder, AnnotationArray* annotations_array, jint category,
3018
- JavaThread* THREAD, JVMCI_TRAPS) {
3017
+ static jbyteArray get_encoded_annotation_values (InstanceKlass* holder, AnnotationArray* annotations_array,
3018
+ jint category, Klass* memberType,
3019
+ JavaThread* THREAD, JVMCI_TRAPS) {
3019
3020
// Get a ConstantPool object for annotation parsing
3020
3021
Handle jcp = reflect_ConstantPool::create (CHECK_NULL);
3021
3022
reflect_ConstantPool::set_cp (jcp (), holder->constants ());
@@ -3031,6 +3032,10 @@ static jbyteArray get_encoded_annotation_values(InstanceKlass* holder, Annotatio
3031
3032
3032
3033
typeArrayOop annotations_oop = Annotations::make_java_array (annotations_array, CHECK_NULL);
3033
3034
typeArrayHandle annotations = typeArrayHandle (THREAD, annotations_oop);
3035
+ Handle memberTypeMirror;
3036
+ if (memberType != nullptr ) {
3037
+ memberTypeMirror = Handle (THREAD, memberType->java_mirror ());
3038
+ }
3034
3039
3035
3040
// invoke VMSupport.encodeAnnotations
3036
3041
JavaValue result (T_OBJECT);
@@ -3039,6 +3044,7 @@ static jbyteArray get_encoded_annotation_values(InstanceKlass* holder, Annotatio
3039
3044
args.push_int (category);
3040
3045
args.push_oop (Handle (THREAD, holder->java_mirror ()));
3041
3046
args.push_oop (jcp);
3047
+ args.push_oop (memberTypeMirror);
3042
3048
Symbol* signature = vmSymbols::encodeAnnotations_signature ();
3043
3049
JavaCalls::call_static (&result,
3044
3050
vm_support,
@@ -3078,23 +3084,27 @@ C2V_VMENTRY_NULL(jbyteArray, getEncodedClassAnnotationValues, (JNIEnv* env, jobj
3078
3084
THROW_MSG_NULL (vmSymbols::java_lang_IllegalArgumentException (),
3079
3085
err_msg (" %d" , category));
3080
3086
}
3081
- return get_encoded_annotation_values(holder, raw_annotations, category, THREAD, JVMCIENV);
3087
+ return get_encoded_annotation_values(holder, raw_annotations, category, nullptr , THREAD, JVMCIENV);
3082
3088
C2V_END
3083
3089
3084
- C2V_VMENTRY_NULL (jbyteArray, getEncodedExecutableAnnotationValues, (JNIEnv* env, jobject, ARGUMENT_PAIR(method), jint category))
3090
+ C2V_VMENTRY_NULL (jbyteArray, getEncodedExecutableAnnotationValues, (JNIEnv* env, jobject, ARGUMENT_PAIR(method), ARGUMENT_PAIR(memberTypeKlass), jint category))
3085
3091
CompilerThreadCanCallJava canCallJava(thread, true ); // Requires Java support
3086
3092
methodHandle method (THREAD, UNPACK_PAIR(Method, method));
3087
3093
AnnotationArray* raw_annotations;
3094
+ Klass* memberType = nullptr ;
3088
3095
if (category == CompilerToVM::DECLARED_ANNOTATIONS) {
3089
3096
raw_annotations = method->annotations ();
3090
3097
} else if (category == CompilerToVM::PARAMETER_ANNOTATIONS) {
3091
3098
raw_annotations = method->parameter_annotations ();
3092
3099
} else if (category == CompilerToVM::TYPE_ANNOTATIONS) {
3093
3100
raw_annotations = method->type_annotations ();
3101
+ } else if (category == CompilerToVM::ANNOTATION_MEMBER_VALUE) {
3102
+ raw_annotations = method->annotation_default ();
3103
+ memberType = UNPACK_PAIR (Klass, memberTypeKlass);
3094
3104
} else {
3095
3105
THROW_MSG_NULL (vmSymbols::java_lang_IllegalArgumentException (), err_msg (" %d" , category));
3096
3106
}
3097
- return get_encoded_annotation_values(method->method_holder (), raw_annotations, category, THREAD, JVMCIENV);
3107
+ return get_encoded_annotation_values(method->method_holder (), raw_annotations, category, memberType, THREAD, JVMCIENV);
3098
3108
C2V_END
3099
3109
3100
3110
C2V_VMENTRY_NULL (jbyteArray, getEncodedFieldAnnotationValues, (JNIEnv* env, jobject, ARGUMENT_PAIR(klass), jint index, jint category))
@@ -3110,7 +3120,7 @@ C2V_VMENTRY_NULL(jbyteArray, getEncodedFieldAnnotationValues, (JNIEnv* env, jobj
3110
3120
THROW_MSG_NULL (vmSymbols::java_lang_IllegalArgumentException (),
3111
3121
err_msg (" %d" , category));
3112
3122
}
3113
- return get_encoded_annotation_values(holder, raw_annotations, category, THREAD, JVMCIENV);
3123
+ return get_encoded_annotation_values(holder, raw_annotations, category, nullptr , THREAD, JVMCIENV);
3114
3124
C2V_END
3115
3125
3116
3126
C2V_VMENTRY_NULL (jobjectArray, getFailedSpeculations, (JNIEnv* env, jobject, jlong failed_speculations_address, jobjectArray current))
@@ -3455,7 +3465,7 @@ JNINativeMethod CompilerToVM::methods[] = {
3455
3465
{CC " asReflectionExecutable" , CC " (" HS_METHOD2 " )" REFLECTION_EXECUTABLE, FN_PTR (asReflectionExecutable)},
3456
3466
{CC " asReflectionField" , CC " (" HS_KLASS2 " I)" REFLECTION_FIELD, FN_PTR (asReflectionField)},
3457
3467
{CC " getEncodedClassAnnotationValues" , CC " (" HS_KLASS2 " I)[B" , FN_PTR (getEncodedClassAnnotationValues)},
3458
- {CC " getEncodedExecutableAnnotationValues" , CC " (" HS_METHOD2 " I)[B" , FN_PTR (getEncodedExecutableAnnotationValues)},
3468
+ {CC " getEncodedExecutableAnnotationValues" , CC " (" HS_METHOD2 HS_KLASS2 " I)[B" , FN_PTR (getEncodedExecutableAnnotationValues)},
3459
3469
{CC " getEncodedFieldAnnotationValues" , CC " (" HS_KLASS2 " II)[B" , FN_PTR (getEncodedFieldAnnotationValues)},
3460
3470
{CC " getFailedSpeculations" , CC " (J[[B)[[B" , FN_PTR (getFailedSpeculations)},
3461
3471
{CC " getFailedSpeculationsAddress" , CC " (" HS_METHOD2 " )J" , FN_PTR (getFailedSpeculationsAddress)},
0 commit comments