ghc.git
4 weeks agoAdd link to mfix.github.io/ghc in HACKING.md wip/gc/base wip/gc/factor-out-bitmap-walking wip/gc/printer-improvements wip/gc/unglobalize-gc-state
Siddharth Bhat [Sun, 16 Jun 2019 12:36:24 +0000 (14:36 +0200)] 
Add link to mfix.github.io/ghc in HACKING.md

4 weeks agomake: Clean includes/settings file
Ben Gamari [Fri, 14 Jun 2019 21:23:20 +0000 (17:23 -0400)] 
make: Clean includes/settings file

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

[skip ci]

4 weeks agoUse TupleSections in CmmParse.y, simplify a few exprs
Ömer Sinan Ağacan [Sun, 16 Jun 2019 07:09:49 +0000 (10:09 +0300)] 
Use TupleSections in CmmParse.y, simplify a few exprs

4 weeks agogitlab-ci: Don't allow failure of deb9-dwarf job
Ben Gamari [Fri, 14 Jun 2019 02:53:37 +0000 (22:53 -0400)] 
gitlab-ci: Don't allow failure of deb9-dwarf job

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

4 weeks agotestsuite: Really fix #16741
Ben Gamari [Fri, 14 Jun 2019 02:51:53 +0000 (22:51 -0400)] 
testsuite: Really fix #16741

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

4 weeks agofix runghc's GHC detection logic to cover the "in-tree Hadrian build" scenario
Alp Mestanogullari [Fri, 14 Jun 2019 19:28:31 +0000 (21:28 +0200)] 
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.

4 weeks agogitlab-ci: Build alpine release bindists
Ben Gamari [Tue, 11 Jun 2019 01:00:57 +0000 (21:00 -0400)] 
gitlab-ci: Build alpine release bindists

4 weeks agotestsuite: Ensure that ffi005 output order is predictable
Ben Gamari [Tue, 11 Jun 2019 17:09:55 +0000 (13:09 -0400)] 
testsuite: Ensure that ffi005 output order is predictable

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

4 weeks agotestsuite: Flush conc059's printf buffer
Ben Gamari [Tue, 11 Jun 2019 17:04:05 +0000 (13:04 -0400)] 
testsuite: Flush conc059's printf buffer

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

4 weeks agotestsuite: Ensure T5423 flushes C output buffer
Ben Gamari [Tue, 11 Jun 2019 16:48:32 +0000 (12:48 -0400)] 
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.

4 weeks agotestsuite: Fix T8602 on musl
Ben Gamari [Tue, 11 Jun 2019 16:45:24 +0000 (12:45 -0400)] 
testsuite: Fix T8602 on musl

Musl wants hash-bangs on all executables.

4 weeks agobase/Event/Poll: Drop POLLRDHUP enum item
Ben Gamari [Tue, 11 Jun 2019 04:51:53 +0000 (00:51 -0400)] 
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.

4 weeks agoRemove dead code
Krzysztof Gogolewski [Wed, 26 Dec 2018 11:28:43 +0000 (12:28 +0100)] 
Remove dead code

4 weeks agoSynchronize ClsInst.doTyConApp with TcTypeable validity checks (#15862)
Ryan Scott [Fri, 14 Jun 2019 15:07:46 +0000 (11:07 -0400)] 
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.

4 weeks agotestsuite: Add assertions that way lists are in fact lists
Ben Gamari [Fri, 14 Jun 2019 00:21:03 +0000 (20:21 -0400)] 
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.

4 weeks agoFix typo in error message
Aiken Cairncross [Fri, 14 Jun 2019 13:21:37 +0000 (14:21 +0100)] 
Fix typo in error message

4 weeks agotestsuite: Skip hDuplicateTo001 in concurrent ways
Ben Gamari [Fri, 14 Jun 2019 00:20:09 +0000 (20:20 -0400)] 
testsuite: Skip hDuplicateTo001 in concurrent ways

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

4 weeks agotestsuite: Introduce concurrent_ways set
Ben Gamari [Fri, 14 Jun 2019 00:17:20 +0000 (20:17 -0400)] 
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.

4 weeks agoDisable optimisation when building Cabal in development flavours
Ben Gamari [Thu, 13 Jun 2019 20:24:10 +0000 (16:24 -0400)] 
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.

4 weeks agoDisable optimisation when building Cabal lib for stage0
Ben Gamari [Thu, 13 Jun 2019 20:22:31 +0000 (16:22 -0400)] 
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.

4 weeks agoBump unix submodule
Ben Gamari [Fri, 14 Jun 2019 20:04:13 +0000 (16:04 -0400)] 
Bump unix submodule

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

4 weeks agoRemove duplicates from 'ghc --info' output
Alp Mestanogullari [Fri, 14 Jun 2019 09:57:38 +0000 (11:57 +0200)] 
Remove duplicates from 'ghc --info' output

4 weeks agogitlab-ci: Lint the linters
Ben Gamari [Wed, 12 Jun 2019 15:11:31 +0000 (11:11 -0400)] 
gitlab-ci: Lint the linters

4 weeks agolint: Only apply --interactive lint to testsuite .T files
Ben Gamari [Wed, 12 Jun 2019 14:54:48 +0000 (10:54 -0400)] 
lint: Only apply --interactive lint to testsuite .T files

4 weeks agogitlab-ci: Lint testsuite for framework failures
Ben Gamari [Wed, 12 Jun 2019 13:37:13 +0000 (09:37 -0400)] 
gitlab-ci: Lint testsuite for framework failures

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

4 weeks agoPrelRules: Don't break let/app invariant in shiftRule
Ben Gamari [Mon, 10 Jun 2019 13:25:57 +0000 (09:25 -0400)] 
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.

4 weeks agoImplement the -XUnliftedNewtypes extension.
Andrew Martin [Sun, 12 May 2019 13:23:25 +0000 (09:23 -0400)] 
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@richarde.dev>
4 weeks agoAdd Outputable instances for Float, Double.
Andreas Klebinger [Thu, 13 Jun 2019 15:07:45 +0000 (17:07 +0200)] 
Add Outputable instances for Float, Double.

4 weeks agoHadrian: remove superfluous dependencies in Rules.Compile
Alp Mestanogullari [Tue, 11 Jun 2019 12:27:17 +0000 (14:27 +0200)] 
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.

4 weeks agoRemove unused Unique field from StgFCallOp
Ömer Sinan Ağacan [Mon, 10 Jun 2019 09:40:37 +0000 (12:40 +0300)] 
Remove unused Unique field from StgFCallOp

Fixes #16696

4 weeks agoMaintain separate flags for C++ compiler invocations
Ben Gamari [Mon, 3 Jun 2019 22:51:17 +0000 (18:51 -0400)] 
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.

5 weeks agogitlab-ci: Disable validate-x86_64-linux-deb9 job to reduce load
Ben Gamari [Wed, 12 Jun 2019 05:36:33 +0000 (01:36 -0400)] 
gitlab-ci: Disable validate-x86_64-linux-deb9 job to reduce load

Enable artifacts on to ensure we have bindist coverage.

5 weeks agogitlab-ci: Disable deb9-llvm job, introduce nightly LLVM job
Ben Gamari [Wed, 12 Jun 2019 05:14:32 +0000 (01:14 -0400)] 
gitlab-ci: Disable deb9-llvm job, introduce nightly LLVM job

This should help alleviate queue times as the LLVM job is one of the
longest that we have.

5 weeks agotestsuite: A more portable solution to #9399
Ben Gamari [Tue, 11 Jun 2019 13:54:55 +0000 (09:54 -0400)] 
testsuite: A more portable solution to #9399

Previously we used an awful hybrid batch script/Bourne shell script to
allow this test to run both on Windows and Linux (fixing #9399).
However, this breaks on some libc implementations (e.g. musl). Fix this.

Fixes #16798.

5 weeks agoClean up .circleci
Ben Gamari [Tue, 11 Jun 2019 03:47:47 +0000 (23:47 -0400)] 
Clean up .circleci

Move prepare-system.sh to .gitlab and remove everything else.

5 weeks agogitlab-ci: Don't build PDF user's guide on AArch64
Ben Gamari [Tue, 11 Jun 2019 23:48:56 +0000 (19:48 -0400)] 
gitlab-ci: Don't build PDF user's guide on AArch64

For reasons I don't understand sphinx seems to fail to produce a .idx
file for makeindex.

5 weeks agousers-guide: Fix a few markup issues
Ben Gamari [Tue, 11 Jun 2019 02:51:58 +0000 (22:51 -0400)] 
users-guide: Fix a few markup issues

Strangely these were only causing the build to fail in the aarch64-linux
job, despite Sphinx throwing errors in all jobs I checked.

Also changes some `#ifdef`s to `#if defined` to satisfy the linter.

5 weeks agoHadrian: Do not allow the Linux jobs to fail anymore
Alp Mestanogullari [Mon, 10 Jun 2019 18:55:12 +0000 (20:55 +0200)] 
Hadrian: Do not allow the Linux jobs to fail anymore

MR !1151 makes the Hadrian/Linux job pass by fixing the last two test failures,
so we can now be stricter and not allow those jobs to fail anymore, easily
letting us see when patches introduce test failures.

5 weeks agoHadrian: Track RTS library symlink targets
David Eichmann [Tue, 4 Jun 2019 18:01:19 +0000 (19:01 +0100)] 
Hadrian: Track RTS library symlink targets

This requires creating RTS library symlinks when registering, outside
of the rule for the registered library file.

5 weeks agoPrelRules: Ensure that string unpack/append rule fires with source notes
Ben Gamari [Tue, 4 Jun 2019 04:42:10 +0000 (00:42 -0400)] 
PrelRules: Ensure that string unpack/append rule fires with source notes

Previously the presence of source notes could hide nested applications
of `unpackFoldrCString#` from our constant folding logic. For instance,
consider the expression:

```haskell
unpackFoldrCString# "foo" c (unpackFoldrCString# "baz" c n)
```

Specifically, ticks appearing in two places can defeat the rule:

  a. Surrounding the inner application of `unpackFoldrCString#`
  b. Surrounding the fold function, `c`

The latter caused the `str_rules` testcase to fail when `base` was built
with `-g3`.

Fixes #16740.

5 weeks agoFix #16525: ObjectCode freed wrongly because of lack of info header check
Phuong Trinh [Thu, 25 Apr 2019 17:44:02 +0000 (18:44 +0100)] 
Fix #16525: ObjectCode freed wrongly because of lack of info header check

`checkUnload` currently doesn't check the info header of static objects.
Thus, it may free an `ObjectCode` struct wrongly even if there's still a
live static object whose info header lies in a mapped section of that
`ObjectCode`. This fixes the issue by adding an appropriate check.

5 weeks agoAdd a few missing llvm-targets
Ben Gamari [Wed, 12 Jun 2019 18:24:23 +0000 (14:24 -0400)] 
Add a few missing llvm-targets

This should finally fix #14261.

[skip ci]

5 weeks agogitlab-ci: Bump Docker image
Ben Gamari [Wed, 12 Jun 2019 21:52:35 +0000 (17:52 -0400)] 
gitlab-ci: Bump Docker image

Fixes linters.

5 weeks agotestsuite: Don't run tests requiring TH in profasm way when GhcDynamic
Ben Gamari [Tue, 11 Jun 2019 19:56:07 +0000 (15:56 -0400)] 
testsuite: Don't run tests requiring TH in profasm way when GhcDynamic

Since we can't load profiled objects when GhcDynamic==YES. Affects:

* T16737
* T16384
* T16718
* T16619
* T16190

5 weeks agotestsuite: Unbreak galois_raytrace on i386
Ben Gamari [Tue, 11 Jun 2019 17:24:35 +0000 (13:24 -0400)] 
testsuite: Unbreak galois_raytrace on i386

galois_raytrace was previously broken on i386 due to use of x87
arithmethic on that platform. However,
42504f4a575395a35eec5c3fd7c9ef6e2b54e68e removes x87 support; this
resulted in an unexpected pass. Unmark this test as broken.

5 weeks agotestsuite: Skip cgrun078 in ghci way
Ben Gamari [Tue, 11 Jun 2019 05:09:17 +0000 (01:09 -0400)] 
testsuite: Skip cgrun078 in ghci way

This test requires FFI usage.

5 weeks agoprocess: Bump submodule
Ben Gamari [Mon, 10 Jun 2019 13:52:08 +0000 (09:52 -0400)] 
process: Bump submodule

 * Skip process005 in ghci way
 * Mark process002 as fragile in threaded2

5 weeks agoBump unix submodule
Ben Gamari [Sat, 6 Apr 2019 18:45:52 +0000 (14:45 -0400)] 
Bump unix submodule

Marks posix002 as fragile in threaded2 way due to #16550.

5 weeks agoFix uses of #ifdef/#ifndef
Ben Gamari [Sun, 9 Jun 2019 13:50:41 +0000 (09:50 -0400)] 
Fix uses of #ifdef/#ifndef

The linter now enforces our preference for `#if defined()` and
`#if !defined()`.

5 weeks agogitlab-ci: Fetch submodules before running submodule linter
Ben Gamari [Sun, 9 Jun 2019 16:31:32 +0000 (12:31 -0400)] 
gitlab-ci: Fetch submodules before running submodule linter

5 weeks agolinters/check-makefiles: Limit lint to Makefiles
Ben Gamari [Sun, 9 Jun 2019 14:36:58 +0000 (10:36 -0400)] 
linters/check-makefiles: Limit lint to Makefiles

Previously we would apply this rule, which is only intended for
testsuite Makefiles, to all files. This lead to a number of
false-positives in all.T files.

5 weeks agotestsuite: Note intentional typo in T7130
Ben Gamari [Tue, 11 Jun 2019 05:11:58 +0000 (01:11 -0400)] 
testsuite: Note intentional typo in T7130

I earlier accidentally corrected it breaking the test.

5 weeks agotestsuite: Mark T16737 as broken in ghci way due to #16541
Ben Gamari [Sun, 9 Jun 2019 13:32:55 +0000 (09:32 -0400)] 
testsuite: Mark T16737 as broken in ghci way due to #16541

5 weeks agotestsuite: Mark T16449_2 as broken due to #16742
Ben Gamari [Tue, 4 Jun 2019 04:56:47 +0000 (00:56 -0400)] 
testsuite: Mark T16449_2 as broken due to #16742

5 weeks agotestsuite: Skip T493 in ghci way.
Ben Gamari [Tue, 4 Jun 2019 04:53:09 +0000 (00:53 -0400)] 
testsuite: Skip T493 in ghci way.

T493 tests #493, which is an FFI test. FFI tests should be skipped
in ghci way.

5 weeks agotestsuite: Omit profasm way for cc017
Ben Gamari [Tue, 4 Jun 2019 00:59:13 +0000 (20:59 -0400)] 
testsuite: Omit profasm way for cc017

cc017 requires TH but we can't load dynamic profiled objects.

5 weeks agotestsuite: Mark threadstatus-T9333 as fragile in ghci way
Ben Gamari [Mon, 8 Apr 2019 14:35:51 +0000 (10:35 -0400)] 
testsuite: Mark threadstatus-T9333 as fragile in ghci way

As noted in #16555.

5 weeks agotestsuite: Fix omit_ways usage
Ben Gamari [Sun, 7 Apr 2019 01:50:24 +0000 (21:50 -0400)] 
testsuite: Fix omit_ways usage

omit_ways expects a list but this was broken in several cases.

5 weeks agotestsuite: Fix fragile_for test modifier
Ben Gamari [Sat, 6 Apr 2019 13:37:52 +0000 (09:37 -0400)] 
testsuite: Fix fragile_for test modifier

5 weeks agotestsuite: Skip T7919 in ghci way
Ben Gamari [Sat, 6 Apr 2019 16:09:35 +0000 (12:09 -0400)] 
testsuite: Skip T7919 in ghci way

It times out pretty reliably. It's not clear that much is gained by
running this test in the ghci way anyways.

5 weeks agotestsuite: Mark T2783 as fragile in threaded1
Ben Gamari [Sat, 6 Apr 2019 02:22:43 +0000 (22:22 -0400)] 
testsuite: Mark T2783 as fragile in threaded1

It was previously marked as broken but it passes non-deterministically.
See #2783.

5 weeks agotestsuite: Mark Overflow as broken in hpc way
Ben Gamari [Fri, 5 Apr 2019 11:47:31 +0000 (07:47 -0400)] 
testsuite: Mark Overflow as broken in hpc way

As noted in #16543.

5 weeks agotestsuite: Omit tcrun022 in hpc way
Ben Gamari [Fri, 5 Apr 2019 03:01:46 +0000 (23:01 -0400)] 
testsuite: Omit tcrun022 in hpc way

As noted in #16542, the expected rule doesn't fire. However, this
doesn't seem terribly surpring given the circumstances.

5 weeks agotestsuite: Mark T16180 as broken in ghci and ext-interp ways
Ben Gamari [Fri, 5 Apr 2019 02:55:00 +0000 (22:55 -0400)] 
testsuite: Mark T16180 as broken in ghci and ext-interp ways

As noted in #16541.

5 weeks agotestsuite: Mark T14761c as broken in hpc, profasm, and optasm ways
Ben Gamari [Fri, 5 Apr 2019 02:50:00 +0000 (22:50 -0400)] 
testsuite: Mark T14761c as broken in hpc, profasm, and optasm ways

As noted in #16540.

5 weeks agotestsuite: Mark T13910 as broken in optasm
Ben Gamari [Fri, 5 Apr 2019 02:38:06 +0000 (22:38 -0400)] 
testsuite: Mark T13910 as broken in optasm

Due to #16537.

5 weeks agotestsuite: Mark T13167 as fragile in threaded2
Ben Gamari [Fri, 5 Apr 2019 02:25:23 +0000 (22:25 -0400)] 
testsuite: Mark T13167 as fragile in threaded2

As noted in #16536.

5 weeks agotestsuite: Mark hWaitForInput-accurate-stdin as broken in threaded ways
Ben Gamari [Fri, 5 Apr 2019 01:57:05 +0000 (21:57 -0400)] 
testsuite: Mark hWaitForInput-accurate-stdin as broken in threaded ways

As noted in #16535.

5 weeks agogitlab-ci: Test using slowtest in deb9-debug job
Ben Gamari [Thu, 4 Apr 2019 16:12:14 +0000 (12:12 -0400)] 
gitlab-ci: Test using slowtest in deb9-debug job

5 weeks agoBump terminfo to 0.4.1.4
Ben Gamari [Wed, 5 Jun 2019 00:31:38 +0000 (20:31 -0400)] 
Bump terminfo to 0.4.1.4

(cherry picked from commit 1134488b4c9cef904ea82f22f1978646eea612df)

5 weeks agoBump time submodule to 1.9.3
Ben Gamari [Wed, 5 Jun 2019 00:34:27 +0000 (20:34 -0400)] 
Bump time submodule to 1.9.3

(cherry picked from commit fdb07571036b1498800589d45b61781e6acdd368)

5 weeks agoBump Cabal submodule
Ben Gamari [Wed, 5 Jun 2019 00:37:31 +0000 (20:37 -0400)] 
Bump Cabal submodule

(cherry picked from commit ff438786613f07df9b2d43eaeac49b13815d849d)

Metric Increase:
    haddock.Cabal

5 weeks agoBump binary to 0.8.7.0
Ben Gamari [Fri, 7 Jun 2019 21:34:16 +0000 (17:34 -0400)] 
Bump binary to 0.8.7.0

(cherry picked from commit 983ada70a013c7642a751f6e41587ff95b57d0f8)

5 weeks agoUse DeriveFunctor throughout the codebase (#15654)
Krzysztof Gogolewski [Sat, 8 Jun 2019 18:48:07 +0000 (20:48 +0200)] 
Use DeriveFunctor throughout the codebase (#15654)

5 weeks agorts/linker: Only mprotect GOT after it is filled
Ben Gamari [Sat, 8 Jun 2019 17:28:19 +0000 (13:28 -0400)] 
rts/linker: Only mprotect GOT after it is filled

This fixes a regression, introduced by 67c422ca, where we mprotect'd the
global offset table (GOT) region to PROT_READ before we had finished
filling it, resulting in a linker crash.

Fixes #16779.

5 weeks agorts/linker: Make elf_got.c a bit more legible
Ben Gamari [Sat, 8 Jun 2019 17:28:08 +0000 (13:28 -0400)] 
rts/linker: Make elf_got.c a bit more legible

5 weeks agotestsuite: Add haddock perf test output to gitignore
Ben Gamari [Mon, 10 Jun 2019 23:00:57 +0000 (19:00 -0400)] 
testsuite: Add haddock perf test output to gitignore

[skip ci]

5 weeks agollvm-targets: Add armv7l-unknown-linux-gnueabi
Ben Gamari [Tue, 11 Jun 2019 01:59:19 +0000 (21:59 -0400)] 
llvm-targets: Add armv7l-unknown-linux-gnueabi

Fixes #15208.

[skip ci]

5 weeks agotestsuite/mk/boilerplate.mk: rename 'ghc-config-mk' to 'ghc_config_mk'
Alp Mestanogullari [Mon, 10 Jun 2019 15:38:34 +0000 (17:38 +0200)] 
testsuite/mk/boilerplate.mk: rename 'ghc-config-mk' to 'ghc_config_mk'

Make/shell variable names which contain dashes can cause problems under
some conditions. The 'ghc-config-mk' variable from testsuite/mk/boilerplate.mk
that I made overridable (by Hadrian) in ba0aed2e was working as expected when
our Hadrian/Linux job was based off the deb8 Docker image, but broke when
I switched the job to use our deb9-based image, in 3d97bad6. The exact
circumstances/tool versions that trigger this problem are unknown, but
changing the variable's name to 'ghc_config_mk' lets us work around the issue.

This fixes the annth_compunits and annth_make test failures that showed up
when we switched the Hadrian/Linux job to use the deb9 environment.

5 weeks agoFix an error message in CheckUnload.c:searchHeapBlocks
Ömer Sinan Ağacan [Mon, 10 Jun 2019 08:36:49 +0000 (11:36 +0300)] 
Fix an error message in CheckUnload.c:searchHeapBlocks

5 weeks agorts/linker: Use mmapForLinker to map PLT
Ben Gamari [Sat, 8 Jun 2019 19:31:54 +0000 (19:31 +0000)] 
rts/linker: Use mmapForLinker to map PLT

The PLT needs to be located within a close distance of
the code calling it under the small memory model.

Fixes #16784.

5 weeks agorts/linker: Mmap into low memory on AArch64
Ben Gamari [Sat, 8 Jun 2019 19:30:48 +0000 (19:30 +0000)] 
rts/linker: Mmap into low memory on AArch64

This extends mmapForLinker to use the same low-memory mapping
strategy used on x86_64 on AArch64. See #16784.

5 weeks agoHadrian: teach the RTS that PROFILING implies TRACING
Alp Mestanogullari [Wed, 5 Jun 2019 22:40:32 +0000 (00:40 +0200)] 
Hadrian: teach the RTS that PROFILING implies TRACING

As discussed in #16744, both the Make and Hadrian build systems
have special code to always pass -eventlog whenever -prof or -debug
are passed. However, there is some similar logic in the RTS itself only
for defining TRACING when the DEBUG macro is defined, but no such logic
is implemented to define TRACING when the PROFILING macro is defined.
This patch adds such a logic and therefore fixes #16744.

5 weeks agorts/RtsFlags.c: mention that -prof too enables support for +RTS -l
Alp Mestanogullari [Thu, 30 May 2019 12:18:01 +0000 (14:18 +0200)] 
rts/RtsFlags.c: mention that -prof too enables support for +RTS -l

5 weeks agoMake `haddock_testsuite` respect `--test-accept`
Alec Theriault [Wed, 29 May 2019 11:33:35 +0000 (07:33 -0400)] 
Make `haddock_testsuite` respect `--test-accept`

Suppose you've made changes that affect the output of `haddockHtmlTest`
so that the following is failing:

    ./hadrian/build.sh -c --only=haddockHtmlTest test

Then, the following will accept new output for Haddock's test cases.

    ./hadrian/build.sh -c --only=haddockHtmlTest test --test-accept

You still do need to make sure those new changes (which show up in
Haddock's tree) get committed though.

Fixes #16694

5 weeks agoRefine the GHCI macro into HAVE[_{INTERNAL, EXTERNAL}]_INTERPRETER
Alp Mestanogullari [Mon, 6 May 2019 16:49:33 +0000 (18:49 +0200)] 
Refine the GHCI macro into HAVE[_{INTERNAL, EXTERNAL}]_INTERPRETER

As discussed in #16331, the GHCI macro, defined through 'ghci' flags
in ghc.cabal.in, ghc-bin.cabal.in and ghci.cabal.in, is supposed to indicate
whether GHC is built with support for an internal interpreter, that runs in
the same process. It is however overloaded in a few places to mean
"there is an interpreter available", regardless of whether it's an internal
or external interpreter.

For the sake of clarity and with the hope of more easily being able to
build stage 1 GHCs with external interpreter support, this patch splits
the previous GHCI macro into 3 different ones:

- HAVE_INTERNAL_INTERPRETER: GHC is built with an internal interpreter
- HAVE_EXTERNAL_INTERPRETER: GHC is built with support for external interpreters
- HAVE_INTERPRETER: HAVE_INTERNAL_INTERPRETER || HAVE_EXTERNAL_INTERPRETER

5 weeks agoWarn about unused packages
Yuras Shumovich [Mon, 21 Jan 2019 00:49:56 +0000 (19:49 -0500)] 
Warn about unused packages

Reviewers: bgamari, simonpj

Reviewed By: simonpj

Subscribers: hvr, simonpj, mpickering, rwbarton, carter

GHC Trac Issues: #15838

Differential Revision: https://phabricator.haskell.org/D5285

5 weeks agoghc-heap: Add closure_size_noopt test
Ben Gamari [Sun, 9 Jun 2019 14:56:32 +0000 (10:56 -0400)] 
ghc-heap: Add closure_size_noopt test

This adds a new test, only run in the `normal` way, to verify the size
of FUNs and PAPs.

5 weeks agotestsuite: Fix and extend closure_size test
Ben Gamari [Sat, 8 Jun 2019 03:15:45 +0000 (23:15 -0400)] 
testsuite: Fix and extend closure_size test

This was previously broken in several ways. This is fixed and it also
now tests arrays. Unfortunately I was unable to find a way to continue
testing PAP and FUN sizes; these simply depend too much upon the
behavior of the simplifier.

I also tried to extend this to test non-empty arrays as well but
unfortunately this was non-trivial as the array card size constant isn't
readily available from haskell.

Fixes #16531.

5 weeks agoRefactor the rules for .hi and .o into a single rule using `&%>` #16764
David Eichmann [Thu, 6 Jun 2019 11:50:42 +0000 (12:50 +0100)] 
Refactor the rules for .hi and .o into a single rule using `&%>` #16764

Currently the rule for .hi files just triggers (via need) the rule
for the .o file, and .o rule generates both the .o and .hi file.
Likewise for .o-boot and .hi-boot files. This is a bit of an abuse
of Shake, and in fact shake supports rules with multiple output
with the &%> function. This exact use case appears in Neil
Mitchell's paper *Shake Before Building* section 6.3.

5 weeks agoComments only: document newtypes' DataConWrapId
Richard Eisenberg [Fri, 31 May 2019 17:37:56 +0000 (13:37 -0400)] 
Comments only: document newtypes' DataConWrapId

5 weeks agoPrint role annotations in TemplateHaskell brackets (#16718)
Vladislav Zavialov [Sat, 1 Jun 2019 12:08:24 +0000 (15:08 +0300)] 
Print role annotations in TemplateHaskell brackets (#16718)

5 weeks agobase: Mark CPUTime001 as fragile
Ben Gamari [Thu, 30 May 2019 13:29:37 +0000 (09:29 -0400)] 
base: Mark CPUTime001 as fragile

As noted in #16224, CPUTime001 has been quite problematic, reporting
non-monotonic timestamps in CI. Unfortunately I've been unable to
reproduce this locally.

5 weeks agorts: Fix RetainerProfile early return with TREC_CHUNK
Daniel Gröber [Thu, 6 Jun 2019 06:14:19 +0000 (08:14 +0200)] 
rts: Fix RetainerProfile early return with TREC_CHUNK

When pop() returns with `*c == NULL` retainerProfile will immediately
return. All other code paths is pop() continue with the next stackElement
when this happens so it seems weird to me that TREC_CHUNK we would suddenly
abort everything even though the stack might still have elements left to
process.

5 weeks agoRemove CPP ensuring word size is 32 or 64 bits around Addr# <-> int# primops
John Ericson [Tue, 4 Jun 2019 02:56:17 +0000 (22:56 -0400)] 
Remove CPP ensuring word size is 32 or 64 bits around Addr# <-> int# primops

It shouldn't be needed these days, and those primops are "highly
deprecated" anyways.

This fits with my plans because it removes one bit of target-dependence
of the builtin primops, and this is the hardest part of GHC to make
multi-target.

CC @carter

5 weeks agoComments only: document tcdDataCusk better.
Richard Eisenberg [Fri, 31 May 2019 17:28:42 +0000 (13:28 -0400)] 
Comments only: document tcdDataCusk better.

5 weeks agoHadrian: need CPP preprocessor dependencies #16660
David Eichmann [Tue, 16 Apr 2019 14:10:35 +0000 (15:10 +0100)] 
Hadrian: need CPP preprocessor dependencies #16660

Use the new -include-cpp-deps ghc option (#16521)
when generating .dependencies files in hadrian.
This is version gated as -include-cpp-deps is a
relatively new option.

5 weeks agotestsuite: Add test for #16509
Ben Gamari [Tue, 28 May 2019 03:00:16 +0000 (23:00 -0400)] 
testsuite: Add test for #16509

5 weeks agoDo not report error if Name in pragma is unbound
nineonine [Wed, 22 May 2019 04:34:27 +0000 (21:34 -0700)] 
Do not report error if Name in pragma is unbound

5 weeks agorts: Separate population of eventTypes from initial event generation
Ben Gamari [Wed, 15 May 2019 21:49:34 +0000 (17:49 -0400)] 
rts: Separate population of eventTypes from initial event generation

Previously these two orthogonal concerns were both implemented in
postHeaderEvents which made it difficult to send header events after RTS
initialization.