--- old/src/share/vm/classfile/javaClasses.cpp 2012-07-13 15:35:50.351760000 -0700 +++ new/src/share/vm/classfile/javaClasses.cpp 2012-07-13 15:35:50.125010000 -0700 @@ -2738,17 +2738,6 @@ if (k != NULL) { compute_offset(_target_offset, k, vmSymbols::target_name(), vmSymbols::java_lang_invoke_MethodHandle_signature()); } - - // Disallow compilation of CallSite.setTargetNormal and CallSite.setTargetVolatile - // (For C2: keep this until we have throttling logic for uncommon traps.) - if (k != NULL) { - instanceKlass* ik = instanceKlass::cast(k); - methodOop m_normal = ik->lookup_method(vmSymbols::setTargetNormal_name(), vmSymbols::setTarget_signature()); - methodOop m_volatile = ik->lookup_method(vmSymbols::setTargetVolatile_name(), vmSymbols::setTarget_signature()); - guarantee(m_normal != NULL && m_volatile != NULL, "must exist"); - m_normal->set_not_compilable_quietly(); - m_volatile->set_not_compilable_quietly(); - } } --- old/src/share/vm/interpreter/interpreterRuntime.cpp 2012-07-13 15:35:51.860529000 -0700 +++ new/src/share/vm/interpreter/interpreterRuntime.cpp 2012-07-13 15:35:51.590534000 -0700 @@ -547,23 +547,6 @@ } } - if (is_put && !is_static && klass->is_subclass_of(SystemDictionary::CallSite_klass()) && (info.name() == vmSymbols::target_name())) { - const jint direction = frame::interpreter_frame_expression_stack_direction(); - Handle call_site (THREAD, *((oop*) thread->last_frame().interpreter_frame_tos_at(-1 * direction))); - Handle method_handle(THREAD, *((oop*) thread->last_frame().interpreter_frame_tos_at( 0 * direction))); - assert(call_site ->is_a(SystemDictionary::CallSite_klass()), "must be"); - assert(method_handle->is_a(SystemDictionary::MethodHandle_klass()), "must be"); - - { - // Walk all nmethods depending on this call site. - MutexLocker mu(Compile_lock, thread); - Universe::flush_dependents_on(call_site, method_handle); - } - - // Don't allow fast path for setting CallSite.target and sub-classes. - put_code = (Bytecodes::Code) 0; - } - cache_entry(thread)->set_field( get_code, put_code, --- old/src/share/vm/prims/methodHandles.cpp 2012-07-13 15:35:53.374003000 -0700 +++ new/src/share/vm/prims/methodHandles.cpp 2012-07-13 15:35:53.130421000 -0700 @@ -3180,17 +3180,15 @@ jclass MH_class = env->FindClass(MH_name); status = env->RegisterNatives(MH_class, invoke_methods, sizeof(invoke_methods)/sizeof(JNINativeMethod)); } + if (!env->ExceptionOccurred()) { + status = env->RegisterNatives(MHN_class, call_site_methods, sizeof(call_site_methods)/sizeof(JNINativeMethod)); + } if (env->ExceptionOccurred()) { warning("JSR 292 method handle code is mismatched to this JVM. Disabling support."); enable_MH = false; env->ExceptionClear(); } - status = env->RegisterNatives(MHN_class, call_site_methods, sizeof(call_site_methods)/sizeof(JNINativeMethod)); - if (env->ExceptionOccurred()) { - // Exception is okay until 7087357 - env->ExceptionClear(); - } } if (enable_MH) { --- old/src/share/vm/prims/unsafe.cpp 2012-07-13 15:35:54.886430000 -0700 +++ new/src/share/vm/prims/unsafe.cpp 2012-07-13 15:35:54.654322000 -0700 @@ -178,17 +178,6 @@ v = *(oop*)index_oop_from_field_offset_long(p, offset); \ } -#define GET_OOP_FIELD_VOLATILE(obj, offset, v) \ - oop p = JNIHandles::resolve(obj); \ - volatile oop v; \ - if (UseCompressedOops) { \ - volatile narrowOop n = *(volatile narrowOop*)index_oop_from_field_offset_long(p, offset); \ - v = oopDesc::decode_heap_oop(n); \ - } else { \ - v = *(volatile oop*)index_oop_from_field_offset_long(p, offset); \ - } \ - OrderAccess::acquire(); - // Get/SetObject must be special-cased, since it works with handles. @@ -296,28 +285,21 @@ UNSAFE_ENTRY(jobject, Unsafe_GetObjectVolatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset)) UnsafeWrapper("Unsafe_GetObjectVolatile"); - GET_OOP_FIELD_VOLATILE(obj, offset, v) + oop p = JNIHandles::resolve(obj); + void* addr = index_oop_from_field_offset_long(p, offset); + volatile oop v; + if (UseCompressedOops) { + volatile narrowOop n = *(volatile narrowOop*) addr; + v = oopDesc::decode_heap_oop(n); + } else { + v = *(volatile oop*) addr; + } + OrderAccess::acquire(); return JNIHandles::make_local(env, v); UNSAFE_END UNSAFE_ENTRY(void, Unsafe_SetObjectVolatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject x_h)) UnsafeWrapper("Unsafe_SetObjectVolatile"); - { - // Catch VolatileCallSite.target stores (via - // CallSite.setTargetVolatile) and check call site dependencies. - oop p = JNIHandles::resolve(obj); - if ((offset == java_lang_invoke_CallSite::target_offset_in_bytes()) && p->is_a(SystemDictionary::CallSite_klass())) { - Handle call_site (THREAD, p); - Handle method_handle(THREAD, JNIHandles::resolve(x_h)); - assert(call_site ->is_a(SystemDictionary::CallSite_klass()), "must be"); - assert(method_handle->is_a(SystemDictionary::MethodHandle_klass()), "must be"); - { - // Walk all nmethods depending on this call site. - MutexLocker mu(Compile_lock, thread); - Universe::flush_dependents_on(call_site(), method_handle()); - } - } - } oop x = JNIHandles::resolve(x_h); oop p = JNIHandles::resolve(obj); void* addr = index_oop_from_field_offset_long(p, offset);