Version 15 (modified by simonmar, 9 years ago) (diff)


The Haskell Execution Model

The STG language has a clear operational model, as well as having a declarative lambda-calculus reading. The business of the code generator is to translate the STG program into C--, and thence to machine code, but that is mere detail. From the STG program you should be able to understand:

  • What functions are in the compiled program, and what their entry and return conventions are
  • What heap objects are allocated, when, and what their layout is

GHC uses an eval/apply execution model, described in the paper How to make a fast curry: push/enter vs eval/apply. This paper is well worth reading if you are interested in this section.