[Git][ghc/ghc][wip/fix-windows] 48 commits: Maintain separate flags for C++ compiler invocations

Ben Gamari gitlab at gitlab.haskell.org
Wed Jun 19 18:35:51 UTC 2019



Ben Gamari pushed to branch wip/fix-windows at Glasgow Haskell Compiler / GHC


Commits:
7bc5d6c6 by Ben Gamari at 2019-06-14T03:34:41Z
Maintain separate flags for C++ compiler invocations

Previously we would pass flags intended for the C compiler to the C++
compiler (see #16738). This would cause, for instance, `-std=gnu99` to
be passed to the C++ compiler, causing spurious test failures. Fix this
by maintaining a separate set of flags for C++ compilation invocations.

- - - - -
71e75ba6 by Ömer Sinan Ağacan at 2019-06-14T03:35:19Z
Remove unused Unique field from StgFCallOp

Fixes #16696

- - - - -
ec25fe59 by Alp Mestanogullari at 2019-06-14T03:35:56Z
Hadrian: remove superfluous dependencies in Rules.Compile

Each package's object files were 'need'ing the library files of all transitive
dependencies of the current package, whichi is pointless since the said
libraries are not needed until we link those object files together.

This fixes #16759.

- - - - -
3bc6df32 by Andreas Klebinger at 2019-06-14T03:36:34Z
Add Outputable instances for Float, Double.

- - - - -
effdd948 by Andrew Martin at 2019-06-14T14:48:13Z
Implement the -XUnliftedNewtypes extension.

GHC Proposal: 0013-unlifted-newtypes.rst
Discussion: https://github.com/ghc-proposals/ghc-proposals/pull/98
Issues: #15219, #1311, #13595, #15883
Implementation Details:
  Note [Implementation of UnliftedNewtypes]
  Note [Unifying data family kinds]
  Note [Compulsory newtype unfolding]

This patch introduces the -XUnliftedNewtypes extension. When this
extension is enabled, GHC drops the restriction that the field in
a newtype must be of kind (TYPE 'LiftedRep). This allows types
like Int# and ByteArray# to be used in a newtype. Additionally,
coerce is made levity-polymorphic so that it can be used with
newtypes over unlifted types.

The bulk of the changes are in TcTyClsDecls.hs. With -XUnliftedNewtypes,
getInitialKind is more liberal, introducing a unification variable to
return the kind (TYPE r0) rather than just returning (TYPE 'LiftedRep).
When kind-checking a data constructor with kcConDecl, we attempt to
unify the kind of a newtype with the kind of its field's type. When
typechecking a data declaration with tcTyClDecl, we again perform a
unification. See the implementation note for more on this.

Co-authored-by: Richard Eisenberg <rae at richarde.dev>

- - - - -
5279dda8 by Ben Gamari at 2019-06-14T14:48:51Z
PrelRules: Don't break let/app invariant in shiftRule

Previously shiftRule would rewrite as invalid shift like
```
let x = I# (uncheckedIShiftL# n 80)
in ...
```
to
```
let x = I# (error "invalid shift")
in ...
```
However, this breaks the let/app invariant as `error` is not
okay-for-speculation. There isn't an easy way to avoid this so let's not
try. Instead we just take advantage of the undefined nature of invalid
shifts and return zero.

Fixes #16742.

- - - - -
503e830c by Ben Gamari at 2019-06-15T03:10:08Z
gitlab-ci: Lint testsuite for framework failures

This introduces a new lint job checking for framework failures and
listing broken tests.

- - - - -
b5ea9323 by Ben Gamari at 2019-06-15T03:10:08Z
lint: Only apply --interactive lint to testsuite .T files

- - - - -
5c97211c by Ben Gamari at 2019-06-15T03:10:08Z
gitlab-ci: Lint the linters

- - - - -
257165b4 by Alp Mestanogullari at 2019-06-15T03:10:46Z
Remove duplicates from 'ghc --info' output

- - - - -
5da6c86f by Ben Gamari at 2019-06-15T19:14:01Z
Bump unix submodule

Skips `executeFile001` test in `threaded2` way. Fixes #16814.

- - - - -
20b4d5ec by Ben Gamari at 2019-06-16T03:32:38Z
Disable optimisation when building Cabal lib for stage0

This disables optimisation when building Cabal for Hadrian and
stage0 `ghc-cabal`. Cabal is performance critical in neither case nor
will any performance difference here be visible to the end-user.

See #16817.

- - - - -
76b7f619 by Ben Gamari at 2019-06-16T03:32:38Z
Disable optimisation when building Cabal in development flavours

This updates the make and Hadrian build flavours targetting developers
to disable optimisation when building the Cabal library. Cabal tends to
tickle some very bad compiler performance cases (e.g. #16577) so
disabling optimisation here makes a sizeable impact on overall build
time.

See #16817.

- - - - -
0d2a4258 by Ben Gamari at 2019-06-16T03:33:13Z
testsuite: Introduce concurrent_ways set

Previously we just tested for the threaded2 when determining whether to
skip tests which are fragile under concurrent execution. However, this
isn't the only way which is concurrent.

- - - - -
beacb6fd by Ben Gamari at 2019-06-16T03:33:13Z
testsuite: Skip hDuplicateTo001 in concurrent ways

As noted in #16819, this operation is racy under concurrent execution.

- - - - -
ca721193 by Aiken Cairncross at 2019-06-16T03:33:50Z
Fix typo in error message

- - - - -
57b71848 by Ben Gamari at 2019-06-16T03:34:25Z
testsuite: Add assertions that way lists are in fact lists

Previously there were a few cases where operations like `omit_ways`
were incorrectly passed a single way (e.g. `omit_ways('threaded2')`).
This won't work as the author expected.

- - - - -
25ee60cd by Ryan Scott at 2019-06-16T03:35:03Z
Synchronize ClsInst.doTyConApp with TcTypeable validity checks (#15862)

Issue #15862 demonstrated examples of type constructors on which
`TcTypeable.tyConIsTypeable` would return `False`, but the `Typeable`
constraint solver in `ClsInst` (in particular, `doTyConApp`) would
try to generate `Typeable` evidence for anyway, resulting in
disaster. This incongruity was caused by the fact that `doTyConApp`
was using a weaker validity check than `tyConIsTypeable` to determine
if a type constructor warrants `Typeable` evidence or not. The
solution, perhaps unsurprisingly, is to use `tyConIsTypeable` in
`doTyConApp` instead.

To avoid import cycles between `ClsInst` and `TcTypeable`, I factored
out `tyConIsTypeable` into its own module, `TcTypeableValidity`.

Fixes #15862.

- - - - -
4138bf86 by Krzysztof Gogolewski at 2019-06-16T03:35:38Z
Remove dead code

- - - - -
db313f98 by Ben Gamari at 2019-06-16T10:26:38Z
base/Event/Poll: Drop POLLRDHUP enum item

Previously the Event enumeration produced by hsc2hs would sometimes
include a currently-unused POLLRDHUP item. This unused binding would
result in a build failure. Drop it.

- - - - -
81608e82 by Ben Gamari at 2019-06-16T10:26:38Z
testsuite: Fix T8602 on musl

Musl wants hash-bangs on all executables.

- - - - -
a0f68379 by Ben Gamari at 2019-06-16T10:26:38Z
testsuite: Ensure T5423 flushes C output buffer

Previously T5423 would fail to flush the printf output buffer.
Consequently it was platform-dependent whether the C or Haskell print
output would be emitted first.

- - - - -
543dfaab by Ben Gamari at 2019-06-16T10:26:38Z
testsuite: Flush conc059's printf buffer

Otherwise it the order out the Haskell and C output will be
system-dependent.

- - - - -
e647752e by Ben Gamari at 2019-06-16T10:26:38Z
testsuite: Ensure that ffi005 output order is predictable

The libc output buffer wasn't being flushed, making the order
system-depedent.

- - - - -
338336d3 by Ben Gamari at 2019-06-16T10:26:38Z
gitlab-ci: Build alpine release bindists

- - - - -
75c6ccf7 by Alp Mestanogullari at 2019-06-16T10:27:17Z
fix runghc's GHC detection logic to cover the "in-tree Hadrian build" scenario

Before this patch, runghc would only run the GHC detection logic on Windows and
assume that it was invoked through a wrapper script on all other platforms.
This patch lifts this limitation and makes that logic work for the scenario
where someone is calling the runghc executable directly, without passing an
explicit path to GHC.

- - - - -
3c35e140 by Ben Gamari at 2019-06-16T23:38:51Z
testsuite: Really fix #16741

The previous fix, !1095, didn't work as `--show-iface` ignores
`-dsuppress-ticks`. Rework the test instead.

- - - - -
b3bb1b06 by Ben Gamari at 2019-06-16T23:38:51Z
gitlab-ci: Don't allow failure of deb9-dwarf job

This #16741 out of the way this should now pass.

- - - - -
b965de1e by Ömer Sinan Ağacan at 2019-06-16T23:39:29Z
Use TupleSections in CmmParse.y, simplify a few exprs

- - - - -
63965ae3 by Ben Gamari at 2019-06-17T05:20:21Z
make: Clean includes/settings file

Now since this is generated by the build system we should ensure that it
is properly cleaned.

[skip ci]

- - - - -
bb141114 by Siddharth Bhat at 2019-06-17T05:20:57Z
Add link to mfix.github.io/ghc in HACKING.md

- - - - -
24afbfe9 by Ben Gamari at 2019-06-17T14:20:32Z
gitlab-ci: Run nofib on binary distributions

Updates docker images to ensure that the `time` utility is available.

- - - - -
62f0213d by Fumiaki Kinoshita at 2019-06-18T20:00:20Z
Data.Ord: give a field name getDown to Down

- - - - -
da33f2bb by Fumiaki Kinoshita at 2019-06-18T20:00:20Z
Add more newtype-derived instances to Data.Ord.Down

Metric Increase:
    haddock.base

- - - - -
dbf9ca20 by Ben Gamari at 2019-06-18T20:00:56Z
testsuite: Add testcase for #16689

- - - - -
29ec33cd by Ben Gamari at 2019-06-18T20:00:56Z
SafeHaskell: Don't throw -Wsafe warning if module is declared Safe

Fixes #16689.

- - - - -
a491e40c by Ben Gamari at 2019-06-18T20:01:31Z
hadrian: Compile UserSettings with -O0

This guarantees that the interface file for `UserSettings` doesn't 
contain any unfoldings, ensuring that a change in it requires minimal 
rebuilds.
- - - - -
74bd6b22 by Ben Gamari at 2019-06-18T20:02:07Z
testsuite: Add test for #16832

- - - - -
6a92f59d by Ben Gamari at 2019-06-18T20:02:42Z
gitlab-ci: Run alpine builds during nightly job

- - - - -
4549cadf by Andreas Klebinger at 2019-06-18T20:03:19Z
Make sure mkSplitUniqSupply stores the precomputed mask only.

mkSplitUniqSupply was lazy on the boxed char.

This caused a bunch of issues:
* The closure captured the boxed Char
* The mask was recomputed on every split of the supply.
* It also caused the allocation of MkSplitSupply to happen in it's own
(allocated) closure. The reason of which I did not further investigate.

We know force the computation of the mask inside mkSplitUniqSupply.
* This way the mask is computed at most once per UniqSupply creation.
* It allows ww to kick in, causing the closure to retain the unboxed
value.

Requesting Uniques in a loop is now faster by about 20%.

I did not check the impact on the overall compiler, but I added a test
to avoid regressions.

- - - - -
550f077b by Ben Gamari at 2019-06-19T18:35:40Z
testsuite: Skip dynamicToo006 when dynamic linking is not available

This was previously failling on Windows.

- - - - -
31bccb49 by Ben Gamari at 2019-06-19T18:35:40Z
testsuite: Mark T3372 as fragile on Windows

On Windows we must lock package databases even when opening for
read-only access. This means that concurrent GHC sessions are very
likely to fail with file lock contention.

See #16773.

- - - - -
2514569e by Ben Gamari at 2019-06-19T18:35:40Z
testsuite: Add stderr output for UnsafeInfered02 on Windows

This test uses TemplateHaskell causing GHC to build dynamic objects on
platforms where dynamic linking is available. However, Windows doesn't support
dynamic linking. Consequently the test would fail on Windows with:

```patch
--- safeHaskell/safeInfered/UnsafeInfered02.run/UnsafeInfered02.stderr.normalised	2019-06-04 15:10:10.521594200 +0000
+++ safeHaskell/safeInfered/UnsafeInfered02.run/UnsafeInfered02.comp.stderr.normalised	2019-06-04 15:10:10.523546200 +0000
@@ -1,5 +1,5 @@
-[1 of 2] Compiling UnsafeInfered02_A ( UnsafeInfered02_A.hs, UnsafeInfered02_A.o, UnsafeInfered02_A.dyn_o )
-[2 of 2] Compiling UnsafeInfered02  ( UnsafeInfered02.hs, UnsafeInfered02.o, UnsafeInfered02.dyn_o )
+[1 of 2] Compiling UnsafeInfered02_A ( UnsafeInfered02_A.hs, UnsafeInfered02_A.o )
+[2 of 2] Compiling UnsafeInfered02  ( UnsafeInfered02.hs, UnsafeInfered02.o )

 UnsafeInfered02.hs:4:1:
     UnsafeInfered02_A: Can't be safely imported!
```

The other approach I considered for this issue is to pass `-v0` to GHC.
However, I felt we should probably do this consistently for all of the tests in
this directory and this would take more time than I currently have.

- - - - -
dc47845c by Ben Gamari at 2019-06-19T18:35:40Z
testsuite: Mark OldModLocation as broken on Windows

Strangely the path it emits contains duplicate path delimiters (#16772),
```patch
--- ghc-api/downsweep/OldModLocation.run/OldModLocation.stderr.normalised	2019-06-04 14:40:26.326075000 +0000
+++ ghc-api/downsweep/OldModLocation.run/OldModLocation.run.stderr.normalised	2019-06-04 14:40:26.328029200 +0000
@@ -1 +1 @@
-[Just "A.hs",Just "mydir/B.hs"]
+[Just "A.hs",Just "mydir//B.hs"]
```

- - - - -
eff11fd2 by Ben Gamari at 2019-06-19T18:35:41Z
testsuite: Mark T7170 as broken on Windows

Due to #16801.

- - - - -
509ae3f7 by Ben Gamari at 2019-06-19T18:35:41Z
testsuite: Mark T7702 as broken on Windows

Due to #16799.

- - - - -
153a1ade by Ben Gamari at 2019-06-19T18:35:41Z
testsuite: Mark T15633a and T15633b as fragile on Windows

As noted in #16813, these tests seem to be fragile on Windows.

- - - - -
4b9f06cd by Ben Gamari at 2019-06-19T18:35:41Z
linker: Disable code unloading

As noted in #16841, there are currently a variety of bugs in the
unloading logic. These only affect Windows since code unloading is
disabled on Linux, where we build with `GhcDynamic=YES` by default.

In the interest of getting the tree green on Windows disable code
unloading until the issues are resolved.

- - - - -


30 changed files:

- .gitlab-ci.yml
- .gitlab/linters/check-makefiles.py
- .gitlab/linters/linter.py
- HACKING.md
- aclocal.m4
- compiler/basicTypes/Id.hs
- compiler/basicTypes/MkId.hs
- compiler/basicTypes/UniqSupply.hs
- compiler/cmm/CmmParse.y
- compiler/codeGen/StgCmmExpr.hs
- compiler/codeGen/StgCmmForeign.hs
- compiler/codeGen/StgCmmPrim.hs
- compiler/coreSyn/CoreSyn.hs
- compiler/deSugar/Check.hs
- compiler/deSugar/DsExpr.hs
- compiler/ghc.cabal.in
- compiler/ghci/Linker.hs
- compiler/hsSyn/HsTypes.hs
- compiler/main/DynFlags.hs
- compiler/main/HscMain.hs
- compiler/main/Settings.hs
- compiler/main/SysTools.hs
- compiler/main/SysTools/Info.hs
- compiler/main/SysTools/Tasks.hs
- compiler/main/TidyPgm.hs
- compiler/main/ToolSettings.hs
- compiler/prelude/PrelRules.hs
- compiler/prelude/PrimOp.hs
- compiler/prelude/TysPrim.hs
- compiler/prelude/primops.txt.pp


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/compare/0c544faecaf8dddc8a3df24bbe83e559158fdd93...4b9f06cd4dc96f1bbaa5b38961845fbed37d1b11

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/compare/0c544faecaf8dddc8a3df24bbe83e559158fdd93...4b9f06cd4dc96f1bbaa5b38961845fbed37d1b11
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/20190619/b8066347/attachment-0001.html>


More information about the ghc-commits mailing list