[commit: ghc] master: Clarify the TSO_SQUEEZED check. (997a488)

git at git.haskell.org git
Thu Oct 10 21:56:02 UTC 2013


Repository : ssh://git at git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/997a48858f354a71ee550d912b23cc7fd2665ce0/ghc

>---------------------------------------------------------------

commit 997a48858f354a71ee550d912b23cc7fd2665ce0
Author: Edward Z. Yang <ezyang at mit.edu>
Date:   Thu Oct 10 14:54:58 2013 -0700

    Clarify the TSO_SQUEEZED check.
    
    Signed-off-by: Edward Z. Yang <ezyang at mit.edu>


>---------------------------------------------------------------

997a48858f354a71ee550d912b23cc7fd2665ce0
 rts/Threads.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/rts/Threads.c b/rts/Threads.c
index 44bb31f..742119d 100644
--- a/rts/Threads.c
+++ b/rts/Threads.c
@@ -544,6 +544,14 @@ threadStackOverflow (Capability *cap, StgTSO *tso)
     // and then it runs again.  So to avoid this, if we squeezed *and*
     // there is still less than BLOCK_SIZE_W words free, then we enlarge
     // the stack anyway.
+    //
+    // NB: This reasoning only applies if the stack has been squeezed;
+    // if no squeezing has occurred, then BLOCK_SIZE_W free space does
+    // not mean there is enough stack to run; the thread may have
+    // requested a large amount of stack (see below).  If the amount
+    // we squeezed is not enough to run the thread, we'll come back
+    // here (no squeezing will have occurred and thus we'll enlarge the
+    // stack.)
     if ((tso->flags & TSO_SQUEEZED) && 
         ((W_)(tso->stackobj->sp - tso->stackobj->stack) >= BLOCK_SIZE_W)) {
         return;




More information about the ghc-commits mailing list