comparison src/share/vm/runtime/sharedRuntime.cpp @ 4044:2ec638646e86

7101642: JSR 292: SIGSEGV in java.lang.invoke.MethodHandleImpl$FieldAccessor.getFieldI(Ljava/lang/Object;)I Reviewed-by: kvn, iveresov
author twisti
date Tue, 25 Oct 2011 04:07:20 -0700
parents 23a1c8de9d51
children 04b9a2566eec 15d394228cfa
comparison
equal deleted inserted replaced
4043:12d38ffcba2a 4044:2ec638646e86
1670 1670
1671 // The check above makes sure this is a nmethod. 1671 // The check above makes sure this is a nmethod.
1672 nmethod* nm = cb->as_nmethod_or_null(); 1672 nmethod* nm = cb->as_nmethod_or_null();
1673 assert(nm, "must be"); 1673 assert(nm, "must be");
1674 1674
1675 // Don't fixup MethodHandle call sites as c2i/i2c adapters are used 1675 // Get the return PC for the passed caller PC.
1676 // to implement MethodHandle actions. 1676 address return_pc = caller_pc + frame::pc_return_offset;
1677 if (nm->is_method_handle_return(caller_pc)) { 1677
1678 // Don't fixup method handle call sites as the executed method
1679 // handle adapters are doing the required MethodHandle chain work.
1680 if (nm->is_method_handle_return(return_pc)) {
1678 return; 1681 return;
1679 } 1682 }
1680 1683
1681 // There is a benign race here. We could be attempting to patch to a compiled 1684 // There is a benign race here. We could be attempting to patch to a compiled
1682 // entry point at the same time the callee is being deoptimized. If that is 1685 // entry point at the same time the callee is being deoptimized. If that is
1691 1694
1692 if (nm->is_in_use()) { 1695 if (nm->is_in_use()) {
1693 1696
1694 // Expect to find a native call there (unless it was no-inline cache vtable dispatch) 1697 // Expect to find a native call there (unless it was no-inline cache vtable dispatch)
1695 MutexLockerEx ml_patch(Patching_lock, Mutex::_no_safepoint_check_flag); 1698 MutexLockerEx ml_patch(Patching_lock, Mutex::_no_safepoint_check_flag);
1696 if (NativeCall::is_call_before(caller_pc + frame::pc_return_offset)) { 1699 if (NativeCall::is_call_before(return_pc)) {
1697 NativeCall *call = nativeCall_before(caller_pc + frame::pc_return_offset); 1700 NativeCall *call = nativeCall_before(return_pc);
1698 // 1701 //
1699 // bug 6281185. We might get here after resolving a call site to a vanilla 1702 // bug 6281185. We might get here after resolving a call site to a vanilla
1700 // virtual call. Because the resolvee uses the verified entry it may then 1703 // virtual call. Because the resolvee uses the verified entry it may then
1701 // see compiled code and attempt to patch the site by calling us. This would 1704 // see compiled code and attempt to patch the site by calling us. This would
1702 // then incorrectly convert the call site to optimized and its downhill from 1705 // then incorrectly convert the call site to optimized and its downhill from
1742 tty->print_cr(" to " INTPTR_FORMAT, entry_point); 1745 tty->print_cr(" to " INTPTR_FORMAT, entry_point);
1743 } 1746 }
1744 } 1747 }
1745 } 1748 }
1746 } 1749 }
1747
1748 IRT_END 1750 IRT_END
1749 1751
1750 1752
1751 // same as JVM_Arraycopy, but called directly from compiled code 1753 // same as JVM_Arraycopy, but called directly from compiled code
1752 JRT_ENTRY(void, SharedRuntime::slow_arraycopy_C(oopDesc* src, jint src_pos, 1754 JRT_ENTRY(void, SharedRuntime::slow_arraycopy_C(oopDesc* src, jint src_pos,