[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 13 commits: Fix recompilation checking for multiple home units

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Tue Jan 24 12:40:52 UTC 2023



Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC


Commits:
1d1dd3fb by Matthew Pickering at 2023-01-24T05:37:52-05:00
Fix recompilation checking for multiple home units

The key part of this change is to store a UnitId in the
`UsageHomeModule` and `UsageHomeModuleInterface`.

* Fine-grained dependency tracking is used if the dependency comes from
  any home unit.
* We actually look up the right module when checking whether we need to
  recompile in the `UsageHomeModuleInterface` case.

These scenarios are both checked by the new tests (
multipleHomeUnits_recomp and multipleHomeUnits_recomp_th )

Fixes #22675

- - - - -
7bfb30f9 by Matthew Pickering at 2023-01-24T05:37:52-05:00
Augment target filepath by working directory when checking if module satisfies target

This fixes a spurious warning in -Wmissing-home-modules.

This is a simple oversight where when looking for the target in the
first place we augment the search by the -working-directory flag but
then fail to do so when checking this warning.

Fixes #22676

- - - - -
69500dd4 by Matthew Pickering at 2023-01-24T05:37:52-05:00
Use NodeKey rather than ModuleName in pruneCache

The `pruneCache` function assumes that the list of `CachedInfo` all have unique `ModuleName`, this is not true:

* In normal compilation, the same module name can appear for a file and it's boot file.
* In multiple home unit compilation the same ModuleName can appear in different units

The fix is to use a `NodeKey` as the actual key for the interfaces which includes `ModuleName`, `IsBoot` and `UnitId`.

Fixes #22677

- - - - -
336b2b1c by Matthew Pickering at 2023-01-24T05:37:52-05:00
Recompilation checking: Don't try to find artefacts for Interactive & hs-boot combo

In interactive mode we don't produce any linkables for hs-boot files. So
we also need to not going looking for them when we check to see if we
have all the right objects needed for recompilation.

Ticket #22669

- - - - -
6469fea7 by Matthew Pickering at 2023-01-24T05:37:52-05:00
Don't write o-boot files in Interactive mode

We should not be producing object files when in interactive mode but we
still produced the dummy o-boot files. These never made it into a
`Linkable` but then confused the recompilation checker.

Fixes #22669

- - - - -
06cc0a95 by Matthew Pickering at 2023-01-24T05:37:52-05:00
Improve driver diagnostic messages by including UnitId in message

Currently the driver diagnostics don't give any indication about which unit they correspond to.

For example `-Wmissing-home-modules` can fire multiple times for each different home unit and gives no indication about which unit it's actually reporting about.

Perhaps a longer term fix is to generalise the providence information away from a SrcSpan so that these kind of whole project errors can be reported with an accurate provenance. For now we can just include the `UnitId` in the error message.

Fixes #22678

- - - - -
4fe9eaff by Matthew Pickering at 2023-01-24T05:37:52-05:00
Key ModSummary cache by UnitId as well as FilePath

Multiple units can refer to the same files without any problem. Just
another assumption which needs to be updated when we may have multiple
home units.

However, there is the invariant that within each unit each file only
maps to one module, so as long as we also key the cache by UnitId then
we are all good.

This led to some confusing behaviour in GHCi when reloading,
multipleHomeUnits_shared distils the essence of what can go wrong.

Fixes #22679

- - - - -
ada29f5c by Matthew Pickering at 2023-01-24T05:37:52-05:00
Finder: Look in current unit before looking in any home package dependencies

In order to preserve existing behaviour it's important to look within the current component before consideirng a module might come from an external component.

This already happened by accident in `downsweep`, (because roots are used to repopulated the cache) but in the `Finder` the logic was the wrong way around.

Fixes #22680

-------------------------
Metric Decrease:
    MultiComponentModules
    MultiComponentModulesRecomp
-------------------------p

- - - - -
be701cc6 by Matthew Pickering at 2023-01-24T05:37:52-05:00
Debug: Print full NodeKey when pretty printing ModuleGraphNode

This is helpful when debugging multiple component issues.

- - - - -
34d2d463 by Krzysztof Gogolewski at 2023-01-24T05:38:32-05:00
Fix Lint check for duplicate external names

Lint was checking for duplicate external names by calling removeDups,
which needs a comparison function that is passed to Data.List.sortBy.
But the comparison was not a valid ordering - it returned LT
if one of the names was not external.
For example, the previous implementation won't find a duplicate in
[M.x, y, M.x].
Instead, we filter out non-external names before looking for duplicates.

- - - - -
1c050ed2 by Matthew Pickering at 2023-01-24T05:39:08-05:00
Add test for T22671

This was fixed by b13c6ea5

Closes #22671

- - - - -
b47c22f7 by Tom Ellis at 2023-01-24T07:40:42-05:00
Clarify where `f` is defined

- - - - -
5841aac8 by Cheng Shao at 2023-01-24T07:40:43-05:00
CmmToC: fix CmmRegOff for 64-bit register on a 32-bit target

We used to print the offset value to a platform word sized integer.
This is incorrect when the offset is negative (e.g. output of cmm
constant folding) and the register is 64-bit but on a 32-bit target,
and may lead to incorrect runtime result (e.g. #22607).

The fix is simple: just treat it as a proper MO_Add, with the correct
width info inferred from the register itself.

Metric Increase:
    T12707
    T13379
    T4801
    T5321FD
    T5321Fun

- - - - -


30 changed files:

- compiler/GHC/CmmToC.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Driver/Backend.hs
- compiler/GHC/Driver/Errors/Ppr.hs
- compiler/GHC/Driver/Errors/Types.hs
- compiler/GHC/Driver/Main.hs
- compiler/GHC/Driver/Make.hs
- compiler/GHC/Driver/Pipeline/Execute.hs
- compiler/GHC/HsToCore/Usage.hs
- compiler/GHC/Iface/Load.hs
- compiler/GHC/Iface/Recomp.hs
- compiler/GHC/Unit/Env.hs
- compiler/GHC/Unit/Finder.hs
- compiler/GHC/Unit/Module/Deps.hs
- compiler/GHC/Unit/Module/Graph.hs
- docs/users_guide/using-warnings.rst
- testsuite/tests/driver/Makefile
- + testsuite/tests/driver/T22669.hs
- + testsuite/tests/driver/T22669.hs-boot
- testsuite/tests/driver/all.T
- + testsuite/tests/driver/multipleHomeUnits/A.hs
- + testsuite/tests/driver/multipleHomeUnits/Dep.hs
- testsuite/tests/driver/multipleHomeUnits/Makefile
- + testsuite/tests/driver/multipleHomeUnits/Recomp.hs
- + testsuite/tests/driver/multipleHomeUnits/RecompTH.hs
- testsuite/tests/driver/multipleHomeUnits/all.T
- + testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_import_order.stderr
- + testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_recomp.stdout
- + testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_recomp_th.stdout
- + testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_shared.stderr


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5b85a8d30a458a955a5f071f7325572693e88ea1...5841aac8cbf3873a43cf19fb2b8821bce982c095

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5b85a8d30a458a955a5f071f7325572693e88ea1...5841aac8cbf3873a43cf19fb2b8821bce982c095
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/20230124/1b9b07e1/attachment-0001.html>


More information about the ghc-commits mailing list