[Git][ghc/ghc][wip/ipe-section] 156 commits: Drop circle-ci-job.sh

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Fri Aug 4 18:17:21 UTC 2023



Ben Gamari pushed to branch wip/ipe-section at Glasgow Haskell Compiler / GHC


Commits:
b9e7beb9 by Ben Gamari at 2023-07-07T11:32:22-04:00
Drop circle-ci-job.sh

- - - - -
9955eead by Ben Gamari at 2023-07-07T11:32:22-04:00
testsuite: Allow preservation of unexpected output

Here we introduce a new flag to the testsuite driver,
--unexpected-output-dir=<dir>, which allows the user to ask
the driver to preserve unexpected output from tests. The intent is for
this to be used in CI to allow users to more easily fix unexpected
platform-dependent output.

- - - - -
48f80968 by Ben Gamari at 2023-07-07T11:32:22-04:00
gitlab-ci: Preserve unexpected output

Here we enable use of the testsuite driver's `--unexpected-output-dir`
flag by CI, preserving the result as an artifact for use by users.

- - - - -
76983a0d by Matthew Pickering at 2023-07-07T11:32:58-04:00
driver: Fix -S with .cmm files

There was an oversight in the driver which assumed that you would always
produce a `.o` file when compiling a .cmm file.

Fixes #23610

- - - - -
6df15e93 by Mike Pilgrem at 2023-07-07T11:33:40-04:00
Update Hadrian's stack.yaml
- - - - -
1dff43cf by Ben Gamari at 2023-07-08T05:05:37-04:00
compiler: Rework ShowSome

Previously the field used to filter the sub-declarations to show
was rather ad-hoc and was only able to show at most one sub-declaration.

- - - - -
8165404b by Ben Gamari at 2023-07-08T05:05:37-04:00
testsuite: Add test to catch changes in core libraries

This adds testing infrastructure to ensure that changes in core
libraries (e.g. `base` and `ghc-prim`) are caught in CI.

- - - - -
ec1c32e2 by Melanie Phoenix at 2023-07-08T05:06:14-04:00
Deprecate Data.List.NonEmpty.unzip

- - - - -
5d2442b8 by Ben Gamari at 2023-07-08T05:06:51-04:00
Drop latent mentions of -split-objs

Closes #21134.

- - - - -
a9bc20cb by Oleg Grenrus at 2023-07-08T05:07:31-04:00
Add warn_and_run test kind

This is a compile_and_run variant which also captures the GHC's
stderr. The warn_and_run name is best I can come up with,
as compile_and_run is taken.

This is useful specifically for testing warnings.  We want to test that
when warning triggers, and it's not a false positive, i.e. that the
runtime behaviour is indeed "incorrect".

As an example a single test is altered to use warn_and_run

- - - - -
c7026962 by Ben Gamari at 2023-07-08T05:08:11-04:00
configure: Don't use ld.gold on i386

ld.gold appears to produce invalid static constructor tables on i386.
While ideally we would add an autoconf check to check for this
brokenness, sadly such a check isn't easy to compose. Instead to
summarily reject such linkers on i386.

Somewhat hackily closes #23579.

- - - - -
054261dd by Bodigrim at 2023-07-08T19:32:47-04:00
Add since annotations for Data.Foldable1

- - - - -
550af505 by Sylvain Henry at 2023-07-08T19:33:28-04:00
JS: support -this-unit-id for programs in the linker (#23613)

- - - - -
d284470a by Bodigrim at 2023-07-08T19:34:08-04:00
Bump text submodule

- - - - -
8e11630e by jade at 2023-07-10T16:58:40-04:00
Add a hint to enable ExplicitNamespaces for type operator imports (Fixes/Enhances #20007)

As suggested in #20007 and implemented in !8895, trying to import type operators
will suggest a fix to use the 'type' keyword, without considering whether
ExplicitNamespaces is enabled. This patch will query whether ExplicitNamespaces
is enabled and add a hint to suggest enabling ExplicitNamespaces if it isn't enabled,
alongside the suggestion of adding the 'type' keyword.

- - - - -
61b1932e by sheaf at 2023-07-10T16:59:26-04:00
tyThingLocalGREs: include all DataCons for RecFlds

The GREInfo for a record field should include the collection of all
the data constructors of the parent TyCon that have this record field.
This information was being incorrectly computed in the tyThingLocalGREs
function for a DataCon, as we were not taking into account other
DataCons with the same parent TyCon.

Fixes #23546

- - - - -
e6627cbd by Alan Zimmerman at 2023-07-10T17:00:05-04:00
EPA: Simplify GHC/Parser.y comb3

A follow up to !10743

- - - - -
ee20da34 by Bodigrim at 2023-07-10T17:01:01-04:00
Document that compareByteArrays# is available since ghc-prim-0.5.2.0

- - - - -
4926af7b by Matthew Pickering at 2023-07-10T17:01:38-04:00
Revert "Bump text submodule"

This reverts commit d284470a77042e6bc17bdb0ab0d740011196958a.

This commit requires that we bootstrap with ghc-9.4, which we do not
require until #23195 has been completed.

Subsequently this has broken nighty jobs such as the rocky8 job which in
turn has broken nightly releases.

- - - - -
d1c92bf3 by Ben Gamari at 2023-07-11T08:07:02-04:00
compiler: Fingerprint more code generation flags

Previously our recompilation check was quite inconsistent in its
coverage of non-optimisation code generation flags. Specifically, we
failed to account for most flags that would affect the behavior of
generated code in ways that might affect the result of a program's
execution (e.g. `-feager-blackholing`, `-fstrict-dicts`)

Closes #23369.

- - - - -
eb623149 by Ben Gamari at 2023-07-11T08:07:02-04:00
compiler: Record original thunk info tables on stack

Here we introduce a new code generation option, `-forig-thunk-info`,
which ensures that an `stg_orig_thunk_info` frame is pushed before every
update frame. This can be invaluable when debugging thunk cycles and
similar.

See Note [Original thunk info table frames] for details.

Closes #23255.

- - - - -
4731f44e by Jaro Reinders at 2023-07-11T08:07:40-04:00
Fix wrong MIN_VERSION_GLASGOW_HASKELL macros

I forgot to change these after rebasing.

- - - - -
dd38aca9 by Andreas Schwab at 2023-07-11T13:55:56+00:00
Hadrian: enable GHCi support on riscv64

- - - - -
09a5c6cc by Josh Meredith at 2023-07-12T11:25:13-04:00
JavaScript: support unicode code points > 2^16 in toJSString using String.fromCodePoint (#23628)

- - - - -
29fbbd4e by Matthew Pickering at 2023-07-12T11:25:49-04:00
Remove references to make build system in mk/build.mk

Fixes #23636

- - - - -
630e3026 by sheaf at 2023-07-12T11:26:43-04:00
Valid hole fits: don't panic on a Given

The function GHC.Tc.Errors.validHoleFits would end up panicking when
encountering a Given constraint. To fix this, it suffices to filter out
the Givens before continuing.

Fixes #22684

- - - - -
c39f279b by Matthew Pickering at 2023-07-12T23:18:38-04:00
Use deb10 for i386 bindists

deb9 is now EOL so it's time to upgrade the i386 bindist to use deb10

Fixes #23585

- - - - -
bf9b9de0 by Krzysztof Gogolewski at 2023-07-12T23:19:15-04:00
Fix #23567, a specializer bug

Found by Simon in https://gitlab.haskell.org/ghc/ghc/-/issues/23567#note_507834

The testcase isn't ideal because it doesn't detect the bug in master,
unless doNotUnbox is removed as in
https://gitlab.haskell.org/ghc/ghc/-/issues/23567#note_507692.
But I have confirmed that with that modification, it fails before
and passes afterwards.

- - - - -
84c1a4a2 by Bartłomiej Cieślar at 2023-07-12T23:20:08-04:00
Comments

- - - - -
b2846cb5 by Bartłomiej Cieślar at 2023-07-12T23:20:08-04:00
updates to comments

- - - - -
2af23f0e by Bartłomiej Cieślar at 2023-07-12T23:20:08-04:00
changes

- - - - -
6143838a by sheaf at 2023-07-13T08:02:17-04:00
Fix deprecation of record fields

Commit 3f374399 inadvertently broke the deprecation/warning mechanism
for record fields due to its introduction of record field namespaces.

This patch ensures that, when a top-level deprecation is applied to
an identifier, it applies to all the record fields as well.
This is achieved by refactoring GHC.Rename.Env.lookupLocalTcNames, and
GHC.Rename.Env.lookupBindGroupOcc, to not look up a fixed number of
NameSpaces but to look up all NameSpaces and filter out the irrelevant
ones.

- - - - -
6fd8f566 by sheaf at 2023-07-13T08:02:17-04:00
Introduce greInfo, greParent

These are simple helper functions that wrap the internal
field names gre_info, gre_par.

- - - - -
7f0a86ed by sheaf at 2023-07-13T08:02:17-04:00
Refactor lookupGRE_... functions

This commit consolidates all the logic for looking up something in
the Global Reader Environment into the single function lookupGRE.
This allows us to declaratively specify all the different modes of
looking up in the GlobalRdrEnv, and avoids manually passing around
filtering functions as was the case in e.g. the function
GHC.Rename.Env.lookupSubBndrOcc_helper.

-------------------------
Metric Decrease:
    T8095
-------------------------
-------------------------
Metric Increase:
    T8095
-------------------------

- - - - -
5e951395 by Rodrigo Mesquita at 2023-07-13T08:02:54-04:00
configure: Drop DllWrap command

We used to configure into settings a DllWrap command for windows
builds and distributions, however, we no longer do, and dllwrap is
effectively unused.

This simplification is motivated in part by the larger
toolchain-selection project (#19877, !9263)

- - - - -
e10556b6 by Teo Camarasu at 2023-07-14T16:28:46-04:00
base: fix haddock syntax in GHC.Profiling

- - - - -
0f3fda81 by Matthew Pickering at 2023-07-14T16:29:23-04:00
Revert "CI: add JS release and debug builds, regen CI jobs"

This reverts commit 59c5fe1d4b624423b1c37891710f2757bb58d6af.

This commit added two duplicate jobs on all validate pipelines, so we
are reverting for now whilst we work out what the best way forward is.

Ticket #23618

- - - - -
54bca324 by Alan Zimmerman at 2023-07-15T03:23:26-04:00
EPA: Simplify GHC/Parser.y sLL

Follow up to !10743

- - - - -
c8863828 by sheaf at 2023-07-15T03:24:06-04:00
Configure: canonicalise PythonCmd on Windows

This change makes PythonCmd resolve to a canonical absolute path on
Windows, which prevents HLS getting confused (now that we have a
build-time dependency on python).

fixes #23652

- - - - -
ca1e636a by Rodrigo Mesquita at 2023-07-15T03:24:42-04:00
Improve Note [Binder-swap during float-out]

- - - - -
cf86f3ec by Matthew Craven at 2023-07-16T01:42:09+02:00
Equality of forall-types is visibility aware

This patch finally (I hope) nails the question of whether
   (forall a. ty) and (forall a -> ty)
are `eqType`: they aren't!

There is a long discussion in #22762, plus useful Notes:

* Note [ForAllTy and type equality] in GHC.Core.TyCo.Compare
* Note [Comparing visiblities] in GHC.Core.TyCo.Compare
* Note [ForAllCo] in GHC.Core.TyCo.Rep

It also establishes a helpful new invariant for ForAllCo,
and ForAllTy, when the bound variable is a CoVar:in that
case the visibility must be coreTyLamForAllTyFlag.

All this is well documented in revised Notes.

- - - - -
7f13acbf by Vladislav Zavialov at 2023-07-16T01:56:27-04:00
List and Tuple<n>: update documentation

Add the missing changelog.md entries and @since-annotations.

- - - - -
2afbddb0 by Andrei Borzenkov at 2023-07-16T10:21:24+04:00
Type patterns (#22478, #18986)

Improved name resolution and type checking of type patterns in constructors:

1. HsTyPat: a new dedicated data type that represents type patterns in
   HsConPatDetails instead of reusing HsPatSigType

2. rnHsTyPat: a new function that renames a type
   pattern and collects its binders into three groups:
    - explicitly bound type variables, excluding locally bound
      variables
    - implicitly bound type variables from kind signatures
      (only if ScopedTypeVariables are enabled)
    - named wildcards (only from kind signatures)
2a. rnHsPatSigTypeBindingVars: removed in favour of rnHsTyPat
2b. rnImplcitTvBndrs: removed because no longer needed

3. collect_pat: updated to collect type variable binders from type patterns
   (this means that types and terms use the same infrastructure to detect
   conflicting bindings, unused variables and name shadowing)
3a. CollVarTyVarBinders: a new CollectFlag constructor that enables
    collection of type variables

4. tcHsTyPat: a new function that typechecks type patterns, capable of
   handling polymorphic kinds.
   See Note [Type patterns: binders and unifiers]

Examples of code that is now accepted:

   f = \(P @a) -> \(P @a) -> ...  -- triggers -Wname-shadowing

   g :: forall a. Proxy a -> ...
   g (P @a) = ...                 -- also triggers -Wname-shadowing

   h (P @($(TH.varT (TH.mkName "t")))) = ...
                                  -- t is bound at splice time

   j (P @(a :: (x,x))) = ...      -- (x,x) is no longer rejected

   data T where
     MkT :: forall (f :: forall k. k -> Type).
       f Int -> f Maybe -> T
   k :: T -> ()
   k (MkT @f (x :: f Int) (y :: f Maybe)) = ()
                                  -- f :: forall k. k -> Type

Examples of code that is rejected with better error messages:

  f (Left @a @a _) = ...
  -- new message:
  --     • Conflicting definitions for ‘a’
  --       Bound at: Test.hs:1:11
  --                 Test.hs:1:14

Examples of code that is now rejected:

  {-# OPTIONS_GHC -Werror=unused-matches #-}
  f (P @a) = ()
  -- Defined but not used: type variable ‘a’

- - - - -
eb1a6ab1 by sheaf at 2023-07-16T09:20:45-04:00
Don't use substTyUnchecked in newMetaTyVar

There were some comments that explained that we needed to use an
unchecked substitution function because of issue #12931, but that
has since been fixed, so we should be able to use substTy instead now.

- - - - -
c7bbad9a by sheaf at 2023-07-17T02:48:19-04:00
rnImports: var shouldn't import NoFldSelectors

In an import declaration such as

  import M ( var )

the import of the variable "var" should **not** bring into scope record
fields named "var" which are defined with NoFieldSelectors.
Doing so can cause spurious "unused import" warnings, as reported in
ticket #23557.

Fixes #23557

- - - - -
1af2e773 by sheaf at 2023-07-17T02:48:19-04:00
Suggest similar names in imports

This commit adds similar name suggestions when importing. For example

  module A where { spelling = 'o' }
  module B where { import B ( speling ) }

will give rise to the error message:

  Module ‘A’ does not export ‘speling’.
  Suggested fix: Perhaps use ‘spelling’

This also provides hints when users try to import record fields defined
with NoFieldSelectors.

- - - - -
654fdb98 by Alan Zimmerman at 2023-07-17T02:48:55-04:00
EPA: Store leading AnnSemi for decllist in al_rest

This simplifies the markAnnListA implementation in ExactPrint

- - - - -
22565506 by sheaf at 2023-07-17T21:12:59-04:00
base: add COMPLETE pragma to BufferCodec PatSyn

This implements CLC proposal #178, rectifying an oversight in the
implementation of CLC proposal #134 which could lead to spurious
pattern match warnings.

https://github.com/haskell/core-libraries-committee/issues/178
https://github.com/haskell/core-libraries-committee/issues/134

- - - - -
860f6269 by sheaf at 2023-07-17T21:13:00-04:00
exactprint: silence incomplete record update warnings

- - - - -
df706de3 by sheaf at 2023-07-17T21:13:00-04:00
Re-instate -Wincomplete-record-updates

Commit e74fc066 refactored the handling of record updates to use
the HsExpanded mechanism. This meant that the pattern matching inherent
to a record update was considered to be "generated code", and thus we
stopped emitting "incomplete record update" warnings entirely.

This commit changes the "data Origin = Source | Generated" datatype,
adding a field to the Generated constructor to indicate whether we
still want to perform pattern-match checking. We also have to do a bit
of plumbing with HsCase, to record that the HsCase arose from an
HsExpansion of a RecUpd, so that the error message continues to mention
record updates as opposed to a generic "incomplete pattern matches in case"
error.

Finally, this patch also changes the way we handle inaccessible code
warnings. Commit e74fc066 was also a regression in this regard, as we
were emitting "inaccessible code" warnings for case statements spuriously
generated when desugaring a record update (remember: the desugaring mechanism
happens before typechecking; it thus can't take into account e.g. GADT information
in order to decide which constructors to include in the RHS of the desugaring
of the record update).
We fix this by changing the mechanism through which we disable inaccessible
code warnings: we now check whether we are in generated code in
GHC.Tc.Utils.TcMType.newImplication in order to determine whether to
emit inaccessible code warnings.

Fixes #23520
Updates haddock submodule, to avoid incomplete record update warnings

- - - - -
1d05971e by sheaf at 2023-07-17T21:13:00-04:00
Propagate long-distance information in do-notation

The preceding commit re-enabled pattern-match checking inside record
updates. This revealed that #21360 was in fact NOT fixed by e74fc066.

This commit makes sure we correctly propagate long-distance information
in do blocks, e.g. in

```haskell
data T = A { fld :: Int } | B

f :: T -> Maybe T
f r = do
  a at A{} <- Just r
  Just $ case a of { A _ -> A 9 }
```

we need to propagate the fact that "a" is headed by the constructor "A"
to see that the case expression "case a of { A _ -> A 9 }" cannot fail.

Fixes #21360

- - - - -
bea0e323 by sheaf at 2023-07-17T21:13:00-04:00
Skip PMC for boring patterns

Some patterns introduce no new information to the pattern-match
checker (such as plain variable or wildcard patterns). We can thus
skip doing any pattern-match checking on them when the sole purpose
for doing so was introducing new long-distance information.

See Note [Boring patterns] in GHC.Hs.Pat.

Doing this avoids regressing in performance now that we do additional
pattern-match checking inside do notation.

- - - - -
ddcdd88c by Rodrigo Mesquita at 2023-07-17T21:13:36-04:00
Split GHC.Platform.ArchOS from ghc-boot into ghc-platform

Split off the `GHC.Platform.ArchOS` module from the `ghc-boot` package
into this reinstallable standalone package which abides by the PVP, in
part motivated by the ongoing work on `ghc-toolchain` towards runtime
retargetability.

- - - - -
b55a8ea7 by Sylvain Henry at 2023-07-17T21:14:27-04:00
JS: better implementation for plusWord64 (#23597)

- - - - -
889c2bbb by sheaf at 2023-07-18T06:37:32-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
-------------------------

- - - - -
00648e5d by Krzysztof Gogolewski at 2023-07-18T06:38:10-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.

- - - - -
787bae96 by Krzysztof Gogolewski at 2023-07-18T06:38:50-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.

- - - - -
257f1567 by Jaro Reinders at 2023-07-18T06:39:29-04:00
Add StgFromCore and StgCodeGen linting

- - - - -
34d08a20 by Ben Gamari at 2023-07-19T03:33:22-04:00
Reg.Liveness: Strictness

- - - - -
c5deaa27 by Ben Gamari at 2023-07-19T03:33:22-04:00
Reg.Liveness: Don't repeatedly construct UniqSets

- - - - -
b947250b by Ben Gamari at 2023-07-19T03:33:22-04:00
compiler/Types: Ensure that fromList-type operations can fuse

In #20740 I noticed that mkUniqSet does not fuse. In practice, allowing
it to do so makes a considerable difference in allocations due to the
backend.

Metric Decrease:
    T12707
    T13379
    T3294
    T4801
    T5321FD
    T5321Fun
    T783

- - - - -
6c88c2ba by Sven Tennie at 2023-07-19T03:33:59-04:00
x86 Codegen: Implement MO_S_MulMayOflo for W16

- - - - -
5f1154e0 by Sven Tennie at 2023-07-19T03:33:59-04:00
x86 CodeGen: MO_S_MulMayOflo better error message for rep > W64

It's useful to see which value made the pattern match fail. (If it ever
occurs.)

- - - - -
e8c9a95f by Sven Tennie at 2023-07-19T03:33:59-04:00
x86 CodeGen: Implement MO_S_MulMayOflo for W8

This case wasn't handled before. But, the test-primops test suite showed
that it actually might appear.

- - - - -
a36f9dc9 by Sven Tennie at 2023-07-19T03:33:59-04:00
Add test for %mulmayoflo primop

The test expects a perfect implementation with no false positives.

- - - - -
38a36248 by Matthew Pickering at 2023-07-19T03:34:36-04:00
lint-ci-config: Generate jobs-metadata.json

We also now save the jobs-metadata.json and jobs.yaml file as artifacts
as:

* It might be useful for someone who is modifying CI to copy jobs.yaml
  if they are having trouble regenerating locally.
* jobs-metadata.json is very useful for downstream pipelines to work out
  the right job to download.

Fixes #23654

- - - - -
1535a671 by Vladislav Zavialov at 2023-07-19T03:35:12-04:00
Initialize 9.10.1-notes.rst

Create new release notes for the next GHC release (GHC 9.10)

- - - - -
3bd4d5b5 by sheaf at 2023-07-19T03:35:53-04:00
Prioritise Parent when looking up class sub-binder

When we look up children GlobalRdrElts of a given Parent, we sometimes
would rather prioritise those GlobalRdrElts which have the right Parent,
and sometimes prioritise those that have the right NameSpace:

  - in export lists, we should prioritise NameSpace
  - for class/instance binders, we should prioritise Parent

See Note [childGREPriority] in GHC.Types.Name.Reader.

fixes #23664

- - - - -
9c8fdda3 by Alan Zimmerman at 2023-07-19T03:36:29-04:00
EPA: Improve annotation management in getMonoBind

Ensure the LHsDecl for a FunBind has the correct leading comments and
trailing annotations.

See the added note for details.

- - - - -
ff884b77 by Matthew Pickering at 2023-07-19T11:42:02+01:00
Remove unused files in .gitlab

These were left over after 6078b429

- - - - -
29ef590c by Matthew Pickering at 2023-07-19T11:42:52+01:00
gen_ci: Add hie.yaml file

This allows you to load `gen_ci.hs` into HLS, and now it is a huge
module, that is quite useful.

- - - - -
808b55cf by Matthew Pickering at 2023-07-19T12:24:41+01:00
ci: Make "fast-ci" the default validate configuration

We are trying out a lighter weight validation pipeline where by default
we just test on 5 platforms:

* x86_64-deb10-slow-validate
* windows
* x86_64-fedora33-release
* aarch64-darwin
* aarch64-linux-deb10

In order to enable the "full" validation pipeline you can apply the
`full-ci` label which will enable all the validation pipelines.

All the validation jobs are still run on a marge batch.

The goal is to reduce the overall CI capacity so that pipelines start
faster for MRs and marge bot batches are faster.

Fixes #23694

- - - - -
0b23db03 by Alan Zimmerman at 2023-07-20T05:28:47-04:00
EPA: Simplify GHC/Parser.y sL1

This is the next patch in a series simplifying location management in
GHC/Parser.y

This one simplifies sL1, to use the HasLoc instances introduced in
!10743 (closed)

- - - - -
3ece9856 by Ben Gamari at 2023-07-21T07:30:45-04:00
nativeGen: Explicitly set flags of text sections on Windows

The binutils documentation (for COFF) claims,

> If no flags are specified, the default flags depend upon the section
> name. If the section name is not recognized, the default will be for the
> section to be loaded and writable.

We previously assumed that this would do the right thing for split
sections (e.g. a section named `.text$foo` would be correctly inferred
to be a text section). However, we have observed that this is not the
case (at least under the clang toolchain used on Windows): when
split-sections is enabled, text sections are treated by the assembler as
data (matching the "default" behavior specified by the documentation).

Avoid this by setting section flags explicitly. This should fix split
sections on Windows.

Fixes #22834.

- - - - -
db7f7240 by Ben Gamari at 2023-07-21T07:30:45-04:00
nativeGen: Set explicit section types on all platforms

- - - - -
b444c16f by Finley McIlwaine at 2023-07-21T07:31:28-04:00
Insert documentation into parsed signature modules

Causes haddock comments in signature modules to be properly
inserted into the AST (just as they are for regular modules)
if the `-haddock` flag is given.

Also adds a test that compares `-ddump-parsed-ast` output
for a signature module to prevent further regressions.

Fixes #23315

- - - - -
c30cea53 by Ben Gamari at 2023-07-21T23:23:49-04:00
primops: Introduce unsafeThawByteArray#

This addresses an odd asymmetry in the ByteArray# primops, which
previously provided unsafeFreezeByteArray# but no corresponding
thaw operation.

Closes #22710

- - - - -
87f9bd47 by Ben Gamari at 2023-07-21T23:23:49-04:00
testsuite: Elaborate in interface stability README

This discussion didn't make it into the original MR.

- - - - -
e4350b41 by Matthew Pickering at 2023-07-21T23:24:25-04:00
Allow users to override non-essential haddock options in a Flavour

We now supply the non-essential options to haddock using the `extraArgs`
field, which can be specified in a Flavour so that if an advanced user
wants to change how documentation is generated then they can use
something other than the `defaultHaddockExtraArgs`.

This does have the potential to regress some packaging if a user has
overridden `extraArgs` themselves, because now they also need to add
the haddock options to extraArgs. This can easily be done by appending
`defaultHaddockExtraArgs` to their extraArgs invocation but someone
might not notice this behaviour has changed.

In any case, I think passing the non-essential options in this manner is
the right thing to do and matches what we do for the "ghc" builder,
which by default doesn't pass any optmisation levels, and would likewise
be very bad if someone didn't pass suitable `-O` levels for builds.

Fixes #23625

- - - - -
fc186b0c by Ilias Tsitsimpis at 2023-07-21T23:25:03-04:00
ghc-prim: Link against libatomic

Commit b4d39adbb58 made 'hs_cmpxchg64()' available to all architectures.
Unfortunately this made GHC to fail to build on armel, since armel needs
libatomic to support atomic operations on 64-bit word sizes.

Configure libraries/ghc-prim/ghc-prim.cabal to link against libatomic,
the same way as we do in rts/rts.cabal.

- - - - -
4f5538a8 by Matthew Pickering at 2023-07-21T23:25:39-04:00
simplifier: Correct InScopeSet in rule matching

The in-scope set passedto the `exprIsLambda_maybe` call lacked all the
in-scope binders. @simonpj suggests this fix where we augment the
in-scope set with the free variables of expression which fixes this
failure mode in quite a direct way.

Fixes #23630

- - - - -
5ad8d597 by Krzysztof Gogolewski at 2023-07-21T23:26:17-04:00
Add a test for #23413

It was fixed by commit e1590ddc661d6: Add the SolverStage monad.

- - - - -
7e05f6df by sheaf at 2023-07-21T23:26:56-04:00
Finish migration of diagnostics in GHC.Tc.Validity

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

It also refactors the error message datatypes for class and family
instances, to common them up under a single datatype as much as possible.

- - - - -
4876fddc by Matthew Pickering at 2023-07-21T23:27:33-04:00
ci: Enable some more jobs to run in a marge batch

In !10907 I made the majority of jobs not run on a validate pipeline but
then forgot to renable a select few jobs on the marge batch MR.

- - - - -
026991d7 by Jens Petersen at 2023-07-21T23:28:13-04:00
user_guide/flags.py: python-3.12 no longer includes distutils

packaging.version seems able to handle this fine

- - - - -
b91bbc2b by Matthew Pickering at 2023-07-21T23:28:50-04:00
ci: Mention ~full-ci label in MR template

We mention that if you need a full validation pipeline then you can
apply the ~full-ci label to your MR in order to test against the full
validation pipeline (like we do for marge).

- - - - -
42b05e9b by sheaf at 2023-07-22T12:36:00-04:00
RTS: declare setKeepCAFs symbol

Commit 08ba8720 failed to declare the dependency of keepCAFsForGHCi on
the symbol setKeepCAFs in the RTS, which led to undefined symbol errors
on Windows, as exhibited by the testcase frontend001.

Thanks to Moritz Angermann and Ryan Scott for the diagnosis and fix.

Fixes #22961

- - - - -
a72015d6 by sheaf at 2023-07-22T12:36:01-04:00
Mark plugins-external as broken on Windows

This test is broken on Windows, so we explicitly mark it as such now
that we stop skipping plugin tests on Windows.

- - - - -
cb9c93d7 by sheaf at 2023-07-22T12:36:01-04:00
Stop marking plugin tests as fragile on Windows

Now that b2bb3e62 has landed we are in a better situation with
regards to plugins on Windows, allowing us to unmark many plugin tests
as fragile.

Fixes #16405

- - - - -
a7349217 by Krzysztof Gogolewski at 2023-07-22T12:36:37-04:00
Misc cleanup

- Remove unused RDR names
- Fix typos in comments
- Deriving: simplify boxConTbl and remove unused litConTbl
- chmod -x GHC/Exts.hs, this seems accidental

- - - - -
33b6850a by Vladislav Zavialov at 2023-07-23T10:27:37-04:00
Visible forall in types of terms: Part 1 (#22326)

This patch implements part 1 of GHC Proposal #281,
introducing explicit `type` patterns and `type` arguments.

Summary of the changes:

1. New extension flag:
     RequiredTypeArguments

2. New user-facing syntax:
     `type p` patterns    (represented by EmbTyPat)
     `type e` expressions (represented by HsEmbTy)

3. Functions with required type arguments (visible forall)
   can now be defined and applied:
      idv :: forall a -> a -> a    -- signature   (relevant change: checkVdqOK in GHC/Tc/Validity.hs)
      idv (type a) (x :: a) = x    -- definition  (relevant change: tcPats in GHC/Tc/Gen/Pat.hs)
      x = idv (type Int) 42        -- usage       (relevant change: tcInstFun in GHC/Tc/Gen/App.hs)

4. template-haskell support:
      TH.TypeE corresponds to HsEmbTy
      TH.TypeP corresponds to EmbTyPat

5. Test cases and a new User's Guide section

Changes *not* included here are the t2t (term-to-type) transformation
and term variable capture; those belong to part 2.

- - - - -
73b5c7ce by sheaf at 2023-07-23T10:28:18-04:00
Add test for #22424

This is a simple Template Haskell test in which we refer to
record selectors by their exact Names, in two different ways.

Fixes #22424

- - - - -
83cbc672 by Ben Gamari at 2023-07-24T07:40:49+00:00
ghc-toolchain: Initial commit

- - - - -
31dcd26c by Rodrigo Mesquita at 2023-07-24T07:40:49+00:00
ghc-toolchain: Toolchain Selection

This commit integrates ghc-toolchain, the brand new way of configuring
toolchains for GHC, with the Hadrian build system, with configure, and
extends and improves the first iteration of ghc-toolchain.

The general overview is

* We introduce a program invoked `ghc-toolchain --triple=...` which, when run,
  produces a file with a `Target`. A `GHC.Toolchain.Target.Target`
  describes the properties of a target and the toolchain (executables
  and configured flags) to produce code for that target

* Hadrian was modified to read Target files, and will both
  * Invoke the toolchain configured in the Target file as needed
  * Produce a `settings` file for GHC based on the Target file for that stage

* `./configure` will invoke ghc-toolchain to generate target files, but
  it will also generate target files based on the flags configure itself
  configured (through `.in` files that are substituted)

  * By default, the Targets generated by configure are still (for now) the ones used by Hadrian

  * But we additionally validate the Target files generated by
    ghc-toolchain against the ones generated by configure, to get a head
    start on catching configuration bugs before we transition
    completely.

  * When we make that transition, we will want to drop a lot of the
    toolchain configuration logic from configure, but keep it otherwise.

* For each compiler stage we should have 1 target file (up to a stage compiler we can't run in our machine)
  * We just have a HOST target file, which we use as the target for stage0
  * And a TARGET target file, which we use for stage1 (and later stages, if not cross compiling)
  * Note there is no BUILD target file, because we only support cross compilation where BUILD=HOST
  * (for more details on cross-compilation see discussion on !9263)

See also
* Note [How we configure the bundled windows toolchain]
* Note [ghc-toolchain consistency checking]
* Note [ghc-toolchain overview]

Ticket: #19877
MR: !9263

- - - - -
a732b6d3 by Rodrigo Mesquita at 2023-07-24T07:40:49+00:00
Add flag to enable/disable ghc-toolchain based configurations

This flag is disabled by default, and we'll use the
configure-generated-toolchains by default until we remove the toolchain
configuration logic from configure.

- - - - -
61eea240 by Rodrigo Mesquita at 2023-07-24T07:40:49+00:00
Split ghc-toolchain executable to new packge

In light of #23690, we split the ghc-toolchain executable out of the
library package to be able to ship it in the bindist using Hadrian.

Ideally, we eventually revert this commit.

- - - - -
38e795ff by Rodrigo Mesquita at 2023-07-24T07:40:49+00:00
Ship ghc-toolchain in the bindist

Add the ghc-toolchain binary to the binary distribution we ship to
users, and teach the bindist configure to use the existing ghc-toolchain.

- - - - -
32cae784 by Matthew Craven at 2023-07-24T16:48:24-04:00
Kill off gen_bytearray_addr_access_ops.py

The relevant primop descriptions are now
generated directly by genprimopcode.

This makes progress toward fixing #23490, but it is not
a complete fix since there is more than one way in which
cabal-reinstall (hadrian/build build-cabal) is broken.

- - - - -
02e6a6ce by Matthew Pickering at 2023-07-24T16:49:00-04:00
compiler: Remove unused `containers.h` include

Fixes #23712

- - - - -
822ef66b by Matthew Pickering at 2023-07-25T08:44:50-04:00
Fix pretty printing of WARNING pragmas

There is still something quite unsavoury going on with WARNING pragma
printing because the printing relies on the fact that for decl
deprecations the SourceText of WarningTxt is empty. However, I let that
lion sleep and just fixed things directly.

Fixes #23465

- - - - -
e7b38ede by Matthew Pickering at 2023-07-25T08:45:28-04:00
ci-images: Bump to commit which has 9.6 image

The test-bootstrap job has been failing for 9.6 because we accidentally
used a non-master commit.

- - - - -
bb408936 by Matthew Pickering at 2023-07-25T08:45:28-04:00
Update bootstrap plans for 9.6.2 and 9.4.5

- - - - -
355e1792 by Alan Zimmerman at 2023-07-26T10:17:32-04:00
EPA: Simplify GHC/Parser.y comb4/comb5

Use the HasLoc instance from Ast.hs to allow comb4/comb5 to work with
anything with a SrcSpan

Also get rid of some more now unnecessary reLoc calls.

- - - - -
9393df83 by Gavin Zhao at 2023-07-26T10:18:16-04:00
compiler: make -ddump-asm work with wasm backend NCG

Fixes #23503.

Now the `-ddump-asm` flag is respected in the wasm backend
NCG, so developers can directly view the generated ASM instead of
needing to pass `-S` or `-keep-tmp-files` and manually find & open
the assembly file.

Ideally, we should be able to output the assembly files in smaller
chunks like in other NCG backends. This would also make dumping assembly
stats easier. However, this would require a large refactoring, so for
short-term debugging purposes I think the current approach works fine.

Signed-off-by: Gavin Zhao <git at gzgz.dev>

- - - - -
79463036 by Krzysztof Gogolewski at 2023-07-26T10:18:54-04:00
llvm: Restore accidentally deleted code in 0fc5cb97

Fixes #23711

- - - - -
20db7e26 by Rodrigo Mesquita at 2023-07-26T10:19:33-04:00
configure: Default missing options to False when preparing ghc-toolchain Targets

This commit fixes building ghc with 9.2 as the boostrap compiler.

The ghc-toolchain patch assumed all _STAGE0 options were available, and
forgot to account for this missing information in 9.2.

Ghc 9.2 does not have in settings whether ar supports -l, hence can't
report it with --info (unliked 9.4 upwards).

The fix is to default the missing information (we default "ar supports
-l" and other missing options to False)

- - - - -
fac9e84e by Naïm Favier at 2023-07-26T10:20:16-04:00
docs: Fix typo
- - - - -
503fd647 by Bartłomiej Cieślar at 2023-07-26T17:23:10-04:00
This MR is an implementation of the proposal #516.

It adds a warning -Wincomplete-record-selectors for usages of a record
field access function (either a record selector or getField @"rec"),
while trying to silence the warning whenever it can be sure that a constructor
without the record field would not be invoked (which would otherwise cause
the program to fail). For example:

    data T = T1 | T2 {x :: Bool}

    f a = x a -- this would throw an error

    g T1 = True
    g a = x a -- this would not throw an error

    h :: HasField "x" r Bool => r -> Bool
    h = getField @"x"

    j :: T -> Bool
    j = h -- this would throw an error because of the `HasField`
          -- constraint being solved

See the tests DsIncompleteRecSel* and TcIncompleteRecSel for more examples of the warning.
See Note [Detecting incomplete record selectors] in GHC.HsToCore.Expr for implementation details

- - - - -
af6fdf42 by Arnaud Spiwack at 2023-07-26T17:23:52-04:00
Fix user-facing label in MR template

- - - - -
5d45b92a by Matthew Pickering at 2023-07-27T05:46:46-04:00
ci: Test bootstrapping configurations with full-ci and on marge batches

There have been two incidents recently where bootstrapping has been
broken by removing support for building with 9.2.*.

The process for bumping the minimum required version starts with bumping
the configure version and then other CI jobs such as the bootstrap jobs
have to be updated. We must not silently bump the minimum required
version.

Now we are running a slimmed down validate pipeline it seems worthwile
to test these bootstrap configurations in the full-ci pipeline.

- - - - -
25d4fee7 by Matthew Pickering at 2023-07-27T05:46:46-04:00
bootstrap: Remove ghc-9_2_* plans

We are anticipating shortly making it necessary to use ghc-9.4 to boot
the compiler.

- - - - -
2f66da16 by Matthew Pickering at 2023-07-27T05:46:46-04:00
Update bootstrap plans for ghc-platform and ghc-toolchain dependencies

Fixes #23735

- - - - -
c8c6eab1 by Matthew Pickering at 2023-07-27T05:46:46-04:00
bootstrap: Disable -selftest flag from bootstrap plans

This saves on building one dependency (QuickCheck) which is unecessary
for bootstrapping.

- - - - -
a80ca086 by Bodigrim at 2023-07-27T05:47:26-04:00
Link reference paper and package from System.Mem.{StableName,Weak}

- - - - -
a5319358 by David Knothe at 2023-07-28T13:13:10-04:00
Update Match Datatype

EquationInfo currently contains a list of the equation's patterns together with a CoreExpr that is to be evaluated after a successful match on this equation.
All the match-functions only operate on the first pattern of an equation - after successfully matching it, match is called recursively on the tail of the pattern list.
We can express this more clearly and make the code a little more elegant by updating the datatype of EquationInfo as follows:

data EquationInfo
    = EqnMatch { eqn_pat = Pat GhcTc, eqn_rest = EquationInfo }
    | EqnDone { eqn_rhs = MatchResult CoreExpr }

An EquationInfo now explicitly exposes its first pattern which most functions operate on, and exposes the equation that remains after processing the first pattern. An EqnDone signifies an empty equation where the CoreExpr can now be evaluated.

- - - - -
86ad1af9 by David Binder at 2023-07-28T13:13:53-04:00
Improve documentation for Data.Fixed

- - - - -
f8fa1d08 by Ben Gamari at 2023-07-28T13:14:31-04:00
ghc-prim: Use C11 atomics

Previously `ghc-prim`'s atomic wrappers used the legacy `__sync_*`
family of C builtins. Here we refactor these to rather use the
appropriate C11 atomic equivalents, allowing us to be more explicit
about the expected ordering semantics.

- - - - -
0bfc8908 by Finley McIlwaine at 2023-07-28T18:46:26-04:00
Include -haddock in DynFlags fingerprint

The -haddock flag determines whether or not the resulting .hi files
contain haddock documentation strings. If the existing .hi files do
not contain haddock documentation strings and the user requests them,
we should recompile.

- - - - -
40425c50 by Andreas Klebinger at 2023-07-28T18:47:02-04:00
Aarch64 NCG: Use encoded immediates for literals.

Try to generate

    instr x2, <imm>

instead of

    mov x1, lit
    instr x2, x1

When possible. This get's rid if quite a few redundant
mov instructions.

I believe this causes a metric decrease for LargeRecords as
we reduce register pressure.

-------------------------
Metric Decrease:
    LargeRecord
-------------------------

- - - - -
e9a0fa3f by Bodigrim at 2023-07-28T18:47:42-04:00
Bump filepath submodule to 1.4.100.4

Resolves #23741

Metric Decrease:
    MultiComponentModules
    MultiComponentModulesRecomp
    MultiLayerModules
    MultiLayerModulesRecomp
    T10421
    T12234
    T12425
    T13035
    T13701
    T13719
    T16875
    T18304
    T18698a
    T18698b
    T21839c
    T9198
    TcPlugin_RewritePerf
    hard_hole_fits

Metric decrease on Windows can be probably attributed to https://github.com/haskell/filepath/pull/183

- - - - -
ee93edfd by Bodigrim at 2023-07-28T18:48:21-04:00
Add since pragmas to GHC.IO.Handle.FD

- - - - -
d0369802 by Simon Peyton Jones at 2023-07-30T09:24:48+01:00
Make the occurrence analyser smarter about join points

This MR addresses #22404.  There is a big Note

   Note [Occurrence analysis for join points]

that explains it all.  Significant changes

* New field occ_join_points in OccEnv

* The NonRec case of occAnalBind splits into two cases:
  one for existing join points (which does the special magic for
  Note [Occurrence analysis for join points], and one for other
  bindings.

* mkOneOcc adds in info from occ_join_points.

* All "bring into scope" activity is centralised in the
  new function `addInScope`.

* I made a local data type LocalOcc for use inside the occurrence analyser
  It is like OccInfo, but lacks IAmDead and IAmALoopBreaker, which in turn
  makes computationns over it simpler and more efficient.

* I found quite a bit of allocation in GHC.Core.Rules.getRules
  so I optimised it a bit.

More minor changes

* I found I was using (Maybe Arity) a lot, so I defined a new data
  type JoinPointHood and used it everwhere.  This touches a lot of
  non-occ-anal files, but it makes everything more perspicuous.

* Renamed data constructor WithUsageDetails to WUD, and
  WithTailUsageDetails to WTUD

This also fixes #21128, on the way.

--------- Compiler perf -----------
I spent quite a time on performance tuning, so even though it
does more than before, the occurrence analyser runs slightly faster
on average.  Here are the compile-time allocation changes over 0.5%

      CoOpt_Read(normal) ghc/alloc    766,025,520    754,561,992  -1.5%
CoOpt_Singletons(normal) ghc/alloc    759,436,840    762,925,512  +0.5%
     LargeRecord(normal) ghc/alloc  1,814,482,440  1,799,530,456  -0.8%
       PmSeriesT(normal) ghc/alloc     68,159,272     67,519,720  -0.9%
          T10858(normal) ghc/alloc    120,805,224    118,746,968  -1.7%
          T11374(normal) ghc/alloc    164,901,104    164,070,624  -0.5%
          T11545(normal) ghc/alloc     79,851,808     78,964,704  -1.1%
          T12150(optasm) ghc/alloc     73,903,664     71,237,544  -3.6% GOOD
          T12227(normal) ghc/alloc    333,663,200    331,625,864  -0.6%
          T12234(optasm) ghc/alloc     52,583,224     52,340,344  -0.5%
          T12425(optasm) ghc/alloc     81,943,216     81,566,720  -0.5%
          T13056(optasm) ghc/alloc    294,517,928    289,642,512  -1.7%
      T13253-spj(normal) ghc/alloc    118,271,264     59,859,040 -49.4% GOOD
          T15164(normal) ghc/alloc  1,102,630,352  1,091,841,296  -1.0%
          T15304(normal) ghc/alloc  1,196,084,000  1,166,733,000  -2.5%
          T15630(normal) ghc/alloc    148,729,632    147,261,064  -1.0%
          T15703(normal) ghc/alloc    379,366,664    377,600,008  -0.5%
          T16875(normal) ghc/alloc     32,907,120     32,670,976  -0.7%
          T17516(normal) ghc/alloc  1,658,001,888  1,627,863,848  -1.8%
          T17836(normal) ghc/alloc    395,329,400    393,080,248  -0.6%
          T18140(normal) ghc/alloc     71,968,824     73,243,040  +1.8%
          T18223(normal) ghc/alloc    456,852,568    453,059,088  -0.8%
          T18282(normal) ghc/alloc    129,105,576    131,397,064  +1.8%
          T18304(normal) ghc/alloc     71,311,712     70,722,720  -0.8%
         T18698a(normal) ghc/alloc    208,795,112    210,102,904  +0.6%
         T18698b(normal) ghc/alloc    230,320,736    232,697,976  +1.0%  BAD
          T19695(normal) ghc/alloc  1,483,648,128  1,504,702,976  +1.4%
          T20049(normal) ghc/alloc     85,612,024     85,114,376  -0.6%
         T21839c(normal) ghc/alloc    415,080,992    410,906,216  -1.0% GOOD
           T4801(normal) ghc/alloc    247,590,920    250,726,272  +1.3%
           T6048(optasm) ghc/alloc     95,699,416     95,080,680  -0.6%
            T783(normal) ghc/alloc    335,323,384    332,988,120  -0.7%
           T9233(normal) ghc/alloc    709,641,224    685,947,008  -3.3% GOOD
           T9630(normal) ghc/alloc    965,635,712    948,356,120  -1.8%
           T9675(optasm) ghc/alloc    444,604,152    428,987,216  -3.5% GOOD
           T9961(normal) ghc/alloc    303,064,592    308,798,800  +1.9%  BAD
           WWRec(normal) ghc/alloc    503,728,832    498,102,272  -1.1%

               geo. mean                                          -1.0%
               minimum                                           -49.4%
               maximum                                            +1.9%

In fact these figures seem to vary between platforms; generally worse
on i386 for some reason.  The Windows numbers vary by 1% espec in
benchmarks where the total allocation is low. But the geom mean stays
solidly negative, which is good.  The "increase/decrease" list below
covers all platforms.

The big win on T13253-spj comes because it has a big nest of join
points, each occurring twice in the next one.  The new occ-anal takes
only one iteration of the simplifier to do the inlining; the old one
took four.  Moreover, we get much smaller code with the new one:

  New: Result size of Tidy Core
    = {terms: 429, types: 84, coercions: 0, joins: 14/14}

  Old: Result size of Tidy Core
    = {terms: 2,437, types: 304, coercions: 0, joins: 10/10}

--------- Runtime perf -----------
No significant changes in nofib results, except a 1% reduction in
compiler allocation.

Metric Decrease:
    CoOpt_Read
    T13253-spj
    T9233
    T9630
    T9675
    T12150
    T21839c
    LargeRecord
    MultiComponentModulesRecomp
    T10421
    T13701
    T10421
    T13701
    T12425

Metric Increase:
    T18140
    T9961
    T18282
    T18698a
    T18698b
    T19695

- - - - -
42aa7fbd by Julian Ospald at 2023-07-30T17:22:01-04:00
Improve documentation around IOException and ioe_filename

See:

* https://github.com/haskell/core-libraries-committee/issues/189
* https://github.com/haskell/unix/pull/279
* https://github.com/haskell/unix/pull/289

- - - - -
33598ecb by Sylvain Henry at 2023-08-01T14:45:54-04:00
JS: implement getMonotonicTime (fix #23687)

- - - - -
d2bedffd by Bartłomiej Cieślar at 2023-08-01T14:46:40-04:00
Implementation of the Deprecated Instances proposal #575

This commit implements the ability to deprecate certain instances,
which causes the compiler to emit the desired deprecation message
whenever they are instantiated. For example:

  module A where
  class C t where
  instance {-# DEPRECATED "dont use" #-} C Int where

  module B where
  import A
  f :: C t => t
  f = undefined
  g :: Int
  g = f -- "dont use" emitted here

The implementation is as follows:
  - In the parser, we parse deprecations/warnings attached to instances:

      instance {-# DEPRECATED "msg" #-} Show X
      deriving instance {-# WARNING "msg2" #-} Eq Y

    (Note that non-standalone deriving instance declarations do not support
    this mechanism.)

  - We store the resulting warning message in `ClsInstDecl` (respectively, `DerivDecl`).
    In `GHC.Tc.TyCl.Instance.tcClsInstDecl` (respectively, `GHC.Tc.Deriv.Utils.newDerivClsInst`),
    we pass on that information to `ClsInst` (and eventually store it in `IfaceClsInst` too).

  - Finally, when we solve a constraint using such an instance, in
    `GHC.Tc.Instance.Class.matchInstEnv`, we emit the appropriate warning
    that was stored in `ClsInst`.
    Note that we only emit a warning when the instance is used in a different module
    than it is defined, which keeps the behaviour in line with the deprecation of
    top-level identifiers.

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

- - - - -
d5a65af6 by Ben Gamari at 2023-08-01T14:47:18-04:00
compiler: Style fixes

- - - - -
7218c80a by Ben Gamari at 2023-08-01T14:47:19-04:00
rts: Fix implicit cast

This ensures that Task.h can be built with a C++ compiler.

- - - - -
d6d5aafc by Ben Gamari at 2023-08-01T14:47:19-04:00
testsuite: Fix warning in hs_try_putmvar001

- - - - -
d9eddf7a by Ben Gamari at 2023-08-01T14:47:19-04:00
testsuite: Add AtomicModifyIORef test

- - - - -
f9eea4ba by Ben Gamari at 2023-08-01T14:47:19-04:00
rts: Introduce NO_WARN macro

This allows fine-grained ignoring of warnings.

- - - - -
497b24ec by Ben Gamari at 2023-08-01T14:47:19-04:00
rts: Simplify atomicModifyMutVar2# implementation

Previously we would perform a redundant load in the non-threaded RTS in
atomicModifyMutVar2# implementation for the benefit of the non-moving
GC's write barrier. Eliminate this.

- - - - -
52ee082b by Ben Gamari at 2023-08-01T14:47:19-04:00
rts: Introduce more principled fence operations

- - - - -
cd3c0377 by Ben Gamari at 2023-08-01T14:47:19-04:00
rts: Introduce SET_INFO_RELAXED

- - - - -
6df2352a by Ben Gamari at 2023-08-01T14:47:19-04:00
rts: Style fixes

- - - - -
4ef6f319 by Ben Gamari at 2023-08-01T14:47:19-04:00
codeGen/tsan: Rework handling of spilling

- - - - -
f9ca7e27 by Ben Gamari at 2023-08-01T14:47:19-04:00
hadrian: More debug information

- - - - -
df4153ac by Ben Gamari at 2023-08-01T14:47:19-04:00
Improve TSAN documentation

- - - - -
fecae988 by Ben Gamari at 2023-08-01T14:47:19-04:00
hadrian: More selective TSAN instrumentation

- - - - -
465a9a0b by Alan Zimmerman at 2023-08-01T14:47:56-04:00
EPA: Provide correct annotation span for ImportDecl

Use the whole declaration, rather than just the span of the 'import'
keyword.

Metric Decrease:
   T9961
   T5205
Metric Increase:
  T13035

- - - - -
ae63d0fa by Bartłomiej Cieślar at 2023-08-01T14:48:40-04:00
Add cases to T23279: HasField for deprecated record fields

This commit adds additional tests from ticket #23279 to ensure that we don't
regress on reporting deprecated record fields in conjunction with HasField,
either when using overloaded record dot syntax or directly through `getField`.

Fixes #23279

- - - - -
00fb6e6b by Andreas Klebinger at 2023-08-01T14:49:17-04:00
AArch NCG: Pure refactor

Combine some alternatives. Add some line breaks for overly long lines

- - - - -
8f3b3b78 by Andreas Klebinger at 2023-08-01T14:49:54-04:00
Aarch ncg: Optimize immediate use for address calculations

When the offset doesn't fit into the immediate we now just reuse the
general getRegister' code path which is well optimized to compute the
offset into a register instead of a special case for CmmRegOff.

This means we generate a lot less code under certain conditions which is
why performance metrics for these improve.

-------------------------
Metric Decrease:
    T4801
    T5321FD
    T5321Fun
-------------------------

- - - - -
74a882dc by MorrowM at 2023-08-02T06:00:03-04:00
Add a RULE to make lookup fuse

See https://github.com/haskell/core-libraries-committee/issues/175

Metric Increase:
    T18282

- - - - -
cca74dab by Ben Gamari at 2023-08-02T06:00:39-04:00
hadrian: Ensure that way-flags are passed to CC

Previously the way-specific compilation flags (e.g. `-DDEBUG`,
`-DTHREADED_RTS`) would not be passed to the CC invocations. This meant
that C dependency files would not correctly reflect
dependencies predicated on the way, resulting in the rather
painful #23554.

Closes #23554.

- - - - -
622b483c by Jaro Reinders at 2023-08-02T06:01:20-04:00
Native 32-bit Enum Int64/Word64 instances

This commits adds more performant Enum Int64 and Enum Word64 instances
for 32-bit platforms, replacing the Integer-based implementation.

These instances are a copy of the Enum Int and Enum Word instances with
minimal changes to manipulate Int64 and Word64 instead.

On i386 this yields a 1.5x performance increase and for the JavaScript
back end it even yields a 5.6x speedup.

Metric Decrease:
    T18964

- - - - -
c8bd7fa4 by Sylvain Henry at 2023-08-02T06:02:03-04:00
JS: fix typos in constants (#23650)

- - - - -
b9d5bfe9 by Josh Meredith at 2023-08-02T06:02:40-04:00
JavaScript: update MK_TUP macros to use current tuple constructors (#23659)

- - - - -
28211215 by Matthew Pickering at 2023-08-02T06:03:19-04:00
ci: Pass -Werror when building hadrian in hadrian-ghc-in-ghci job

Warnings when building Hadrian can end up cluttering the output of HLS,
and we've had bug reports in the past about these warnings when building
Hadrian. It would be nice to turn on -Werror on at least one build of
Hadrian in CI to avoid a patch introducing warnings when building
Hadrian.

Fixes #23638

- - - - -
aca20a5d by Ben Gamari at 2023-08-02T06:03:55-04:00
codeGen: Ensure that TSAN is aware of writeArray# write barriers

By using a proper release store instead of a fence.

- - - - -
453c0531 by Ben Gamari at 2023-08-02T06:03:55-04:00
codeGen: Ensure that array reads have necessary barriers

This was the cause of #23541.

- - - - -
93a0d089 by Arnaud Spiwack at 2023-08-02T06:04:37-04:00
Add test for #23550

- - - - -
6a2f4a20 by Arnaud Spiwack at 2023-08-02T06:04:37-04:00
Desugar non-recursive lets to non-recursive lets (take 2)

This reverts commit 522bd584f71ddeda21efdf0917606ce3d81ec6cc. And
takes care of the case that I missed in my previous attempt. Namely
the case of an AbsBinds with no type variables and no dictionary
variable.

Ironically, the comment explaining why non-recursive lets were
desugared to recursive lets were pointing specifically at this case
as the reason. I just failed to understand that it was until Simon PJ
pointed it out to me.

See #23550 for more discussion.

- - - - -
ff81d53f by jade at 2023-08-02T06:05:20-04:00
Expand documentation of List & Data.List

This commit aims to improve the documentation and examples
of symbols exported from Data.List

- - - - -
fa4e5913 by Jade at 2023-08-02T06:06:03-04:00
Improve documentation of Semigroup & Monoid

This commit aims to improve the documentation of various symbols
exported from Data.Semigroup and Data.Monoid

- - - - -
7d484b00 by Ben Gamari at 2023-08-04T14:17:13-04:00
CmmToAsm.PPC: Refactor pprAlignForSection

Reduces code duplication and improves clarity.

- - - - -
77804b0b by Ben Gamari at 2023-08-04T14:17:13-04:00
compiler: Place IPE information in separate section

Previously IPE information would end up in the `.data` section. Not only
does this make it difficult to measure the size of the IPE metadata, but
by placing it in its own section we reduce the probability of the
(generally rather large) IPE metadata inducing large displacements at link-time.

Moreover, we can now in principle allow the data to be stripped
post-build; we would merely need to sort out how to make the
could

- - - - -


15 changed files:

- .gitlab-ci.yml
- .gitlab/ci.sh
- − .gitlab/circle-ci-job.sh
- − .gitlab/gen-ci.cabal
- .gitlab/generate-ci/gen_ci.hs
- .gitlab/hie.yaml → .gitlab/generate-ci/hie.yaml
- .gitlab/jobs.yaml
- .gitlab/merge_request_templates/Default.md
- .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py
- .gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/Names/TH.hs
- compiler/GHC/Builtin/PrimOps.hs
- compiler/GHC/Builtin/PrimOps/Ids.hs
- compiler/GHC/Builtin/Types.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4eb41f6216e6c2366d99e14eca88d916c40c0523...77804b0b4512867f92b5875eb82d63c10295feb6

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4eb41f6216e6c2366d99e14eca88d916c40c0523...77804b0b4512867f92b5875eb82d63c10295feb6
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/20230804/711272b4/attachment-0001.html>


More information about the ghc-commits mailing list