Changes between Version 1 and Version 2 of Commentary/Rts/Word


Ignore:
Timestamp:
Sep 6, 2006 11:16:25 AM (9 years ago)
Author:
simonmar
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Rts/Word

    v1 v2  
    33= GHC Commentary: The Word =
    44
    5 The most important type in the runtime is {{{StgWord}}}, defined in [[GhcFile(includes/StgTypes.h)]]
    6 [[HelloWorld(foo,bar)]]
     5The most important type in the runtime is {{{StgWord}}}, defined in [[GhcFile(includes/StgTypes.h)]].  A word is defined to be the same size as a pointer on the current platform.  All these types are interconvertible without losing information, and have the same size (as reported by {{{sizeof}}}):
    76
     7 {{{StgWord}}}::
     8  An unsiged integral type of word size
     9
     10 {{{StgInt}}}::
     11  A signed integral type of word size
     12
     13 {{{StgPtr}}}::
     14  Pointer to {{{StgWord}}}
     15
     16The word is the basic unit of allocation in GHC: the heap and stack are both allocated in units of a word.  Throughout the runtime we often use sizes that are in units of words, so as to abstract away from the real word size of the underlying architecture.
     17
     18C-- only understands units of bytes, so we have various macros in [[GhcFile(includes/Cmm.h)]] to make manipulating things in units of words easier in {{{.cmm}}} files.