never executed always true always false
    1 {-# LANGUAGE TupleSections #-}
    2 {-# LANGUAGE ForeignFunctionInterface #-}
    3 
    4 module GHCi.StaticPtrTable ( sptAddEntry ) where
    5 
    6 import Prelude -- See note [Why do we import Prelude here?]
    7 import Data.Word
    8 import Foreign
    9 import GHC.Fingerprint
   10 import GHCi.RemoteTypes
   11 
   12 -- | Used by GHCi to add an SPT entry for a set of interactive bindings.
   13 sptAddEntry :: Fingerprint -> HValue -> IO ()
   14 sptAddEntry (Fingerprint a b) (HValue x) = do
   15     -- We own the memory holding the key (fingerprint) which gets inserted into
   16     -- the static pointer table and can't free it until the SPT entry is removed
   17     -- (which is currently never).
   18     fpr_ptr <- newArray [a,b]
   19     sptr <- newStablePtr x
   20     ent_ptr <- malloc
   21     poke ent_ptr (castStablePtrToPtr sptr)
   22     spt_insert_stableptr fpr_ptr ent_ptr
   23 
   24 foreign import ccall "hs_spt_insert_stableptr"
   25     spt_insert_stableptr :: Ptr Word64 -> Ptr (Ptr ()) -> IO ()