diff options
author | Crazycolorz5 <Crazycolorz5@gmail.com> | 2019-01-20 19:26:58 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-12-11 14:12:17 -0500 |
commit | f80c4a66ae219afa7bd4172441f4e94ba649c9d9 (patch) | |
tree | 34c3aa2cc484ade9b2460ca18941763fcb101fcc /libraries | |
parent | 6e47a76a3d0a7b3d424442914478de579a49363c (diff) | |
download | haskell-f80c4a66ae219afa7bd4172441f4e94ba649c9d9.tar.gz |
rts: Specialize hashing at call site rather than in struct.
Separate word and string hash tables on the type level, and do not store
the hashing function. Thus when a different hash function is desire it
is provided upon accessing the table. This is worst case the same as
before the change, and in the majority of cases is better. Also mark the
functions for aggressive inlining to improve performance. {F1686506}
Reviewers: bgamari, erikd, simonmar
Subscribers: rwbarton, thomie, carter
GHC Trac Issues: #13165
Differential Revision: https://phabricator.haskell.org/D4889
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/base/GHC/StaticPtr.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libraries/base/GHC/StaticPtr.hs b/libraries/base/GHC/StaticPtr.hs index ee5ba786f6..b8d5c116d1 100644 --- a/libraries/base/GHC/StaticPtr.hs +++ b/libraries/base/GHC/StaticPtr.hs @@ -48,7 +48,7 @@ module GHC.StaticPtr ) where import Foreign.C.Types (CInt(..)) -import Foreign.Marshal (allocaArray, peekArray) +import Foreign.Marshal (allocaArray, peekArray, withArray) import GHC.Ptr (Ptr(..), nullPtr) import GHC.Fingerprint (Fingerprint(..)) import GHC.Prim @@ -87,13 +87,13 @@ staticKey (StaticPtr w0 w1 _ _) = Fingerprint (W64# w0) (W64# w1) -- unsafeLookupStaticPtr :: StaticKey -> IO (Maybe (StaticPtr a)) unsafeLookupStaticPtr (Fingerprint w1 w2) = do - ptr@(Ptr addr) <- hs_spt_lookup w1 w2 + ptr@(Ptr addr) <- withArray [w1, w2] hs_spt_lookup if (ptr == nullPtr) then return Nothing else case addrToAny# addr of (# spe #) -> return (Just spe) -foreign import ccall unsafe hs_spt_lookup :: Word64 -> Word64 -> IO (Ptr a) +foreign import ccall unsafe hs_spt_lookup :: Ptr Word64 -> IO (Ptr a) -- | A class for things buildable from static pointers. class IsStatic p where |