|Version 144 (modified by dterei, 5 years ago) (diff)|
The GHC Commentary
This tree of wiki pages is a "commentary" on the GHC source code. It contains all the explanatory material that doesn't belong in comments in the source code itself, because the material is wide-ranging, usually covers multiple source files, and is more architectural in nature. The commentary can also be considered a design document for GHC.
For the dedicated, there are videos of Simon and Simon giving an overview of GHC, at the 2006 GHC Hackathon.
Editing the Commentary
Please feel free to add material to the rest of the wiki: don't worry too much about accuracy (in due course someone will edit your contribution). When unsure though please indicate this in the wiki and its best to ask on the GHC mailing list so you can correct the commentary. Please give some though to where in the commentary your contribution belongs. GHC has an older commentary (non wiki based) that read like a single coherent narrative, made sure to define terms before using them, and introduced concepts in the order which made them easiest to understand. Please do try to preserve those properties in this wiki commentary. If you're unsure or in a hurry, consider creating a wiki page outside the commentary and linking to it from the commentary (or the "contributed documentation" section below).
Try to link to source files as much as possible by using this macro: [[GhcFile(compiler/Makefile)]]. Also try to add appropriate links to other parts of the commentary.
- Getting Started
- The Runtime System (Rts)
- Cross-cutting concerns: topics which span both the compiler and the runtime system
- The User Manual (formatting guidelines etc)
The above commentary covers the source code of GHC. For material that doesn't concern this topic (such as proposals, work-in-progress and status reports) or that don't fit into the existing structure, you will find them below. Feel free to add new material here but please categorise it correctly.
- General Notes on the GHC compiler
- Edward Yang's blog post about the entire complilation pipeline for `factorial`
- New Prim Ops: How to add new primitive operations to GHC Haskell.
- Replacing GMP: Notes from an effort to replace GMP with another Bignum library.
- External Core: Describes the process of bringing External Core up to speed. Once finished, this will simply describe what External Core is, and how it works.
- The Scrap your boilerplate homepage.
- Notes on implemented GHC features:
- The new deriving mechanism
- Notes about Template Haskell?
- Rewrite Rules: Notes about the implementation of RULEs in GHC
- Type families/type functions: Notes concerning the implementation of type families, associated types, and equality constraints as well as the extension of the type checker with a contraint solver for equality constraints.
- Magic to do with `seq` and friends
- Compiler plug-ins
- memcpy/memmove/memset optimizations
- Backend Ideas: Some ideas and notes about the back end.
- Notes about the new code generator
- Monad Comprehensions: Translation rules and some implementation details
- Intermediate Types: Notes about the type system of GHC's new intermediate language (in the HEAD since ICFP'06)
- DPH: Notes about the implementation of Data Parallel Haskell
- Haddock: Some notes about how the Haddock comment support is implemented.
- Notes on proposed or in progress (but out of tree) GHC compiler features:
- Type level naturals
- Proposal to add a kind for facts, e.g. class constraints
- Polymorphic Dynamic: Notes on adding ad-hoc polymorphic dynamic types
- Proposal to allow classes to give default implementations for their superclasses
- Cmm: Implementing Exception Handling: Implementing exception handling for primitive operations in Cmm
- Cmm: Using Kinds to implement calling conventions: Pointers to explanations of what a CmmKind is and why you might find one useful.
- SIMD: Notes on adding SIMD instructions and primOps to GHC
- Explicit Call Stack: Notes about maintaining an explicit call stack, to support error attribution and profiling.
- SQL-Like Comprehensions: Notes on the ongoing implementation of SPJs "Comprehensive Comprehensions".
- GHCi Debuger
- The Runtime System
- Garbage Collector: Notes about GHC's existing single threaded garbage collector and development of a parallel GC.
- GMP Memory Managment: Describes how the garbage collector cooperates with GMP for Integer.
- SemiTagging: Describes how the semi-tagging optimisation will be implemented.
- PAPI: Measurement of program performance using CPU events (cache misses, branch mis-predictions).
- Other Cross-cutting concerns: topics which span both the compiler and the runtime system
- Parallel Haskell Variants: All aspects of the GpH and Eden parallel variants of GHC. (work in progress)
Here are some useful, but somewhat-out-of-date resources:
- The old GHC Commentary: Information on the internals of GHC, in various states of up-to-dateness. We are keen to move this stuff out of its current location and onto this Wiki. If anyone is willing to help do that, even for just a part in which you are interested, we would be delighted. There is a page which tracks the progress of migrating information from the old commentary to this wiki.
- GHC Papers: Papers and pointers to other documents that relate to the inner workings of GHC.