[Git][ghc/ghc][wip/romes/graph-compact-easy] 6 commits: warnings: Find out if a qualified name is in the interactive scope directly

Rodrigo Mesquita (@alt-romes) gitlab at gitlab.haskell.org
Wed Jan 8 10:55:39 UTC 2025



Rodrigo Mesquita pushed to branch wip/romes/graph-compact-easy at Glasgow Haskell Compiler / GHC


Commits:
f56558be by Matthew Pickering at 2025-01-07T13:53:03-05:00
warnings: Find out if a qualified name is in the interactive scope directly

There were two ad-hoc mechanisms used to determine which modules were in
the interactive scope.

1. Look at everything in the GRE, to see what is imported qualified.
2. Look at the last loaded module in the HPT.

(1) Is very inefficient, GlobalRdrEnvs can be very big.
(2) is incorrect, there is no reason to assume the "last" thing added to
the HPT has any relevance to module loading order.

Happily, the same checks can be implemented directly by looking at the
interactive imports from the interactive context. This mirrors what
happens for normal imports.

Arguably, the error reporting code shouldn't be doing this kind of
processing and it should be an option is set when rendering the error
message. However, this just improves the situation and doesn't block
progress on that front in future.

See #14225 and #15611

Fixes #25600

- - - - -
84155cdb by Simon Peyton Jones at 2025-01-07T13:53:40-05:00
Tidy up kcConDecls

Addresses #25630

In particular,

* Introduce ConArgKind and use it.

* Make kcConDecls and tcConDecls work the same way
  concerning the kind of argument types

- - - - -
6c12b6cf by Bryan Richter at 2025-01-07T18:15:02-05:00
Remove tmp files after toolchain check

Fixes #25620

- - - - -
42826a89 by Cheng Shao at 2025-01-07T18:15:39-05:00
xxhash: bump to v0.8.3

- - - - -
185f17e4 by sheaf at 2025-01-07T18:16:15-05:00
Fix typo in GHC.Tc.Solver.Solve.runTcPluginsWanted
- - - - -
17ed5b64 by Rodrigo Mesquita at 2025-01-08T10:55:31+00:00
driver: Store the HomePackageTable in a mutable reference

This commit refactors the HomePackageTable and HomeUnitGraph:

(1) It fixes a quadratic-in-the-number-of-modules space leak in upsweep (#25511)

(2) And it reworks these structures into their own modules to simplify
    the driver. The refactor is driven by the introduction of IO in the HPT
    interface, but is a bit more aggressive in simplifying the
    interfaces to enforce correct usage (ie to avoid performance
    pitfalls).

Specifically:

- The `HomeUnitGraph` (HUG) is now in `GHC.Unit.Home.Graph`
- The `HomePackageTable` (HPT) is now in `GHC.Unit.Home.PackageTable`
    - The HPT now stores an `IORef` with the table of loaded home package modules.
    - The interface to the HPT now requires IO
    - The interface now enforces that the HPT is a datastructure that
      only grows
    - This is not enforced in the interface, but, clients of the HPT
      should never care about there being more or less entries in the
      HPT when these additional entries are not relevant to their result.
    - The exception to the invariant that the HPT is monotonically
      increasing is `restrictHpt`, a function which is called at a
      "barrier point" (during which there are no other threads
      inspecting or inserting in the HPT). The invariant can be
      temporarily broken at this point (currently, after upsweep).
      This is safe because a single thread holds control over the
      structure (thus the invariant being broken is never observed).

The hug_var and associated structures in the driver, which aimed to
improve memory usage in the driver by updating in place a HUG during
upsweep, are no longer required as the HPT entries in the HUG are now
themselves mutable by construction. This was previously explained in
Note [ModuleNameSet, efficiency and space leaks], which is no longer
relevant and was deleted.

Fixes #25511

Co-authored-by: Matthew Pickering <matthewtpickering at gmail.com>

-------------------------
Metric Decrease:
    MultiComponentModulesRecomp
    MultiLayerModulesRecomp
-------------------------

- - - - -


30 changed files:

- compiler/GHC.hs
- compiler/GHC/Core/Opt/Pipeline.hs
- compiler/GHC/Data/IOEnv.hs
- compiler/GHC/Driver/Backpack.hs
- compiler/GHC/Driver/Env.hs
- compiler/GHC/Driver/Hooks.hs
- compiler/GHC/Driver/Main.hs
- compiler/GHC/Driver/Make.hs
- compiler/GHC/Driver/Pipeline.hs
- compiler/GHC/HsToCore/Monad.hs
- compiler/GHC/HsToCore/Usage.hs
- compiler/GHC/Iface/Errors.hs
- compiler/GHC/Iface/Load.hs
- compiler/GHC/Iface/Recomp.hs
- compiler/GHC/IfaceToCore.hs
- compiler/GHC/Linker/Deps.hs
- compiler/GHC/Linker/ExtraObj.hs
- compiler/GHC/Linker/Loader.hs
- compiler/GHC/Linker/Static.hs
- compiler/GHC/Rename/Names.hs
- compiler/GHC/Rename/Unbound.hs
- compiler/GHC/Runtime/Eval.hs
- compiler/GHC/Runtime/Interpreter.hs
- compiler/GHC/Runtime/Interpreter/JS.hs
- compiler/GHC/Runtime/Loader.hs
- compiler/GHC/StgToByteCode.hs
- compiler/GHC/StgToJS/Linker/Linker.hs
- compiler/GHC/SysTools/Cpp.hs
- compiler/GHC/Tc/Instance/Family.hs
- compiler/GHC/Tc/Module.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/82a818a72248753949ec5d099143ebaa459bd291...17ed5b64676b9b96ede07bbcd9591e8140690cea

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/82a818a72248753949ec5d099143ebaa459bd291...17ed5b64676b9b96ede07bbcd9591e8140690cea
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20250108/cd38833a/attachment.html>


More information about the ghc-commits mailing list