Mercurial > hg > truffle
diff src/cpu/x86/vm/templateInterpreter_x86_64.cpp @ 4743:dca455dea3a7
7116216: StackOverflow GC crash
Summary: GC crash for explicit stack overflow checks after a C2I transition.
Reviewed-by: coleenp, never
Contributed-by: yang02.wang@sap.com, bertrand.delsart@oracle.com
author | bdelsart |
---|---|
date | Tue, 20 Dec 2011 12:33:05 +0100 |
parents | b20d64f83668 |
children | 22cee0ee8927 |
line wrap: on
line diff
--- a/src/cpu/x86/vm/templateInterpreter_x86_64.cpp Fri Dec 16 17:33:08 2011 -0500 +++ b/src/cpu/x86/vm/templateInterpreter_x86_64.cpp Tue Dec 20 12:33:05 2011 +0100 @@ -467,8 +467,18 @@ __ cmpptr(rsp, rax); __ jcc(Assembler::above, after_frame_check); - __ pop(rax); // get return address - __ jump(ExternalAddress(Interpreter::throw_StackOverflowError_entry())); + // Restore sender's sp as SP. This is necessary if the sender's + // frame is an extended compiled frame (see gen_c2i_adapter()) + // and safer anyway in case of JSR292 adaptations. + + __ pop(rax); // return address must be moved if SP is changed + __ mov(rsp, r13); + __ push(rax); + + // Note: the restored frame is not necessarily interpreted. + // Use the shared runtime version of the StackOverflowError. + assert(StubRoutines::throw_StackOverflowError_entry() != NULL, "stub not yet generated"); + __ jump(ExternalAddress(StubRoutines::throw_StackOverflowError_entry())); // all done with frame size check __ bind(after_frame_check);