Skip to content
Snippets Groups Projects
Commit b15fca2b authored by Matthew Pickering's avatar Matthew Pickering Committed by Marge Bot
Browse files

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
-------------------------
parent f1830d74
No related branches found
No related tags found
Loading
Showing
with 1100 additions and 722 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment