ghc.git
3 years agoTestsuite: simplify extra_file handling
Thomas Miedema [Tue, 21 Jun 2016 16:58:50 +0000 (18:58 +0200)] 
Testsuite: simplify extra_file handling

Before, `extra_files(['.hpc/Main.mix'])` meant copy `Main.mix` to
`<testdir>/.hpc/Main.mix`. This feature wasn't really necessary, so now
it just means copy `Main.mix` to `<testdir>/Main.mix`. This simplifies
the implementation.

Some small other cleanups as well. -40 lines of code.

3 years agoTestsuite: remove one level of indentation [skip ci]
Thomas Miedema [Tue, 21 Jun 2016 11:56:21 +0000 (13:56 +0200)] 
Testsuite: remove one level of indentation [skip ci]

Refactoring only. Move try/except out of do_test.

3 years agoTestsuite: report duplicate testnames when `make TEST=<name>`
Thomas Miedema [Tue, 21 Jun 2016 10:32:04 +0000 (12:32 +0200)] 
Testsuite: report duplicate testnames when `make TEST=<name>`

3 years agoTestsuite: never pick up .T files in .run directories
Thomas Miedema [Tue, 21 Jun 2016 07:52:36 +0000 (09:52 +0200)] 
Testsuite: never pick up .T files in .run directories

And use os.walk instead of calling os.listdir many times. The testsuite
driver should be able to handle backward slashes on Windows now.

3 years agorts/Linker.c: Rename ONLY_USED_x86_64_HOST_ARCH macro
Erik de Castro Lopo [Mon, 27 Jun 2016 09:37:06 +0000 (19:37 +1000)] 
rts/Linker.c: Rename ONLY_USED_x86_64_HOST_ARCH macro

Summary:
Rename it to `USED_IF_x86_64_HOST_ARCH` to make it more like the existing
`USED_IF` macros as suggested by Simon Marlow.

Test Plan: Build on x86_64 windows

Reviewers: Phyx, bgamari, simonmar, austin

Subscribers: thomie

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

3 years agoTypos in user manual and code: recurisve -> recursive
Ömer Sinan Ağacan [Mon, 27 Jun 2016 09:50:37 +0000 (09:50 +0000)] 
Typos in user manual and code: recurisve -> recursive

3 years agoRemove some `undefined`s
Ömer Sinan Ağacan [Mon, 27 Jun 2016 09:15:39 +0000 (09:15 +0000)] 
Remove some `undefined`s

These get annoying when `undefined` is actually used as placeholder in WIP code.
Some of these were also completely redundant (just call `deAnnotate'` instead of
`deAnnotate` etc.).

3 years agoDon't run the run_command tests with ext-interp
Simon Marlow [Sun, 26 Jun 2016 05:54:26 +0000 (06:54 +0100)] 
Don't run the run_command tests with ext-interp

3 years agoMake T8761 deterministic, I hope
Simon Marlow [Sun, 26 Jun 2016 05:53:56 +0000 (06:53 +0100)] 
Make T8761 deterministic, I hope

Summary:
T8761 seems to get different interleaving in its output on
Phabricator, so this switches it to use stderr consistently.

Test Plan: worksforme

Reviewers: goldfire, austin, bgamari, erikd

Subscribers: thomie

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

3 years agorts/Linker.c: Improve ugly C pre-processor hack
Erik de Castro Lopo [Sun, 26 Jun 2016 18:54:47 +0000 (04:54 +1000)] 
rts/Linker.c: Improve ugly C pre-processor hack

Test Plan: Build on x86_64/linux, x86_64/darwin and powerpc/linux

Reviewers: Phyx, bgamari, simonmar, austin

Reviewed By: Phyx

Subscribers: thomie

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

3 years agoAllow building static libs.
Moritz Angermann [Sat, 25 Jun 2016 16:07:57 +0000 (17:07 +0100)] 
Allow building static libs.

Summary:
Commit 90538d86af579595987826cd893828d6f379f35a, seems to have broken static linking.
The introduction of `argFixup` in `runLink` rearranges libs, and considers
anything with an `-l` prefix or `.a` suffix a lib, which fails for libs that are
just being linked together (e.g. `-o lib.a`).

The proposed solution explicitly checks for the existance of the `-o` flag.

Reviewers: rwbarton, erikd, Phyx, bgamari, austin

Reviewed By: Phyx

Subscribers: thomie

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

3 years agoRefactor tcInferArgs and add comments.
Richard Eisenberg [Fri, 24 Jun 2016 23:25:07 +0000 (19:25 -0400)] 
Refactor tcInferArgs and add comments.

This removes an unnecessary loop looking for invisible binders
and tries to clarify what the very closely-related functions
tcInferArgs, tc_infer_args, tcInferApps all do.

3 years agos/Invisible/Inferred/g s/Visible/Required/g
Richard Eisenberg [Thu, 23 Jun 2016 20:26:29 +0000 (16:26 -0400)] 
s/Invisible/Inferred/g s/Visible/Required/g

This renames VisibilityFlag from

> data VisibilityFlag = Visible | Specified | Invisible

to

> data ArgFlag = Required | Specified | Inferred

The old name was quite confusing, because both Specified
and Invisible were invisible! The new names are hopefully clearer.

3 years agoAdd template-haskell changelog note for #8761
Ryan Scott [Fri, 24 Jun 2016 18:48:09 +0000 (14:48 -0400)] 
Add template-haskell changelog note for #8761

3 years agoClean up outdated comments in template-haskell changelog
Ryan Scott [Fri, 24 Jun 2016 18:42:26 +0000 (14:42 -0400)] 
Clean up outdated comments in template-haskell changelog

* Replaced 2.11's *TBA* with *May 2016*
* Removed an outdated TODO comment
* Removed lines which incorrectly stated that some strictness-related
  functions had been removed (they have been deprecated instead)

3 years agoFix typo in Data.Bitraverse Haddocks
Ryan Scott [Fri, 24 Jun 2016 18:40:42 +0000 (14:40 -0400)] 
Fix typo in Data.Bitraverse Haddocks

3 years agoTest Trac #12229
Simon Peyton Jones [Fri, 24 Jun 2016 10:31:32 +0000 (11:31 +0100)] 
Test Trac #12229

3 years agoFix T8761 (#12219, #12077)
Simon Marlow [Thu, 23 Jun 2016 17:20:06 +0000 (18:20 +0100)] 
Fix T8761  (#12219, #12077)

3 years agoRemote GHCi: comments only
Simon Marlow [Thu, 23 Jun 2016 08:22:32 +0000 (09:22 +0100)] 
Remote GHCi: comments only

Summary: Add more Notes and signposts across the codebase to help navigation.

Test Plan: validate

Reviewers: goldfire, simonpj, austin, ezyang, hvr, bgamari, erikd

Subscribers: thomie

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

3 years agoRemote GHCi: separate out message types
Simon Marlow [Wed, 22 Jun 2016 17:13:48 +0000 (18:13 +0100)] 
Remote GHCi: separate out message types

Summary:
From a suggestion by @goldfire: clean up the message types, so that
rather than one Message type with all the messages, we have a separate
THMessage type for messages sent back to GHC during TH execution.  At
the same time I also removed the QDone/QFailed/QException messages
into their own type, and made the result type of RunTH more accurate.

Test Plan: validate

Reviewers: goldfire, ezyang, austin, niteria, bgamari, erikd

Subscribers: thomie, goldfire

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

3 years agoRun all TH tests with -fexternal-interpreter (#12219)
Simon Marlow [Wed, 22 Jun 2016 12:47:36 +0000 (13:47 +0100)] 
Run all TH tests with -fexternal-interpreter (#12219)

3 years agoImplement ReifyConStrictness for -fexternal-interpreter (#12219)
Simon Marlow [Wed, 22 Jun 2016 12:46:27 +0000 (13:46 +0100)] 
Implement ReifyConStrictness for -fexternal-interpreter (#12219)

Fixes
   T10697_decided_1.run  T10697_decided_1 [exit code non-0] (ext-interp)
   T10697_decided_2.run  T10697_decided_2 [exit code non-0] (ext-interp)
   T10697_decided_3.run  T10697_decided_3 [exit code non-0] (ext-interp)

3 years agoImprove pretty-printing of Avail
Simon Peyton Jones [Fri, 24 Jun 2016 08:03:01 +0000 (09:03 +0100)] 
Improve pretty-printing of Avail

3 years agoRemove bogus comment on ForAllTy
Simon Peyton Jones [Fri, 24 Jun 2016 08:02:49 +0000 (09:02 +0100)] 
Remove bogus comment on ForAllTy

3 years agoFix renamer panic
Simon Peyton Jones [Fri, 24 Jun 2016 07:59:20 +0000 (08:59 +0100)] 
Fix renamer panic

This patch fixes Trac #12216 and #12127.  The 'combine' function
in 'imp_occ_env' in RnNames.filterImports checked for an empty
field-selector list, which was (a) unnecessary and (b) wrong.

I've elaborated the comments.

This does NOT fix #11959 which is related but not the same
(it concerns bundling of pattern synonyms).

3 years agoComments around invisibility
Simon Peyton Jones [Thu, 23 Jun 2016 13:54:24 +0000 (14:54 +0100)] 
Comments around invisibility

Very minor

3 years agoImprove typechecking of instance defaults
Simon Peyton Jones [Thu, 23 Jun 2016 13:51:22 +0000 (14:51 +0100)] 
Improve typechecking of instance defaults

In an instance declaration when you don't specify the code for a
method, GHC fills in from the default binding in the class.
The type of the default method can legitmiately be ambiguous ---
see Note [Default methods in instances] in TcInstDcls --- so
typechecking it can be tricky.

Trac #12220 showed that although we were dealing with that ambiguity
for /vanilla/ default methods, we were not doing so for /generic/
default methods.  Moreover we were dealing with it clumsily, by
generating post-typechecked code.

This patch fixes the bug AND deletes code!  We now use the same code
path for both vanilla and generic default methods; and generate
/pre-typechecked/ code in both cases.  The key trick is that we can use
Visible Type Application to deal with the ambiguity, which wasn't
possible before.  Hooray.

There is a small hit to performance in compiler/perf/T1969 which
consists of nothing BUT instance declarations with several default
methods to fill, which we now have to typecheck. The actual hit is
from 724 -> 756 or 4% in that extreme example.  Real world programs
have vastly fewer instance decls.

3 years agoTestsuite: do not copy .hi/.o files to testdir (#12112)
Thomas Miedema [Fri, 24 Jun 2016 08:41:48 +0000 (10:41 +0200)] 
Testsuite: do not copy .hi/.o files to testdir (#12112)

3 years agoRelease notes for #11975 and #10963
Richard Eisenberg [Thu, 23 Jun 2016 19:24:42 +0000 (15:24 -0400)] 
Release notes for #11975 and #10963

3 years agoFix #10963 and #11975 by adding new cmds to GHCi.
Richard Eisenberg [Sat, 23 Apr 2016 02:39:17 +0000 (22:39 -0400)] 
Fix #10963 and #11975 by adding new cmds to GHCi.

See the user's guide entry or the Note [TcRnExprMode] in TcRnDriver.

Test cases: ghci/scripts/T{10963,11975}

3 years agoFix #11974 by adding a more smarts to TcDefaults.
Richard Eisenberg [Sat, 23 Apr 2016 02:28:35 +0000 (22:28 -0400)] 
Fix #11974 by adding a more smarts to TcDefaults.

Test cases:
  typecheck/should_compile/T11974
  typecheck/should_fail/T11974b

3 years agoVery confusing typo in error message.
Richard Eisenberg [Fri, 22 Apr 2016 19:29:10 +0000 (15:29 -0400)] 
Very confusing typo in error message.

3 years agoRemove Ord TyCon
Bartosz Nitka [Thu, 23 Jun 2016 13:24:47 +0000 (06:24 -0700)] 
Remove Ord TyCon

After 35d1564cea2e: Provide Uniquable version of SCC we
can remove this. We want to remove it because when used
it can introduce unnecessary nondeterminism.

GHC Trac: #4012

3 years agoProvide Uniquable version of SCC
Bartosz Nitka [Tue, 14 Jun 2016 10:28:30 +0000 (03:28 -0700)] 
Provide Uniquable version of SCC

We want to remove the `Ord Unique` instance because there's
no way to implement it in deterministic way and it's too
easy to use by accident.

We sometimes compute SCC for datatypes whose Ord instance
is implemented in terms of Unique. The Ord constraint on
SCC is just an artifact of some internal data structures.
We can have an alternative implementation with a data
structure that uses Uniquable instead.

This does exactly that and I'm pleased that I didn't have
to introduce any duplication to do that.

Test Plan:
./validate
I looked at performance tests and it's a tiny bit better.

Reviewers: bgamari, simonmar, ezyang, austin, goldfire

Subscribers: thomie

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

GHC Trac Issues: #4012

3 years agoHave Core linter accept programs using StaticPointers and -fhpc.
Facundo Domínguez [Wed, 22 Jun 2016 17:09:57 +0000 (14:09 -0300)] 
Have Core linter accept programs using StaticPointers and -fhpc.

Summary:
This patch uses collectArgsTicks instead of collectArgs to test that
StaticPtr only occurs at the top of RHSs of top-level expressions.

Ticks introduced by -fhpc would interfere otherwise.

Test Plan: ./validate

Reviewers: thomie, austin, goldfire, bgamari, simonpj

Reviewed By: simonpj

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

GHC Trac Issues: #12207

3 years agoNarrow the use of record wildcards slightly
Simon Peyton Jones [Thu, 23 Jun 2016 08:02:00 +0000 (09:02 +0100)] 
Narrow the use of record wildcards slightly

In reviewing the fix to Trac #12130 I found the wild-card
fill-in code for ".." notation in record constructions hard
to understand.  It went to great contortions (including the
find_tycon code) to allow
    data T = C { x, y :: Int }
    f x = C { .. }
to expand to
    f x = C { x = x, y = y }
where 'y' is an /imported function/!  That seems way over the top
for what record wildcards are supposed to do.

So I have narrowed the record-wildcard expansion to include only
/locally-bound/ variables; i.e. not top level, and certainly not
imported.

I don't think anyone is using record wildcards in this bizarre way, so
I don't expect any fallout. Even if there is, you can easily
initialise fields with eponymous but imported values by hand.

An intermediate position would be to allow /local/ top-level
definitions.  But I doubt anyone is doing that either.

Let's see if there's any fallout.  It's a local change, easy to
revert, so I've just gone ahead to save everyone's time.

3 years agoNarrow the warning for simplifiable constraints
Simon Peyton Jones [Thu, 23 Jun 2016 07:50:45 +0000 (08:50 +0100)] 
Narrow the warning for simplifiable constraints

In Trac #11948 I added the warning
    -Wsimplifiable-class-constraints
which warns if the class constraints in a type signature are
simplifiable.

But in fact the fragility it warns about only happens with
NoMonoLocalBinds, so this patch switches off the warning if
you have MonoLocalBinds (and suggests using it in the error
message).

See Note [Simplifiable given constraints] in TcValidity.

3 years agoRemove unused import
Simon Peyton Jones [Thu, 23 Jun 2016 07:49:28 +0000 (08:49 +0100)] 
Remove unused import

3 years agoGive lookupGRE_Name a better API
Simon Peyton Jones [Thu, 23 Jun 2016 07:47:31 +0000 (08:47 +0100)] 
Give lookupGRE_Name a better API

lookupGRE_Name should return either zero or one GREs, never
several. This is a consequence of INVARIANT 1 on GlobalRdrEnv.

So it's better if it returns a Maybe; the panic on multiple results
is put in one place, instead of being scattered or ignored.

Just refactoring, no change in behaviour

3 years agoTest Trac #12163
Simon Peyton Jones [Wed, 22 Jun 2016 21:28:55 +0000 (22:28 +0100)] 
Test Trac #12163

3 years agoExpand given superclasses more eagerly
Simon Peyton Jones [Wed, 22 Jun 2016 13:17:58 +0000 (14:17 +0100)] 
Expand given superclasses more eagerly

This patch fixes Trac #12175, another delicate corner case of
Note [Instance and Given overlap] in TcInteract.

In #12175 we were not expanding given superclasses eagerly
enough. It was easy to fix, and is actually rather neater than
before.

See Note [Eagerly expand given superclasses] in TcCanonical.
The main change is to move the eager expansion of given superclasses
to canClassNC.

3 years agoRemove unused arg to tcSuperClasses
Simon Peyton Jones [Wed, 22 Jun 2016 13:12:08 +0000 (14:12 +0100)] 
Remove unused arg to tcSuperClasses

We don't need the FamInstEnvs argument any more.
Just a tiny refactor.

3 years agoImprove error message in deriving( Functor )
Simon Peyton Jones [Wed, 22 Jun 2016 13:10:53 +0000 (14:10 +0100)] 
Improve error message in deriving( Functor )

Fixes Trac #12163.  Pretty simple.

3 years agoComments only
Simon Peyton Jones [Wed, 22 Jun 2016 13:09:11 +0000 (14:09 +0100)] 
Comments only

3 years agoAccept new (lower) allocations for T7257
Simon Marlow [Wed, 22 Jun 2016 19:54:59 +0000 (20:54 +0100)] 
Accept new (lower) allocations for T7257

3 years agoMake the Ord Module independent of Unique order (2nd try)
Bartosz Nitka [Thu, 9 Jun 2016 15:50:32 +0000 (08:50 -0700)] 
Make the Ord Module independent of Unique order (2nd try)

The `Ord Module` instance currently uses `Unique`s for comparison.
We don't want to use the `Unique` order because it can introduce
nondeterminism.
This switches `Ord ModuleName` and `Ord UnitId` to use lexicographic
ordering making `Ord Module` deterministic transitively.

I've run `nofib` and it doesn't make a measurable difference.

See also Note [ModuleEnv determinism and performance].

This fixes #12191 - the regression, that the previous version of this
patch had.

Test Plan:
./validate
run nofib: P112

Reviewers: simonmar, bgamari, austin

Subscribers: thomie

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

GHC Trac Issues: #4012, #12191

3 years agoDon't error on GCC inlining warning in rts
Bartosz Nitka [Wed, 22 Jun 2016 13:22:45 +0000 (06:22 -0700)] 
Don't error on GCC inlining warning in rts

The warning for reference:
```
rts/RaiseAsync.c: In function ‘throwToMsg’:

rts/SMPClosureOps.h:65:0: error:
     error: inlining failed in call to ‘lockClosure’: call is unlikely
and code size would grow

rts/RaiseAsync.c:305:0: error:  error: called from here

rts/SMPClosureOps.h:65:0: error:
     error: inlining failed in call to ‘lockClosure’: call is unlikely
and code size would grow
```

This warning triggers on `gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-16)`
and it doesn't trigger with new GCCs.

Test Plan: build ghc/rts

Reviewers: bgamari, simonmar, austin

Subscribers: thomie

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

3 years agoMore typos in comments [skip ci]
Gabor Greif [Tue, 21 Jun 2016 14:16:20 +0000 (16:16 +0200)] 
More typos in comments [skip ci]

3 years agoTypos in comments [skip ci]
Gabor Greif [Tue, 21 Jun 2016 14:11:10 +0000 (16:11 +0200)] 
Typos in comments [skip ci]

3 years agoHopefully fix all the rebase-induced breakage
Simon Marlow [Wed, 22 Jun 2016 09:32:12 +0000 (10:32 +0100)] 
Hopefully fix all the rebase-induced breakage

3 years agoFix build breakage due to rebase
Simon Marlow [Wed, 22 Jun 2016 09:19:42 +0000 (10:19 +0100)] 
Fix build breakage due to rebase

3 years agoSecond attempt to fix sizeExpr
Simon Marlow [Fri, 17 Jun 2016 10:21:52 +0000 (11:21 +0100)] 
Second attempt to fix sizeExpr

Summary:
Background:
* sizeExpr was calculating expressions like ((e `cast` T) x) wrongly
* Fixing it caused regressions in compile performance, and one nofib
  program (k-nucleotide)

I managed to fix the source of the compiler regressions.  I think it was
due to traceTc not being inlined, which I fixed in a more robust way by
putting an export list on TcRnMonad.

The k-nucleotide regression is more difficult.  I don't think anything
is actually going wrong, but this program has been highly tuned and is
quite sensitive to changing in inlining behaviour.  I managed to recover
most of the performance by manual lambda-lifting which makes it a bit
less fragile, but the end result was a bit slower.  I don't think this
is disastrous, the program is pretty horrible to begin with and we could
probably make a faster one by starting from scratch.

Test Plan: validate, nofib

Reviewers: simonpj, bgamari, niteria, austin, erikd

Subscribers: thomie

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

GHC Trac Issues: #11564

3 years agoMake checkFamInstConsistency less expensive
Bartosz Nitka [Tue, 21 Jun 2016 22:54:00 +0000 (15:54 -0700)] 
Make checkFamInstConsistency less expensive

Doing canonicalization on every comparison turned
out to be very expensive.

Caching the canonicalization through the smart `modulePair` constructor
gives `8%` reduction in allocations on `haddock.compiler` and
`8.5%` reduction in allocations on `haddock.Cabal`.
Possibly other things as well, but it's really visible in Haddock.

Test Plan: ./validate

Reviewers: jstolarek, simonpj, austin, simonmar, bgamari

Reviewed By: simonpj, simonmar

Subscribers: thomie

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

GHC Trac Issues: #12191

3 years agoDelete commented-out code
Simon Peyton Jones [Mon, 20 Jun 2016 14:50:53 +0000 (15:50 +0100)] 
Delete commented-out code

Richard: in a previous commit I combined the two case for

   decideQuantification

This commit just deletes the old code. I'm afraid it'll leave you
with a merge conflict though, with your stuff on generalisation.

3 years agoDon't quantify over Refl in a RULE
Simon Peyton Jones [Mon, 20 Jun 2016 14:48:09 +0000 (15:48 +0100)] 
Don't quantify over Refl in a RULE

This fixes Trac #12212.  It's quite hard to provoke, but I've
added a standalone test case that does so.

The issue is explained in Note [Evidence foralls] in Specialise.

3 years agoTypos in comments
Gabor Greif [Tue, 21 Jun 2016 10:31:55 +0000 (12:31 +0200)] 
Typos in comments

3 years agoExpand and clarify the docs for ApplicativeDo (#11835)
Simon Marlow [Mon, 20 Jun 2016 14:30:34 +0000 (15:30 +0100)] 
Expand and clarify the docs for ApplicativeDo (#11835)

3 years agoTestsuite: assume timeout_prog always exists
Thomas Miedema [Mon, 20 Jun 2016 11:07:19 +0000 (13:07 +0200)] 
Testsuite: assume timeout_prog always exists

Merge the following functions into one:
  * rawSystem
  * rawSystemWithTimeout
  * runCmd
  * runCmdFor
  * runCmdExitCode

I don't know why this wasn't done before.

3 years agoTestsuite: delete dead code + cleanup
Thomas Miedema [Sat, 18 Jun 2016 16:58:02 +0000 (18:58 +0200)] 
Testsuite: delete dead code + cleanup

* Set config settings directly in mk/test.mk, instead of indirectly in
  config/ghc
* passing --hpcdir for WAY=hpc is unnecessary

3 years agoTestsuite: remove `-Wno-warn-tabs` from default flags
Thomas Miedema [Sat, 18 Jun 2016 21:28:26 +0000 (23:28 +0200)] 
Testsuite: remove `-Wno-warn-tabs` from default flags

This allows the removal of the override_flags stuff in testlib.py.

3 years agoTestsuite: delete TEST_HC_OPTS_NO_RECOMP
Thomas Miedema [Sat, 18 Jun 2016 17:45:22 +0000 (19:45 +0200)] 
Testsuite: delete TEST_HC_OPTS_NO_RECOMP

The previous commits removed `-fforce-recomp` from TEST_HC_OPTS, so
TEST_HC_OPTS_NO_RECOMP = TEST_HC_OPTS.

3 years agoTestsuite: remove `-fforce-recomp` from default flags (#11980)
Thomas Miedema [Sat, 18 Jun 2016 17:00:15 +0000 (19:00 +0200)] 
Testsuite: remove `-fforce-recomp` from default flags (#11980)

There is no need for this flag anymore, since each test runs in a
newly created directory. Removing it cleans up testlib.py a bit.

There is a small risk that this renders some tests useless. It's hard to
know. Those tests should have specified -fforce-recomp` explicitly
anyway, so I'm not going to worry about it. I've fixed the ones that
failed without -fforce-recomp.

Reviewed by: bgamari

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

3 years agoTestsuite: mark tests expect broken
Thomas Miedema [Sun, 19 Jun 2016 11:03:47 +0000 (13:03 +0200)] 
Testsuite: mark tests expect broken

* CgStaticPointers, GcStaticPointers, ListStaticPointers,
  TcStaticPointers01, TcStaticPointers02:  #12207
* T11535: #12210
* ffi017/ffi021: #12209
* T11108: #11108
* T9646: #9646

3 years agoTestsuite: *do* replace backslashes in config.libdir
Thomas Miedema [Sun, 19 Jun 2016 22:54:38 +0000 (00:54 +0200)] 
Testsuite: *do* replace backslashes in config.libdir

See `Note [Replacing backward slashes in config.libdir]`

There is one caveat: in ae4acbd1ba4168b867a1b5fe8de50c0199dfc1f4
I mentioned:

  > Changing backwards slashes to forward slashes apparently confuses
  > msys2/mingw magic path handling.

I can not reproduce that problem anymore, however.

This patch validates for me, and fixes all tests that use config.libdir
for WAY=ghci. We'll see how it goes.

3 years agoTestsuite: fix WAY=ghci when LOCAL=0
Thomas Miedema [Sun, 19 Jun 2016 12:58:46 +0000 (14:58 +0200)] 
Testsuite: fix WAY=ghci when LOCAL=0

3 years agoTestsuite: recover from utf8 decoding errors
Thomas Miedema [Mon, 20 Jun 2016 08:30:12 +0000 (10:30 +0200)] 
Testsuite: recover from utf8 decoding errors

3 years agoTestsuite: tabs -> spaces [skip ci]
Thomas Miedema [Sat, 18 Jun 2016 20:44:19 +0000 (22:44 +0200)] 
Testsuite: tabs -> spaces [skip ci]

3 years agoTestsuite: tabs -> spaces [skip ci]
Thomas Miedema [Sat, 18 Jun 2016 20:44:19 +0000 (22:44 +0200)] 
Testsuite: tabs -> spaces [skip ci]

3 years agoTestsuite: tabs -> spaces [skip ci]
Thomas Miedema [Sat, 18 Jun 2016 20:44:19 +0000 (22:44 +0200)] 
Testsuite: tabs -> spaces [skip ci]

3 years agoTestsuite: tabs -> spaces [skip ci]
Thomas Miedema [Sat, 18 Jun 2016 20:44:19 +0000 (22:44 +0200)] 
Testsuite: tabs -> spaces [skip ci]

3 years agoTestsuite: tabs -> spaces [skip ci]
Thomas Miedema [Sat, 18 Jun 2016 20:44:19 +0000 (22:44 +0200)] 
Testsuite: tabs -> spaces [skip ci]

3 years agoTestsuite: tabs -> spaces [skip ci]
Thomas Miedema [Sat, 18 Jun 2016 20:44:19 +0000 (22:44 +0200)] 
Testsuite: tabs -> spaces [skip ci]

3 years agoTestsuite: remove Windows CR [skip ci]
Thomas Miedema [Sat, 18 Jun 2016 20:08:53 +0000 (22:08 +0200)] 
Testsuite: remove Windows CR [skip ci]

3 years agoTestsuite: remove Windows CR [skip ci]
Thomas Miedema [Sat, 18 Jun 2016 20:07:49 +0000 (22:07 +0200)] 
Testsuite: remove Windows CR [skip ci]

3 years agoTestsuite: remove Windows CR again.. [skip ci]
Thomas Miedema [Sat, 18 Jun 2016 20:05:51 +0000 (22:05 +0200)] 
Testsuite: remove Windows CR again.. [skip ci]

3 years agoFix double-free in T5644 (#12208)
Simon Marlow [Mon, 20 Jun 2016 12:33:13 +0000 (13:33 +0100)] 
Fix double-free in T5644 (#12208)

3 years agoApplicativeDo: allow "return $ e"
Simon Marlow [Sat, 18 Jun 2016 13:51:04 +0000 (14:51 +0100)] 
ApplicativeDo: allow "return $ e"

Summary:
There's a precedent for special-casing $, as we already have special
typing rules for it.

Test Plan: validate; new test cases

Reviewers: ezyang, austin, niteria, bgamari, simonpj, erikd

Subscribers: thomie

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

GHC Trac Issues: #11835

3 years agoRemove use of KProxy in GHC.Generics
Ryan Scott [Mon, 20 Jun 2016 13:25:55 +0000 (09:25 -0400)] 
Remove use of KProxy in GHC.Generics

Summary:
With `-XTypeInType`, the singletons machinery that `GHC.Generics` uses
no longer needs `KProxy` to hack around the use of `k` as both a type
and a kind. This is simply changing the code to match what's currently
in the upstream `singletons` repo.

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: thomie, goldfire

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

3 years agollvmGen: Add strictness to metadata fields
Ben Gamari [Sat, 18 Jun 2016 10:57:29 +0000 (12:57 +0200)] 
llvmGen: Add strictness to metadata fields

3 years agoPPC NCG: Fix and refactor TOC handling.
Peter Trommler [Sat, 18 Jun 2016 10:29:12 +0000 (12:29 +0200)] 
PPC NCG: Fix and refactor TOC handling.

In a call to a fixed function the TOC does not need to be saved.
The linker handles TOC saving.

Refactor TOC handling by folding the two functions toc_before and
toc_after into the code generating the call sequence. This saves
repeating the case distinction in those two functions.

Test Plan: validate on PowerPC 32-bit Linux and AIX

Reviewers: hvr, simonmar, austin, erikd, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

3 years agoPPC NCG: Fix float parameter passing on 64-bit.
Peter Trommler [Sat, 18 Jun 2016 10:28:41 +0000 (12:28 +0200)] 
PPC NCG: Fix float parameter passing on 64-bit.

On Linux 64-bit PowerPC the first 13 floating point parameters are
passed in registers. We only passed the first 8 floating point params.

The alignment of a floating point single precision value in ELF v1.9 is
the second word of a doubleword. For ELF v2 we support only little
endian and the least significant word of a doubleword is the first word,
so no special handling is required.

Add a regression test.

Test Plan: validate on powerpc Linux and AIX

Reviewers: erikd, hvr, austin, simonmar, bgamari

Reviewed By: simonmar

Subscribers: thomie

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

GHC Trac Issues: #12134

3 years agoFix trac #10647: Notice about lack of SIMD support
Seraphime Kirkovski [Sat, 18 Jun 2016 10:28:19 +0000 (12:28 +0200)] 
Fix trac #10647: Notice about lack of SIMD support

Fixes #10647. Changes the error message when a SIMD size
variable is required in the native code generation backend.

Test Plan:
Try compiling the test case given in the ticket :

{-# LANGUAGE MagicHash #-}
module Foo where
import GHC.Prim
data V = V Int8X16#

GHC should give a clearer error message

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #10647

3 years agoAvoid find_tycon panic if datacon is not in scope
Adam Gundry [Sat, 18 Jun 2016 10:27:47 +0000 (12:27 +0200)] 
Avoid find_tycon panic if datacon is not in scope

When using TH to splice expressions involving record field construction,
the parent datacon may not be in scope.  We shouldn't panic about this,
because we will be renaming Exact RdrNames which don't require any
disambiguation.

Test Plan: new test th/T12130

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #12130

3 years agoRefactor derived Generic instances to reduce allocations
Ryan Scott [Sat, 18 Jun 2016 10:23:12 +0000 (12:23 +0200)] 
Refactor derived Generic instances to reduce allocations

Previously, derived implementations of `to`/`from` in `Generic`
instances were wastefully putting extra `M1`s in every case, which led
to an O(n) increase in the number of coercions, resulting in a slowdown
during the typechecker phase.

This factors out the common `M1` in every case of a `to`/`from`
definition so that the typechecker has far fewer coercions to deal with.
For a datatype with 300 constructors, this change has been observed to
save almost 3 seconds of compilation time.

This is one step towards coming up with a solution for #5642.

Test Plan: ./validate

Reviewers: hvr, austin, simonpj, bgamari

Reviewed By: bgamari

Subscribers: basvandijk, carter, thomie, osa1

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

GHC Trac Issues: #5642

3 years agoAdd Bifoldable and Bitraversable to base
Ryan Scott [Sat, 18 Jun 2016 10:17:24 +0000 (12:17 +0200)] 
Add Bifoldable and Bitraversable to base

This adds `Data.Bifoldable` and `Data.Bitraversable` from the
`bifunctors` package to `base`, completing the migration started in
D336.  This is fairly straightforward, although there were a suprising
amount of reinternal organization in `base` that was needed for this to
happen:

* `Data.Foldable`, `Data.Traversable`, `Data.Bifoldable`, and
  `Data.Bitraversable` share some nonexported datatypes (e.g., `StateL`,
  `StateR`, `Min`, `Max`, etc.) to implement some instances. To avoid
  code duplication, I migrated this internal code to a new hidden
  module, `Data.Functor.Utils` (better naming suggestions welcome).

* `Data.Traversable` and `Data.Bitraversable` also make use of an
  identity newtype, so I modified them to use
  `Data.Functor.Identity.Identity`. This has a ripple effect on several
  other modules, since I had to move instances around in order to avoid
  dependency cycles.

Fixes #10448.

Reviewers: ekmett, hvr, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #9682, #10448

3 years agoVarEnv: Comment only
Ömer Sinan Ağacan [Sat, 18 Jun 2016 16:10:19 +0000 (16:10 +0000)] 
VarEnv: Comment only

3 years agoValidate: use `rm -f` instead of `rm`
Thomas Miedema [Sat, 18 Jun 2016 11:36:41 +0000 (13:36 +0200)] 
Validate: use `rm -f` instead of `rm`

3 years agoTestsuite: validate the tests/stage1 directory with the stage1 compiler
Thomas Miedema [Thu, 16 Jun 2016 17:45:57 +0000 (19:45 +0200)] 
Testsuite: validate the tests/stage1 directory with the stage1 compiler

* See `Note [Why is there no stage1 setup function?]`.
* Move T2632 to the tests/stage1 directory (#10382).

Reviewed by: ezyang, nomeata, bgamari

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

GHC Trac Issues: #12197

3 years agoTestsuite: write "\n" instead of "\r\n" when using mingw Python
Thomas Miedema [Fri, 17 Jun 2016 13:23:34 +0000 (15:23 +0200)] 
Testsuite: write "\n" instead of "\r\n" when using mingw Python

Mingw style Python uses '\r\n' by default for newlines. This is
annoying, because it means that when a GHC developer on Windows uses
mingw Python to `make accept` a test, every single line of the
.stderr file is touched. This makes it difficult to spot the real
changes, and it leads to unnecessary git history bloat.

Prevent this from happening by using io.open instead of open.
See `Note [Universal newlines]`

Reviewed by: Phyx

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

3 years agoTestsuite: run tests in <testdir>.run instead of /tmp
Thomas Miedema [Wed, 15 Jun 2016 14:57:05 +0000 (16:57 +0200)] 
Testsuite: run tests in <testdir>.run instead of /tmp

As discussed in Phab:D1187, this approach makes it a bit easier to
inspect the test directory while working on a new test.

The only tests that needed changes are the ones that refer to files in
ancestor directories. Those files are now copied directly into the test
directory.

validate still runs the tests in a temporary directory in /tmp, see
`Note [Running tests in /tmp]` in testsuite/driver/runtests.py.

Update submodule hpc.

Reviewed by: simonmar

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

GHC Trac Issues: #11980

3 years agoDriver: `ghc ../Test` (without file extension) should work
Thomas Miedema [Mon, 13 Jun 2016 22:10:19 +0000 (00:10 +0200)] 
Driver: `ghc ../Test` (without file extension) should work

Reviewed by: bgamari

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

GHC Trac Issues: #12192

3 years agoRevert accidental submodule updates
Thomas Miedema [Fri, 17 Jun 2016 15:37:37 +0000 (17:37 +0200)] 
Revert accidental submodule updates

Commit 77bb09270c70455bbd547470c4e995707d19f37d seems to have
accidentally set some submodules to earlier versions. Undo this.

3 years agollvmGen: Consolidate MetaExpr pretty-printing
Ben Gamari [Fri, 17 Jun 2016 21:52:39 +0000 (23:52 +0200)] 
llvmGen: Consolidate MetaExpr pretty-printing

Previously this logic was duplicated needlessly.

3 years agollvmGen: Make metadata ids a newtype
Ben Gamari [Fri, 17 Jun 2016 20:57:38 +0000 (22:57 +0200)] 
llvmGen: Make metadata ids a newtype

These were previously just represented as Ints which was needlessly
vague.

3 years agoCmmNode: Make CmmTickScope's Unique strict
Ben Gamari [Fri, 17 Jun 2016 19:29:56 +0000 (21:29 +0200)] 
CmmNode: Make CmmTickScope's Unique strict

There is no reason why we need laziness here and making it strict
enables unpacking.

3 years agoCoreLint: Slightly improve case type annotation error msgs
Ömer Sinan Ağacan [Fri, 17 Jun 2016 21:23:15 +0000 (21:23 +0000)] 
CoreLint: Slightly improve case type annotation error msgs

3 years agoNUMA cleanups
Simon Marlow [Sat, 11 Jun 2016 10:07:14 +0000 (11:07 +0100)] 
NUMA cleanups

- Move the numaMap and nNumaNodes out of RtsFlags to Capability.c
- Add a test to tests/rts

3 years agoRemove dead code: countOnce, countMany
Joachim Breitner [Mon, 2 May 2016 10:34:25 +0000 (12:34 +0200)] 
Remove dead code: countOnce, countMany

and export Count abstractly (the constructors are not used anywhere).

3 years agoAbort the build when a Core plugin pass is specified in stage1 compiler
Ömer Sinan Ağacan [Fri, 17 Jun 2016 07:54:28 +0000 (07:54 +0000)] 
Abort the build when a Core plugin pass is specified in stage1 compiler

This also makes the behavior the same with frontend plugin errors --
frontend was failing with an exception (`CmdLineError`) while the
simplifier was just ignoring plugins. Now we abort with `CmdLineError`
in both cases with a slightly improved error message.

Test Plan:
- add tests (will add tests once #12197 is implemented)
- validate (done)

Reviewers: austin, bgamari

Subscribers: thomie

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

GHC Trac Issues: #11690

3 years agoCoreMonad: Update error msg function docs
Ömer Sinan Ağacan [Thu, 16 Jun 2016 08:51:55 +0000 (08:51 +0000)] 
CoreMonad: Update error msg function docs