JDK-7012914 : JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: hs20
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2011-01-18
  • Updated: 2012-02-01
  • Resolved: 2011-04-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 Other
7Fixed hs21Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (.../src/share/vm/runtime/sharedRuntime.cpp:426), pid=28789, tid=12
#  assert(frame::verify_return_pc(return_address)) failed: must be a return pc
#
# JRE version: 7.0-b125
# Java VM: Java HotSpot(TM) Client VM (20.0-b07-internal-...-fastdebug compiled mode solaris-x86 )
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp

Comments
EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/1b4e6a5d98e0
28-02-2011

SUGGESTED FIX The fix is to add a new handle_exception stub (e.g. handle_exception_from_callee) that is excusively used in LIR_Assembler::emit_exception_handler which does the SP fixup. A new stub is required since for other uses of the handle_exception stub all registers may be live, which makes doing the fixup impossible.
31-01-2011

EVALUATION The changes of 7007377 changed the way MethodHandlesImpl.raiseException is called from the raise_exception method handle adapter as it calls the C2I adapter. Since MethodHandlesImpl.raiseException has three arguments, on 32-bit x86 we need to pass one argument on the stack. This additional word on the stack needs to be removed when we return to the actual callee during unwinding. Since the call site that triggers the exception is a method handle call site we just need to restore the saved SP from BP. Right now this is only a problem on 32-bit x86 because of the way we implement the raise_exception method handle adapter. But I assume it's not impossible that in the future there are stack manipulations before we throw an exception. So a fix for all architectures seems reasonable.
21-01-2011

EVALUATION $ gamma -Xcomp -XX:+UnlockExperimentalVMOptions -XX:+EnableMethodHandles -cp /java/devtools/share/junit/latest/junit.jar:. org.junit.runner.JUnitCore test.java.dyn.MethodHandlesTest (dbx) where current thread: t@2 [1] _waitid(0x0, 0x1dde, 0xfdedddd0, 0x3), at 0xfe12af95 [2] _waitpid(0x1dde, 0xfdedde90, 0x0), at 0xfe0d93bf [3] waitpid(0x1dde, 0xfdedde90, 0x0), at 0xfe11c805 =>[4] os::fork_and_exec(cmd = 0xfeeca0bc "dbx - 7587"), line 6238 in "os_solaris.cpp" [5] VMError::show_message_box(this = 0xfdede038, buf = 0xfeeca0bc "dbx - 7587", buflen = 2000), line 56 in "vmError_solaris.cpp" [6] VMError::report_and_die(this = 0xfdede038), line 786 in "vmError.cpp" [7] report_vm_error(file = 0xfed2b9ea "/home/ct232829/hotspot-comp/hotspot/src/share/vm/runtime/sharedRuntime.cpp", line = 426, error_msg = 0xfed2ba35 "assert(frame::verify_return_pc(return_address)) failed", detail_msg = 0xfed2ba6c "must be a return pc"), line 216 in "debug.cpp" [8] SharedRuntime::raw_exception_handler_for_return_address(thread = 0x8080400, return_address = 0xfdede140 "\xc0\xb4\xf6\xec"), line 426 in "sharedRuntime.cpp" [9] SharedRuntime::exception_handler_for_return_address(thread = 0x8080400, return_address = 0xfdede140 "\xc0\xb4\xf6\xec"), line 486 in "sharedRuntime.cpp" [10] 0xfbce7959(0xecf6b4c0, 0xe52e0000, 0x400d, 0x0, 0x0, 0x0), at 0xfbce7959 (dbx) fr 8 Current function is SharedRuntime::raw_exception_handler_for_return_address 426 assert(frame::verify_return_pc(return_address), "must be a return pc"); (dbx) p findpc((long) return_address) "Executing findpc" 0xfdede140 is pointing into the stack for thread: 0x08080400 "main" prio=3 tid=0x08080400 nid=0x2 runnable [0x00000000] java.lang.Thread.State: RUNNABLE JavaThread state: _thread_in_Java Thread: 0x08080400 [0x 2] State: _running _has_called_back 0 _at_poll_safepoint 0 JavaThread state: _thread_in_Java findpc((long ) return_address) = (void)
18-01-2011