patch applied (ghc): Haskell Program Coverage
Simon Peyton-Jones
simonpj at microsoft.com
Thu Nov 2 04:36:39 EST 2006
Andy,
| > instead of
| >
| > Note (Tick "M" 23) e
| >
| > how about
| >
| > case tick# "M"# 23# of DEFAULT -> e
| >
| > where tick# is a PrimOp, and the case expression is compiled to
| > inline code (ie. no extra info table / return address for e). The
| > PrimOp would be marked as having side effects, so the simplifier
| > wouldn't rearrange code around it. There would be nothing HPC-
| > specific in CoreSyn, CorePrep, CoreToStg, or StgSyn. All you need
| > to do is provide an implementation for tick# in CgPrimOp. I'm
| > probably missing something!
| >
| > The "M"# is a Literal - a MachStr. I imagine you don't need the
| > package name, because it is always the current package name (the
| > code generator for tick# can prepend the package name if it needs
| > to). A bit of cleverness in CgPrimOp is required to common up all
| > the module names, I guess.
| >
|
| I tried this, and the tick# M# 23# got lifted out into a CAF, and was
| evaluated only once :-) Perhaps the PrimOp's side_effect flag
| was off on that build, though. Does the side_effect flag stop this?
What you want is
a) Return an unboxed result (can be State#)
b) the side-effect flag
If both these hold, then the primop won't be floated out anywhere.
Please do try this. I would much, much rather use a PrimOp than a Note.
Indeed I think we should do the SCC stuff via primops too.
Simon
More information about the Cvs-ghc
mailing list