7148486: At a method handle call returning with an exception may call the runtime with misaligned stack (x64)

Stack must be realigned when calling the runtime for exception propagation at a call.

Reviewed-by: kvn, never
This commit is contained in:
Roland Westrelin 2012-02-27 11:42:30 +01:00
parent 4012f6cd34
commit c815908774
2 changed files with 26 additions and 6 deletions

View file

@ -3620,8 +3620,12 @@ void OptoRuntime::generate_exception_blob() {
//
// 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 @@ void OptoRuntime::generate_exception_blob() {
OopMapSet* oop_maps = new OopMapSet();
oop_maps->add_gc_map( __ pc()-start, new OopMap(SimpleRuntimeFrame::framesize, 0));
oop_maps->add_gc_map(the_pc - start, new OopMap(SimpleRuntimeFrame::framesize, 0));
__ reset_last_Java_frame(false, false);
__ reset_last_Java_frame(false, true);
// Restore callee-saved registers