Skip to content

Profiler is inconsistent about biography for GHC's heap

My slightly modified rnBind has this clause (i is an Int):

rnBind sig_fn
       trim
       i
       (L loc (FunBind { fun_id = name, 
                         fun_infix = inf, 
                         fun_matches = matches,
                         -- no pattern FVs
                         bind_fvs = _
                       }))
       -- invariant: no free vars here when it's a FunBind
  = i `seq` setSrcSpan loc $
    do  { let plain_name = unLoc name

    ; (matches', fvs) <- bindSigTyVarsFV (sig_fn plain_name) $
                -- bindSigTyVars tests for Opt_ScopedTyVars
                 rnMatchGroup (FunRhs plain_name inf) matches

    ; checkPrecMatch inf plain_name matches'

    ; return
        (L loc (trace ("Using FunBind for " ++ show i)
                (FunBind { fun_id = name, 
                                  fun_infix = inf, 
                                  fun_matches = matches',
                     bind_fvs = trim fvs, 
                                  fun_co_fn = idHsWrapper, 
                                  fun_tick = Nothing })),
          [plain_name],
          fvs)
      }

If I comment out the trace and run

ghc --make J -fforce-recomp +RTS -p -hcrnBind -hyHsBindLR -hb

then I get notrace.png, all VOID. However, with the trace I get trace.png, LAG turning into DRAG. The two graphs are also a slightly different shape, which is curious.

Also attached is the core for with and without the tracing. I think the only interesting difference is

-      a30_ [ALWAYS Just L] :: NameSet.FreeVars
+      a30_ [ALWAYS Just L] :: HsBinds.HsBindLR Name.Name Name.Name
       [Str: DmdType]
-      a30_ = w1_ ww3_ } in
-    let {
-      a31_ :: HsBinds.HsWrapper
-      []
-      a31_ =
-        __scc {rnBind ghc-6.9.20080517:RnBinds !}
-        __scc {idHsWrapper ghc-6.9.20080517:HsBinds} HsBinds.WpHole } in
-    let {
-      a32_ :: HsBinds.HsWrapper
-      []
-      a32_ =
-        __scc {rnBind ghc-6.9.20080517:RnBinds !}
-        __scc {idHsWrapper ghc-6.9.20080517:HsBinds} HsBinds.WpHole } in
-    let {
-      a33_ :: HsBinds.HsBindLR Name.Name Name.Name
-      [Str: DmdType]
-      a33_ =
-        HsBinds.FunBind
-          @ Name.Name
-          @ Name.Name
-          name_
-          inf_
-          ww2_
-          a32_
-          a30_
-          (Data.Maybe.Nothing @ (GHC.Base.Int, [Name.Name])) } in
+      a30_ =
+        Debug.Trace.trace
+          @ (HsBinds.HsBindLR Name.Name Name.Name)
+          lvl45_
+          (HsBinds.FunBind
+             @ Name.Name
+             @ Name.Name
+             name_
+             inf_
+             ww2_
+             (__scc {rnBind ghc-6.9.20080517:RnBinds !}
+              __scc {idHsWrapper ghc-6.9.20080517:HsBinds} HsBinds.WpHole)
+             (w1_ ww3_)
+             (Data.Maybe.Nothing @ (GHC.Base.Int, [Name.Name]))) } in
Trac metadata
Trac field Value
Version 6.9
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Profiling
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Unknown
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information