Commit 074d13eb authored by Simon Marlow's avatar Simon Marlow
Browse files

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
parent 08a6fc69
...@@ -156,13 +156,26 @@ again: ...@@ -156,13 +156,26 @@ again:
THUNK_STATIC, THUNK_STATIC,
THUNK_SELECTOR: THUNK_SELECTOR:
{ {
// The thunk might evaluate to a function, so we have to come // We have a thunk of some kind, so evaluate it.
// back here again to adjust its CCS if necessary. The
// stg_restore_ccs_eval stack frame does that. // 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(); 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) jump %ENTRY_CODE(info)
(stg_restore_cccs_eval_info, CCCS) (stg_restore_cccs_eval_info, CCCS)
(UNTAG(fun)); (untaggedfun);
} }
default: default:
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment