projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
move directory after Win32/unix
[ghc-hetmet.git]
/
includes
/
Stg.h
diff --git
a/includes/Stg.h
b/includes/Stg.h
index
8e3da0f
..
022b385
100644
(file)
--- a/
includes/Stg.h
+++ b/
includes/Stg.h
@@
-31,6
+31,9
@@
*/
#ifndef IN_STG_CODE
# define IN_STG_CODE 1
*/
#ifndef IN_STG_CODE
# define IN_STG_CODE 1
+# define _ISOC99_SOURCE
+// Turn on C99 for .hc code. This gives us the INFINITY and NAN
+// constants from math.h, which we occasionally need to use in .hc (#1861)
#endif
#if IN_STG_CODE == 0
#endif
#if IN_STG_CODE == 0
@@
-41,6
+44,11
@@
#include "ghcconfig.h"
#include "RtsConfig.h"
#include "ghcconfig.h"
#include "RtsConfig.h"
+/* The code generator calls the math functions directly in .hc code.
+ NB. after configuration stuff above, because this sets #defines
+ that depend on config info, such as __USE_FILE_OFFSET64 */
+#include <math.h>
+
/* -----------------------------------------------------------------------------
Useful definitions
-------------------------------------------------------------------------- */
/* -----------------------------------------------------------------------------
Useful definitions
-------------------------------------------------------------------------- */
@@
-66,20
+74,42
@@
#define BITS_IN(x) (BITS_PER_BYTE * sizeof(x))
/*
#define BITS_IN(x) (BITS_PER_BYTE * sizeof(x))
/*
- * 'Portable' inlining
+ * '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
*/
#if defined(__GNUC__) || defined( __INTEL_COMPILER)
*/
#if defined(__GNUC__) || defined( __INTEL_COMPILER)
+
# define INLINE_HEADER static inline
# define INLINE_ME inline
# define STATIC_INLINE INLINE_HEADER
# define INLINE_HEADER static inline
# define INLINE_ME inline
# define STATIC_INLINE INLINE_HEADER
+
+# if defined(KEEP_INLINES)
+# define EXTERN_INLINE inline
+# else
+# define EXTERN_INLINE extern inline
+# endif
+
#elif defined(_MSC_VER)
#elif defined(_MSC_VER)
+
# define INLINE_HEADER __inline static
# define INLINE_ME __inline
# define STATIC_INLINE INLINE_HEADER
# define INLINE_HEADER __inline static
# define INLINE_ME __inline
# define STATIC_INLINE INLINE_HEADER
+
+# if defined(KEEP_INLINES)
+# define EXTERN_INLINE __inline
+# else
+# define EXTERN_INLINE __inline extern
+# endif
+
#else
#else
+
# error "Don't know how to inline functions with your C compiler."
# error "Don't know how to inline functions with your C compiler."
+
#endif
#endif
+
/*
* GCC attributes
*/
/*
* GCC attributes
*/
@@
-95,6
+125,12
@@
#define GNUC3_ATTRIBUTE(at)
#endif
#define GNUC3_ATTRIBUTE(at)
#endif
+#if __GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 3
+#define GNUC_ATTR_HOT __attribute__((hot))
+#else
+#define GNUC_ATTR_HOT /* nothing */
+#endif
+
#define STG_UNUSED GNUC3_ATTRIBUTE(__unused__)
/* -----------------------------------------------------------------------------
#define STG_UNUSED GNUC3_ATTRIBUTE(__unused__)
/* -----------------------------------------------------------------------------
@@
-146,7
+182,10
@@
typedef StgWord StgWordArray[];
#include "StgDLL.h"
#include "MachRegs.h"
#include "Regs.h"
#include "StgDLL.h"
#include "MachRegs.h"
#include "Regs.h"
-#include "StgProf.h" /* ToDo: separate out RTS-only stuff from here */
+
+#ifdef TICKY_TICKY
+#include "TickyCounters.h"
+#endif
#if IN_STG_CODE
/*
#if IN_STG_CODE
/*
@@
-156,8
+195,7
@@
typedef StgWord StgWordArray[];
#include "StgMiscClosures.h"
#endif
#include "StgMiscClosures.h"
#endif
-/* RTS external interface */
-#include "RtsExternal.h"
+#include "SMP.h" // write_barrier() inline is required
/* -----------------------------------------------------------------------------
Moving Floats and Doubles
/* -----------------------------------------------------------------------------
Moving Floats and Doubles
@@
-442,7
+480,9
@@
typedef union {
/* Approximate version when we don't have long arithmetic (on 64-bit archs) */
/* Approximate version when we don't have long arithmetic (on 64-bit archs) */
-#define HALF_POS_INT (((I_)1) << (BITS_IN (I_) / 2))
+/* If we have n-bit words then we have n-1 bits after accounting for the
+ * sign bit, so we can fit the result of multiplying 2 (n-1)/2-bit numbers */
+#define HALF_POS_INT (((I_)1) << ((BITS_IN (I_) - 1) / 2))
#define HALF_NEG_INT (-HALF_POS_INT)
#define mulIntMayOflo(a,b) \
#define HALF_NEG_INT (-HALF_POS_INT)
#define mulIntMayOflo(a,b) \