1194 } |
1194 } |
1195 java_lang_invoke_CallSite::set_target_volatile(call_site(), target()); |
1195 java_lang_invoke_CallSite::set_target_volatile(call_site(), target()); |
1196 } |
1196 } |
1197 JVM_END |
1197 JVM_END |
1198 |
1198 |
1199 JVM_ENTRY(jobject, MH_invoke_UOE(JNIEnv *env, jobject igmh, jobjectArray igargs)) { |
|
1200 TempNewSymbol UOE_name = SymbolTable::new_symbol("java/lang/UnsupportedOperationException", CHECK_NULL); |
|
1201 THROW_MSG_NULL(UOE_name, "MethodHandle.invoke cannot be invoked reflectively"); |
|
1202 return NULL; |
|
1203 } |
|
1204 JVM_END |
|
1205 |
|
1206 JVM_ENTRY(jobject, MH_invokeExact_UOE(JNIEnv *env, jobject igmh, jobjectArray igargs)) { |
|
1207 TempNewSymbol UOE_name = SymbolTable::new_symbol("java/lang/UnsupportedOperationException", CHECK_NULL); |
|
1208 THROW_MSG_NULL(UOE_name, "MethodHandle.invokeExact cannot be invoked reflectively"); |
|
1209 return NULL; |
|
1210 } |
|
1211 JVM_END |
|
1212 |
|
1213 |
|
1214 /// JVM_RegisterMethodHandleMethods |
1199 /// JVM_RegisterMethodHandleMethods |
1215 |
1200 |
1216 #undef CS // Solaris builds complain |
1201 #undef CS // Solaris builds complain |
1217 |
1202 |
1218 #define LANG "Ljava/lang/" |
1203 #define LANG "Ljava/lang/" |
1246 {CC"staticFieldOffset", CC"("MEM")J", FN_PTR(MHN_staticFieldOffset)}, |
1231 {CC"staticFieldOffset", CC"("MEM")J", FN_PTR(MHN_staticFieldOffset)}, |
1247 {CC"staticFieldBase", CC"("MEM")"OBJ, FN_PTR(MHN_staticFieldBase)}, |
1232 {CC"staticFieldBase", CC"("MEM")"OBJ, FN_PTR(MHN_staticFieldBase)}, |
1248 {CC"getMemberVMInfo", CC"("MEM")"OBJ, FN_PTR(MHN_getMemberVMInfo)} |
1233 {CC"getMemberVMInfo", CC"("MEM")"OBJ, FN_PTR(MHN_getMemberVMInfo)} |
1249 }; |
1234 }; |
1250 |
1235 |
1251 static JNINativeMethod invoke_methods[] = { |
|
1252 {CC"invoke", CC"(["OBJ")"OBJ, FN_PTR(MH_invoke_UOE)}, |
|
1253 {CC"invokeExact", CC"(["OBJ")"OBJ, FN_PTR(MH_invokeExact_UOE)} |
|
1254 }; |
|
1255 |
|
1256 // This one function is exported, used by NativeLookup. |
1236 // This one function is exported, used by NativeLookup. |
1257 |
1237 |
1258 JVM_ENTRY(void, JVM_RegisterMethodHandleMethods(JNIEnv *env, jclass MHN_class)) { |
1238 JVM_ENTRY(void, JVM_RegisterMethodHandleMethods(JNIEnv *env, jclass MHN_class)) { |
1259 if (!EnableInvokeDynamic) { |
1239 if (!EnableInvokeDynamic) { |
1260 warning("JSR 292 is disabled in this JVM. Use -XX:+UnlockDiagnosticVMOptions -XX:+EnableInvokeDynamic to enable."); |
1240 warning("JSR 292 is disabled in this JVM. Use -XX:+UnlockDiagnosticVMOptions -XX:+EnableInvokeDynamic to enable."); |
1276 |
1256 |
1277 if (enable_MH) { |
1257 if (enable_MH) { |
1278 ThreadToNativeFromVM ttnfv(thread); |
1258 ThreadToNativeFromVM ttnfv(thread); |
1279 |
1259 |
1280 status = env->RegisterNatives(MHN_class, required_methods_JDK8, sizeof(required_methods_JDK8)/sizeof(JNINativeMethod)); |
1260 status = env->RegisterNatives(MHN_class, required_methods_JDK8, sizeof(required_methods_JDK8)/sizeof(JNINativeMethod)); |
1281 if (status == JNI_OK && !env->ExceptionOccurred()) { |
|
1282 status = env->RegisterNatives(MH_class, invoke_methods, sizeof(invoke_methods)/sizeof(JNINativeMethod)); |
|
1283 } |
|
1284 if (status != JNI_OK || env->ExceptionOccurred()) { |
1261 if (status != JNI_OK || env->ExceptionOccurred()) { |
1285 warning("JSR 292 method handle code is mismatched to this JVM. Disabling support."); |
1262 warning("JSR 292 method handle code is mismatched to this JVM. Disabling support."); |
1286 enable_MH = false; |
1263 enable_MH = false; |
1287 env->ExceptionClear(); |
1264 env->ExceptionClear(); |
1288 } |
1265 } |