
Awesome that's definitely very helpful! I'll be sure to ask again if/when I
get stuck.
Thanks!!
On Sat, Jun 4, 2016 at 3:20 PM, Ben Gamari
Richard Fung
writes: Hello! I apologize if this isn't the right place to ask; if it isn't please steer me in the right direction.
Hi Richard!
Would anyone be willing to advise me on my first ticket? I've been trying to work on it on and off but haven't made much progress on my own.
It's ticket #9370: https://ghc.haskell.org/trac/ghc/ticket/9370
Great, I'm happy to hear that someone has picked this one up. I think it is a nice choice for a self-contained newcomers project.
I think I understand the issue conceptually but I don't know where to look for the code that needs to be changed..
I don't know where the code responsible for this is off the top of my head, however I can provide some pointers.
So the unfoldings you are looking to preserve come from interface files. The machinery for all of this is in compiler/iface. IfaceSyn.hs is of particular interest and there you will find the definition of IfaceUnfolding, which is the unfolding representation which is stored in the interface file. Unfoldings live inside of IdInfo values, which hold various miscellaneous information which we need to preserve about a particular Id (identifier).
There is a somewhat useful comment regarding how IdInfo is treated above the definition of IfaceIdInfo in IfaceSyn. In particular it seems that interface files for modules compiled with -O0 will have their IdInfo fields set to NoInfo. It's not clear what happens when an interface file is read. However, grepping for NoInfo reveals a use-site in TcIface.tcIdInfo which looks interesting (in particular the ignore_prags guard). I think this should be enough to get you going on the interface file part of this.
The other part of this ticket is deciding whether to use an unfolding when considering whether to inline. This will be done in the simplifier (compiler/simplCore). Grepping for "inline" and "unfold" in simplCore/Simplify.hs (as well as reading the notes in that file) will likely be enough to get you started.
Do let me know if you still feel lost or want to discuss this further. I look forward to hearing how it goes.
Cheers,
- Ben