Write an interface file.
See Note [Deduplication during iface binary serialisation] for details.
:: a typeCtrl KGHC 9.14.1 · lts/ghc-9.14.x · b2f3bfd · 2026-10-11
Moduleghc-9.14.1GHC2021
Binary interface file support.
Write an interface file.
See Note [Deduplication during iface binary serialisation] for details.
Read an interface file.
See Note [Deduplication during iface binary serialisation] for details.
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.
The compression/deduplication level of ModIface files.
A ModIface contains many duplicated symbols and names. To keep interface files small, we deduplicate them during serialisation. It is impossible to write an interface file with *no* compression/deduplication.
We support different levels of compression/deduplication, with different trade-offs for run-time performance and memory usage. If you don't have any specific requirements, then SafeExtraCompression is a good default.
NormalCompressionPerform the normal compression operations,
such as deduplicating Names and FastStrings
SafeExtraCompressionPerform some extra compression steps that have minimal impact
on the run-time of ghc.
This reduces the size of '.hi' files significantly in some cases and reduces overall memory usage in certain scenarios.
MaximumCompressionTry to compress as much as possible.
Yields the smallest '.hi' files but at the cost of additional run-time.
Bounded CompressionIFaceDefined in ghc-9.14.1 · GHC.Iface.BinaryEnum CompressionIFaceDefined in ghc-9.14.1 · GHC.Iface.BinaryEq CompressionIFaceDefined in ghc-9.14.1 · GHC.Iface.BinaryOrd CompressionIFaceDefined in ghc-9.14.1 · GHC.Iface.BinaryShow CompressionIFaceDefined in ghc-9.14.1 · GHC.Iface.BinaryOutputable CompressionIFaceDefined in ghc-9.14.1 · GHC.Iface.BinaryEq CheckHiWayDefined in ghc-9.14.1 · GHC.Iface.BinaryTraceBinIFace (SDoc -> IO ())QuietBinIFacePuts the ModIface to the WriteBinHandle.
This avoids serialisation of the ModIface if the fields mi_hi_bytes contains a Just value. This field is populated by reading the ModIface using getIfaceWithExtFields and not modifying it in any way afterwards.
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.
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.
BinSymbolTablebin_symtab_next :: !FastMutIntbin_symtab_map :: !IORef (UniqFM Name (Int, Name))Write all deduplication tables to disk after serialising the main payload.
Writes forward pointers to the deduplication tables before writing the payload to allow deserialisation *before* the payload is read again.