Avoid unneccessarily re-serialising the `ModIface`
To reduce memory usage of `ModIface`, we serialise `ModIface` to an in-memory byte array, which implicitly shares duplicated values. This serailised byte array can be reused to avoid work when we actually write the `ModIface` to disk. We introduce a new field to `ModIface` which allows us to save the byte array, and write it to disk if the `ModIface` wasn't changed after the initial serialisation. This requires us to change absolute offsets, for example to jump to the deduplication table for `Name` or `FastString` with relative offsets, as the deduplication byte array doesn't contain header information, such as fingerprints. To allow us to dump the binary blob to disk, we need to replace all absolute offsets with relative ones. This leads to new primitives for `ModIface`, which help to construct relative offsets.
Showing
- compiler/GHC/Iface/Binary.hs 15 additions, 7 deletionscompiler/GHC/Iface/Binary.hs
- compiler/GHC/Iface/Ext/Fields.hs 3 additions, 3 deletionscompiler/GHC/Iface/Ext/Fields.hs
- compiler/GHC/Iface/Load.hs 2 additions, 1 deletioncompiler/GHC/Iface/Load.hs
- compiler/GHC/Iface/Make.hs 46 additions, 30 deletionscompiler/GHC/Iface/Make.hs
- compiler/GHC/Iface/Recomp.hs 4 additions, 1 deletioncompiler/GHC/Iface/Recomp.hs
- compiler/GHC/Tc/Gen/Splice.hs 4 additions, 2 deletionscompiler/GHC/Tc/Gen/Splice.hs
- compiler/GHC/Unit/Module/ModIface.hs 156 additions, 3 deletionscompiler/GHC/Unit/Module/ModIface.hs
- compiler/GHC/Utils/Binary.hs 148 additions, 11 deletionscompiler/GHC/Utils/Binary.hs
- utils/haddock 1 addition, 1 deletionutils/haddock
Loading
Please register or sign in to comment