Changes between Version 8 and Version 9 of Commentary/SourceTree/Includes


Ignore:
Timestamp:
Dec 11, 2012 4:49:09 PM (16 months ago)
Author:
simonmar
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/SourceTree/Includes

    v8 v9  
    3535written in C, such as the compiler itself, or the C-- code in the RTS? 
    3636 
    37 Our solution is the C program 
    38 [http://darcs.haskell.org/ghc/includes/mkDerivedConstants.c mkDerivedConstants.c]. 
    39 It `#includes` the C header files containing the structure 
    40 definitions, and emits a new C header file containing only `#define`s 
    41 that give the byte offsets of important fields in those structures. 
    42 The program generates the following files: 
     37Our solution is the Haskell program in [source:utils/deriveConstants/DeriveConstants.hs]. 
     38It determines the sizes and fields offsets from the C header files by invoking the C compiler for the target platform, and then looking at the resulting object file (we can't ''run'' the code generated by the target C compiler, because this is the host platform). 
    4339 
    44  * `DerivedConstants.h` 
    45  * `GHCConstants.h` 
    46  
    47 Take a look at those files in a build tree to see exactly what is 
    48 generated.  These new headers can then be `#included` into Haskell 
    49 code or C-- code. 
     40The !DeriveConstants program generates a few header files, notably `includes/dist-derivedconstants/header/DerivedConstants.h`, which contains C `#define`s for each of the derived constants; this file is used by C-- code in the RTS.  It also generates a few files of Haskell code which are included into GHC itself, in the `DynFlags` module. 
    5041 
    5142== Used when compiling via C ==