Where am I?

And what am I doing here? I currently read (more or less randomized) remarks about GHC’s source code; the codebase is quite huge (and probably the biggest code base that I’ve ever worked with):

Extension  Lines
.lhs       300482
.hs        473479
.c         184039
.h         448394

combined  1406394

Found using wc -l `find . -name \*.`

Thankfully I only need a tiny fraction of it to add the dynamic-capabilities-feature: according to the commentary on the runtime system it consist of only about 50000 lines, and again, I probably need to modify / extend just a fraction of it. The code of the runtime system has an extra page on the wiki; it describes

  • the purpose of the single files. Unfortunately these are currently only one liners and links to the particular files. Maybe I will add a much more extensive description for the Capabilities-files.
  • the coding conventions for this subsystem. They are quite extensive but (in my humble opinion) very good and describe not only syntactical conventions but also some general remarks, debugging and robustness tricks.

For seeing how the capabilites are initialized I think that the file RtsFlag.c is helpful:

  • RtsFlag.c defines parsing for -N<…>, hence I see where the capabilites are set and how they fit in the big puzzle of the RTS.
  • RtsFlag.c uses and sets RtsFlags.ParFlags.nNodes (line 958). The structure is included in includes/Rts.h which includes include/rts/Flags.h (line 189 defines the important parts).
  • RtsMessage.c would probably help me in the future for printing some debugging messages.

I’m curious if I’m on the right track. By the way, take all the informations with a grain of salt, since I’m currently in the beginning of understanding the code of the runtime system.

Minor update: After a look at the commentary I’m pretty sure I need to understand much of the scheduling subsystem to extend the capabilities-system. Thankfully the wiki seems to document it.

Leave a Reply