X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fincludes%2FStg.h;h=c6792b33c80f5f845b64ad26584d40b369fdc170;hb=aa95678657cc96dc2bf7a3f235a7031a6c005b0a;hp=b515e21f0be12a5ac8a28c93ce19fcf181e2d23d;hpb=0bffc410964e1688ad80d277d53400659e697ab5;p=ghc-hetmet.git diff --git a/ghc/includes/Stg.h b/ghc/includes/Stg.h index b515e21..c6792b3 100644 --- a/ghc/includes/Stg.h +++ b/ghc/includes/Stg.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Stg.h,v 1.50 2002/12/11 15:36:39 simonmar Exp $ + * $Id: Stg.h,v 1.60 2003/12/28 13:09:43 panne Exp $ * * (c) The GHC Team, 1998-1999 * @@ -36,6 +36,10 @@ /* Configuration */ #include "config.h" +/* This needs to be up near the top as the register line on alpha needs + * to be before all procedures */ +#include "TailCalls.h" + #if __GNUC__ >= 3 /* Assume that a flexible array member at the end of a struct * can be defined thus: T arr[]; */ @@ -78,8 +82,40 @@ # define LAZY_BLACKHOLING #endif -/* ToDo: remove */ -#define COMPILER 1 +#if defined(__GNUC__) +#define GNU_ATTRIBUTE(at) __attribute__((at)) +#else +#define GNU_ATTRIBUTE(at) +#endif + +/* + * Empty structures isn't supported by all, so to define + * empty structures, please protect the defn with an + * #if SUPPORTS_EMPTY_STRUCTS. Similarly for use, + * employ the macro MAYBE_EMPTY_STRUCT(): + * + * MAYBE_EMPTY_STRUCT(structFoo, fieldName); + */ +#if SUPPORTS_EMPTY_STRUCTS +# define MAYBE_EMPTY_STRUCT(a,b) a b; +#else +# define MAYBE_EMPTY_STRUCT(a,b) /* empty */ +#endif + +/* + * 'Portable' + */ +#if defined(__GNUC__) +# define INLINE_HEADER static inline +# define INLINE_ME inline +# define STATIC_INLINE INLINE_HEADER +#elif defined(_MSC_VER) +# define INLINE_HEADER __inline static +# define INLINE_ME __inline +# define STATIC_INLINE INLINE_HEADER +#else +# error "Don't know how to inline functions with your C compiler." +#endif /* TABLES_NEXT_TO_CODE says whether to assume that info tables are * assumed to reside just before the code for a function. @@ -186,12 +222,18 @@ typedef StgWord64 LW_; #include "SMP.h" #include "MachRegs.h" #include "Regs.h" -#include "TailCalls.h" #include "Block.h" /* RTS public interface */ #include "RtsAPI.h" +/* System headers: stdlib.h is eeded so that we can use NULL. It must + * come after MachRegs.h, because stdlib.h might define some inline + * functions which may only be defined after register variables have + * been declared. + */ +#include + #ifdef SMP #include #endif @@ -225,15 +267,21 @@ typedef StgWord64 LW_; /* Misc stuff without a home */ DLL_IMPORT_RTS extern char **prog_argv; /* so we can get at these from Haskell */ DLL_IMPORT_RTS extern int prog_argc; +DLL_IMPORT_RTS extern char *prog_name; extern void stackOverflow(void); -/* Creating and destroying an adjustor thunk. - I cannot make myself create a separate .h file - for these two (sof.) +#if defined(WANT_DOTNET_SUPPORT) +#include "DNInvoke.h" +#endif + +/* Creating and destroying an adjustor thunk and initialising the whole + adjustor thunk machinery. I cannot make myself create a separate .h file + for these three (sof.) */ -extern void* createAdjustor(int cconv, StgStablePtr hptr, StgFunPtr wptr); -extern void freeHaskellFunctionPtr(void* ptr); +extern void* createAdjustor(int cconv, StgStablePtr hptr, StgFunPtr wptr); +extern void freeHaskellFunctionPtr(void* ptr); +extern rtsBool initAdjustor(void); #endif /* STG_H */