ghc.git
4 years agoAPI Annotations : ExprWithTySig processing discards annotated spans
Alan Zimmerman [Tue, 14 Apr 2015 12:32:40 +0000 (07:32 -0500)] 
API Annotations : ExprWithTySig processing discards annotated spans

In RdrHsSyn.checkAPat the processing for ExprWithTySig is defined as

   ExprWithTySig e t _ -> do e <- checkLPat msg e
                             -- Pattern signatures are parsed as sigtypes,
                             -- but they aren't explicit forall points.  Hence
                             -- we have to remove the implicit forall here.
                             let t' = case t of
                                        L _ (HsForAllTy Implicit _ _
                                             (L _ []) ty) -> ty
                                        other -> other
                             return (SigPatIn e (mkHsWithBndrs t'))

The t' variable ends up losing its original SrcSpan in the first case
branch. This results in annotations becoming detached from the AST.

Reviewed By: austin

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

GHC Trac Issues: #10255

4 years agoRemove LlvmCodeGen panic variants.
Edward Z. Yang [Tue, 14 Apr 2015 12:32:17 +0000 (07:32 -0500)] 
Remove LlvmCodeGen panic variants.

It's pretty irritating having hasktags with multiple top-level
declarations with the same type; hasktags can't figure out which
declaration you actually wanted.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Reviewed By: dterei, austin

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

4 years agoAdd "error:" prefix to error-messages
Konstantine Rybnikov [Tue, 14 Apr 2015 06:38:54 +0000 (01:38 -0500)] 
Add "error:" prefix to error-messages

Add "error:" prefix to error-messages, also lowercase "Warning:"
message to match GCC behavior closer.

Reviewed By: thomie, austin

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

GHC Trac Issues: #10021

4 years agoComments and white space only
Simon Peyton Jones [Tue, 14 Apr 2015 08:21:27 +0000 (09:21 +0100)] 
Comments and white space only

4 years agoComments only
Simon Peyton Jones [Tue, 14 Apr 2015 08:21:00 +0000 (09:21 +0100)] 
Comments only

4 years agoZap usage info in CSE (Trac #10218)
Simon Peyton Jones [Tue, 14 Apr 2015 08:20:42 +0000 (09:20 +0100)] 
Zap usage info in CSE (Trac #10218)

Trac #10218 reports a subtle bug that turned out to be:

- CSE invalidated the usage information computed
  by earlier demand analysis, by increasing sharing

- that made a single-entry thunk into a multi-entry thunk

- and with -feager-blackholing, that led to <<loop>>

The patch fixes it by making the CSE pass zap usage information for
let-bound identifiers.   It can be restored by -flate-dmd-anal.

(But making -flate-dmd-anal the default needs some careful work;
see Trac #7782.)

4 years agoparser : the API annotation on opt_sig is being discarded
Alan Zimmerman [Tue, 14 Apr 2015 06:17:58 +0000 (01:17 -0500)] 
parser : the API annotation on opt_sig is being discarded

The opt_sig production is defined as

  opt_sig :: { ([AddAnn],Maybe (LHsType RdrName)) }
          : {- empty -}                   { ([],Nothing) }
          | '::' sigtype                  { ([mj AnnDcolon $1],Just $2) }

It is used in the alt and decl_no_th productions, but neither of them
add the returned annotations.

This commit captures the annotations in the calling productions.

Reviewed By: austin

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

GHC Trac Issues: #10254

4 years agoparser: API Annotations : guardquals1 does not annotate commas properly
Alan Zimmerman [Tue, 14 Apr 2015 06:17:48 +0000 (01:17 -0500)] 
parser: API Annotations : guardquals1 does not annotate commas properly

The `guardquals1` production includes

   : guardquals1 ',' qual  {% addAnnotation (gl $ last $ unLoc $1) AnnComma
                                             (gl $2) >>
                               return (sLL $1 $> ($3 : unLoc $1)) }

The AnnComma should be attached to `(gl $ head $ unLoc $1)`, rather than
`last`.

Reviewed By: austin

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

GHC Trac Issues: #10256

4 years agoparser: opt_kind_sig has incorrect SrcSpan
Alan Zimmerman [Tue, 14 Apr 2015 06:16:48 +0000 (01:16 -0500)] 
parser: opt_kind_sig has incorrect SrcSpan

The production for opt_kind_sig is

  opt_kind_sig :: { Located (Maybe (LHsKind RdrName)) }
          :                             { noLoc Nothing }
          | '::' kind                   {% ajl (sLL $1 $> (Just $2)) AnnDcolon (gl $1) }

The outer Location is used only to get the full span for the enclosing
declration, and is then stripped. The inner LHsKind then has a SrcSpan that does
not include the '::'

Extend the SrcSpan on $2 to include $1

Reviewed By: austin

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

GHC Trac Issues: #10209

4 years agouse projectVersion from DynFlags rather than cProjectVersion for versionedAppDir
Luite Stegeman [Tue, 14 Apr 2015 06:13:27 +0000 (01:13 -0500)] 
use projectVersion from DynFlags rather than cProjectVersion for versionedAppDir

Reviewed By: edsko, austin

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

GHC Trac Issues: #10232

4 years agoDerive Generic instance for Data.Version.Version
Herbert Valerio Riedel [Tue, 14 Apr 2015 06:12:38 +0000 (01:12 -0500)] 
Derive Generic instance for Data.Version.Version

Reviewed By: austin

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

4 years agoDerive Generic instance for System.Exit.ExitCode
Herbert Valerio Riedel [Tue, 14 Apr 2015 06:12:22 +0000 (01:12 -0500)] 
Derive Generic instance for System.Exit.ExitCode

Reviewed By: austin

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

4 years agoFix autoconf's check for create_timer()
Austin Seipp [Tue, 14 Apr 2015 06:12:09 +0000 (01:12 -0500)] 
Fix autoconf's check for create_timer()

GHC build system have custom autoconf check for `create_timer()`
function from librt. Check description says that it checks for
`CLOCK_REALTIME` timer, but checking code also checks for
`CLOCK_PROCESS_CPUTIME_ID` timer, which is not commonly present (for
example, FreeBSD doesn't have it). This makes whole check fail despite
the fact that FreeBSD have `create_timer()` call and supports
`CLOCK_REALTIME`. As a consequence, GHC RTS falls back to using SIGALRM
for its timing machinery. Not only it's very ancient codepath, it also
break some FFI bindings to C code that isn't prepared for syscall
interruption caused by SIGALRM delivery.

Grepping through ghc source code reveals that `USE_TIMER_CREATE`
defininition in the config.h doesn't imply having
`CLOCK_PROCESS_CPUTIME_ID`. The only place where
`CLOCK_PROCESS_CPUTIME_ID` is used is rts/posix/GetTime.c and this code
handles the absence of `CLOCK_PROCESS_CPUTIME_ID` gracefully.

This patch makes autoconf checking code to check only for
`timer_create(CLOCK_REALTIME, ...)` and fixes check description.

Reviewed By: austin

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

4 years agoconfigure : LLVM and LD detections improvements (#10234).
Erik de Castro Lopo [Wed, 8 Apr 2015 05:11:38 +0000 (15:11 +1000)] 
configure : LLVM and LD detections improvements (#10234).

* distrib/configure.ac.in : Detect correct version of LLVM tools as
  was done for the top level configure.ac in 42448e3757.
* aclocal.m4 : Add a FIND_LD macro that can be used in both
  configure scripts.
* Use new FIND_LD macro in both configure scripts.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
Test Plan: validate on amd64-linux and armhf-linux.

Reviewers: rwbarton, austin

Subscribers: thomie

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

GHC Trac Issues: #10234

4 years agoTypos in error messages and in comments
Gabor Greif [Fri, 10 Apr 2015 08:00:50 +0000 (10:00 +0200)] 
Typos in error messages and in comments

4 years agoMake the evidence in a CtGiven into an EvId
Simon Peyton Jones [Thu, 9 Apr 2015 16:36:41 +0000 (17:36 +0100)] 
Make the evidence in a CtGiven into an EvId

Note [Bind new Givens immediately] in TcRnTypes

We were never using the generality.  Result: less code, more efficient.
Cake for everyone.

4 years agoComments only
Simon Peyton Jones [Thu, 9 Apr 2015 14:03:05 +0000 (15:03 +0100)] 
Comments only

4 years agoComments in rejigConRes
Simon Peyton Jones [Thu, 9 Apr 2015 14:02:34 +0000 (15:02 +0100)] 
Comments in rejigConRes

4 years agoComments about AnyK
Simon Peyton Jones [Thu, 9 Apr 2015 14:02:08 +0000 (15:02 +0100)] 
Comments about AnyK

4 years agoImport rand using capi
Reid Barton [Thu, 9 Apr 2015 15:31:20 +0000 (11:31 -0400)] 
Import rand using capi

Summary: Android has no rand symbol (it's a static inline function there).

Test Plan: ghc-android builds

Reviewers: trofi, austin, hvr

Reviewed By: hvr

Subscribers: thomie

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

GHC Trac Issues: #10274

4 years agoFixes a compiler error with -DDEBUG (#10265)
Dave Laing [Wed, 8 Apr 2015 18:38:59 +0000 (14:38 -0400)] 
Fixes a compiler error with -DDEBUG (#10265)

Test Plan: validate

Reviewers: austin, ezyang, erikd, rwbarton

Reviewed By: ezyang, erikd, rwbarton

Subscribers: erikd, thomie

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

GHC Trac Issues: #10265

4 years agoTest Trac #8030
Simon Peyton Jones [Wed, 8 Apr 2015 08:43:20 +0000 (09:43 +0100)] 
Test Trac #8030

4 years agoIgnore temporary ./configure files.
Edward Z. Yang [Tue, 7 Apr 2015 20:44:51 +0000 (13:44 -0700)] 
Ignore temporary ./configure files.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
4 years agoAxe one-shot sig-of
Edward Z. Yang [Tue, 2 Dec 2014 09:08:59 +0000 (01:08 -0800)] 
Axe one-shot sig-of

Summary:
We're getting rid of -sig-of foo:A usage, because
it doesn't make sense in any compilation mode besides one-shot,
and we don't expect users to use it anyway.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate

Reviewers: simonpj, austin

Subscribers: thomie

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

4 years agoCommit missing T10148 files and ignore the built executable.
Edward Z. Yang [Tue, 7 Apr 2015 18:59:09 +0000 (11:59 -0700)] 
Commit missing T10148 files and ignore the built executable.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
4 years agoSupport for multiple signature files in scope.
Edward Z. Yang [Wed, 8 Oct 2014 03:54:54 +0000 (20:54 -0700)] 
Support for multiple signature files in scope.

Summary:
A common pattern when programming with signatures is to combine multiple
signatures together (signature linking).  We achieve this by making it
not-an-error to have multiple, distinct interface files for the same module
name, as long as they have the same backing implementation.  When a user
imports a module name, they get ALL matching signatures dumped into their
scope.

On the way, I refactored the module finder code, which now distinguishes
between exact finds (when you had a 'Module') and regular finds (when
you had a 'ModuleName').  I also refactored the package finder code to
use a Monoid instance on LookupResult to collect together various results.

ToDo: At the moment, if a signature is declared in the local package,
it completely overrides any remote signatures.  Eventually, we'll want
to also pull in the remote signatures (or even override the local signature,
if the full implementation is available.)  There are bunch of ToDos in the
code for what to do once this is done.

ToDo: At the moment, whenever a module name lookup occurs in GHCi and we
would have seen a signature, we instead continue and return the Module
for the backing implementation.  This is correct for most cases, but there
might be some situations where we want something a little more fine-grained
(e.g. :browse should only list identifiers which are available through
the in-scope signatures, and not ALL of them.)

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate

Reviewers: simonpj, hvr, austin

Subscribers: carter, thomie

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

GHC Trac Issues: #9252

4 years agoFinal error message wibble
Simon Peyton Jones [Tue, 7 Apr 2015 16:52:14 +0000 (17:52 +0100)] 
Final error message wibble

4 years agoMore error message wibbles
Simon Peyton Jones [Tue, 7 Apr 2015 16:33:44 +0000 (17:33 +0100)] 
More error message wibbles

..due to suppressing base-package module names.

Needs a submodule update on array.

4 years agoTest Trac #10148
Simon Peyton Jones [Tue, 7 Apr 2015 16:20:43 +0000 (17:20 +0100)] 
Test Trac #10148

4 years agoThe production for squals is incorrect; see D806 for specifics.
Alan Zimmerman [Tue, 7 Apr 2015 14:10:27 +0000 (09:10 -0500)] 
The production for squals is incorrect; see D806 for specifics.

This diff depends on D803.

Reviewed By: austin

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

GHC Trac Issues: #10214

4 years agoThe production for `pquals` is incorrect; the specifics are in D803.
Alan Zimmerman [Tue, 7 Apr 2015 14:10:18 +0000 (09:10 -0500)] 
The production for `pquals` is incorrect; the specifics are in D803.

Reviewed By: austin

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

GHC Trac Issues: #10207

4 years agoDon't repeat package key with -dppr-debug when package info is missing.
Edward Z. Yang [Tue, 7 Apr 2015 14:08:54 +0000 (09:08 -0500)] 
Don't repeat package key with -dppr-debug when package info is missing.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Reviewed By: austin

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

4 years agorts/Linker.c: distinct between DATA and CODE labels when importing
Sergei Trofimovich [Tue, 7 Apr 2015 14:08:37 +0000 (09:08 -0500)] 
rts/Linker.c: distinct between DATA and CODE labels when importing

The patch is a last major piece to make unregisterised GHC build
under GCC's link-time optimizer.

Before the patch we imported everything external as functions.
Now we distinct between global variables and functions.

The difference is crucial on ia64 and a complement to fixes:
    > d82f592522eb8e063276a8a8c87ab93e18353c6b
    > CMM: add a mechanism to import C .data labels
    > e18525fae273f4c1ad8d6cbe1dea4fc074cac721
    > pprC: declare extern cmm primitives as functions, not data

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
Reviewed By: austin

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

4 years agoReplace endian test by 64-bit word access in T7600
Peter Trommler [Tue, 7 Apr 2015 14:08:29 +0000 (09:08 -0500)] 
Replace endian test by 64-bit word access in T7600

In commit 3f30912f an include `ghcconfig.h` was added for
`WORDS_BIGENDIAN`.

Converting the floating point array to a `Word64` array avoids
using the preprocessor altogether and leads to smaller code.

Fixes #10239

Reviewed By: rwbarton, austin

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

GHC Trac Issues: #10239

4 years agoLook inside synonyms for foralls when unifying
Simon Peyton Jones [Tue, 7 Apr 2015 13:45:04 +0000 (14:45 +0100)] 
Look inside synonyms for foralls when unifying

This fixes Trac #10194

4 years agoMore aggressive Given/Wanted overlap check
Simon Peyton Jones [Tue, 7 Apr 2015 13:29:10 +0000 (14:29 +0100)] 
More aggressive Given/Wanted overlap check

This fixes Trac #10195

For some reason we considered untouchability before, but Trac #10195
shows that this is positively worng.

See Note [Instance and Given overlap] in TcInteract.

Looking at the Git log, it seems that this bug was introduced at the
same time that we introduced the Given/Wanted overlap check in the first
place.

4 years agoPut quotes round a Name in an error message
Simon Peyton Jones [Tue, 7 Apr 2015 13:06:11 +0000 (14:06 +0100)] 
Put quotes round a Name in an error message

Cosmetic consistency only

4 years agoDo not quantify over the function itself in a RULE
Simon Peyton Jones [Tue, 7 Apr 2015 13:01:39 +0000 (14:01 +0100)] 
Do not quantify over the function itself in a RULE

We were erroneously quantifying over the function when it
had a dictionary type. A bit pathological, but possible.

This fixes Trac #10251

4 years agoGHC.Prim.Constraint is not built-in syntax
Simon Peyton Jones [Tue, 7 Apr 2015 12:55:43 +0000 (13:55 +0100)] 
GHC.Prim.Constraint is not built-in syntax

This fixes Trac #10233

4 years agoError msg wibbles from reduced module prefixes
Simon Peyton Jones [Tue, 7 Apr 2015 13:54:56 +0000 (14:54 +0100)] 
Error msg wibbles from reduced module prefixes

4 years agoReduce module qualifiers in pretty-printing
Simon Peyton Jones [Tue, 7 Apr 2015 12:48:30 +0000 (13:48 +0100)] 
Reduce module qualifiers in pretty-printing

The change is in HscTypes.mkPrintUnqualified, and suppresses the
module qualifier on Names from ghc-prim, base, and template-haskell,
where no ambiguity can aries.  It's somewhat arbitrary, but helps
with things like 'Constraint' which are often not in scope, but
occasionally show up in error messages.

4 years agoFix a long-standing bug in the demand analyser
Simon Peyton Jones [Mon, 6 Apr 2015 13:10:52 +0000 (14:10 +0100)] 
Fix a long-standing bug in the demand analyser

This patch fixes Trac #10148, an outright and egregious
bug in the demand analyser.

It is explained in Note [Demand on case-alternative binders]
in Demand.hs.

I did some other minor refactoring.

To my astonishment I got some big compiler perf changes

* perf/compiler/T5837: bytes allocated -76%
* perf/compiler/T5030: bytes allocated -10%
* perf/compiler/T3294: max bytes used  -25%

Happy days

4 years agoSuggest how to fix .ghci when it is group writeable (#8248)
Vikas Menon [Tue, 7 Apr 2015 13:39:44 +0000 (15:39 +0200)] 
Suggest how to fix .ghci when it is group writeable (#8248)

```
chmod 664 $PATH_TO_GHCI_CONF/.ghci
```

Run ghci. You will now get a warning + a suggestion:

```
  *** WARNING: $PATH_TO_GHCI_CONF/.ghci is writable by someone else, IGNORING!
  Suggested fix: execute 'chmod 644 $PATH_TO_GHCI_CONF/.ghci'
```

Execute fix and the warning should disappear.

Reviewed By: mboes, thomie

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

4 years agotestdriver: delete unused ways
Thomas Miedema [Tue, 7 Apr 2015 09:50:11 +0000 (11:50 +0200)] 
testdriver: delete unused ways

And mention more prominently that `-DDEBUG` and tests that call
`compiler_stats_num_fields` don't play well together

Reviewed By: austin

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

4 years agoTypechecker: refactoring only
Thomas Miedema [Tue, 7 Apr 2015 09:48:35 +0000 (11:48 +0200)] 
Typechecker: refactoring only

* don't call `nlHsPar`, as `genOpApp` already does so.
* don't reimplement `isUnboxedTupleTyCon` and `isBoxedTupleTyCon`.

Reviewed By: austin

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

4 years agoAdd -n to the RTS help output
Simon Marlow [Thu, 26 Mar 2015 08:47:04 +0000 (08:47 +0000)] 
Add -n to the RTS help output

4 years agoAdd +RTS -O<size> to control the minimum old gen size
Simon Marlow [Tue, 24 Mar 2015 14:20:58 +0000 (14:20 +0000)] 
Add +RTS -O<size> to control the minimum old gen size

4 years agoReplace hooks by callbacks in RtsConfig (#8785)
Simon Marlow [Mon, 9 Jun 2014 08:18:12 +0000 (09:18 +0100)] 
Replace hooks by callbacks in RtsConfig (#8785)

Summary:
Hooks rely on static linking semantics, and are broken by -Bsymbolic
which we need when using dynamic linking.

Test Plan: Built it

Reviewers: austin, hvr, tibbe

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

4 years agofix typo
Javran Cheng [Mon, 6 Apr 2015 11:36:21 +0000 (13:36 +0200)] 
fix typo

[skip ci]

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

4 years agofix '&stg_interp_constr_entry' FFI type to be FunPtr
Sergei Trofimovich [Mon, 6 Apr 2015 10:16:30 +0000 (11:16 +0100)] 
fix '&stg_interp_constr_entry' FFI type to be FunPtr

Summary:
It used to be Ptr, which is slightly incorrect.
ia64 has different representations for those types.

Found when tried to build unregisterised ghc with -flto,
GCC's link-time optimisation which happens to check
data / code declaration inconsistencies.

It our case 'stg_interp_constr_entry' is an RTS function:
   StgFunPtr f (StgFunPtr)
while '"&f" :: Ptr()' produces
   StgWordArray f[];

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
Reviewers: simonmar, hvr, austin

Reviewed By: austin

Subscribers: thomie

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

4 years agoStop profiling output from running together (#8811)
Dave Laing [Mon, 6 Apr 2015 10:10:29 +0000 (12:10 +0200)] 
Stop profiling output from running together (#8811)

Reviewed By: thomie

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

4 years agoUser's guide: .a files can be 2-2.5x larger with -split-objs
Thomas Miedema [Mon, 6 Apr 2015 09:51:34 +0000 (11:51 +0200)] 
User's guide: .a files can be 2-2.5x larger with -split-objs

And remove warning. This feature is available through cabal even.

Reviewed By: austin

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

4 years agoTest case for #10246
Joachim Breitner [Mon, 6 Apr 2015 07:37:42 +0000 (09:37 +0200)] 
Test case for #10246

still marked known_broken. This also adds the test case for #10245,
which should pass once #10246 is fixed.

4 years agoCmmSwitch: Do not trip over a case with no (valid) branches
Joachim Breitner [Sun, 5 Apr 2015 20:50:42 +0000 (22:50 +0200)] 
CmmSwitch: Do not trip over a case with no (valid) branches

This fixes #10245. I did not commit the test case, as it fails
unconditionally with a compiler built with -DDEBUG, so maybe it is bogus
Haskell anyways.

4 years agoUpdate hsc2hs submodule
Reid Barton [Sun, 5 Apr 2015 19:59:14 +0000 (15:59 -0400)] 
Update hsc2hs submodule

4 years agoWhitespace only
Reid Barton [Sun, 5 Apr 2015 19:33:35 +0000 (15:33 -0400)] 
Whitespace only

4 years agotestsuite: skip T10017 on Windows
Austin Seipp [Fri, 3 Apr 2015 11:33:26 +0000 (06:33 -0500)] 
testsuite: skip T10017 on Windows

Signed-off-by: Austin Seipp <austin@well-typed.com>
4 years agorts/linker: make an error msg a debug msg
Austin Seipp [Fri, 3 Apr 2015 11:12:35 +0000 (06:12 -0500)] 
rts/linker: make an error msg a debug msg

This fixes more testsuite failures on Windows.

Signed-off-by: Austin Seipp <austin@well-typed.com>
4 years agotestsuite: fix failing amd64/Windows perf tests
Austin Seipp [Fri, 3 Apr 2015 10:59:57 +0000 (05:59 -0500)] 
testsuite: fix failing amd64/Windows perf tests

Signed-off-by: Austin Seipp <austin@well-typed.com>
4 years agoComments only, mostly typos
Thomas Miedema [Fri, 3 Apr 2015 15:58:53 +0000 (17:58 +0200)] 
Comments only, mostly typos

[skip ci]

4 years agoDon't `make accept` output of `expect_broken_for` tests
Thomas Miedema [Fri, 3 Apr 2015 12:01:15 +0000 (14:01 +0200)] 
Don't `make accept` output of `expect_broken_for` tests

This is a followup to d4cf7051bc17182238b17ba1dc42e190fa5c6f0d, which
did the same for `expect_broken` tests.

Reviewed By: austin

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

4 years agoRemove an incorrect statement about -fwarn-tabs
Dave Laing [Fri, 3 Apr 2015 05:49:38 +0000 (00:49 -0500)] 
Remove an incorrect statement about -fwarn-tabs

Reviewed By: austin

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

GHC Trac Issues: #10213

4 years agoData.Complex: Derive Generic
Ben Gamari [Fri, 3 Apr 2015 05:48:51 +0000 (00:48 -0500)] 
Data.Complex: Derive Generic

Reviewed By: hvr, austin

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

4 years agoparser: allow type-level cons in prefix position
Kinokkory [Fri, 3 Apr 2015 05:47:15 +0000 (00:47 -0500)] 
parser: allow type-level cons in prefix position

Reviewed By: austin

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

GHC Trac Issues: #10188

4 years agoRestore unwind information generation
Peter Wortmann [Fri, 3 Apr 2015 05:23:56 +0000 (00:23 -0500)] 
Restore unwind information generation

While we want to reduce the amount of information generated into
debug_info, it really doesn't make sense to remove block information
for unwinding.

This is a simple oversight introduced in 4ab57024, which severly
reduces the usefulness of generated unwind data. Thanks to bitonic
for spotting this!

Reviewed By: austin

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

GHC Trac Issues: #10236

4 years agodocs: remove unused -ddump flags from users guide
Javran Cheng [Fri, 3 Apr 2015 05:24:06 +0000 (00:24 -0500)] 
docs: remove unused -ddump flags from users guide

According to https://phabricator.haskell.org/rGHC6e771fa19dbb7edc116b5974124229a2725103e8

Reviewed By: austin

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

4 years agoclarify --no-as-needed is only needed on ELF
Peter Trommler [Fri, 3 Apr 2015 05:22:59 +0000 (00:22 -0500)] 
clarify --no-as-needed is only needed on ELF

From the code it was not clear that `--no-as-needed` was not necessary
on Windows. Add this fact and describe the fix for #10110 in a separate
note.

See audit for rGHC1b7f59769052fd8193c6acc561216e070d0ca335 raised
by @thomie.

Reviewed By: thomie

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

GHC Trac Issues: #10110

4 years agoFix validate linenumber off-by-one
Thomas Miedema [Thu, 2 Apr 2015 22:19:15 +0000 (00:19 +0200)] 
Fix validate linenumber off-by-one

4 years agolibffi: backport noexecstack fix for x86/win32.S
Sergei Trofimovich [Thu, 2 Apr 2015 21:02:57 +0000 (22:02 +0100)] 
libffi: backport noexecstack fix for x86/win32.S

Got detected by gentoo's QA preinstall hook:
 * RWX --- --- usr/lib/ghc-7.10.1/rts/libffi.so.6.0.2
 * RWX --- --- usr/lib/ghc-7.10.1/rts/libffi.so
 * RWX --- --- usr/lib/ghc-7.10.1/rts/libffi.so.6
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi.a:win32.o
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_p.a:win32.o
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_l.a:win32.o
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_debug.a:win32.o
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr.a:win32.o
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr_debug.a:win32.o
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr_l.a:win32.o
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr_p.a:win32.o

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
Test Plan: built ghc-7.10.1 binary and checked stacks as NX

Reviewers: rwbarton, hvr, austin

Reviewed By: austin

Subscribers: thomie

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

GHC Trac Issues: #10208

4 years agoChange 'Tab character' warnings so there is one per file (#9723)
Dave Laing [Thu, 2 Apr 2015 16:51:46 +0000 (18:51 +0200)] 
Change 'Tab character' warnings so there is one per file (#9723)

Reviewed By: nomeata, thomie

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

Signed-off-by: Dave Laing <dave.laing.80@gmail.com>
4 years agoDisable same warnings for normal builds as for validate (#10223)
Thomas Miedema [Thu, 2 Apr 2015 09:41:47 +0000 (11:41 +0200)] 
Disable same warnings for normal builds as for validate (#10223)

The default validate settings currently disable some warnings in the
libraries. This patch moves those settings to a new file called
`mk/warnings.mk`, and applies them also to normal builds.

Through uncommenting a line in build.mk, developers can now build with
-Werror.

-Werror is not the default, because:
* We can not guarantee that the build is warning free on platforms we
  don't run regularly run validate (as part of continuous integration
  systems), and we still want the build to go through on those
  platforms.
* quoting rwbarton on irc > "I think -Werror by default has come up in
  the past and the argument was that it is too annoying when you are
  doing nontrivial development"

Reviewed By: austin

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

4 years agoDo not set -fasm explicitly in build.mk.sample (#10223)
Thomas Miedema [Thu, 2 Apr 2015 09:39:54 +0000 (11:39 +0200)] 
Do not set -fasm explicitly in build.mk.sample (#10223)

On platforms that support -fasm, it is already the default, so we don't
have to set it.

Reviewed By: austin, erikd (tested on powerpc and armhf)

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

4 years agoFake (->) fixity declaration (#10145)
Oleg Grenrus [Thu, 2 Apr 2015 09:28:03 +0000 (11:28 +0200)] 
Fake (->) fixity declaration (#10145)

Reviewed By: simonpj, austin

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

4 years agoIndentation only.
Edward Z. Yang [Sun, 29 Mar 2015 05:34:32 +0000 (22:34 -0700)] 
Indentation only.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
4 years agoFilter out `-Rghc-timing` for V=0 builds (#10223)
Thomas Miedema [Wed, 1 Apr 2015 17:30:16 +0000 (19:30 +0200)] 
Filter out `-Rghc-timing` for V=0 builds (#10223)

Reviewed By: austin

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

4 years agoReformat build flavours in build.mk.sample (#10223)
Thomas Miedema [Wed, 1 Apr 2015 17:24:13 +0000 (19:24 +0200)] 
Reformat build flavours in build.mk.sample (#10223)

Use same format for each build flavour, to make it easier to compare
them. Refactoring only.

Reviewed By: austin

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

4 years agoChange which files --make thinks are 'Haskellish' (#10220)
Thomas Miedema [Wed, 1 Apr 2015 17:22:28 +0000 (19:22 +0200)] 
Change which files --make thinks are 'Haskellish' (#10220)

`.hspp` and `.hscpp` are haskell files that have already been preprocessed.

Treat `.hspp` and `.hscpp` as Haskellish sources again, as they were before
commit a10e1990. This way, ghc --make will load their imports.

Make sure that `.cmm` and `.cmmcpp` are still not treated as Haskellish,
by moving them out of `haskell_src_suffixes` (but still keeping them in
haskellish_suffixes, though I'm not sure what the purpose of that group
is).

Reviewed By: austin

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

4 years agoDon't `make accept` output of expect_broken tests
Thomas Miedema [Wed, 1 Apr 2015 15:28:39 +0000 (17:28 +0200)] 
Don't `make accept` output of expect_broken tests

When running `make accept` on a directory in the testsuite, don't accept
the output of tests that are marked as expect_broken. This makes it
easier to review `git diff` after running `make accept`.

When you change an error message in the compiler that shows up in the
output of many tests, you can run `make accept` in the testsuite
directory, and all expected test output will be updated. But since your
change didn't magically fix all the other bugs in the compiler for which
we have an expect_broken test, the output for those tests should
probably not be updated.

Before, the effect of running `make accept` could be that some tests
would end up in the 'unexpected passes' group.

[skip ci]

Reviewed By: austin

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

4 years agouBackpack: simplified Backpack description.
Edward Z. Yang [Tue, 24 Mar 2015 19:28:16 +0000 (12:28 -0700)] 
uBackpack: simplified Backpack description.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
4 years agoTestsuite: redirect stderr to /dev/null when running GS on bad.ps
Thomas Miedema [Tue, 31 Mar 2015 12:12:52 +0000 (14:12 +0200)] 
Testsuite: redirect stderr to /dev/null when running GS on bad.ps

This is a followup to a3d0a7a0ba3a1ee458a9883011247561dfe22f4a.

Reviewed by: Rufflewind

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

4 years agoDon't treat .hcr and .raw_s as haskellish suffixes
Thomas Miedema [Tue, 31 Mar 2015 10:15:34 +0000 (12:15 +0200)] 
Don't treat .hcr and .raw_s as haskellish suffixes

.hcr: external core
.raw_s: direct output from the c compiler, back in the day

Reviewed By: austin

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

4 years agoDon't throw exception when start_phase==stop_phase (#10219)
Thomas Miedema [Tue, 31 Mar 2015 10:12:24 +0000 (12:12 +0200)] 
Don't throw exception when start_phase==stop_phase (#10219)

Just do nothing instead. This bug only shows up when using `-x hspp` in
--make mode on registerised builds.

Reviewed By: austin

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

4 years agoExplicitly check for -C on registerised build (#7563)
Thomas Miedema [Tue, 31 Mar 2015 10:11:08 +0000 (12:11 +0200)] 
Explicitly check for -C on registerised build (#7563)

Show a more descriptive error message.

Reviewed By: austin

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

4 years agoTestsuite: suppress errors when running GS on bad.ps
Phil Ruffwind [Tue, 31 Mar 2015 10:04:50 +0000 (12:04 +0200)] 
Testsuite: suppress errors when running GS on bad.ps

Suppress the errors that appear in standard output when running gs on
bad.ps since it's expected to fail anyway.

Reviewed By: thomie, austin

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

4 years agoDrop old integer-gmp-0.5 from GHC source tree
Herbert Valerio Riedel [Sun, 29 Mar 2015 17:02:08 +0000 (19:02 +0200)] 
Drop old integer-gmp-0.5 from GHC source tree

This completes what c774b28f76ee4c220f7c1c9fd81585e0e3af0e8a (#9281)
started.  `integer-gmp-1.0` was added as an additional
`libraries/integer-gmp2` folder while retaining the ability to configure
GHC w/ the old `integer-gmp-0.5` to have a way back, and or the ability
to easily switch between old/new `integer-gmp` for benchmark/debugging
purposes.

This commit removes the old `libraries/integer-gmp` folder and moves
`libraries/integer-gmp2` into its place, while removing any mentions of
"gmp2" as well as the to support two different `integer-gmp` packages in
GHC's source-tree.

Reviewed By: austin

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

4 years agoAdd `integer-gmp` specific hint to build.mk.sample
Herbert Valerio Riedel [Tue, 31 Mar 2015 08:54:15 +0000 (10:54 +0200)] 
Add `integer-gmp` specific hint to build.mk.sample

[skip ci]

4 years agoSyntax check package-qualified imports (#9225)
Thomas Miedema [Mon, 30 Mar 2015 22:41:23 +0000 (00:41 +0200)] 
Syntax check package-qualified imports (#9225)

Version numbers are not allowed in the package name of a
package-qualified import.

Reviewed By: austin, ezyang

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

4 years agoDelete unused field `PipeEnv.pe_isHaskellishFile`
Thomas Miedema [Mon, 30 Mar 2015 21:05:16 +0000 (23:05 +0200)] 
Delete unused field `PipeEnv.pe_isHaskellishFile`

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

4 years agoRemove an unused include that doesn't exist on OS X (#10211)
Dave Laing [Mon, 30 Mar 2015 11:02:33 +0000 (13:02 +0200)] 
Remove an unused include that doesn't exist on OS X (#10211)

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

4 years agoRefactor the story around switches (#10137)
Joachim Breitner [Mon, 30 Mar 2015 08:20:14 +0000 (10:20 +0200)] 
Refactor the story around switches (#10137)

This re-implements the code generation for case expressions at the Stg →
Cmm level, both for data type cases as well as for integral literal
cases. (Cases on float are still treated as before).

The goal is to allow for fancier strategies in implementing them, for a
cleaner separation of the strategy from the gritty details of Cmm, and
to run this later than the Common Block Optimization, allowing for one
way to attack #10124. The new module CmmSwitch contains a number of
notes explaining this changes. For example, it creates larger
consecutive jump tables than the previous code, if possible.

nofib shows little significant overall improvement of runtime. The
rather large wobbling comes from changes in the code block order
(see #8082, not much we can do about it). But the decrease in code size
alone makes this worthwhile.

```
        Program           Size    Allocs   Runtime   Elapsed  TotalMem
            Min          -1.8%      0.0%     -6.1%     -6.1%     -2.9%
            Max          -0.7%     +0.0%     +5.6%     +5.7%     +7.8%
 Geometric Mean          -1.4%     -0.0%     -0.3%     -0.3%     +0.0%
```

Compilation time increases slightly:
```
        -1 s.d.                -----            -2.0%
        +1 s.d.                -----            +2.5%
        Average                -----            +0.3%
```

The test case T783 regresses a lot, but it is the only one exhibiting
any regression. The cause is the changed order of branches in an
if-then-else tree, which makes the hoople data flow analysis traverse
the blocks in a suboptimal order. Reverting that gets rid of this
regression, but has a consistent, if only very small (+0.2%), negative
effect on runtime. So I conclude that this test is an extreme outlier
and no reason to change the code.

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

4 years agoRenames some files to help with validation cleanup (#10212)
Dave Laing [Mon, 30 Mar 2015 07:21:13 +0000 (09:21 +0200)] 
Renames some files to help with validation cleanup (#10212)

Test Plan: validate twice

Reviewed by: thomie

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

4 years agoDoc typofix.
Edward Z. Yang [Sun, 29 Mar 2015 03:57:20 +0000 (20:57 -0700)] 
Doc typofix.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
4 years agoRename C(obj)cplusplus to C(obj)cxx
Thomas Miedema [Sat, 28 Mar 2015 00:27:59 +0000 (01:27 +0100)] 
Rename C(obj)cplusplus to C(obj)cxx

Reviewed By: kgardas

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

4 years agoRename driver phases C(obj)cpp to C(obj)cplusplus
Thomas Miedema [Fri, 27 Mar 2015 20:37:49 +0000 (21:37 +0100)] 
Rename driver phases C(obj)cpp to C(obj)cplusplus

Before:
Cpp     = Pre-process C
Ccpp    = Compile C++
Cobjcpp = Compile Objective-C++
CmmCpp  = Pre-process Cmm

Quite confusing! This commit renames `Ccpp` to `Ccplusplus`, and
`Cobjcpp` to `Cobjcplusplus`. The two letters `p-p` keep standing for
`pre-processing` throughout the compiler.

Reviewed By: austin

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

4 years agoUpdate list of primops that don't get wrappers (#10191)
Reid Barton [Fri, 27 Mar 2015 04:09:23 +0000 (00:09 -0400)] 
Update list of primops that don't get wrappers (#10191)

Summary:
The list was 14 years old, and there don't seem to be any problems
with seq# or par#; the other par*# primops were not actually
implemented at all and were removed in D758.

Test Plan:
validate; will also try to locally validate an unregisterised build
in case there was some truth to the deleted comment

Reviewers: austin

Subscribers: thomie

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

GHC Trac Issues: #10191

4 years agoRemove some unimplemented GranSim primops
Reid Barton [Fri, 27 Mar 2015 15:25:19 +0000 (11:25 -0400)] 
Remove some unimplemented GranSim primops

Summary:
An attempt to use these resulted in an error like:

[1 of 1] Compiling Main             ( p.hs, p.o )
ghc: panic! (the 'impossible' happened)
  (GHC version 7.8.4 for x86_64-unknown-linux):
emitPrimOp: can't translate PrimOp  parAt#{v}

Test Plan: validate

Reviewers: thomie, austin

Reviewed By: thomie, austin

Subscribers: thomie

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

4 years agoFix Git-commit-id detection for RELEASE=YES
Herbert Valerio Riedel [Thu, 26 Mar 2015 21:39:52 +0000 (22:39 +0100)] 
Fix Git-commit-id detection for RELEASE=YES

By mistake, the Git-commit-id detection was only enabled for
`RELEASE=NO` (since the date-based GHC version computation is
only active in that case). With this commit the commit-id
detection is active regardless of the `RELEASE`-setting.

This is a follow-up to 73e5e2f8bade2d8b2b1ecae958fe12d0b24591ef

4 years agoAdd Monad instance for `((,) a)` (#10190)
Fumiaki Kinoshita [Wed, 25 Mar 2015 04:30:25 +0000 (13:30 +0900)] 
Add Monad instance for `((,) a)` (#10190)

This was proposed a couple of times in the past, e.g.

 - https://mail.haskell.org/pipermail/libraries/2011-November/017153.html
 - https://mail.haskell.org/pipermail/libraries/2013-July/020446.html

but its implementation had been blocked by the fact that `Monoid` wasn't
in scope where the `Monad` class was defined. Since the AMP/FTP restructuring
this is no longer the case.

4 years agoMore comments (related to Trac #10180)
Simon Peyton Jones [Tue, 24 Mar 2015 13:52:20 +0000 (13:52 +0000)] 
More comments (related to Trac #10180)

4 years agoImprove environment handling in TcBinds
Simon Peyton Jones [Tue, 24 Mar 2015 12:52:29 +0000 (12:52 +0000)] 
Improve environment handling in TcBinds

This is a minor refactoring, but it simplifies the code quite a bit

* Decrease the number of variants of tcExtend in TcEnv
* Remove "not_actually_free" from TcEnv.tc_extend_local_env2
* Simplify plumbingof the "closed" flag
* Remove redundant scoping of wild-card variables