X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=docs%2Fcomm%2Frts-libs%2Fprimitives.html;fp=docs%2Fcomm%2Frts-libs%2Fprimitives.html;h=28abc794261be1a50ca0b4469b2d3a5e188d1b2f;hp=0000000000000000000000000000000000000000;hb=0065d5ab628975892cea1ec7303f968c3338cbe1;hpb=28a464a75e14cece5db40f2765a29348273ff2d2 diff --git a/docs/comm/rts-libs/primitives.html b/docs/comm/rts-libs/primitives.html new file mode 100644 index 0000000..28abc79 --- /dev/null +++ b/docs/comm/rts-libs/primitives.html @@ -0,0 +1,70 @@ + + + + + The GHC Commentary - Primitives + + + +

The GHC Commentary - Primitives

+

+ Most user-level Haskell types and functions provided by GHC (in + particular those from the Prelude and GHC's Prelude extensions) are + internally constructed from even more elementary types and functions. + Most notably, GHC understands a notion of unboxed types, which + are the Haskell representation of primitive bit-level integer, float, + etc. types (as opposed to their boxed, heap allocated counterparts) - + cf. "Unboxed + Values as First Class Citizens." + +

The Ultimate Source of Primitives

+

+ The hardwired types of GHC are brought into scope by the module + PrelGHC. This modules only exists in the form of a + handwritten interface file PrelGHC.hi-boot, + which lists the type and function names, as well as instance + declarations. The actually types of these names as well as their + implementation is hardwired into GHC. Note that the names in this file + are z-encoded, and in particular, identifiers ending on zh + denote user-level identifiers ending in a hash mark (#), + which is used to flag unboxed values or functions operating on unboxed + values. For example, we have Char#, ord#, and + so on. + +

The New Primitive Definition Scheme

+

+ As of (about) the development version 4.11, the types and various + properties of primitive operations are defined in the file primops.txt.pp. + (Personally, I don't think that the .txt suffix is really + appropriate, as the file is used for automatic code generation; the + recent addition of .pp means that the file is now mangled + by cpp.) +

+ The utility genprimopcode + generates a series of Haskell files from primops.txt, which + encode the types and various properties of the primitive operations as + compiler internal data structures. These Haskell files are not complete + modules, but program fragments, which are included into compiler modules + during the GHC build process. The generated include files can be found + in the directory fptools/ghc/compiler/ and carry names + matching the pattern primop-*.hs-incl. They are generate + during the execution of the boot target in the + fptools/ghc/ directory. This scheme significantly + simplifies the maintenance of primitive operations. +

+ As of development version 5.02, the primops.txt file also allows the + recording of documentation about intended semantics of the primitives. This can + be extracted into a latex document (or rather, into latex document fragments) + via an appropriate switch to genprimopcode. In particular, see primops.txt + for full details of how GHC is configured to cope with different machine word sizes. +

+ +Last modified: Mon Nov 26 18:03:16 EST 2001 + + + +