[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 4 commits: Do primop rep-poly checks when instantiating

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Tue Jul 18 06:57:23 UTC 2023



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


Commits:
20cbac8c by sheaf at 2023-07-18T02:57:17-04:00
Do primop rep-poly checks when instantiating

This patch changes how we perform representation-polymorphism checking
for primops (and other wired-in Ids such as coerce).
When instantiating the primop, we check whether each type variable
is required to instantiated to a concrete type, and if so we create a
new concrete metavariable (a ConcreteTv) instead of a simple MetaTv.
(A little subtlety is the need to apply the substitution obtained from
instantiating to the ConcreteTvOrigins, see
Note [substConcreteTvOrigin] in GHC.Tc.Utils.TcMType.)

This allows us to prevent representation-polymorphism in non-argument
position, as that is required for some of these primops.

We can also remove the logic in tcRemainingValArgs, except for
the part concerning representation-polymorphic unlifted newtypes.
The function has been renamed rejectRepPolyNewtypes; all it does now
is reject unsaturated occurrences of representation-polymorphic newtype
constructors when the representation of its argument isn't a concrete
RuntimeRep (i.e. still a PHASE 1 FixedRuntimeRep check).
The Note [Eta-expanding rep-poly unlifted newtypes] in GHC.Tc.Gen.Head
gives more explanation about a possible path to PHASE 2, which would be
in line with the treatment for primops taken in this patch.

We also update the Core Lint check to handle this new framework. This
means Core Lint now checks representation-polymorphism in continuation
position like needed for catch#.

Fixes #21906

-------------------------
Metric Increase:
    LargeRecord
-------------------------

- - - - -
fa80e478 by Krzysztof Gogolewski at 2023-07-18T02:57:17-04:00
Core Lint: distinguish let and letrec in locations

Lint messages were saying "in the body of letrec" even for non-recursive
let.

I've also renamed BodyOfLetRec to BodyOfLet in stg, since there's no
separate letrec.

- - - - -
4c3466d1 by Krzysztof Gogolewski at 2023-07-18T02:57:18-04:00
Use extended literals when deriving Show

This implements GHC proposal
https://github.com/ghc-proposals/ghc-proposals/pull/596

Also add support for Int64# and Word64#; see testcase ShowPrim.

- - - - -
ed41ef9d by Jaro Reinders at 2023-07-18T02:57:18-04:00
Add StgFromCore and StgCodeGen linting

- - - - -


27 changed files:

- compiler/GHC/Builtin/PrimOps.hs
- compiler/GHC/Builtin/PrimOps/Ids.hs
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/Core.hs
- compiler/GHC/Core/DataCon.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/TyCo/Subst.hs
- compiler/GHC/Core/Type.hs
- compiler/GHC/Driver/Config/Core/Lint.hs
- compiler/GHC/HsToCore.hs
- compiler/GHC/Stg/Lint.hs
- compiler/GHC/Stg/Pipeline.hs
- compiler/GHC/Tc/Deriv/Generate.hs
- compiler/GHC/Tc/Errors.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Gen/App.hs
- compiler/GHC/Tc/Gen/Expr.hs
- compiler/GHC/Tc/Gen/Head.hs
- compiler/GHC/Tc/Gen/Sig.hs
- compiler/GHC/Tc/Solver/Equality.hs
- compiler/GHC/Tc/TyCl/Build.hs
- compiler/GHC/Tc/Types/Origin.hs
- compiler/GHC/Tc/Types/Origin.hs-boot
- compiler/GHC/Tc/Utils/Concrete.hs
- compiler/GHC/Tc/Utils/Instantiate.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/b763f2c167af60f2c6a3b14343c7c7877b055c35...ed41ef9d42a7a8a6adb1610840c2bb7aea53e282

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/b763f2c167af60f2c6a3b14343c7c7877b055c35...ed41ef9d42a7a8a6adb1610840c2bb7aea53e282
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/20230718/f2b575ed/attachment-0001.html>


More information about the ghc-commits mailing list