[Git][ghc/ghc][wip/oneshot-unify] 27 commits: Switch from HscSource to IsBootInterface for module lookup in GhcMake

Ben Gamari gitlab at gitlab.haskell.org
Fri Jun 26 03:06:32 UTC 2020



Ben Gamari pushed to branch wip/oneshot-unify at Glasgow Haskell Compiler / GHC


Commits:
809caedf by John Ericson at 2020-06-23T22:47:37-04:00
Switch from HscSource to IsBootInterface for module lookup in GhcMake

We look up modules by their name, and not their contents. There is no
way to separately reference a signature vs regular module; you get what
you get. Only boot files can be referenced indepenently with `import {-#
SOURCE #-}`.

- - - - -
7750bd45 by Sylvain Henry at 2020-06-23T22:48:18-04:00
Cmm: introduce SAVE_REGS/RESTORE_REGS

We don't want to save both Fn and Dn register sets on x86-64 as they are
aliased to the same arch register (XMMn).

Moreover, when SAVE_STGREGS was used in conjunction with `jump foo [*]`
which makes a set of Cmm registers alive so that they cover all arch
registers used to pass parameter, we could have Fn, Dn and XMMn alive at
the same time. It made the LLVM code generator choke (see #17920).

Now `SAVE_REGS/RESTORE_REGS` and `jump foo [*]` use the same set of
registers.

- - - - -
2636794d by Sylvain Henry at 2020-06-23T22:48:18-04:00
CmmToC: don't add extern decl to parsed Cmm data

Previously, if a .cmm file *not in the RTS* contained something like:

```cmm
section "rodata" { msg : bits8[] "Test\n"; }
```

It would get compiled by CmmToC into:

```c
ERW_(msg);
const char msg[] = "Test\012";
```

and fail with:

```
/tmp/ghc32129_0/ghc_4.hc:5:12: error:
     error: conflicting types for \u2018msg\u2019
     const char msg[] = "Test\012";
                ^~~

In file included from /tmp/ghc32129_0/ghc_4.hc:3:0: error:

/tmp/ghc32129_0/ghc_4.hc:4:6: error:
     note: previous declaration of \u2018msg\u2019 was here
     ERW_(msg);
          ^

/builds/hsyl20/ghc/_build/install/lib/ghc-8.11.0.20200605/lib/../lib/x86_64-linux-ghc-8.11.0.20200605/rts-1.0/include/Stg.h:253:46: error:
     note: in definition of macro \u2018ERW_\u2019
     #define ERW_(X)   extern       StgWordArray (X)
                                                  ^
```

See the rationale for this on https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/compiler/backends/ppr-c#prototypes

Now we don't generate these extern declarations (ERW_, etc.) for
top-level data. It shouldn't change anything for the RTS (the only place
we use .cmm files) as it is already special cased in
`GHC.Cmm.CLabel.needsCDecl`. And hand-written Cmm can use explicit
extern declarations when needed.

Note that it allows `cgrun069` test to pass with CmmToC (cf #15467).

- - - - -
5f6a0665 by Sylvain Henry at 2020-06-23T22:48:18-04:00
LLVM: refactor and comment register padding code (#17920)

- - - - -
cad62ef1 by Sylvain Henry at 2020-06-23T22:48:18-04:00
Add tests for #17920

Metric Decrease:
    T12150
    T12234

- - - - -
a2a9006b by Xavier Denis at 2020-06-23T22:48:56-04:00
Fix issue #18262 by zonking constraints after solving

Zonk residual constraints in checkForExistence to reveal user type
errors.

Previously when `:instances` was used with instances that have TypeError
constraints the result would look something like:

instance [safe] s0 => Err 'A -- Defined at ../Bug2.hs:8:10

whereas after zonking, `:instances` now sees the `TypeError` and
properly eliminates the constraint from the results.

- - - - -
181516bc by Simon Peyton Jones at 2020-06-23T22:49:33-04:00
Fix a buglet in Simplify.simplCast

This bug, revealed by #18347, is just a missing update to
sc_hole_ty in simplCast.  I'd missed a code path when I
made the recentchanges in

    commit 6d49d5be904c0c01788fa7aae1b112d5b4dfaf1c
    Author: Simon Peyton Jones <simonpj at microsoft.com>
    Date:   Thu May 21 12:53:35 2020 +0100

    Implement cast worker/wrapper properly

The fix is very easy.

Two other minor changes

* Tidy up in SimpleOpt.simple_opt_expr. In fact I think this is an
  outright bug, introduced in the fix to #18112: we were simplifying
  the same coercion twice *with the same substitution*, which is just
  wrong.  It'd be a hard bug to trigger, so I just fixed it; less code
  too.

* Better debug printing of ApplyToVal

- - - - -
625a7f54 by Simon Peyton Jones at 2020-06-23T22:50:11-04:00
Two small tweaks to Coercion.simplifyArgsWorker

These tweaks affect the inner loop of simplifyArgsWorker, which
in turn is called from the flattener in Flatten.hs.  This is
a key perf bottleneck to T9872{a,b,c,d}.

These two small changes have a modest but useful benefit.
No change in functionality whatsoever.

Relates to #18354

- - - - -
b5768cce by Sylvain Henry at 2020-06-23T22:50:49-04:00
Don't use timesInt2# with GHC < 8.11 (fix #18358)

- - - - -
7ad4085c by Sylvain Henry at 2020-06-23T22:51:27-04:00
Fix invalid printf format

- - - - -
a1f34d37 by Krzysztof Gogolewski at 2020-06-23T22:52:09-04:00
Add missing entry to freeNamesItem (#18369)

- - - - -
03a708ba by Andreas Klebinger at 2020-06-25T03:54:37-04:00
Enable large address space optimization on windows.

Starting with Win 8.1/Server 2012 windows no longer preallocates
page tables for reserverd memory eagerly, which prevented us from
using this approach in the past.

We also try to allocate the heap high in the memory space.
Hopefully this makes it easier to allocate things in the low
4GB of memory that need to be there. Like jump islands for the
linker.

- - - - -
7e6d3d09 by Roland Senn at 2020-06-25T03:54:38-04:00
In `:break ident` allow out of scope and nested identifiers (Fix #3000)

This patch fixes the bug and implements the feature request of #3000.

1. If `Module` is a real module name and `identifier` a name of a
top-level function in `Module` then `:break Module.identifer` works
also for an `identifier` that is out of scope.

2. Extend the syntax for `:break identifier` to:

    :break [ModQual.]topLevelIdent[.nestedIdent]...[.nestedIdent]

`ModQual` is optional and is either the effective name of a module or
the local alias of a qualified import statement.

`topLevelIdent` is the name of a top level function in the module
referenced by `ModQual`.

`nestedIdent` is optional and the name of a function nested in a let or
where clause inside the previously mentioned function `nestedIdent` or
`topLevelIdent`.

If `ModQual` is a module name, then `topLevelIdent` can be any top level
identifier in this module. If `ModQual` is missing or a local alias of a
qualified import, then `topLevelIdent` must be in scope.

Breakpoints can be set on arbitrarily deeply nested functions, but the
whole chain of nested function names must be specified.

3. To support the new functionality rewrite the code to tab complete `:break`.

- - - - -
30e42652 by Ben Gamari at 2020-06-25T03:54:39-04:00
make: Respect XELATEX variable

Previously we simply ignored the XELATEX variable when building
PDF documentation.

- - - - -
4acc2934 by Ben Gamari at 2020-06-25T03:54:39-04:00
hadrian/make: Detect makeindex

Previously we would simply assume that makeindex was available.
Now we correctly detect it in `configure` and respect this conclusion in
hadrian and make.

- - - - -
0d61f866 by Simon Peyton Jones at 2020-06-25T03:54:40-04:00
Expunge GhcTcId

GHC.Hs.Extension had

  type GhcPs   = GhcPass 'Parsed
  type GhcRn   = GhcPass 'Renamed
  type GhcTc   = GhcPass 'Typechecked
  type GhcTcId = GhcTc

The last of these, GhcTcId, is a vestige of the past.

This patch expunges it from GHC.

- - - - -
8ddbed4a by Adam Wespiser at 2020-06-25T03:54:40-04:00
add examples to Data.Traversable

- - - - -
284001d0 by Oleg Grenrus at 2020-06-25T03:54:42-04:00
Export readBinIface_

- - - - -
90f43872 by Zubin Duggal at 2020-06-25T03:54:43-04:00
Export everything from HsToCore.

This lets us reuse these functions in haddock, avoiding synchronization bugs.

Also fixed some divergences with haddock in that file

Updates haddock submodule

- - - - -
c7dd6da7 by Takenobu Tani at 2020-06-25T03:54:44-04:00
Clean up haddock hyperlinks of GHC.* (part1)

This updates haddock comments only.

This patch focuses to update for hyperlinks in GHC API's haddock comments,
because broken links especially discourage newcomers.

This includes the following hierarchies:
  - GHC.Hs.*
  - GHC.Core.*
  - GHC.Stg.*
  - GHC.Cmm.*
  - GHC.Types.*
  - GHC.Data.*
  - GHC.Builtin.*
  - GHC.Parser.*
  - GHC.Driver.*
  - GHC top

- - - - -
1eb997a8 by Takenobu Tani at 2020-06-25T03:54:44-04:00
Clean up haddock hyperlinks of GHC.* (part2)

This updates haddock comments only.

This patch focuses to update for hyperlinks in GHC API's haddock comments,
because broken links especially discourage newcomers.

This includes the following hierarchies:

  - GHC.Iface.*
  - GHC.Llvm.*

  - GHC.Rename.*
  - GHC.Tc.*

  - GHC.HsToCore.*
  - GHC.StgToCmm.*
  - GHC.CmmToAsm.*

  - GHC.Runtime.*

  - GHC.Unit.*
  - GHC.Utils.*
  - GHC.SysTools.*

- - - - -
67a86b4d by Oleg Grenrus at 2020-06-25T03:54:46-04:00
Add MonadZip and MonadFix instances for Complex

These instances are taken from
https://hackage.haskell.org/package/linear-1.21/docs/Linear-Instances.html

They are the unique possible, so let they be in `base`.

- - - - -
c50ef26e by Artem Pelenitsyn at 2020-06-25T03:54:47-04:00
test suite: add reproducer for #17516

- - - - -
fe281b27 by Roland Senn at 2020-06-25T03:54:48-04:00
Enable maxBound checks for OverloadedLists (Fixes #18172)

Consider the Literal `[256] :: [Data.Word.Word8]`

When the `OverloadedLists` extension is not active, then the `ol_ext` field
in the `OverLitTc` record that is passed to the function `getIntegralLit`
contains the type `Word8`. This is a simple type, and we can use its
type constructor immediately for the `warnAboutOverflowedLiterals` function.

When the `OverloadedLists` extension is active, then the `ol_ext` field
contains the type family `Item [Word8]`. The function `nomaliseType` is used
to convert it to the needed type `Word8`.

- - - - -
a788d4d1 by Ben Gamari at 2020-06-25T03:54:52-04:00
rts/Hash: Simplify freeing of HashListChunks

While looking at #18348 I noticed that the treatment of HashLists are a
bit more complex than necessary (which lead to some initial confusion on
my part). Specifically, we allocate HashLists in chunks. Each chunk
allocation makes two allocations: one for the chunk itself and one for a
HashListChunk to link together the chunks for the purposes of freeing.

Simplify this (and hopefully make the relationship between these
clearer) but allocating the HashLists and HashListChunk in a single
malloc. This will both make the implementation easier to follow and
reduce C heap fragmentation.

Note that even after this patch we fail to bound the size of the free
HashList pool. However, this is a separate bug.

- - - - -
d3c2d59b by Sylvain Henry at 2020-06-25T03:54:55-04:00
RTS: avoid overflow on 32-bit arch (#18375)

We're now correctly computing allocated bytes on 32-bit arch, so we get
huge increases.

Metric Increase:
    haddock.Cabal
    haddock.base
    haddock.compiler
    space_leak_001

- - - - -
a3d69dc6 by Sebastian Graf at 2020-06-25T23:06:18-04:00
GHC.Core.Unify: Make UM actions one-shot by default

This MR makes the UM monad in GHC.Core.Unify into a one-shot
monad.  See the long Note [The one-shot state monad trick].

See also #18202 and !3309, which applies this to all Reader/State-like
monads in GHC for compile-time perf improvements. The pattern used
here enables something similar to the state-hack, but is applicable to
user-defined monads, not just `IO`.

Metric Decrease 'runtime/bytes allocated' (test_env='i386-linux-deb9'):
    haddock.Cabal

- - - - -


30 changed files:

- compiler/GHC.hs
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/Builtin/Types/Prim.hs
- compiler/GHC/Builtin/Utils.hs
- compiler/GHC/ByteCode/Types.hs
- compiler/GHC/Cmm/CLabel.hs
- compiler/GHC/Cmm/CallConv.hs
- compiler/GHC/Cmm/Dataflow/Block.hs
- compiler/GHC/Cmm/Info.hs
- compiler/GHC/Cmm/Parser.y
- compiler/GHC/CmmToAsm/CFG.hs
- compiler/GHC/CmmToAsm/Dwarf/Constants.hs
- compiler/GHC/CmmToAsm/Monad.hs
- compiler/GHC/CmmToAsm/Reg/Graph/SpillClean.hs
- compiler/GHC/CmmToAsm/SPARC/CodeGen/Base.hs
- compiler/GHC/CmmToLlvm/Base.hs
- compiler/GHC/CmmToLlvm/CodeGen.hs
- compiler/GHC/Core.hs
- compiler/GHC/Core/Class.hs
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/DataCon.hs
- compiler/GHC/Core/FVs.hs
- compiler/GHC/Core/InstEnv.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Make.hs
- compiler/GHC/Core/Map.hs
- compiler/GHC/Core/Opt/OccurAnal.hs
- compiler/GHC/Core/Opt/Simplify.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
- compiler/GHC/Core/Rules.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/62be92e5be07b34fc25c77e36223268c4a6eadec...a3d69dc6c2134afe239caf4f881ba5542d2c2be0

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/62be92e5be07b34fc25c77e36223268c4a6eadec...a3d69dc6c2134afe239caf4f881ba5542d2c2be0
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/20200625/cfd4e3b6/attachment-0001.html>


More information about the ghc-commits mailing list