... | ... | @@ -14,9 +14,9 @@ The code generator needs to know the layout of heap objects, because it generate |
|
|
|
|
|
Currently we solve the problem this way:
|
|
|
|
|
|
- C types representing heap objects are defined in the C header files, see for example [includes/rts/storage/Closures.h](/trac/ghc/browser/ghc/includes/rts/storage/Closures.h).
|
|
|
- C types representing heap objects are defined in the C header files, see for example [includes/rts/storage/Closures.h](/ghc/ghc/tree/master/ghc/includes/rts/storage/Closures.h).
|
|
|
|
|
|
- A C program, [includes/mkDerivedConstants.c](/trac/ghc/browser/ghc/includes/mkDerivedConstants.c), `#includes` the runtime headers.
|
|
|
- A C program, [includes/mkDerivedConstants.c](/ghc/ghc/tree/master/ghc/includes/mkDerivedConstants.c), `#includes` the runtime headers.
|
|
|
This program is built and run when you type `make` or `make boot` in `includes/`. It is
|
|
|
run twice: once to generate `includes/DerivedConstants.h`, and again to generate
|
|
|
`includes/GHCConstants.h`.
|
... | ... | @@ -28,7 +28,7 @@ Currently we solve the problem this way: |
|
|
```
|
|
|
|
|
|
which says that the offset to the why_blocked field of an `StgTSO` is 18 bytes. This file
|
|
|
is `#included` into [includes/Cmm.h](/trac/ghc/browser/ghc/includes/Cmm.h), so these offests are available to the
|
|
|
is `#included` into [includes/Cmm.h](/ghc/ghc/tree/master/ghc/includes/Cmm.h), so these offests are available to the
|
|
|
[hand-written .cmm files](commentary/rts/cmm).
|
|
|
|
|
|
- The file `GHCConstants.h` contains similar definitions:
|
... | ... | @@ -38,13 +38,13 @@ Currently we solve the problem this way: |
|
|
```
|
|
|
|
|
|
This time the definitions are in Haskell syntax, and this file is `#included` directly into
|
|
|
[compiler/main/Constants.lhs](/trac/ghc/browser/ghc/compiler/main/Constants.lhs). This is the way that these offsets are made
|
|
|
[compiler/main/Constants.lhs](/ghc/ghc/tree/master/ghc/compiler/main/Constants.lhs). This is the way that these offsets are made
|
|
|
available to GHC's code generator.
|
|
|
|
|
|
## Generated Cmm Naming Convention
|
|
|
|
|
|
|
|
|
See [compiler/cmm/CLabel.hs](/trac/ghc/browser/ghc/compiler/cmm/CLabel.hs)
|
|
|
See [compiler/cmm/CLabel.hs](/ghc/ghc/tree/master/ghc/compiler/cmm/CLabel.hs)
|
|
|
|
|
|
|
|
|
Labels generated by the code generator are of the form `<name>_<type>`
|
... | ... | |