X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=docs%2Fcomm%2Frts-libs%2Fstgc.html;fp=docs%2Fcomm%2Frts-libs%2Fstgc.html;h=196ec9150db9668b53bb9a9ebb013783eb1df60c;hp=0000000000000000000000000000000000000000;hb=0065d5ab628975892cea1ec7303f968c3338cbe1;hpb=28a464a75e14cece5db40f2765a29348273ff2d2 diff --git a/docs/comm/rts-libs/stgc.html b/docs/comm/rts-libs/stgc.html new file mode 100644 index 0000000..196ec91 --- /dev/null +++ b/docs/comm/rts-libs/stgc.html @@ -0,0 +1,45 @@ + + + + + The GHC Commentary - Spineless Tagless C + + + +

The GHC Commentary - Spineless Tagless C

+

+ The C code generated by GHC doesn't use higher-level features of C to be + able to control as precisely as possible what code is generated. + Moreover, it uses special features of gcc (such as, first class labels) + to produce more efficient code. +

+ STG C makes ample use of C's macro language to define idioms, which also + reduces the size of the generated C code (thus, reducing I/O times). + These macros are defined in the C headers located in GHC's includes + directory. + +

TailCalls.h

+

+ TailCalls.h + defines how tail calls are implemented - and in particular - optimised + in GHC generated code. The default case, for an architecture for which + GHC is not optimised, is to use the mini interpreter described in the STG paper. +

+ For supported architectures, various tricks are used to generate + assembler implementing proper tail calls. On i386, gcc's first class + labels are used to directly jump to a function pointer. Furthermore, + markers of the form --- BEGIN --- and --- END + --- are added to the assembly right after the function prologue + and before the epilogue. These markers are used by the Evil Mangler. + +

+ +Last modified: Wed Aug 8 19:28:29 EST 2001 + + + +