comparison src/share/vm/prims/methodHandles.cpp @ 6729:d17383603741

7196120: NPG: JSR 2292 test fails because missing fix for 7188911 Reviewed-by: kvn, coleenp
author twisti
date Tue, 04 Sep 2012 18:01:20 -0700
parents da91efe96a93
children 19eb999cb72c
comparison
equal deleted inserted replaced
6728:ca11db66f9de 6729:d17383603741
1192 } 1192 }
1193 java_lang_invoke_CallSite::set_target_volatile(call_site(), target()); 1193 java_lang_invoke_CallSite::set_target_volatile(call_site(), target());
1194 } 1194 }
1195 JVM_END 1195 JVM_END
1196 1196
1197 JVM_ENTRY(jobject, MH_invoke_UOE(JNIEnv *env, jobject igmh, jobjectArray igargs)) {
1198 TempNewSymbol UOE_name = SymbolTable::new_symbol("java/lang/UnsupportedOperationException", CHECK_NULL);
1199 THROW_MSG_NULL(UOE_name, "MethodHandle.invoke cannot be invoked reflectively");
1200 return NULL;
1201 }
1202 JVM_END
1203
1204 JVM_ENTRY(jobject, MH_invokeExact_UOE(JNIEnv *env, jobject igmh, jobjectArray igargs)) {
1205 TempNewSymbol UOE_name = SymbolTable::new_symbol("java/lang/UnsupportedOperationException", CHECK_NULL);
1206 THROW_MSG_NULL(UOE_name, "MethodHandle.invokeExact cannot be invoked reflectively");
1207 return NULL;
1208 }
1209 JVM_END
1210
1211 /// JVM_RegisterMethodHandleMethods 1197 /// JVM_RegisterMethodHandleMethods
1212 1198
1213 #undef CS // Solaris builds complain 1199 #undef CS // Solaris builds complain
1214 1200
1215 #define LANG "Ljava/lang/" 1201 #define LANG "Ljava/lang/"
1243 {CC"staticFieldOffset", CC"("MEM")J", FN_PTR(MHN_staticFieldOffset)}, 1229 {CC"staticFieldOffset", CC"("MEM")J", FN_PTR(MHN_staticFieldOffset)},
1244 {CC"staticFieldBase", CC"("MEM")"OBJ, FN_PTR(MHN_staticFieldBase)}, 1230 {CC"staticFieldBase", CC"("MEM")"OBJ, FN_PTR(MHN_staticFieldBase)},
1245 {CC"getMemberVMInfo", CC"("MEM")"OBJ, FN_PTR(MHN_getMemberVMInfo)} 1231 {CC"getMemberVMInfo", CC"("MEM")"OBJ, FN_PTR(MHN_getMemberVMInfo)}
1246 }; 1232 };
1247 1233
1248 static JNINativeMethod invoke_methods[] = {
1249 {CC"invoke", CC"(["OBJ")"OBJ, FN_PTR(MH_invoke_UOE)},
1250 {CC"invokeExact", CC"(["OBJ")"OBJ, FN_PTR(MH_invokeExact_UOE)}
1251 };
1252
1253 // This one function is exported, used by NativeLookup. 1234 // This one function is exported, used by NativeLookup.
1254 1235
1255 JVM_ENTRY(void, JVM_RegisterMethodHandleMethods(JNIEnv *env, jclass MHN_class)) { 1236 JVM_ENTRY(void, JVM_RegisterMethodHandleMethods(JNIEnv *env, jclass MHN_class)) {
1256 if (!EnableInvokeDynamic) { 1237 if (!EnableInvokeDynamic) {
1257 warning("JSR 292 is disabled in this JVM. Use -XX:+UnlockDiagnosticVMOptions -XX:+EnableInvokeDynamic to enable."); 1238 warning("JSR 292 is disabled in this JVM. Use -XX:+UnlockDiagnosticVMOptions -XX:+EnableInvokeDynamic to enable.");
1273 1254
1274 if (enable_MH) { 1255 if (enable_MH) {
1275 ThreadToNativeFromVM ttnfv(thread); 1256 ThreadToNativeFromVM ttnfv(thread);
1276 1257
1277 status = env->RegisterNatives(MHN_class, required_methods_JDK8, sizeof(required_methods_JDK8)/sizeof(JNINativeMethod)); 1258 status = env->RegisterNatives(MHN_class, required_methods_JDK8, sizeof(required_methods_JDK8)/sizeof(JNINativeMethod));
1278 if (status == JNI_OK && !env->ExceptionOccurred()) {
1279 status = env->RegisterNatives(MH_class, invoke_methods, sizeof(invoke_methods)/sizeof(JNINativeMethod));
1280 }
1281 if (status != JNI_OK || env->ExceptionOccurred()) { 1259 if (status != JNI_OK || env->ExceptionOccurred()) {
1282 warning("JSR 292 method handle code is mismatched to this JVM. Disabling support."); 1260 warning("JSR 292 method handle code is mismatched to this JVM. Disabling support.");
1283 enable_MH = false; 1261 enable_MH = false;
1284 env->ExceptionClear(); 1262 env->ExceptionClear();
1285 } 1263 }