diff options
author | Simon Marlow <simonmar@microsoft.com> | 2007-01-17 09:59:44 +0000 |
---|---|---|
committer | Simon Marlow <simonmar@microsoft.com> | 2007-01-17 09:59:44 +0000 |
commit | 709599a8485aad112c996ed8eb7cf3462525755d (patch) | |
tree | 54ecd829b6ca40a97cbce28582f5d315c3e48e28 /rts/Exception.cmm | |
parent | 866316bd1fd56d4f122e550b14cc3c0d894e28ba (diff) | |
download | haskell-709599a8485aad112c996ed8eb7cf3462525755d.tar.gz |
addition to "Eagerly raise a blocked exception" to fix unreg case
Diffstat (limited to 'rts/Exception.cmm')
-rw-r--r-- | rts/Exception.cmm | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/rts/Exception.cmm b/rts/Exception.cmm index bf5893e21a..a3f3dd0d82 100644 --- a/rts/Exception.cmm +++ b/rts/Exception.cmm @@ -68,6 +68,16 @@ INFO_TABLE_RET( stg_unblockAsyncExceptionszh_ret, * we are about to raise an async exception in the current * thread, which might result in the thread being killed. */ + +#ifndef REG_R1 + /* + * raiseAsync assumes that the stack is in ThreadRunGHC state, + * i.e. with a return address on the top. In unreg mode, the + * return value for IO is on top of the return address, so we + * need to make a small adjustment here. + */ + Sp_adj(1); +#endif SAVE_THREAD_STATE(); r = foreign "C" maybePerformBlockedException (MyCapability() "ptr", CurrentTSO "ptr") [R1]; @@ -82,6 +92,15 @@ INFO_TABLE_RET( stg_unblockAsyncExceptionszh_ret, jump %ENTRY_CODE(Sp(0)); } } +#ifndef REG_R1 + /* + * Readjust stack in unregisterised mode if we didn't raise an + * exception, see above + */ + else { + Sp_adj(-1); + } +#endif } #ifdef REG_R1 |