[Git][ghc/ghc][wip/T22194-flags] 15 commits: Rework documentation for data Char

Simon Peyton Jones (@simonpj) gitlab at gitlab.haskell.org
Tue Apr 4 10:47:12 UTC 2023



Simon Peyton Jones pushed to branch wip/T22194-flags at Glasgow Haskell Compiler / GHC


Commits:
f60f6110 by Bodigrim at 2023-04-02T18:59:30-04:00
Rework documentation for data Char

- - - - -
43ebd5dc by Bodigrim at 2023-04-02T19:00:09-04:00
cmm: implement parsing of MO_AtomicRMW from hand-written CMM files

Fixes #23206

- - - - -
ab9cd52d by Sylvain Henry at 2023-04-03T08:15:21-04:00
ghc-heap: remove wrong Addr# coercion (#23181)

Conversion from Addr# to I# isn't correct with the JS backend.

- - - - -
2b2afff3 by Matthew Pickering at 2023-04-03T08:15:58-04:00
hadrian: Update bootstrap plans for 9.2.6, 9.2.7, 9.4.4, 9.4.5, 9.6.1

Also fixes the ./generate_bootstrap_plans script which was recently
broken

We can hopefully drop the 9.2 plans soon but they still work so kept
them around for now.

- - - - -
c2605e25 by Matthew Pickering at 2023-04-03T08:15:58-04:00
ci: Add job to test 9.6 bootstrapping

- - - - -
53e4d513 by Krzysztof Gogolewski at 2023-04-03T08:16:35-04:00
hadrian: Improve option parsing

Several options in Hadrian had their argument marked as optional
(`OptArg`), but if the argument wasn't there they were just giving an
error. It's more idiomatic to mark the argument as required instead;
the code uses less Maybes, the parser can enforce that the argument
is present, --help gives better output.

- - - - -
a8e36892 by Sylvain Henry at 2023-04-03T08:17:16-04:00
JS: fix issues with FD api support

- Add missing implementations for fcntl_read/write/lock
- Fix fdGetMode

These were found while implementing TH in !9779. These functions must be
used somehow by the external interpreter code.

- - - - -
8b092910 by Haskell-mouse at 2023-04-03T19:31:26-04:00
Convert diagnostics in GHC.Rename.HsType to proper TcRnMessage

I've turned all occurrences of TcRnUnknownMessage in GHC.Rename.HsType
module into a proper TcRnMessage.
Instead, these TcRnMessage messages were introduced:

TcRnDataKindsError
TcRnUnusedQuantifiedTypeVar
TcRnIllegalKindSignature
TcRnUnexpectedPatSigType
TcRnSectionPrecedenceError
TcRnPrecedenceParsingError
TcRnIllegalKind
TcRnNegativeNumTypeLiteral
TcRnUnexpectedKindVar
TcRnBindMultipleVariables
TcRnBindVarAlreadyInScope

- - - - -
220a7a48 by Krzysztof Gogolewski at 2023-04-03T19:32:02-04:00
Fixes around unsafeCoerce#

1. `unsafeCoerce#` was documented in `GHC.Prim`. But since the overhaul
in 74ad75e87317, `unsafeCoerce#` is no longer defined there.
I've combined the documentation in `GHC.Prim` with the `Unsafe.Coerce` module.

2. The documentation of `unsafeCoerce#` stated that you should not
cast a function to an algebraic type, even if you later cast it back
before applying it. But ghci was doing that type of cast, as can be seen
with 'ghci -ddump-ds' and typing 'x = not'. I've changed it to use Any
following the documentation.

- - - - -
9095e297 by Matthew Craven at 2023-04-04T01:04:10-04:00
Add a few more memcpy-ish primops

* copyMutableByteArrayNonOverlapping#
* copyAddrToAddr#
* copyAddrToAddrNonOverlapping#
* setAddrRange#

The implementations of copyBytes, moveBytes, and fillBytes
in base:Foreign.Marshal.Utils now use these new primops,
which can cause us to work a bit harder generating code for them,
resulting in the metric increase in T21839c observed by CI on
some architectures.  But in exchange, we get better code!

Metric Increase:
    T21839c

- - - - -
f7da530c by Matthew Craven at 2023-04-04T01:04:10-04:00
StgToCmm: Upgrade -fcheck-prim-bounds behavior

Fixes #21054. Additionally, we can now check for range overlap
when generating Cmm for primops that use memcpy internally.

- - - - -
cd00e321 by sheaf at 2023-04-04T01:04:50-04:00
Relax assertion in varToRecFieldOcc

When using Template Haskell, it is possible to re-parent a field OccName
belonging to one data constructor to another data constructor. The
lsp-types package did this in order to "extend" a data constructor
with additional fields.

This ran into an assertion in 'varToRecFieldOcc'. This assertion
can simply be relaxed, as the resulting splices are perfectly sound.

Fixes #23220

- - - - -
3d182660 by Simon Peyton Jones at 2023-04-04T11:48:49+01:00
Major refactor in the handling of equality constraints

This MR substantially refactors the way in which the constraint
solver deals with equality constraints.  The big thing is:

* Intead of a pipeline in which we /first/ canonicalise and /then/
  interact (the latter including performing unification) the two steps
  are more closely integreated into one.  That avoids the current
  rather indirect communication between the two steps.

The proximate cause for this refactoring is fixing #22194, which involve
solving   [W] alpha[2] ~ Maybe (F beta[4])
by doing this:
          alpha[2] := Maybe delta[2]
          [W] delta[2] ~ F beta[4]
That is, we don't promote beta[4]!  This is very like introducing a cycle
breaker, and was very awkward to do before, but now it is all nice.
See GHC.Tc.Utils.Unify Note [Promotion and level-checking] and
Note [Family applications in canonical constraints].

The big change is this:

* Several canonicalisation checks (occurs-check, cycle-breaking,
  checking for concreteness) are combined into one new function:
     GHC.Tc.Utils.Unify.checkTyEqRhs

  This function is controlled by `TyEqFlags`, which says what to do
  for foralls, type families etc.

* `canEqCanLHSFinish` now sees if unification is possible, and if so,
  actually does it: see `canEqCanLHSFinish_try_unification`.

There are loads of smaller changes:

* The on-the-fly unifier `GHC.Tc.Utils.Unify.unifyType` has a
  cheap-and-cheerful version of `checkTyEqRhs`, called
  `simpleUnifyCheck`.  If `simpleUnifyCheck` succeeds, it can unify,
  otherwise it defers by emitting a constraint. This is simpler than
  before.

* I simplified the swapping code in `GHC.Tc.Solver.Equality.canEqCanLHS`.
  Especially the nasty stuff involving `swap_for_occurs` and
  `canEqTyVarFunEq`.  Much nicer now.  See
      Note [Orienting TyVarLHS/TyFamLHS]
      Note [Orienting TyFamLHS/TyFamLHS]

* Added `cteSkolemOccurs`, `cteConcrete`, and `cteCoercionHole` to the
  problems that can be discovered by `checkTyEqRhs`.

* I fixed #23199 `pickQuantifiablePreds`, which actually allows GHC to
  to accept both cases in #22194 rather than rejecting both.

Yet smaller:

* Added a `synIsConcrete` flag to `SynonymTyCon` (alongside `synIsFamFree`)
  to reduce the need for synonym expansion when checking concreteness.
  Use it in `isConcreteType`.

* Renamed `isConcrete` to `isConcreteType`

* Defined `GHC.Core.TyCo.FVs.isInjectiveInType` as a more efficient
  way to find if a particular type variable is used injectively than
  finding all the injective variables.  It is called in
  `GHC.Tc.Utils.Unify.definitely_poly`, which in turn is used quite a
  lot.

* Moved `rewriterView` to `GHC.Core.Type`, so we can use it from the
  constraint solver.

Fixes #22194, #23199

Compile times decrease by an average of 0.1%; but there is a 7.4%
drop in compiler allocation on T15703.

Metric Decrease:
    T15703

- - - - -
0418bd89 by Simon Peyton Jones at 2023-04-04T11:48:49+01:00
Add some documentation about redundant constraints

- - - - -
abcbfe52 by Simon Peyton Jones at 2023-04-04T11:48:49+01:00
Make approximateWC a bit cleverer

This MR fixes
  #23224: making approximateWC more clever
  #23223: misleading error with partial type signatuers

See the long notes:

* Note [ApproximateWC] in GHC.Tc.Solver
* Note [Partial type signatures and the MR] in GHC.Tc.Gen.Bind

All this is delicate and ad-hoc -- but it /has/ to be: we are
talking about inferring a type for a binding in the presence of
GADTs, type families and whatnot: known difficult territory.
We just try as hard as we can.

The test #19106 becomes an error again, but with a better error
message; it's a very subtle case, conjured out of Richard's brain.

- - - - -


25 changed files:

- .gitlab-ci.yml
- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/Cmm/CLabel.hs
- compiler/GHC/Cmm/Parser.y
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/TyCo/FVs.hs
- compiler/GHC/Core/TyCo/Rep.hs
- compiler/GHC/Core/TyCon.hs
- compiler/GHC/Core/Type.hs
- compiler/GHC/Core/Type.hs-boot
- compiler/GHC/Data/Bag.hs
- compiler/GHC/Data/Maybe.hs
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Type.hs
- compiler/GHC/Rename/HsType.hs
- compiler/GHC/Rename/Names.hs
- compiler/GHC/StgToCmm/Foreign.hs
- compiler/GHC/StgToCmm/Prim.hs
- compiler/GHC/StgToJS/Prim.hs
- compiler/GHC/Tc/Errors.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Gen/Bind.hs
- compiler/GHC/Tc/Module.hs
- compiler/GHC/Tc/Solver.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d82250e8ab66107ed004878948a09f1f7b960472...abcbfe522b68f0fe17092818472162794bf22605

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d82250e8ab66107ed004878948a09f1f7b960472...abcbfe522b68f0fe17092818472162794bf22605
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/20230404/2e5b8f11/attachment-0001.html>


More information about the ghc-commits mailing list