1091 //
1092 // Here are the native methods in java.lang.invoke.MethodHandleNatives
1093 // They are the private interface between this JVM and the HotSpot-specific
1094 // Java code that implements JSR 292 method handles.
1095 //
1096 // Note: We use a JVM_ENTRY macro to define each of these, for this is the way
1097 // that intrinsic (non-JNI) native methods are defined in HotSpot.
1098 //
1099
1100 #ifndef PRODUCT
1101 #define EACH_NAMED_CON(template, requirement) \
1102 template(java_lang_invoke_MemberName,MN_IS_METHOD) \
1103 template(java_lang_invoke_MemberName,MN_IS_CONSTRUCTOR) \
1104 template(java_lang_invoke_MemberName,MN_IS_FIELD) \
1105 template(java_lang_invoke_MemberName,MN_IS_TYPE) \
1106 template(java_lang_invoke_MemberName,MN_CALLER_SENSITIVE) \
1107 template(java_lang_invoke_MemberName,MN_SEARCH_SUPERCLASSES) \
1108 template(java_lang_invoke_MemberName,MN_SEARCH_INTERFACES) \
1109 template(java_lang_invoke_MemberName,MN_REFERENCE_KIND_SHIFT) \
1110 template(java_lang_invoke_MemberName,MN_REFERENCE_KIND_MASK) \
1111 /*end*/
1112
1113 #define IGNORE_REQ(req_expr) /* req_expr */
1114 #define ONE_PLUS(scope,value) 1+
1115 static const int con_value_count = EACH_NAMED_CON(ONE_PLUS, IGNORE_REQ) 0;
1116 #define VALUE_COMMA(scope,value) scope::value,
1117 static const int con_values[con_value_count+1] = { EACH_NAMED_CON(VALUE_COMMA, IGNORE_REQ) 0 };
1118 #define STRING_NULL(scope,value) #value "\0"
1119 static const char con_names[] = { EACH_NAMED_CON(STRING_NULL, IGNORE_REQ) };
1120
1121 static bool advertise_con_value(int which) {
1122 if (which < 0) return false;
1123 bool ok = true;
1124 int count = 0;
1125 #define INC_COUNT(scope,value) \
1126 ++count;
1127 #define CHECK_REQ(req_expr) \
1128 if (which < count) return ok; \
1129 ok = (req_expr);
1130 EACH_NAMED_CON(INC_COUNT, CHECK_REQ);
|
1091 //
1092 // Here are the native methods in java.lang.invoke.MethodHandleNatives
1093 // They are the private interface between this JVM and the HotSpot-specific
1094 // Java code that implements JSR 292 method handles.
1095 //
1096 // Note: We use a JVM_ENTRY macro to define each of these, for this is the way
1097 // that intrinsic (non-JNI) native methods are defined in HotSpot.
1098 //
1099
1100 #ifndef PRODUCT
1101 #define EACH_NAMED_CON(template, requirement) \
1102 template(java_lang_invoke_MemberName,MN_IS_METHOD) \
1103 template(java_lang_invoke_MemberName,MN_IS_CONSTRUCTOR) \
1104 template(java_lang_invoke_MemberName,MN_IS_FIELD) \
1105 template(java_lang_invoke_MemberName,MN_IS_TYPE) \
1106 template(java_lang_invoke_MemberName,MN_CALLER_SENSITIVE) \
1107 template(java_lang_invoke_MemberName,MN_SEARCH_SUPERCLASSES) \
1108 template(java_lang_invoke_MemberName,MN_SEARCH_INTERFACES) \
1109 template(java_lang_invoke_MemberName,MN_REFERENCE_KIND_SHIFT) \
1110 template(java_lang_invoke_MemberName,MN_REFERENCE_KIND_MASK) \
1111 template(java_lang_invoke_MemberName,MN_NESTMATE_CLASS) \
1112 template(java_lang_invoke_MemberName,MN_HIDDEN_CLASS) \
1113 template(java_lang_invoke_MemberName,MN_STRONG_LOADER_LINK) \
1114 template(java_lang_invoke_MemberName,MN_ACCESS_VM_ANNOTATIONS) \
1115 /*end*/
1116
1117 #define IGNORE_REQ(req_expr) /* req_expr */
1118 #define ONE_PLUS(scope,value) 1+
1119 static const int con_value_count = EACH_NAMED_CON(ONE_PLUS, IGNORE_REQ) 0;
1120 #define VALUE_COMMA(scope,value) scope::value,
1121 static const int con_values[con_value_count+1] = { EACH_NAMED_CON(VALUE_COMMA, IGNORE_REQ) 0 };
1122 #define STRING_NULL(scope,value) #value "\0"
1123 static const char con_names[] = { EACH_NAMED_CON(STRING_NULL, IGNORE_REQ) };
1124
1125 static bool advertise_con_value(int which) {
1126 if (which < 0) return false;
1127 bool ok = true;
1128 int count = 0;
1129 #define INC_COUNT(scope,value) \
1130 ++count;
1131 #define CHECK_REQ(req_expr) \
1132 if (which < count) return ok; \
1133 ok = (req_expr);
1134 EACH_NAMED_CON(INC_COUNT, CHECK_REQ);
|