[commit: ghc] master: Linker: Fix type in m32_free_internal (8ddf417)
git at git.haskell.org
git at git.haskell.org
Fri Oct 30 08:53:52 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/8ddf41744ea8b0c1d034f9c5e062b0112d3d3aff/ghc
>---------------------------------------------------------------
commit 8ddf41744ea8b0c1d034f9c5e062b0112d3d3aff
Author: Erik de Castro Lopo <erikd at mega-nerd.com>
Date: Fri Oct 30 15:07:21 2015 +1100
Linker: Fix type in m32_free_internal
The code:
uint64_t c = __sync_sub_and_fetch((uint64_t*)addr, 1);
was causing GCC to emit atomic instructions for 64 bit values which
are not available on PowerPC. However, since PowerPC only has a 32
bit address space, use of a 64 bit value is superflous.
Switching the type from `uint64_t` to `uintptr_t` should simply do
the correct thing on all 32 and 64 bit architectures.
Reviewers: austin, bgamari, simonmar
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1399
GHC Trac Issues: #11036
>---------------------------------------------------------------
8ddf41744ea8b0c1d034f9c5e062b0112d3d3aff
rts/Linker.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rts/Linker.c b/rts/Linker.c
index 98969b9..e7bb8f0 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -1217,7 +1217,7 @@ static void m32_allocator_init(m32_allocator m32) {
* You shouldn't have to use this method. Use `m32_free` instead.
*/
static void m32_free_internal(void * addr) {
- uint64_t c = __sync_sub_and_fetch((uint64_t*)addr, 1);
+ uintptr_t c = __sync_sub_and_fetch((uintptr_t*)addr, 1);
if (c == 0) {
munmapForLinker(addr, getPageSize());
}
More information about the ghc-commits
mailing list