Questions about "time and space profiling for non-strict langs" paper and cost centre impl. of GHC

Simon Marlow marlowsd at gmail.com
Wed May 21 08:07:06 UTC 2014


On 18/05/2014 15:20, Ömer Sinan Ağacan wrote:
> Thanks again for the answer.
>
>> Not sure what "_call_" is suppose to be. What's the context?
>
> In Simon Marlow's slides, stack traces are implemented in terms of
> "call" and "push" operations. I guess `push` in STG syntax is stands
> for "push" operation explained in the slides but as far as I can see
> "call" is missing in generated STG.

"call" is implemented by enterFunCCS() in rts/Profiling.c.

I'm afraid there's no good high-level description of how profiling works 
in GHC currently.  My plan was to flesh out the semantics and then write 
it up properly, but since leaving MSR I've had less time to work on it, 
so unfortunately we have an implementation but no semantics.  Which is a 
sad state of affairs, I agree.  All I can say is that a lot of 
experimentation went into the current implementation, so I'm fairly 
confident it behaves sensibly in most situations.

Cheers,
Simon


>>> There is also something like `CCCS` in generated STG but I have no
>>> ideas about this.
>>
>> That's simply "current cost-centre stack". I like to think that the hint
>> of silliness was intentional.
>
> Yes, but I'm wondering what does that syntax in STG mean
> operationally? For example, here's some part of generated STG:
>
>      let {
>        sat_s2OT [Occ=Once] :: GHC.Integer.Type.Integer
>        [LclId, Str=DmdType] =
>            CCCS GHC.Integer.Type.S#! [0];
>      }
>
> What does "CCCS" stand for here? I guess in long term it'd be best for
> me to learn Cmm and see the generated code for this syntax to
> understand what does it really do.(assuming Cmm has better
> documentation that STG :) )
>
>> Sure. Better place for quick queries might be #ghc on FreeNode though -
>> my nick is petermw.
>
> Great, my nick is osa1 and I'll be pinging you for short questions.
> Thanks again!
>
> ---
> Ömer Sinan Ağacan
> http://osa1.net
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://www.haskell.org/mailman/listinfo/ghc-devs
>


More information about the ghc-devs mailing list