summaryrefslogtreecommitdiff
path: root/rts/ThreadPaused.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2008-11-17 14:45:15 +0000
committerSimon Marlow <marlowsd@gmail.com>2008-11-17 14:45:15 +0000
commit0fa59deb44b8a1a0b44ee2b4cc4ae0db31dec038 (patch)
treeaf9ebb1997ee0520325c21ea2cc4797430155944 /rts/ThreadPaused.c
parent94bdf8cb5234289267310b1134b5877f31ddada0 (diff)
downloadhaskell-0fa59deb44b8a1a0b44ee2b4cc4ae0db31dec038.tar.gz
Fix #2783: detect black-hole loops properly
At some point we regressed on detecting simple black-hole loops. This happened due to the introduction of duplicate-work detection for parallelism: a black-hole loop looks very much like duplicate work, except it's duplicate work being performed by the very same thread. So we have to detect and handle this case.
Diffstat (limited to 'rts/ThreadPaused.c')
-rw-r--r--rts/ThreadPaused.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/rts/ThreadPaused.c b/rts/ThreadPaused.c
index c32a75b9a8..5463deecb8 100644
--- a/rts/ThreadPaused.c
+++ b/rts/ThreadPaused.c
@@ -231,8 +231,10 @@ threadPaused(Capability *cap, StgTSO *tso)
(long)((StgPtr)frame - tso->sp));
// If this closure is already an indirection, then
- // suspend the computation up to this point:
- suspendComputation(cap,tso,(StgPtr)frame);
+ // suspend the computation up to this point.
+ // NB. check raiseAsync() to see what happens when
+ // we're in a loop (#2783).
+ suspendComputation(cap,tso,(StgUpdateFrame*)frame);
// Now drop the update frame, and arrange to return
// the value to the frame underneath:
@@ -242,8 +244,9 @@ threadPaused(Capability *cap, StgTSO *tso)
// And continue with threadPaused; there might be
// yet more computation to suspend.
- threadPaused(cap,tso);
- return;
+ frame = (StgClosure *)tso->sp + 2;
+ prev_was_update_frame = rtsFalse;
+ continue;
}
if (bh->header.info != &stg_CAF_BLACKHOLE_info) {