diff options
| author | Simon Marlow <marlowsd@gmail.com> | 2012-08-03 11:24:27 +0100 |
|---|---|---|
| committer | Simon Marlow <marlowsd@gmail.com> | 2012-08-06 09:47:33 +0100 |
| commit | f67a8b859b4b5a94d06572e24c1947af0d3f5649 (patch) | |
| tree | 24dcd9a7df0baefb40b93d73724d10931328c156 /compiler/cmm/CmmLayoutStack.hs | |
| parent | 22d5822929be3591d8a16b23a02f97e196ac2c09 (diff) | |
| download | haskell-f67a8b859b4b5a94d06572e24c1947af0d3f5649.tar.gz | |
Continue by jumping to the top-of-stack after a safe foreign call
Diffstat (limited to 'compiler/cmm/CmmLayoutStack.hs')
| -rw-r--r-- | compiler/cmm/CmmLayoutStack.hs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/cmm/CmmLayoutStack.hs b/compiler/cmm/CmmLayoutStack.hs index d2fffab4ac..02c90e6adc 100644 --- a/compiler/cmm/CmmLayoutStack.hs +++ b/compiler/cmm/CmmLayoutStack.hs @@ -897,7 +897,7 @@ live across the call. Our job now is to expand the call so we get | BaseReg = resumeThread(token) | LOAD_THREAD_STATE() | R1 = r -- copyOut - | jump L1 + | jump Sp[0] '----------------------- L1: r = R1 -- copyIn, inserted by mkSafeCall @@ -928,15 +928,17 @@ lowerSafeForeignCall dflags block mkAssign (CmmGlobal BaseReg) (CmmReg (CmmLocal new_base)) <*> caller_load <*> loadThreadState dflags load_tso load_stack - -- Note: The successor must be a procpoint, and we have already split, - -- so we use a jump, not a branch. - succLbl = CmmLit (CmmLabel (infoTblLbl succ)) (ret_args, regs, copyout) = copyOutOflow NativeReturn Jump (Young succ) (map (CmmReg . CmmLocal) res) updfr (0, []) - jump = CmmCall { cml_target = succLbl + -- NB. after resumeThread returns, the top-of-stack probably contains + -- the stack frame for succ, but it might not: if the current thread + -- received an exception during the call, then the stack might be + -- different. Hence we continue by jumping to the top stack frame, + -- not by jumping to succ. + jump = CmmCall { cml_target = CmmLoad (CmmReg spReg) bWord , cml_cont = Just succ , cml_args_regs = regs , cml_args = widthInBytes wordWidth |
