Ticket #9878: track-9887.export-io.patch

File track-9887.export-io.patch, 1.2 KB (added by qnikst, 4 years ago)

Export IO variant of staticPtrKeys

  • libraries/base/GHC/StaticPtr.hs

    commit 9fb2e57592e9a959e5091f05fe25bf3b371e6e00
    Author: Alexander Vershilov <alexander.vershilov@gmail.com>
    Date:   Mon Dec 15 04:54:48 2014 +0300
    
        Trac 9878: export IO variant of staticPtrKeys.
    
    diff --git a/libraries/base/GHC/StaticPtr.hs b/libraries/base/GHC/StaticPtr.hs
    index b92b843..e089ed2 100644
    a b module GHC.StaticPtr 
    3939  , StaticPtrInfo(..)
    4040  , staticPtrInfo
    4141  , staticPtrKeys
     42  , currentStaticPtrKeys
    4243  ) where
    4344
    4445import Data.Typeable       (Typeable)
    foreign import ccall unsafe hs_spt_lookup :: Ptr () -> IO (Ptr a) 
    109110
    110111-- | A list of all known keys.
    111112staticPtrKeys :: [StaticKey]
    112 staticPtrKeys = unsafePerformIO $ do
     113staticPtrKeys = unsafePerformIO $ currentStaticPtrKeys
     114{-# NOINLINE staticPtrKeys #-}
     115
     116currentStaticPtrKeys :: IO [StaticKey]
     117currentStaticPtrKeys = do
    113118    keyCount <- hs_spt_key_count
    114119    allocaArray (fromIntegral keyCount) $ \p -> do
    115120      count <- hs_spt_keys p keyCount
    116121      peekArray (fromIntegral count) p >>=
    117122        mapM (\pa -> peekArray 2 pa >>= \[w1, w2] -> return $ Fingerprint w1 w2)
    118 {-# NOINLINE staticPtrKeys #-}
    119123
    120124foreign import ccall unsafe hs_spt_key_count :: IO CInt
    121125