[commit: ghc] ghc-7.8: Fix incorrect blocksize calculation on Win64 (e2dc029)

git at git.haskell.org git at git.haskell.org
Mon Mar 17 15:36:36 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-7.8
Link       : http://ghc.haskell.org/trac/ghc/changeset/e2dc02942ba918fab0fca26596882ba2990b8833/ghc

>---------------------------------------------------------------

commit e2dc02942ba918fab0fca26596882ba2990b8833
Author: Kyrill Briantsev <kyrab at mail.ru>
Date:   Wed Mar 12 14:31:21 2014 -0500

    Fix incorrect blocksize calculation on Win64
    
    Fixes #8839
    
    Signed-off-by: Austin Seipp <austin at well-typed.com>
    (cherry picked from commit b7e5d722c6811f34253d8202540dd9b0ec1b6766)


>---------------------------------------------------------------

e2dc02942ba918fab0fca26596882ba2990b8833
 includes/rts/storage/Block.h |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/includes/rts/storage/Block.h b/includes/rts/storage/Block.h
index 5567bf4..29c081b 100644
--- a/includes/rts/storage/Block.h
+++ b/includes/rts/storage/Block.h
@@ -9,16 +9,26 @@
 #ifndef RTS_STORAGE_BLOCK_H
 #define RTS_STORAGE_BLOCK_H
 
+#include "ghcconfig.h"
+
 /* The actual block and megablock-size constants are defined in
  * includes/Constants.h, all constants here are derived from these.
  */
 
 /* Block related constants (BLOCK_SHIFT is defined in Constants.h) */
 
+#if SIZEOF_LONG == SIZEOF_VOID_P
+#define UNIT 1UL
+#elif SIZEOF_LONG_LONG == SIZEOF_VOID_P
+#define UNIT 1ULL
+#else
+#error "Size of pointer is suspicious."
+#endif
+
 #ifdef CMINUSMINUS
 #define BLOCK_SIZE   (1<<BLOCK_SHIFT)
 #else
-#define BLOCK_SIZE   (1UL<<BLOCK_SHIFT)
+#define BLOCK_SIZE   (UNIT<<BLOCK_SHIFT)
 // Note [integer overflow]
 #endif
 
@@ -33,7 +43,7 @@
 #ifdef CMINUSMINUS
 #define MBLOCK_SIZE    (1<<MBLOCK_SHIFT)
 #else
-#define MBLOCK_SIZE    (1UL<<MBLOCK_SHIFT)
+#define MBLOCK_SIZE    (UNIT<<MBLOCK_SHIFT)
 // Note [integer overflow]
 #endif
 



More information about the ghc-commits mailing list