Mercurial > hg > truffle
diff src/cpu/x86/vm/templateInterpreter_x86_32.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_32.cpp Fri Dec 16 17:33:08 2011 -0500 +++ b/src/cpu/x86/vm/templateInterpreter_x86_32.cpp Tue Dec 20 12:33:05 2011 +0100 @@ -522,9 +522,18 @@ __ pop(rsi); // get saved bcp / (c++ prev state ). - __ 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, rsi); + __ 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_pop); __ pop(rsi);