[GHC] #8435: Do not copy stack after stack overflow

GHC ghc-devs
Thu Oct 10 21:56:51 UTC 2013


#8435: Do not copy stack after stack overflow
------------------------------+--------------------------------------------
       Reporter:  ezyang      |             Owner:  simonmar
           Type:  bug         |            Status:  new
       Priority:  normal      |         Milestone:
      Component:  Runtime     |           Version:  7.7
  System                      |  Operating System:  Unknown/Multiple
       Keywords:              |   Type of failure:  Runtime performance bug
   Architecture:              |         Test Case:
  Unknown/Multiple            |          Blocking:
     Difficulty:  Unknown     |
     Blocked By:              |
Related Tickets:              |
------------------------------+--------------------------------------------
 I am not sure, but I was doing a close reading of `threadStackOverflow`
 and noticed that after we throw a stack overflow exception, we fall
 through to the code responsible for allocating a new stack and copying the
 code over. An old iteration of the stack overflow code (removed in the
 commit cited below) did return after throwing the exception, and I did not
 see anything in the commit message suggesting the change was intentional.
 It seems sound to copy the stack; it will just become dead immediately.

 The relevant commit:

 {{{
 commit f30d527344db528618f64a25250a3be557d9f287
 Author: Simon Marlow <marlowsd at gmail.com>
 Date:   Wed Dec 15 12:08:43 2010 +0000

     Implement stack chunks and separate TSO/STACK objects
 }}}

 Suggested (untested) patch:

 {{{
 diff --git a/rts/Threads.c b/rts/Threads.c
 index 742119d..ccd6b17 100644
 --- a/rts/Threads.c
 +++ b/rts/Threads.c
 @@ -533,6 +533,7 @@ threadStackOverflow (Capability *cap, StgTSO *tso)

          // Send this thread the StackOverflow exception
          throwToSingleThreaded(cap, tso, (StgClosure
 *)stackOverflow_closure);
 +        return;
      }


 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8435>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the ghc-tickets mailing list