Mercurial > hg > graal-jvmci-8
comparison 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 |
comparison
equal
deleted
inserted
replaced
5903:da4be62fb889 | 5904:bf7796b7367a |
---|---|
3618 // If not, it prepares for stack-unwinding, restoring the callee-save | 3618 // If not, it prepares for stack-unwinding, restoring the callee-save |
3619 // registers of the frame being removed. | 3619 // registers of the frame being removed. |
3620 // | 3620 // |
3621 // address OptoRuntime::handle_exception_C(JavaThread* thread) | 3621 // address OptoRuntime::handle_exception_C(JavaThread* thread) |
3622 | 3622 |
3623 __ set_last_Java_frame(noreg, noreg, NULL); | 3623 // At a method handle call, the stack may not be properly aligned |
3624 // when returning with an exception. | |
3625 address the_pc = __ pc(); | |
3626 __ set_last_Java_frame(noreg, noreg, the_pc); | |
3624 __ mov(c_rarg0, r15_thread); | 3627 __ mov(c_rarg0, r15_thread); |
3628 __ andptr(rsp, -(StackAlignmentInBytes)); // Align stack | |
3625 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, OptoRuntime::handle_exception_C))); | 3629 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, OptoRuntime::handle_exception_C))); |
3626 | 3630 |
3627 // Set an oopmap for the call site. This oopmap will only be used if we | 3631 // Set an oopmap for the call site. This oopmap will only be used if we |
3628 // are unwinding the stack. Hence, all locations will be dead. | 3632 // are unwinding the stack. Hence, all locations will be dead. |
3629 // Callee-saved registers will be the same as the frame above (i.e., | 3633 // Callee-saved registers will be the same as the frame above (i.e., |
3630 // handle_exception_stub), since they were restored when we got the | 3634 // handle_exception_stub), since they were restored when we got the |
3631 // exception. | 3635 // exception. |
3632 | 3636 |
3633 OopMapSet* oop_maps = new OopMapSet(); | 3637 OopMapSet* oop_maps = new OopMapSet(); |
3634 | 3638 |
3635 oop_maps->add_gc_map( __ pc()-start, new OopMap(SimpleRuntimeFrame::framesize, 0)); | 3639 oop_maps->add_gc_map(the_pc - start, new OopMap(SimpleRuntimeFrame::framesize, 0)); |
3636 | 3640 |
3637 __ reset_last_Java_frame(false, false); | 3641 __ reset_last_Java_frame(false, true); |
3638 | 3642 |
3639 // Restore callee-saved registers | 3643 // Restore callee-saved registers |
3640 | 3644 |
3641 // rbp is an implicitly saved callee saved register (i.e. the calling | 3645 // rbp is an implicitly saved callee saved register (i.e. the calling |
3642 // convention will save restore it in prolog/epilog) Other than that | 3646 // convention will save restore it in prolog/epilog) Other than that |