[Git][ghc/ghc][wip/toolchain-selection] 77 commits: Migrate errors in GHC.Tc.Validity

Rodrigo Mesquita (@alt-romes) gitlab at gitlab.haskell.org
Mon May 29 16:15:15 UTC 2023



Rodrigo Mesquita pushed to branch wip/toolchain-selection at Glasgow Haskell Compiler / GHC


Commits:
838aaf4b by hainq at 2023-05-24T12:41:19-04:00
Migrate errors in GHC.Tc.Validity

This patch migrates the error messages in GHC.Tc.Validity to use
the new diagnostic infrastructure.

It adds the constructors:

  - TcRnSimplifiableConstraint
  - TcRnArityMismatch
  - TcRnIllegalInstanceDecl, with sub-datatypes for HasField errors
    and fundep coverage condition errors.

- - - - -
8539764b by Krzysztof Gogolewski at 2023-05-24T12:41:56-04:00
linear lint: Add missing processing of DEFAULT

In this correct program

f :: a %1 -> a
f x = case x of x { _DEFAULT -> x }

after checking the alternative we weren't popping the case binder 'x'
from the usage environment, which meant that the lambda-bound 'x'
was counted twice: in the scrutinee and (incorrectly) in the alternative.
In fact, we weren't checking the usage of 'x' at all.
Now the code for handling _DEFAULT is similar to the one handling
data constructors.

Fixes #23025.

- - - - -
ae683454 by Matthew Pickering at 2023-05-24T12:42:32-04:00
Remove outdated "Don't check hs-boot type family instances too early" note

This note was introduced in 25b70a29f623 which delayed performing some
consistency checks for type families. However, the change was reverted
later in 6998772043a7f0b0360116eb5ffcbaa5630b21fb but the note was not
removed.

I found it confusing when reading to code to try and work out what
special behaviour there was for hs-boot files (when in-fact there isn't
any).

- - - - -
44af57de by Matthew Pickering at 2023-05-24T12:43:08-04:00
rts: Define ticky macro stubs

These macros have long been undefined which has meant we were missing
reporting these allocations in ticky profiles.

The most critical missing definition was TICK_ALLOC_HEAP_NOCTR which was
missing all the RTS calls to allocate, this leads to a the overall
ALLOC_RTS_tot number to be severaly underreported.

Of particular interest though is the ALLOC_STACK_ctr and ALLOC_STACK_tot
counters which are useful to tracking stack allocations.

Fixes #23421

- - - - -
b2dabe3a by Matthew Pickering at 2023-05-24T12:43:08-04:00
rts: ticky: Rename TICK_ALLOC_HEAP_NOCTR to TICK_ALLOC_RTS

This macro increments the ALLOC_HEAP_tot and ALLOC_HEAP_ctr so it makes
more sense to name it after that rather than the suffix NOCTR, whose
meaning has been lost to the mists of time.

- - - - -
eac4420a by Ben Gamari at 2023-05-24T12:43:45-04:00
users guide: A few small mark-up fixes

- - - - -
a320ca76 by Rodrigo Mesquita at 2023-05-24T12:44:20-04:00
configure: Fix support check for response files.

In failing to escape the '-o' in '-o\nconftest\nconftest.o\n' argument
to printf, the writing of the arguments response file always failed.

The fix is to pass the arguments after `--` so that they are treated
positional arguments rather than flags to printf.

Closes #23435

- - - - -
f21ce0e4 by mangoiv at 2023-05-24T12:45:00-04:00
[feat] add .direnv to the .gitignore file

- - - - -
36d5944d by Bodigrim at 2023-05-24T20:58:34-04:00
Add Data.List.unsnoc

See https://github.com/haskell/core-libraries-committee/issues/165 for discussion

- - - - -
c0f2f9e3 by Bartłomiej Cieślar at 2023-05-24T20:59:14-04:00
Fix crash in backpack signature merging with -ddump-rn-trace

In some cases, backpack signature merging could crash in addUsedGRE
when -ddump-rn-trace was enabled, as pretty-printing the GREInfo would cause
unavailable interfaces to be loaded.
This commit fixes that issue by not pretty-printing the GREInfo in addUsedGRE
when -ddump-rn-trace is enabled.

Fixes #23424

Signed-off-by: Bartłomiej Cieślar <bcieslar2001 at gmail.com>

- - - - -
5a07d94a by Krzysztof Gogolewski at 2023-05-25T03:30:20-04:00
Add a regression test for #13981

The panic was fixed by 6998772043a7f0b. Fixes #13981.

- - - - -
182df90e by Krzysztof Gogolewski at 2023-05-25T03:30:57-04:00
Add a test for #23355

It was fixed by !10061, so I'm adding it in the same group.

- - - - -
1b31b039 by uhbif19 at 2023-05-25T12:08:28+02:00
Migrate errors in GHC.Rename.Splice GHC.Rename.Pat

This commit migrates the errors in GHC.Rename.Splice and GHC.Rename.Pat
to use the new diagnostic infrastructure.

- - - - -
56abe494 by sheaf at 2023-05-25T12:09:55+02:00
Common up Template Haskell errors in TcRnMessage

This commit commons up the various Template Haskell errors into a
single constructor, TcRnTHError, of TcRnMessage.

- - - - -
a487ba9e by Krzysztof Gogolewski at 2023-05-25T14:35:56-04:00
Enable ghci tests for unboxed tuples

The tests were originally skipped because ghci used not to support
unboxed tuples/sums.

- - - - -
dc3422d4 by Matthew Pickering at 2023-05-25T18:57:19-04:00
rts: Build ticky GHC with single-threaded RTS

The threaded RTS allows you to use ticky profiling but only for the
counters in the generated code. The counters used in the C portion of
the RTS are disabled. Updating the counters is also racy using the
threaded RTS which can lead to misleading or incorrect ticky results.

Therefore we change the hadrian flavour to build using the
single-threaded RTS (mainly in order to get accurate C code counter
increments)

Fixes #23430

- - - - -
fbc8e04e by sheaf at 2023-05-25T18:58:00-04:00
Propagate long-distance info in generated code

When desugaring generated pattern matches, we skip pattern match checks.
However, this ended up also discarding long-distance information, which
might be needed for user-written sub-expressions.

Example:

```haskell
okay (GADT di) cd =
  let sr_field :: ()
      sr_field = case getFooBar di of { Foo -> () }
  in case cd of { SomeRec _ -> SomeRec sr_field }
```

With sr_field a generated FunBind, we still want to propagate the outer
long-distance information from the GADT pattern match into the checks
for the user-written RHS of sr_field.

Fixes #23445

- - - - -
f8ced241 by Matthew Pickering at 2023-05-26T15:26:21-04:00
Introduce GHCiMessage to wrap GhcMessage

By introducing a wrapped message type we can control how certain
messages are printed in GHCi (to add extra information for example)

- - - - -
58e554c1 by Matthew Pickering at 2023-05-26T15:26:22-04:00
Generalise UnknownDiagnostic to allow embedded diagnostics to access
parent diagnostic options.

* Split default diagnostic options from Diagnostic class into
  HasDefaultDiagnosticOpts class.
* Generalise UnknownDiagnostic to allow embedded diagnostics to access
  options.

The principle idea here is that when wrapping an error message (such as
GHCMessage to make GHCiMessage) then we need to also be able to lift the
configuration when overriding how messages are printed (see load' for an
example).

- - - - -
b112546a by Matthew Pickering at 2023-05-26T15:26:22-04:00
Allow API users to wrap error messages created during 'load'

This allows API users to configure how messages are rendered when they
are emitted from the load function. For an example see how
'loadWithCache' is used in GHCi.

- - - - -
2e4cf0ee by Matthew Pickering at 2023-05-26T15:26:22-04:00
Abstract cantFindError and turn Opt_BuildingCabal into a print-time option

* cantFindError is abstracted so that the parts which mention specific
  things about ghc/ghci are parameters. The intention being that
  GHC/GHCi can specify the right values to put here but otherwise
  display the same error message.
* The BuildingCabalPackage argument from GenericMissing is removed and
  turned into a print-time option. The reason for the error is not
  dependent on whether `-fbuilding-cabal-package` is passed, so we don't
  want to store that in the error message.

- - - - -
34b44f7d by Matthew Pickering at 2023-05-26T15:26:22-04:00
error messages: Don't display ghci specific hints for missing packages

Tickets like #22884 suggest that it is confusing that GHC used on the
command line can suggest options which only work in GHCi.

This ticket uses the error message infrastructure to override certain
error messages which displayed GHCi specific information so that this
information is only showed when using GHCi.

The main annoyance is that we mostly want to display errors in the same
way as before, but with some additional information. This means that the
error rendering code has to be exported from the Iface/Errors/Ppr.hs
module.

I am unsure about whether the approach taken here is the best or most
maintainable solution.

Fixes #22884

- - - - -
05a1b626 by Matthew Pickering at 2023-05-26T15:26:58-04:00
ghcup-metadata: Don't override existing metadata if version already exists.

If a nightly pipeline runs twice for some reason for the same version
then we really don't want to override an existing entry with new
bindists. This could cause ABI compatability issues for users or break
ghcup's caching logic.

- - - - -
fcbcb3cc by Matthew Pickering at 2023-05-26T15:26:58-04:00
ghcup-metadata: Use proper API url for bindist download

Previously we were using links from the web interface, but it's more
robust and future-proof to use the documented links to the artifacts.

https://docs.gitlab.com/ee/api/job_artifacts.html

- - - - -
5b59c8fe by Matthew Pickering at 2023-05-26T15:26:58-04:00
ghcup-metadata: Set Nightly and LatestNightly tags

The latest nightly release needs the LatestNightly tag, and all other
nightly releases need the Nightly tag. Therefore when the metadata is
updated we need to replace all LatestNightly with Nightly.`

- - - - -
914e1468 by Matthew Pickering at 2023-05-26T15:26:58-04:00
ghcup-metadata: Download nightly metadata for correct date

The metadata now lives in https://gitlab.haskell.org/ghc/ghcup-metadata
with one metadata file per year. When we update the metadata we download
and update the right file for the current year.

- - - - -
16cf7d2e by Matthew Pickering at 2023-05-26T15:26:58-04:00
ghcup-metadata: Download metadata and update for correct year

something about pipeline date

- - - - -
14792c4b by Matthew Pickering at 2023-05-26T15:26:58-04:00
ghcup-metadata: Don't skip CI

On a push we now have a CI job which updates gitlab pages with the
metadata files.

- - - - -
1121bdd8 by Matthew Pickering at 2023-05-26T15:26:59-04:00
ghcup-metadata: Add --date flag to specify the release date

The ghcup-metadata now has a viReleaseDay field which needs to be
populated with the day of the release.

- - - - -
bc478bee by Matthew Pickering at 2023-05-26T15:26:59-04:00
ghcup-metadata: Add dlOutput field

ghcup now requires us to add this field which specifies where it should
download the bindist to. See
https://gitlab.haskell.org/ghc/ghcup-metadata/-/issues/1 for some more
discussion.

- - - - -
2bdbd9da by Josh Meredith at 2023-05-26T15:27:35-04:00
JS: Convert rendering to use HLine instead of SDoc (#22455)

- - - - -
abd9e37c by Norman Ramsey at 2023-05-26T15:28:12-04:00
testsuite: add WasmControlFlow test

This patch adds the WasmControlFlow test to test the wasm backend's
relooper component.

- - - - -
07f858eb by Sylvain Henry at 2023-05-26T15:28:53-04:00
Factorize getLinkDeps

Prepare reuse of getLinkDeps for TH implementation in the JS backend
(cf #22261 and review of !9779).

- - - - -
fad9d092 by Oleg Grenrus at 2023-05-27T13:38:08-04:00
Change GHC.Driver.Session import to .DynFlags

Also move targetPlatform selector

Plenty of GHC needs just DynFlags.
Even more can be made to use .DynFlags if more selectors is migrated.
This is a low hanging fruit.

- - - - -
69fdbece by Alan Zimmerman at 2023-05-27T13:38:45-04:00
EPA: Better fix for #22919

The original fix for #22919 simply removed the ability to match up
prior comments with the first declaration in the file.

Restore it, but add a check that the comment is on a single line, by
ensuring that it comes immediately prior to the next thing (comment or
start of declaration), and that the token preceding it is not on the
same line.

closes #22919

- - - - -
3463eb38 by Rodrigo Mesquita at 2023-05-29T17:14:28+01:00
Configure CPP into settings

There is a distinction to be made between the Haskell Preprocessor and
the C preprocessor. The former is used to preprocess Haskell files,
while the latter is used in C preprocessing such as Cmm files.

In practice, they are both the same program (usually the C compiler) but
invoked with different flags.

Previously we would, at configure time, configure the haskell
preprocessor and save the configuration in the settings file, but,
instead of doing the same for CPP, we had hardcoded in GHC that the CPP
program was either `cc -E` or `cpp`.

This commit fixes that asymmetry by also configuring CPP at configure
time, and tries to make more explicit the difference between HsCpp and
Cpp (see Note [Preprocessing invocations]).

Note that we don't use the standard CPP and CPPFLAGS to configure Cpp,
but instead use the non-standard --with-cpp and --with-cpp-flags.
The reason is that autoconf sets CPP to "$CC -E", whereas we expect the
CPP command to be configured as a standalone executable rather than a
command. These are symmetrical with --with-hs-cpp and
--with-hs-cpp-flags.

Cleanup: Hadrian no longer needs to pass the CPP configuration for CPP
         to be C99 compatible through -optP, since we now configure that
         into settings.

Closes #23422

- - - - -
34d531de by Ben Gamari at 2023-05-29T17:14:28+01:00
configure: Rip out Solaris dyld check

Solaris 11 was released over a decade ago and, moreover, I doubt we have
any Solaris users

- - - - -
998c3baa by Ben Gamari at 2023-05-29T17:14:28+01:00
ghc-toolchain: Initial commit

- - - - -
835cfdc9 by Ben Gamari at 2023-05-29T17:14:28+01:00
Move via-C flags into GHC

These were previously hardcoded in configure (with no option for
overriding them) and simply passed onto ghc through the settings file.

Since configure already guarantees gcc supports those flags, we simply
move them into GHC.

- - - - -
c1b9b9aa by Ben Gamari at 2023-05-29T17:14:28+01:00
Rip out runtime linker/compiler checks

- - - - -
2bf524a4 by Ben Gamari at 2023-05-29T17:14:28+01:00
configure: Rip out toolchain selection logic

- - - - -
7a61dd7f by Ben Gamari at 2023-05-29T17:14:28+01:00
Fixes

- - - - -
a0563af8 by Rodrigo Mesquita at 2023-05-29T17:14:28+01:00
ghc-toolchain: Rename readProcess to readProcessStdout

Fixes bugs regarding a translation from the original autconf program
that failed to account for the exit code.

The longer name reenforces that we really only care about the stdout,
and the exit code and stderr of the program are irrelevant for the case.

- - - - -
905f69ce by Rodrigo Mesquita at 2023-05-29T17:14:28+01:00
Re-introduce ld-override option

- - - - -
e79ff601 by Rodrigo Mesquita at 2023-05-29T17:14:28+01:00
ROMES:WIP

- - - - -
a1d83469 by Rodrigo Mesquita at 2023-05-29T17:14:28+01:00
ghc-toolchain library and usage in hadrian flags

- - - - -
eda4529e by Rodrigo Mesquita at 2023-05-29T17:14:28+01:00
ROMES: WIP

- - - - -
6fe4dc40 by Rodrigo Mesquita at 2023-05-29T17:14:28+01:00
Re-introduce flags in hadrian config

- - - - -
cd42abb1 by Rodrigo Mesquita at 2023-05-29T17:14:29+01:00
ROMES WIP

- - - - -
d97505da by Rodrigo Mesquita at 2023-05-29T17:14:29+01:00
ghc-toolchain: UseLibFFI, LdCompactUnwind, LdFileList

A more complete ghc-toolchain.
Added configuration of:

* Use libffi for adjustors
* Supports compact unwind
* Supports filelist

- - - - -
b09da989 by Rodrigo Mesquita at 2023-05-29T17:14:29+01:00
Handle passing CPP cmd and flags from configure to ghc-toolchain

- - - - -
5eaf682e by Rodrigo Mesquita at 2023-05-29T17:14:29+01:00
Rip more of configure that is no longer being used

- - - - -
0be7c619 by Rodrigo Mesquita at 2023-05-29T17:14:29+01:00
Remove configure checks of GNUnoexecStack and ident directive

And fix bug in ghc-toolchain respective code

- - - - -
9aae1e18 by Rodrigo Mesquita at 2023-05-29T17:14:29+01:00
Rip out more from hadrians system.config.in

- - - - -
01118fb5 by Rodrigo Mesquita at 2023-05-29T17:15:02+01:00
Configure CLink supports response files

- - - - -
1defbe03 by Rodrigo Mesquita at 2023-05-29T17:15:04+01:00
Read deleted keys from host and target's target

- - - - -
f2b8eedc by Rodrigo Mesquita at 2023-05-29T17:15:04+01:00
ROMES: WIP 3

- - - - -
819e57be by Rodrigo Mesquita at 2023-05-29T17:15:04+01:00
Delete CMD_OPTS_STAGEX

Instead of having configure configure different options for different
programs depend on the stage, we delete this completely and have hadrian
select the correct target toolchain configuration file depending on the
stage, from which it can read those options.

- - - - -
05516cfc by Rodrigo Mesquita at 2023-05-29T17:15:04+01:00
Fix [host|target]-[os|arch] vs [host|target]-haskell-[os|arch]

- - - - -
36f8892f by Rodrigo Mesquita at 2023-05-29T17:15:04+01:00
Handle unspecified vs specified flags and commands better

- - - - -
422763b3 by Rodrigo Mesquita at 2023-05-29T17:15:04+01:00
ROMES: WIP 4

- - - - -
68e171ed by Rodrigo Mesquita at 2023-05-29T17:15:04+01:00
Configure Cpp and HsCpp separately

- - - - -
df081047 by Rodrigo Mesquita at 2023-05-29T17:15:04+01:00
Fixes for compilation

- - - - -
1821d168 by Rodrigo Mesquita at 2023-05-29T17:15:04+01:00
Link is GNU linkerg

- - - - -
3bf5b97e by Rodrigo Mesquita at 2023-05-29T17:15:04+01:00
ROMES: WIP 5

- - - - -
45cd1dc2 by Rodrigo Mesquita at 2023-05-29T17:15:04+01:00
Revert "Rip more of configure that is no longer being used"

I realized we still need this function in rts/configure.ac

This reverts commit 01f5d4b480f4ab1514ac0a4fc957db199d1a0279.

- - - - -
8472655d by Rodrigo Mesquita at 2023-05-29T17:15:04+01:00
Revert get_arm_isa deletion from 74f03f243d08aa910d39cdd9dadb976e9386283a

As in the previous commit, we still need this info from the rts
configure script.

I suppose it could be useful for the rts to also read somehow the
toolchain information...

- - - - -
11761523 by Rodrigo Mesquita at 2023-05-29T17:15:04+01:00
helper AC function for enable/disable

- - - - -
2584aaae by Rodrigo Mesquita at 2023-05-29T17:15:04+01:00
Delete unused imports of SysTools.Info

- - - - -
cefb1618 by Rodrigo Mesquita at 2023-05-29T17:15:04+01:00
Drop PROG_CPP in distrib/autoconf too

- - - - -
2507ec99 by Rodrigo Mesquita at 2023-05-29T17:15:04+01:00
Delete trailing whitespace

- - - - -
799ca6df by Rodrigo Mesquita at 2023-05-29T17:15:04+01:00
Delete trailing whitespace

- - - - -
8c52d31e by Rodrigo Mesquita at 2023-05-29T17:15:04+01:00
tweak

- - - - -
a49e04eb by Rodrigo Mesquita at 2023-05-29T17:15:04+01:00
Get rid of MonadCatch instances and dependencies

- - - - -
2144e04e by Rodrigo Mesquita at 2023-05-29T17:15:04+01:00
ghc-toolchain: Check Cc supports extra-via-c-flags

- - - - -
a1be7f3a by Rodrigo Mesquita at 2023-05-29T17:15:04+01:00
Consider empty programs as non-specified programs

- - - - -
917b4362 by Rodrigo Mesquita at 2023-05-29T17:15:04+01:00
Cpp and HsCpp cleanup

- - - - -


30 changed files:

- .gitignore
- .gitlab-ci.yml
- .gitlab/rel_eng/mk-ghcup-metadata/README.mkd
- .gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py
- compiler/GHC/CmmToAsm.hs
- compiler/GHC/CmmToLlvm.hs
- compiler/GHC/CmmToLlvm/Base.hs
- compiler/GHC/Core/LateCC.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Opt/Pipeline.hs
- compiler/GHC/Core/Opt/SpecConstr.hs
- compiler/GHC/Core/Opt/Specialise.hs
- compiler/GHC/Core/UsageEnv.hs
- compiler/GHC/Driver/Backend.hs
- compiler/GHC/Driver/Backpack.hs
- compiler/GHC/Driver/CmdLine.hs
- compiler/GHC/Driver/CodeOutput.hs
- compiler/GHC/Driver/Config.hs
- compiler/GHC/Driver/Config/Cmm.hs
- compiler/GHC/Driver/Config/Cmm/Parser.hs
- compiler/GHC/Driver/Config/CmmToAsm.hs
- compiler/GHC/Driver/Config/CmmToLlvm.hs
- compiler/GHC/Driver/Config/Core/Lint.hs
- compiler/GHC/Driver/Config/Core/Lint/Interactive.hs
- compiler/GHC/Driver/Config/Core/Opt/Arity.hs
- compiler/GHC/Driver/Config/Core/Opt/LiberateCase.hs
- compiler/GHC/Driver/Config/Core/Opt/Simplify.hs
- compiler/GHC/Driver/Config/Core/Opt/WorkWrap.hs
- compiler/GHC/Driver/Config/Core/Rules.hs
- compiler/GHC/Driver/Config/CoreToStg.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e3592361d5c710f987e90193b6f9e639716667e6...917b43623a547fc2a135d835caf09c1831365fbd

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e3592361d5c710f987e90193b6f9e639716667e6...917b43623a547fc2a135d835caf09c1831365fbd
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/20230529/aeede34e/attachment-0001.html>


More information about the ghc-commits mailing list