[Git][ghc/ghc][wip/T22010] Fix dominators and uniqsupply
Jaro Reinders (@Noughtmare)
gitlab at gitlab.haskell.org
Mon Jun 5 08:23:48 UTC 2023
Jaro Reinders pushed to branch wip/T22010 at Glasgow Haskell Compiler / GHC
Commits:
d87fe61f by Jaro Reinders at 2023-06-05T10:23:36+02:00
Fix dominators and uniqsupply
- - - - -
2 changed files:
- compiler/GHC/CmmToAsm/CFG/Dominators.hs
- compiler/GHC/Types/Unique/Supply.hs
Changes:
=====================================
compiler/GHC/CmmToAsm/CFG/Dominators.hs
=====================================
@@ -500,8 +500,10 @@ asGraph t@(Node a _) = let g = go t in (a, fromAdj g)
asTree :: Rooted -> Tree Word64
asTree (r,g) = let go a = Node a (fmap go ((WS.toList . f) a))
- f = (g WM.!)
+ f = (g !)
in go r
+ where (!) g n = maybe mempty id (WM.lookup n g)
+
reachable :: (Word64 -> Word64Set) -> (Word64 -> Word64Set)
reachable f a = go (WS.singleton a) a
=====================================
compiler/GHC/Types/Unique/Supply.hs
=====================================
@@ -43,15 +43,14 @@ import Data.Char
import Data.Word
import GHC.Exts( Ptr(..), noDuplicate#, oneShot )
import Foreign.Storable
-import GHC.Word (Word64(..))
#include "MachDeps.h"
#if MIN_VERSION_GLASGOW_HASKELL(9,1,0,0)
-#if WORD_SIZE_IN_BITS < 64
-import GHC.Exts( fetchAddWord64Addr#, plusWord64#, readWord64OffAddr# )
-#else
+import GHC.Word( Word64(..) )
import GHC.Exts( fetchAddWordAddr#, plusWord#, readWordOffAddr# )
+#if MIN_VERSION_GLASGOW_HASKELL(9,4,0,0) && WORD_SIZE_IN_BITS == 64
+import GHC.Exts( wordToWord64# )
#endif
#endif
@@ -230,7 +229,7 @@ mkSplitUniqSupply c
(# s4, MkSplitUniqSupply (mask .|. u) x y #)
}}}}
-#if !MIN_VERSION_GLASGOW_HASKELL(9,1,0,0)
+#if !MIN_VERSION_GLASGOW_HASKELL(9,1,0,0) || WORD_SIZE_IN_BITS != 64
foreign import ccall unsafe "genSym" genSym :: IO Word64
#else
genSym :: IO Word64
@@ -238,16 +237,13 @@ genSym = do
let !mask = (1 `unsafeShiftL` uNIQUE_BITS) - 1
let !(Ptr counter) = ghc_unique_counter
let !(Ptr inc_ptr) = ghc_unique_inc
-#if WORD_SIZE_IN_BITS < 64
- u <- IO $ \s0 -> case readWord64OffAddr# inc_ptr 0# s0 of
- (# s1, inc #) -> case fetchAddWord64Addr# counter inc s1 of
- (# s2, val #) ->
- let !u = W64# (val `plusWord64#` inc) .&. mask
-#else
u <- IO $ \s0 -> case readWordOffAddr# inc_ptr 0# s0 of
(# s1, inc #) -> case fetchAddWordAddr# counter inc s1 of
(# s2, val #) ->
+#if !MIN_VERSION_GLASGOW_HASKELL(9,3,0,0)
let !u = W64# (val `plusWord#` inc) .&. mask
+#else
+ let !u = W64# (wordToWord64# (val `plusWord#` inc)) .&. mask
#endif
in (# s2, u #)
#if defined(DEBUG)
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d87fe61fc42ad227bb0d74016364e215d4966deb
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d87fe61fc42ad227bb0d74016364e215d4966deb
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/20230605/990d9db4/attachment-0001.html>
More information about the ghc-commits
mailing list