[commit: ghc] master: Fix #13433 (074d13e)
git at git.haskell.org
git at git.haskell.org
Tue Mar 28 10:31:39 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/074d13eb3b6489e8b2f555f61496761614a3e207/ghc
>---------------------------------------------------------------
commit 074d13eb3b6489e8b2f555f61496761614a3e207
Author: Simon Marlow <marlowsd at gmail.com>
Date: Mon Mar 27 13:15:04 2017 +0100
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
>---------------------------------------------------------------
074d13eb3b6489e8b2f555f61496761614a3e207
rts/Apply.cmm | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/rts/Apply.cmm b/rts/Apply.cmm
index b3a04ca..4c34f0f 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:
{
More information about the ghc-commits
mailing list