932b4ec2ab975ea9cc352e389a9db5763e9a9f3a
[ghc-hetmet.git] / ghc / includes / Stg.h
1 /* -----------------------------------------------------------------------------
2  * $Id: Stg.h,v 1.12 1999/05/11 16:46:20 keithw Exp $
3  *
4  * (c) The GHC Team, 1998-1999
5  *
6  * Top-level include file for everything STG-ish.  
7  *
8  * This file is included *automatically* by all .hc files.
9  *
10  * ---------------------------------------------------------------------------*/
11
12 #ifndef STG_H
13 #define STG_H
14
15 #ifndef NON_POSIX_SOURCE
16 #define _POSIX_SOURCE
17 #endif
18
19 /* Configuration */
20 #include "config.h"
21 #ifdef __HUGS__ /* vile hack till the GHC folks come on board */
22 #include "options.h"
23 #endif
24
25 /* Some macros to handle DLLing (Win32 only at the moment). */
26 #include "StgDLL.h"
27
28 /* Turn lazy blackholing and eager blackholing on/off.
29  *
30  * Using eager blackholing makes things easier to debug because
31  * the blackholes are more predictable - but it's slower and less sexy.
32  *
33  * For now, do lazy and not eager.
34  */
35
36 #define LAZY_BLACKHOLING
37 /* #define EAGER_BLACKHOLING */
38
39 #ifdef TICKY_TICKY
40 /* TICKY_TICKY needs EAGER_BLACKHOLING to verify no double-entries of single-entry thunks. */
41 # undef  LAZY_BLACKHOLING 
42 # define EAGER_BLACKHOLING
43 #endif
44
45 /* ToDo: Set this flag properly: COMPILER and INTERPRETER should not be mutually exclusive. */
46 #ifndef INTERPRETER
47 #define COMPILER 1
48 #endif
49
50 /* bit macros
51  */
52 #define BITS_PER_BYTE 8
53 #define BITS_IN(x) (BITS_PER_BYTE * sizeof(x))
54
55 /* -----------------------------------------------------------------------------
56    Assertions and Debuggery
57    -------------------------------------------------------------------------- */
58
59 #ifndef DEBUG
60 #define ASSERT(predicate) /* nothing */
61 #else
62
63 void _stgAssert (char *, unsigned int);
64
65 #define ASSERT(predicate)                       \
66         if (predicate)                          \
67             /*null*/;                           \
68         else                                    \
69             _stgAssert(__FILE__, __LINE__)
70 #endif /* DEBUG */
71
72 /* -----------------------------------------------------------------------------
73    Include everything STG-ish
74    -------------------------------------------------------------------------- */
75
76 /* Global type definitions*/
77 #include "StgTypes.h"
78
79 /* Global constaints */
80 #include "Constants.h"
81
82 /* Profiling information */
83 #include "Profiling.h"
84
85 /* Storage format definitions */
86 #include "Closures.h"
87 #include "ClosureTypes.h"
88 #include "InfoTables.h"
89 #include "TSO.h"
90
91 /* STG/Optimised-C related stuff */
92 #include "MachRegs.h"
93 #include "Regs.h"
94 #include "TailCalls.h"
95
96 /* these are all ANSI C headers */
97 #include <stdlib.h>
98 #include <string.h>
99 #include <math.h>
100 #include <assert.h>
101 #include <errno.h>
102 #include <stdio.h>
103
104 #ifdef HAVE_SIGNAL_H
105 #include <signal.h>
106 #endif
107
108 #ifdef HAVE_UNISTD_H
109 #include <unistd.h>
110 #endif
111
112 /* GNU mp library */
113 #include "gmp.h"
114
115 /* Wired-in Prelude identifiers */
116 #include "Prelude.h"
117
118 /* Storage Manager */
119 #include "StgStorage.h"
120
121 /* Macros for STG/C code */
122 #include "ClosureMacros.h"
123 #include "InfoMacros.h"
124 #include "StgMacros.h"
125 #include "StgProf.h"
126 #include "PrimOps.h"
127 #include "Updates.h"
128 #include "StgTicky.h"
129 #include "CCall.h"
130 #include "Stable.h"
131
132 /* Built-in entry points */
133 #include "StgMiscClosures.h"
134
135 /* Runtime-system hooks */
136 #include "Hooks.h"
137
138 /* Misc stuff without a home */
139 #if defined(ENABLE_WIN32_DLL_SUPPOT) && !defined(COMPILING_RTS)
140 extern DLLIMPORT char **prog_argv;      /* so we can get at these from Haskell */
141 extern DLLIMPORT int    prog_argc;
142 #else
143 extern char **prog_argv;        /* so we can get at these from Haskell */
144 extern int    prog_argc;
145 #endif
146
147 extern char **environ;
148
149 /* Creating and destroying an adjustor thunk.
150    I cannot make myself create a separate .h file
151    for these two (sof.) 
152    
153 */
154 extern void* createAdjustor(int cconv, StgStablePtr hptr, StgFunPtr wptr);
155 extern void  freeHaskellFunctionPtr(void* ptr);
156
157 #endif /* STG_H */