|Version 2 (modified by simonmar, 9 years ago) (diff)|
[ Up one level ]
GHC Source Tree Roadmap: rts/
This directory contains the source code for the runtime system.
There are three types of files:
- Header files that are private to the RTS. That is, header files in this directory are not shipped with GHC, and APIs they define are therefore intended to be private and not usable by client code (in practice, we do not and probably cannot enforce this). Header files that we do ship with GHC are in the includes directory.
- C source code for the runtime system. Conventions used in this code are described in Commentary/Rts/Conventions.
- C-- code for parts of the runtime that are part of the Haskell execution environment: for example, the implementation of primitives, exceptions, and so on. A .cmm file is pseudo C--: more or less C-- syntax with some omissions and some additional macro-like extensions implemented by GHC. The .cmm files are compiled using GHC itself: see Commentary/Compiler/CmmFiles?.
Subdirectories of rts/
- POSIX and Win32-specific parts of the runtime respectively. We try to put platform-specific stuff in these directories, however not all of the RTS follows this convention right now.
- Hooks for changing the RTS behaviour from client code, eg. changing the default heap size. (see User's Guide for more about hooks).
All this code runs on the Haskell side of the Haskell/C divide; StgCRun is the interface between the two layers.
- Apply.cmm, AutoApply.h, AutoApply.cmm, Apply.h
- The eval/apply machinery. Note: AutoApply.cmm is the family of functions for performing generic application of unknown functions, this code depends on the number of registers available for argument passing, so it is generated automatically by the program genapply in utils/genapply.
- Support for execptions.
- Code for preparing the stack when the current Haskell thread needs to return to the RTS, because we either ran out of heap or stack, or need to block (eg. takeMVar), or yield.
- Some built-in closures, such as the family of small Ints and Chars, and some built-in info tables such as BLACKHOLE and ARR_WORDS.
- Code that executes when a Haskell thread begins and ends.
- Header file included when compiling .cmm files via C.
- Floating-point stuff.
- Implementation of Software Transactional Memory.
The Storage Manager?
- Determining properties of various types of closures.
- The generational copying garbage collector.
- MBlock.c, MBlock.h, OSMem.h
- The "megablock" allocator; this is the thin layer between the RTS and the operating system for allocating memory.
- Stable names and stable pointers.
- Top-level of the storage manager.
- Waiting for events (non-threaded RTS only).
- Timer.c, Timer.h, Ticker.h
- The runtime's interval timer, used for context switching and profiling.
C files: the Commentary/Rts/FFI
- Very hairy support for foreign import "wrapper".
- Disassembler.c, Disassembler.h
- Interpreter.c, Interpreter.h
- The byte-code interpreter and disassembler.
The Front Panel
The front panel is currently defunct. It offers a graphical view of the running Haskell program in real time, and was pretty cool when it worked.
- FrontPanel.c, FrontPanel.h
- VisCallbacks.c, VisCallbacks.h
- VisSupport.c, VisSupport.h
- VisWindow.c, VisWindow.h
- The C main() function for a standalone Haskell program; basically this is just a client of HsFFI.h.
- Understands the +RTS ... -RTS flags.
- Support for emitting messages from the runtime.
- Code for GUM: parallel GHC. This is heavily bitrotted and currently doesn't work (as of GHC 6.6; it last worked around 5.02 I believe).
- Bitrotted code for GHC.NET.