X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=includes%2FStg.h;h=06a866256e0d94408d2f72a6f5443a6964889af2;hb=ad379ff7e22681c09ec7b50bc00d2d6cd3ae3263;hp=392fd2a0abb30dfa4c5e1bcd1df22e90ab5f2f82;hpb=930a3e53e87cae37d266925f2908c9d180045311;p=ghc-hetmet.git diff --git a/includes/Stg.h b/includes/Stg.h index 392fd2a..06a8662 100644 --- a/includes/Stg.h +++ b/includes/Stg.h @@ -36,7 +36,8 @@ // constants from math.h, which we occasionally need to use in .hc (#1861) # define _ISOC99_SOURCE -// Turning on _ISOC99_SOURCE means S_ISSOCK gets defined on Linux +// We need _BSD_SOURCE so that math.h defines things like gamma +// on Linux # define _BSD_SOURCE #endif @@ -77,11 +78,16 @@ #define BITS_PER_BYTE 8 #define BITS_IN(x) (BITS_PER_BYTE * sizeof(x)) +/* Compute offsets of struct fields + */ +#define STG_FIELD_OFFSET(s_type, field) ((StgWord)&(((s_type*)0)->field)) + /* * 'Portable' inlining: * INLINE_HEADER is for inline functions in header files (macros) * STATIC_INLINE is for inline functions in source files - * EXTERN_INLINE is for functions that we want to inline sometimes + * EXTERN_INLINE is for functions that we want to inline sometimes + * (we also compile a static version of the function; see Inlines.c) */ #if defined(__GNUC__) || defined( __INTEL_COMPILER) @@ -89,11 +95,28 @@ # define INLINE_ME inline # define STATIC_INLINE INLINE_HEADER -# if defined(KEEP_INLINES) -# define EXTERN_INLINE inline -# else -# define EXTERN_INLINE extern inline -# endif +// The special "extern inline" behaviour is now only supported by gcc +// when _GNUC_GNU_INLINE__ is defined, and you have to use +// __attribute__((gnu_inline)). So when we don't have this, we use +// ordinary static inline. +// +// Apple's gcc defines __GNUC_GNU_INLINE__ without providing +// gnu_inline, so we exclude MacOS X and fall through to the safe +// version. +// +#if defined(__GNUC_GNU_INLINE__) && !defined(__APPLE__) +# if defined(KEEP_INLINES) +# define EXTERN_INLINE inline +# else +# define EXTERN_INLINE extern inline __attribute__((gnu_inline)) +# endif +#else +# if defined(KEEP_INLINES) +# define EXTERN_INLINE +# else +# define EXTERN_INLINE INLINE_HEADER +# endif +#endif #elif defined(_MSC_VER) @@ -187,9 +210,7 @@ typedef StgWord StgWordArray[]; #include "MachRegs.h" #include "Regs.h" -#ifdef TICKY_TICKY #include "TickyCounters.h" -#endif #if IN_STG_CODE /*