--- a/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp Fri Sep 09 13:47:11 2011 -0700
+++ b/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp Sat Sep 10 00:11:04 2011 -0700
@@ -624,6 +624,11 @@
// error path for invokeExact (only)
__ bind(invoke_exact_error_path);
+ // ensure that the top of stack is properly aligned.
+ __ mov(rdi, rsp);
+ __ andptr(rsp, -StackAlignmentInBytes); // Align the stack for the ABI
+ __ pushptr(Address(rdi, 0)); // Pick up the return address
+
// Stub wants expected type in rax and the actual type in rcx
__ jump(ExternalAddress(StubRoutines::throw_WrongMethodTypeException_entry()));