iface: Store logical parts of ModIface together
The ModIface structure is divided into several logical parts: 1. mi_mod_info: Basic module metadata (name, version, etc.) 2. mi_public: The public interface of the module (the ABI), which includes: - Exports, declarations, fixities, warnings, annotations - Class and type family instances - Rewrite rules and COMPLETE pragmas - Safe Haskell and package trust information - ABI hashes for recompilation checking 4. mi_self_recomp: Information needed for self-recompilation checking (see Note [Self recompilation information in interface files]) 5. mi_simplified_core: Optional simplified Core for bytecode generation (only present when -fwrite-if-simplified-core is enabled) 6. mi_docs: Optional documentation (only present when -haddock is enabled) 7. mi_top_env: Information about the top-level environment of the original source 8. mi_ext_fields: Additional fields for extensibility This structure helps organize the interface data according to its purpose and usage patterns. Different parts of the compiler use different fields. By separating them logically in the interface we can arrange to only deserialize the fields that are needed. This patch also enforces the invariant that the fields of ModIface are lazy. If you are keeping a ModIface on disk, then force it using `forceModIface`. Otherwise, when the `ModIface` is read from disk, only the parts which are needed from the interface will be deserialised. In a follow-up patch I will tackle follow-up issues: * Recompilation checking doesn't take into account exported named defaults (#25855) * Recompilation checking does not take into account COMPLETE pragmas (#25854) * mi_deps_ field in an interface is confused about whether the information is for self-recompilation checking or part of the ABI (#25844) Fixes #25845 ------------------------- Metric Decrease: MultiLayerModulesDefsGhciWithCore -------------------------
Showing
- compiler/GHC.hs 31 additions, 23 deletionscompiler/GHC.hs
- compiler/GHC/Driver/Main.hs 10 additions, 12 deletionscompiler/GHC/Driver/Main.hs
- compiler/GHC/HsToCore/Usage.hs 5 additions, 5 deletionscompiler/GHC/HsToCore/Usage.hs
- compiler/GHC/Iface/Flags.hs 22 additions, 28 deletionscompiler/GHC/Iface/Flags.hs
- compiler/GHC/Iface/Load.hs 20 additions, 56 deletionscompiler/GHC/Iface/Load.hs
- compiler/GHC/Iface/Make.hs 11 additions, 9 deletionscompiler/GHC/Iface/Make.hs
- compiler/GHC/Iface/Recomp.hs 189 additions, 160 deletionscompiler/GHC/Iface/Recomp.hs
- compiler/GHC/Iface/Recomp/Types.hs 55 additions, 14 deletionscompiler/GHC/Iface/Recomp/Types.hs
- compiler/GHC/Rename/Fixity.hs 1 addition, 1 deletioncompiler/GHC/Rename/Fixity.hs
- compiler/GHC/Rename/Names.hs 3 additions, 3 deletionscompiler/GHC/Rename/Names.hs
- compiler/GHC/Rename/Utils.hs 3 additions, 3 deletionscompiler/GHC/Rename/Utils.hs
- compiler/GHC/Tc/Instance/Family.hs 1 addition, 1 deletioncompiler/GHC/Tc/Instance/Family.hs
- compiler/GHC/Tc/Utils/Backpack.hs 2 additions, 2 deletionscompiler/GHC/Tc/Utils/Backpack.hs
- compiler/GHC/Unit/Module/Deps.hs 74 additions, 53 deletionscompiler/GHC/Unit/Module/Deps.hs
- compiler/GHC/Unit/Module/ModIface.hs 634 additions, 351 deletionscompiler/GHC/Unit/Module/ModIface.hs
- compiler/GHC/Utils/Binary.hs 36 additions, 0 deletionscompiler/GHC/Utils/Binary.hs
- ghc/Main.hs 3 additions, 1 deletionghc/Main.hs
Loading
Please register or sign in to comment