GHC.Iface.Binary

ghc-9.10.0.20240413: The GHC API

Safe Haskell | None
Language | GHC2021

GHC.Iface.Binary

Contents

- Public API for interface file serialisation
- Internal serialisation functions

Description

Binary interface file support.

Synopsis

- writeBinIface :: Profile -> TraceBinIFace -> FilePath -> ModIface -> IO ()
- readBinIface :: Profile -> NameCache -> CheckHiWay -> TraceBinIFace -> FilePath -> IO ModIface
- readBinIfaceHeader :: Profile -> NameCache -> CheckHiWay -> TraceBinIFace -> FilePath -> IO (Fingerprint, BinHandle)
- getSymtabName :: NameCache -> Dictionary -> SymbolTable -> BinHandle -> IO Name
- data CheckHiWay
  - = CheckHiWay
  - | IgnoreHiWay
- data TraceBinIFace
  - = TraceBinIFace (SDoc -> IO ())
  - | QuietBinIFace
- getWithUserData :: Binary a => NameCache -> BinHandle -> IO a
- putWithUserData :: Binary a => TraceBinIFace -> BinHandle -> a -> IO ()
- getSymbolTable :: BinHandle -> NameCache -> IO SymbolTable
- putName :: FSTable -> BinSymbolTable -> BinHandle -> Name -> IO ()
- putSymbolTable :: BinHandle -> Int -> UniqFM Name (Int, Name) -> IO ()
- data BinSymbolTable = BinSymbolTable {
  - bin_symtab_next :: !FastMutInt
  - bin_symtab_map :: !(IORef (UniqFM Name (Int, Name)))
  }

# Public API for interface file serialisation

writeBinIface :: Profile -> TraceBinIFace -> FilePath -> ModIface -> IO () Source #

Write an interface file

readBinIface :: Profile -> NameCache -> CheckHiWay -> TraceBinIFace -> FilePath -> IO ModIface Source #

Read an interface file.

readBinIfaceHeader :: Profile -> NameCache -> CheckHiWay -> TraceBinIFace -> FilePath -> IO (Fingerprint, BinHandle) Source #

Read an interface file header, checking the magic number, version, and way. Returns the hash of the source file and a BinHandle which points at the start of the rest of the interface file data.

getSymtabName :: NameCache -> Dictionary -> SymbolTable -> BinHandle -> IO Name Source #

data CheckHiWay Source #

Constructors

CheckHiWay |
IgnoreHiWay |

#### Instances

Instances details

Eq CheckHiWay Source # |
Instance details Defined in GHC.Iface.Binary Methods (==) :: CheckHiWay -> CheckHiWay -> Bool # (/=) :: CheckHiWay -> CheckHiWay -> Bool #

data TraceBinIFace Source #

Constructors

TraceBinIFace (SDoc -> IO ()) |
QuietBinIFace |

getWithUserData :: Binary a => NameCache -> BinHandle -> IO a Source #

This performs a get action after reading the dictionary and symbol table. It is necessary to run this before trying to deserialise any Names or FastStrings.

putWithUserData :: Binary a => TraceBinIFace -> BinHandle -> a -> IO () Source #

Put a piece of data with an initialised `UserData` field. This is necessary if you want to serialise Names or FastStrings. It also writes a symbol table and the dictionary. This segment should be read using `getWithUserData`.

# Internal serialisation functions

getSymbolTable :: BinHandle -> NameCache -> IO SymbolTable Source #

putName :: FSTable -> BinSymbolTable -> BinHandle -> Name -> IO () Source #

putSymbolTable :: BinHandle -> Int -> UniqFM Name (Int, Name) -> IO () Source #

data BinSymbolTable Source #

Constructors

BinSymbolTable |
Fields bin_symtab_next :: !FastMutInt bin_symtab_map :: !(IORef (UniqFM Name (Int, Name)))