[commit: ghc] master: Fix incorrect blocksize calculation on Win64 (b7e5d72)

git at git.haskell.org git at git.haskell.org
Thu Mar 13 22:57:55 UTC 2014


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/b7e5d722c6811f34253d8202540dd9b0ec1b6766/ghc

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

commit b7e5d722c6811f34253d8202540dd9b0ec1b6766
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>


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

b7e5d722c6811f34253d8202540dd9b0ec1b6766
 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