Mercurial > hg > graal-jvmci-8
diff src/cpu/x86/vm/sharedRuntime_x86_64.cpp @ 5904:bf7796b7367a
7148486: At a method handle call returning with an exception may call the runtime with misaligned stack (x64)
Summary: stack must be realigned when calling the runtime for exception propagation at a call.
Reviewed-by: kvn, never
author | roland |
---|---|
date | Mon, 27 Feb 2012 11:42:30 +0100 |
parents | 0382d2b469b2 |
children | 2ee7dcc77c63 |
line wrap: on
line diff
--- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Mon Feb 27 09:17:44 2012 +0100 +++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Mon Feb 27 11:42:30 2012 +0100 @@ -3620,8 +3620,12 @@ // // address OptoRuntime::handle_exception_C(JavaThread* thread) - __ set_last_Java_frame(noreg, noreg, NULL); + // At a method handle call, the stack may not be properly aligned + // when returning with an exception. + address the_pc = __ pc(); + __ set_last_Java_frame(noreg, noreg, the_pc); __ mov(c_rarg0, r15_thread); + __ andptr(rsp, -(StackAlignmentInBytes)); // Align stack __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, OptoRuntime::handle_exception_C))); // Set an oopmap for the call site. This oopmap will only be used if we @@ -3632,9 +3636,9 @@ OopMapSet* oop_maps = new OopMapSet(); - oop_maps->add_gc_map( __ pc()-start, new OopMap(SimpleRuntimeFrame::framesize, 0)); - - __ reset_last_Java_frame(false, false); + oop_maps->add_gc_map(the_pc - start, new OopMap(SimpleRuntimeFrame::framesize, 0)); + + __ reset_last_Java_frame(false, true); // Restore callee-saved registers