diff options
author | Simon Marlow <marlowsd@gmail.com> | 2017-03-27 13:15:04 +0100 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2017-03-28 11:31:22 +0100 |
commit | 074d13eb3b6489e8b2f555f61496761614a3e207 (patch) | |
tree | de8d352834297e440b65168e92b01463388e47b2 /rts/Apply.cmm | |
parent | 08a6fc69ce1617bb997cb02584a961ac29a266eb (diff) | |
download | haskell-074d13eb3b6489e8b2f555f61496761614a3e207.tar.gz |
Fix #13433
Summary: See comments for details.
Test Plan: validate
Reviewers: mpickering, bgamari, austin, erikd
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3386
Diffstat (limited to 'rts/Apply.cmm')
-rw-r--r-- | rts/Apply.cmm | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/rts/Apply.cmm b/rts/Apply.cmm index b3a04ca58c..4c34f0f3d8 100644 --- a/rts/Apply.cmm +++ b/rts/Apply.cmm @@ -156,13 +156,26 @@ again: THUNK_STATIC, THUNK_SELECTOR: { - // The thunk might evaluate to a function, so we have to come - // back here again to adjust its CCS if necessary. The - // stg_restore_ccs_eval stack frame does that. + // We have a thunk of some kind, so evaluate it. + + // The thunk might evaluate to a function, so we have to + // come back here again to adjust its CCS if necessary. + // Therefore we need to push a stack frame to look at the + // function that gets returned (a stg_restore_ccs_eval + // frame), and therefore we need a stack check. STK_CHK_GEN(); + + // We can't use the value of 'info' any more, because if + // STK_CHK_GEN() did a GC then the closure we're looking + // at may have changed, e.g. a THUNK_SELECTOR may have + // been evaluated by the GC. So we reload the info + // pointer now. + untaggedfun = UNTAG(fun); + info = %INFO_PTR(untaggedfun); + jump %ENTRY_CODE(info) (stg_restore_cccs_eval_info, CCCS) - (UNTAG(fun)); + (untaggedfun); } default: { |