How does TH know to load non-profiled object code when compiling profiled?

Simon Marlow marlowsd at
Fri Jan 8 08:45:35 UTC 2016

Correct, it's entirely dodgy.  (I seem to remember a Note about this 
somewhere, but I can't find it right now)

In any case, -fexternal-interpreter fixes this properly.


On 08/01/2016 05:21, Edward Z. Yang wrote:
> Thanks!
> In fact, I have just realized that Template Haskell does something
> very dodgy when it is loading profiled code: it will use the
> *profiled* interface files (things that are used in splices
> are brought into scope with import) to figure out what is going on with
> the *non-profiled* object files.  I'm a bit surprised that we haven't
> had any terrifying bugs related to this.  (It should be relatively
> easy to trigger horrible brokenness; just compile hi and p_hi with
> different code so that they are inconsistent.)
> Edward
> Excerpts from Simon Marlow's message of 2016-01-07 09:42:27 -0800:
>> On 07/01/2016 16:28, Edward Z. Yang wrote:
>>> I've been looking for the code that implements this logic, but I can't
>>> seem to find it.  (For what it's worth, compiler plugins *incorrectly*
>>> load the profiling interface when compiling profiled, which is wrong
>>> and something I'd like to fix.)  Simon Marlow, do you happen to know?
>> Yeah, I've been fiddling with this lately.  It's this function here:
>> Cheers,
>> Simon

More information about the ghc-devs mailing list