[project @ 2003-07-18 16:31:27 by simonmar]
authorsimonmar <unknown>
Fri, 18 Jul 2003 16:31:27 +0000 (16:31 +0000)
committersimonmar <unknown>
Fri, 18 Jul 2003 16:31:27 +0000 (16:31 +0000)
Restoring of cost centre in let-no-escape: we need to do this after
binding the args to stack locations, otherwise we end up grabbing the
wrong slot.

Should hopefully fix profiling crashes.  We still don't pay any
attention to the cost centre attached to the let-no-escape binding
itself, which looks wrong, but I don't intend to do anything about
that right now.

ghc/compiler/codeGen/CgLetNoEscape.lhs

index 5e57726..a9c5501 100644 (file)
@@ -1,7 +1,7 @@
 %
 % (c) The GRASP/AQUA Project, Glasgow University, 1993-1998
 %
-% $Id: CgLetNoEscape.lhs,v 1.22 2003/07/02 13:19:29 simonpj Exp $
+% $Id: CgLetNoEscape.lhs,v 1.23 2003/07/18 16:31:27 simonmar Exp $
 %
 %********************************************************
 %*                                                     *
@@ -167,8 +167,7 @@ cgLetNoEscapeClosure
 
        (deAllocStackTop retPrimRepSize         `thenFC` \_ ->
         forkAbsC (
-           restoreCurrentCostCentre cc_slot    `thenC`
-           cgLetNoEscapeBody bndr cc args body
+           cgLetNoEscapeBody bndr cc cc_slot args body
         )                                      `thenFC` \ abs_c ->
         mkRetDirectTarget bndr abs_c srt
                -- Ignore the label that comes back from
@@ -181,13 +180,17 @@ cgLetNoEscapeClosure
 \begin{code}
 cgLetNoEscapeBody :: Id                -- Name of the joint point
                  -> CostCentreStack
+                 -> Maybe VirtualSpOffset
                  -> [Id]       -- Args
                  -> StgExpr    -- Body
                  -> Code
 
-cgLetNoEscapeBody bndr cc all_args body
+cgLetNoEscapeBody bndr cc cc_slot all_args body
    = bindUnboxedTupleComponents all_args       `thenFC` \ (arg_regs, ptrs, nptrs, ret_slot) ->
 
+     -- restore the saved cost centre
+     restoreCurrentCostCentre cc_slot  `thenC`
+
        -- Enter the closures cc, if required
      --enterCostCentreCode closure_info cc IsFunction  `thenC`