[commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Use isTrue# for pointer equality (110a6c4)

git at git.haskell.org git at git.haskell.org
Mon Apr 17 21:44:39 UTC 2017


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

On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394
Link       : http://git.haskell.org/packages/containers.git/commitdiff/110a6c435e3389c065cd1bcb353c3b8335e356f2

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

commit 110a6c435e3389c065cd1bcb353c3b8335e356f2
Author: David Feuer <David.Feuer at gmail.com>
Date:   Mon Aug 1 13:56:31 2016 -0400

    Use isTrue# for pointer equality
    
    Edward Kmett says it's better to do that and take the load off
    core-to-core. Currently, that gets shifted to codegen, I think.


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

110a6c435e3389c065cd1bcb353c3b8335e356f2
 Data/Utils/PtrEquality.hs | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/Data/Utils/PtrEquality.hs b/Data/Utils/PtrEquality.hs
index 5ab38fa..324ef40 100644
--- a/Data/Utils/PtrEquality.hs
+++ b/Data/Utils/PtrEquality.hs
@@ -7,14 +7,21 @@ module Data.Utils.PtrEquality (ptrEq) where
 
 #ifdef __GLASGOW_HASKELL__
 import GHC.Exts ( reallyUnsafePtrEquality# )
+#if __GLASGOW_HASKELL__ < 707
+import GHC.Exts ( (==#) )
+#else
+import GHC.Exts ( isTrue# )
+#endif
 
 -- | Checks if two pointers are equal. Yes means yes;
 -- no means maybe. The values should be forced to at least
 -- WHNF before comparison to get moderately reliable results.
 ptrEq :: a -> a -> Bool
-ptrEq x y = case reallyUnsafePtrEquality# x y of
-              1# -> True
-              _ -> False
+#if __GLASGOW_HASKELL__ < 707
+ptrEq x y = reallyUnsafePtrEquality# x y ==# 1#
+#else
+ptrEq x y = isTrue# (reallyUnsafePtrEquality# x y)
+#endif
 
 #else
 ptrEq :: a -> a -> Bool



More information about the ghc-commits mailing list