summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/Rts.h40
-rw-r--r--includes/stg/Types.h23
-rw-r--r--rts/Linker.c4
-rw-r--r--rts/Stats.c2
4 files changed, 21 insertions, 48 deletions
diff --git a/includes/Rts.h b/includes/Rts.h
index 297297a6bd..501b9dcbfc 100644
--- a/includes/Rts.h
+++ b/includes/Rts.h
@@ -143,44 +143,8 @@ void _assertFail(const char *filename, unsigned int linenum)
#define USED_IF_NOT_THREADS
#endif
-#if SIZEOF_VOID_P == 8
-# define FMT_SizeT "zu"
-# define FMT_HexSizeT "zx"
-# define FMT_Word "zu"
-# define FMT_Int "zd"
-#elif SIZEOF_VOID_P == 4
-# if defined(mingw32_HOST_OS)
-# define FMT_SizeT "u"
-# define FMT_HexSizeT "x"
-# define FMT_Word "u"
-# define FMT_Int "d"
-# else
-# define FMT_SizeT "zu"
-# define FMT_HexSizeT "zx"
-# define FMT_Word "zu"
-# define FMT_Int "zd"
-# endif
-#else
-# error Cannot handle this word size
-#endif
-
-/*
- * Getting printf formats right for platform-dependent typedefs
- */
-#if SIZEOF_LONG == 8
-#define FMT_Word64 "lu"
-#define FMT_Int64 "ld"
-#else
-#if defined(mingw32_HOST_OS) && defined(i386_HOST_ARCH)
-/* mingw doesn't understand %llu/%lld - it treats them as 32-bit
- rather than 64-bit */
-#define FMT_Word64 "I64u"
-#define FMT_Int64 "I64d"
-#else
-#define FMT_Word64 "llu"
-#define FMT_Int64 "lld"
-#endif
-#endif
+#define FMT_SizeT "zu"
+#define FMT_HexSizeT "zx"
/* -----------------------------------------------------------------------------
Time values in the RTS
diff --git a/includes/stg/Types.h b/includes/stg/Types.h
index e05690ac6e..0c71ea4782 100644
--- a/includes/stg/Types.h
+++ b/includes/stg/Types.h
@@ -54,12 +54,16 @@ typedef unsigned char StgWord8;
typedef signed short StgInt16;
typedef unsigned short StgWord16;
-#if SIZEOF_LONG == 4
-typedef signed long StgInt32;
-typedef unsigned long StgWord32;
-#elif SIZEOF_INT == 4
+#if SIZEOF_INT == 4
typedef signed int StgInt32;
typedef unsigned int StgWord32;
+#define FMT_Word32 "u"
+#define FMT_Int32 "d"
+#elif SIZEOF_LONG == 4
+typedef signed long StgInt32;
+typedef unsigned long StgWord32;
+#define FMT_Word32 "lu"
+#define FMT_Int32 "ld"
#else
#error GHC untested on this architecture: sizeof(int) != 4
#endif
@@ -67,12 +71,13 @@ typedef unsigned int StgWord32;
#if SIZEOF_LONG == 8
typedef signed long StgInt64;
typedef unsigned long StgWord64;
-#elif defined(__MSVC__)
-typedef __int64 StgInt64;
-typedef unsigned __int64 StgWord64;
+#define FMT_Word64 "lu"
+#define FMT_Int64 "ld"
#elif SIZEOF_LONG_LONG == 8
typedef signed long long int StgInt64;
typedef unsigned long long int StgWord64;
+#define FMT_Word64 "llu"
+#define FMT_Int64 "lld"
#else
#error cannot find a way to define StgInt64
#endif
@@ -93,12 +98,16 @@ typedef StgInt64 StgInt;
typedef StgWord64 StgWord;
typedef StgInt32 StgHalfInt;
typedef StgWord32 StgHalfWord;
+#define FMT_Word FMT_Word64
+#define FMT_Int FMT_Int64
#else
#if SIZEOF_VOID_P == 4
typedef StgInt32 StgInt;
typedef StgWord32 StgWord;
typedef StgInt16 StgHalfInt;
typedef StgWord16 StgHalfWord;
+#define FMT_Word FMT_Word32
+#define FMT_Int FMT_Int32
#else
#error GHC untested on this architecture: sizeof(void *) != 4 or 8
#endif
diff --git a/rts/Linker.c b/rts/Linker.c
index 6085f9ce14..7a1f550a4b 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -2461,8 +2461,8 @@ addSection ( ObjectCode* oc, SectionKind kind,
s->next = oc->sections;
oc->sections = s;
- IF_DEBUG(linker, debugBelch("addSection: %p-%p (size %" FMT_Int "), kind %d\n",
- start, ((char*)end)-1, (StgInt)end - (StgInt)start + 1, kind ));
+ IF_DEBUG(linker, debugBelch("addSection: %p-%p (size %lld), kind %d\n",
+ start, ((char*)end)-1, ((long long)(size_t)end) - ((long long)(size_t)start) + 1, kind ));
}
diff --git a/rts/Stats.c b/rts/Stats.c
index 3b709bc9e8..5605810ba2 100644
--- a/rts/Stats.c
+++ b/rts/Stats.c
@@ -675,7 +675,7 @@ stat_exit(int alloc)
statsPrintf("%16" FMT_SizeT " MB total memory in use (%" FMT_SizeT " MB lost due to fragmentation)\n\n",
peak_mblocks_allocated * MBLOCK_SIZE_W / (1024 * 1024 / sizeof(W_)),
- (peak_mblocks_allocated * BLOCKS_PER_MBLOCK * BLOCK_SIZE_W - hw_alloc_blocks * BLOCK_SIZE_W) / (1024 * 1024 / sizeof(W_)));
+ (lnat)(peak_mblocks_allocated * BLOCKS_PER_MBLOCK * BLOCK_SIZE_W - hw_alloc_blocks * BLOCK_SIZE_W) / (1024 * 1024 / sizeof(W_)));
/* Print garbage collections in each gen */
statsPrintf(" Tot time (elapsed) Avg pause Max pause\n");