[Git][ghc/ghc][wip/T23003] rts/nonmoving: Fix on LLP64 platforms

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Wed Oct 4 03:49:51 UTC 2023



Ben Gamari pushed to branch wip/T23003 at Glasgow Haskell Compiler / GHC


Commits:
904f58b7 by Ben Gamari at 2023-10-03T23:49:45-04:00
rts/nonmoving: Fix on LLP64 platforms

Previously `NONMOVING_SEGMENT_MASK` and friends were defined with the `UL`
size suffix. However, this is wrong on LLP64 platforms like Windows,
where `long` is 32-bits.

Fixes #23003.
Fixes #24042.

- - - - -


1 changed file:

- rts/sm/NonMoving.h


Changes:

=====================================
rts/sm/NonMoving.h
=====================================
@@ -17,13 +17,13 @@
 #include "BeginPrivate.h"
 
 // Segments
-#define NONMOVING_SEGMENT_BITS 15UL   // 2^15 = 32kByte
+#define NONMOVING_SEGMENT_BITS 15ULL   // 2^15 = 32kByte
 // Mask to find base of segment
-#define NONMOVING_SEGMENT_MASK ((1UL << NONMOVING_SEGMENT_BITS) - 1)
+#define NONMOVING_SEGMENT_MASK (((uintptr_t)1 << NONMOVING_SEGMENT_BITS) - 1)
 // In bytes
-#define NONMOVING_SEGMENT_SIZE (1UL << NONMOVING_SEGMENT_BITS)
+#define NONMOVING_SEGMENT_SIZE ((uintptr_t)1 << NONMOVING_SEGMENT_BITS)
 // In words
-#define NONMOVING_SEGMENT_SIZE_W ((1UL << NONMOVING_SEGMENT_BITS) / SIZEOF_VOID_P)
+#define NONMOVING_SEGMENT_SIZE_W (((uintptr_t)1 << NONMOVING_SEGMENT_BITS) / SIZEOF_VOID_P)
 // In blocks
 #define NONMOVING_SEGMENT_BLOCKS (NONMOVING_SEGMENT_SIZE / BLOCK_SIZE)
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/904f58b777cd024e70415e1ab7d128b94fc3728b

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/904f58b777cd024e70415e1ab7d128b94fc3728b
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20231003/c9643d13/attachment.html>


More information about the ghc-commits mailing list