[commit: ghc] master: More accurate cost attribution for stacks. Fixes #7818. (5724ea0)

Edward Z. Yang ezyang at MIT.EDU
Tue Apr 23 00:40:29 CEST 2013


Repository : http://darcs.haskell.org/ghc.git/

On branch  : master

https://github.com/ghc/ghc/commit/5724ea01c943bbc78b6c8b6bfa01a5d026d42f5a

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

commit 5724ea01c943bbc78b6c8b6bfa01a5d026d42f5a
Author: Edward Z. Yang <ezyang at mit.edu>
Date:   Sun Apr 7 16:31:44 2013 -0700

    More accurate cost attribution for stacks.  Fixes #7818.
    
    Previously, stacks were always attributed to CCCS_SYSTEM.  Now, we
    attribute them to the CCS when the stack was allocated.  If a stack
    grows, new stack chunks inherit the CCS of the old stack.
    
    Signed-off-by: Edward Z. Yang <ezyang at mit.edu>

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

 rts/Threads.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rts/Threads.c b/rts/Threads.c
index b617616..4c990f1 100644
--- a/rts/Threads.c
+++ b/rts/Threads.c
@@ -84,7 +84,7 @@ createThread(Capability *cap, W_ size)
     stack_size = round_to_mblocks(size - sizeofW(StgTSO));
     stack = (StgStack *)allocate(cap, stack_size);
     TICK_ALLOC_STACK(stack_size);
-    SET_HDR(stack, &stg_STACK_info, CCS_SYSTEM);
+    SET_HDR(stack, &stg_STACK_info, cap->r.rCCCS);
     stack->stack_size   = stack_size - sizeofW(StgStack);
     stack->sp           = stack->stack + stack->stack_size;
     stack->dirty        = 1;
@@ -575,7 +575,7 @@ threadStackOverflow (Capability *cap, StgTSO *tso)
                   chunk_size * sizeof(W_));
 
     new_stack = (StgStack*) allocate(cap, chunk_size);
-    SET_HDR(new_stack, &stg_STACK_info, CCS_SYSTEM);
+    SET_HDR(new_stack, &stg_STACK_info, old_stack->header.prof.ccs);
     TICK_ALLOC_STACK(chunk_size);
 
     new_stack->dirty = 0; // begin clean, we'll mark it dirty below





More information about the ghc-commits mailing list