ghc.git
5 years agoUpdate to Unicode version 7.0
David Feuer [Tue, 21 Oct 2014 20:00:33 +0000 (15:00 -0500)] 
Update to Unicode version 7.0

Summary: Update Unicode data to version 7.0

Reviewers: rwbarton, austin

Reviewed By: austin

Subscribers: thomie, carter, ezyang, simonmar

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

5 years agoghc-prim: Use population count appropriate for platform
Ben Gamari [Tue, 21 Oct 2014 20:00:02 +0000 (15:00 -0500)] 
ghc-prim: Use population count appropriate for platform

Summary:
This #ifdef was previously x86-centric and consequently the 64-bit
implementation was chosen for ARM.

Reviewers: rwbarton, hvr, austin, tibbe

Reviewed By: hvr, austin, tibbe

Subscribers: hvr, thomie, carter, ezyang, simonmar

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

5 years agoUse objdump instead of nm to derive constants on OpenBSD
Austin Seipp [Tue, 21 Oct 2014 19:58:21 +0000 (14:58 -0500)] 
Use objdump instead of nm to derive constants on OpenBSD

Summary: OpenBSD's nm doesn't support the -P option and there appears to be no other way to get the desired information from it.

Reviewers: kgardas, #ghc, austin

Reviewed By: kgardas, #ghc, austin

Subscribers: austin, ggreif

Projects: #ghc

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

GHC Trac Issues: #9549

5 years agoUpdated testsuite/.gitignore to cover artifacts on Windows.
Gintautas Miliauskas [Tue, 21 Oct 2014 19:57:57 +0000 (14:57 -0500)] 
Updated testsuite/.gitignore to cover artifacts on Windows.

Test Plan: git status after a test run

Reviewers: austin

Reviewed By: austin

Subscribers: thomie, carter, ezyang, simonmar

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

GHC Trac Issues: #9679

5 years agoMake Applicative-Monad fixes for tests.
Geoffrey Mainland [Thu, 2 Oct 2014 21:39:34 +0000 (17:39 -0400)] 
Make Applicative-Monad fixes for tests.

5 years agoUpdate primitive, vector, and dph submodules.
Geoffrey Mainland [Thu, 28 Aug 2014 02:33:44 +0000 (22:33 -0400)] 
Update primitive, vector, and dph submodules.

5 years agoReify data family instances correctly.
Richard Eisenberg [Mon, 20 Oct 2014 19:36:57 +0000 (15:36 -0400)] 
Reify data family instances correctly.

Summary:
Fix #9692.

The reifier didn't account for the possibility that data/newtype
instances are sometimes eta-reduced. It now eta-expands as necessary.

Test Plan: th/T9692

Reviewers: simonpj, austin

Subscribers: thomie, carter, ezyang, simonmar

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

5 years agoClarify location of Note. Comment change only.
Richard Eisenberg [Mon, 20 Oct 2014 19:36:37 +0000 (15:36 -0400)] 
Clarify location of Note. Comment change only.

5 years agoTest #9692 in th/T9692
Richard Eisenberg [Mon, 20 Oct 2014 19:11:59 +0000 (15:11 -0400)] 
Test #9692 in th/T9692

5 years agoRevert "rts/PrimOps.cmm: follow '_static_closure' update"
Sergei Trofimovich [Tue, 21 Oct 2014 08:40:07 +0000 (09:40 +0100)] 
Revert "rts/PrimOps.cmm: follow '_static_closure' update"

This reverts commit eb191ab6c85f4b668a6e9151dcecaf1f1e7ec7c2.

Follows revert of STATIC_CLOSURE and restores UNREG build.

5 years agoUpdate Haddock submodule
Austin Seipp [Tue, 21 Oct 2014 01:08:14 +0000 (20:08 -0500)] 
Update Haddock submodule

As requested by Yuras Shumovich, this updates Haddock to include
.arcconfig and .arclint files, so diffs for GHC patches can go into
Phabricator.

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agoRevert "Place static closures in their own section."
Edward Z. Yang [Mon, 20 Oct 2014 23:03:50 +0000 (16:03 -0700)] 
Revert "Place static closures in their own section."

This reverts commit b23ba2a7d612c6b466521399b33fe9aacf5c4f75.

Conflicts:
compiler/cmm/PprCmmDecl.hs
compiler/nativeGen/PPC/Ppr.hs
compiler/nativeGen/SPARC/Ppr.hs
compiler/nativeGen/X86/Ppr.hs

5 years agoRevert "BC-breaking changes to C-- CLOSURE syntax."
Edward Z. Yang [Mon, 20 Oct 2014 23:01:45 +0000 (16:01 -0700)] 
Revert "BC-breaking changes to C-- CLOSURE syntax."

This reverts commit 3b5a840bba375c4c4c11ccfeb283f84c3a1ef22c.

5 years agoRevert "Properly generate info tables for static closures in C--."
Edward Z. Yang [Mon, 20 Oct 2014 23:01:39 +0000 (16:01 -0700)] 
Revert "Properly generate info tables for static closures in C--."

This reverts commit 178eb9060f369b216f3f401196e28eab4af5624d.

5 years agoRevert "Rename _closure to _static_closure, apply naming consistently."
Edward Z. Yang [Mon, 20 Oct 2014 22:57:13 +0000 (15:57 -0700)] 
Revert "Rename _closure to _static_closure, apply naming consistently."

This reverts commit 35672072b4091d6f0031417bc160c568f22d0469.

Conflicts:
compiler/main/DriverPipeline.hs

5 years agoRevert "Check for staticclosures section in Windows linker."
Edward Z. Yang [Mon, 20 Oct 2014 22:55:29 +0000 (15:55 -0700)] 
Revert "Check for staticclosures section in Windows linker."

This reverts commit 2fc0c6cf594731f343b4f8a5b3ecf9e72db4c3c0.

5 years agoRevert "Fix typo in section name: no leading period."
Edward Z. Yang [Mon, 20 Oct 2014 22:55:12 +0000 (15:55 -0700)] 
Revert "Fix typo in section name: no leading period."

This reverts commit e8dac6dc60beea863c3a5daded68f5157ab546fb.

5 years agoSync up `containers` submodule to latest `master`-tip
Herbert Valerio Riedel [Mon, 20 Oct 2014 09:38:27 +0000 (11:38 +0200)] 
Sync up `containers` submodule to latest `master`-tip

This updates `containers` to provide more specialised `Foldable`
instance methods, see also

  https://github.com/haskell/containers/issues/56

for more details.

5 years agoIndentation and non-semantic changes only.
Edward Z. Yang [Thu, 16 Oct 2014 05:51:59 +0000 (22:51 -0700)] 
Indentation and non-semantic changes only.

Summary:
Get these lines fitting in 80 columns, and replace ptext (sLit ...) with text

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

Reviewers: simonmar, austin

Subscribers: thomie, carter, ezyang, simonmar

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

5 years agoRefactor module imports in base
Herbert Valerio Riedel [Sun, 19 Oct 2014 12:15:14 +0000 (14:15 +0200)] 
Refactor module imports in base

This commit removes a couple of

  {-# OPTIONS_GHC -fno-warn-unused-imports #-}

by cleaning up the imports, as well as ensuring that all modules in the
GHC.* hierarchy avoid importing the `Prelude` module to clean-up the
import graph a bit.

5 years agoPython 3 support, second attempt (Trac #9184)
Krzysztof Gogolewski [Sun, 19 Oct 2014 11:41:24 +0000 (13:41 +0200)] 
Python 3 support, second attempt (Trac #9184)

Summary:
This is a fixup of https://phabricator.haskell.org/D233

The only difference is in findTFiles (first commit), which
previously broke Windows runner; now I translated literally
instead attempting to improve it, and checked it works.

Test Plan:
I used validate under 2,3 on Linux and under 2 on msys2.
On Windows I've seen a large number of failures, but they don't
seem to be connected with the patch.

Reviewers: hvr, simonmar, thomie, austin

Reviewed By: austin

Subscribers: thomie, carter, ezyang, simonmar

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

GHC Trac Issues: #9184

5 years agoRemove redundant explicit `Prelude` imports
Herbert Valerio Riedel [Sun, 19 Oct 2014 10:03:11 +0000 (12:03 +0200)] 
Remove redundant explicit `Prelude` imports

Since they're implied by the lack of `NoImplicitPrelude`

5 years agoGeneralise `Control.Monad.{foldM,foldM_}` to `Foldable` (#9586)
Herbert Valerio Riedel [Sat, 18 Oct 2014 15:01:11 +0000 (17:01 +0200)] 
Generalise `Control.Monad.{foldM,foldM_}` to `Foldable` (#9586)

With this change `Control.Monad.foldM` becomes an alias for
`Data.Foldable.foldlM`.

Reviewed By: austin, ekmett

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

5 years agoRemove obsolete Data.OldTypeable (#9639)
Michael Karg [Sat, 18 Oct 2014 13:50:48 +0000 (15:50 +0200)] 
Remove obsolete Data.OldTypeable (#9639)

This finally removes the `Data.OldTypeable` module (which
has been deprecated in 7.8), from `base`, compiler and testsuite.

The deprecated `Typeable{1..7}` aliases in `Data.Typeable` are not
removed yet in order to give existing code a bit more time to adapt.

Reviewed By: hvr, dreixel

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

5 years agoImplement optimized NCG `MO_Ctz W64` op for i386 (#9340)
Herbert Valerio Riedel [Sat, 18 Oct 2014 12:32:33 +0000 (14:32 +0200)] 
Implement optimized NCG `MO_Ctz W64` op for i386 (#9340)

Summary:
This is an optimization to the CTZ primops introduced for #9340

Previously we called out to `hs_ctz64`, but we can actually generate
better hand-tuned code while avoiding the FFI ccall.

With this patch, the code

  {-# LANGUAGE MagicHash #-}
  module TestClz0 where
  import GHC.Prim
  ctz64 :: Word64# -> Word#
  ctz64 x = ctz64# x

results in the following assembler generated by NCG on i386:

  TestClz.ctz64_info:
      movl (%ebp),%eax
      movl 4(%ebp),%ecx
      movl %ecx,%edx
      orl %eax,%edx
      movl $64,%edx
      je _nAO

      bsf %ecx,%ecx
      addl $32,%ecx
      bsf %eax,%eax
      cmovne %eax,%ecx
      movl %ecx,%edx
  _nAO:
      movl %edx,%esi
      addl $8,%ebp
      jmp *(%ebp)

For comparision, here's what LLVM 3.4 currently generates:

  000000fc <TestClzz_ctzz64_info>:
    fc:   0f bc 45 04             bsf    0x4(%ebp),%eax
   100:   b9 20 00 00 00          mov    $0x20,%ecx
   105:   0f 45 c8                cmovne %eax,%ecx
   108:   83 c1 20                add    $0x20,%ecx
   10b:   8b 45 00                mov    0x0(%ebp),%eax
   10e:   8b 55 08                mov    0x8(%ebp),%edx
   111:   0f bc f0                bsf    %eax,%esi
   114:   85 c0                   test   %eax,%eax
   116:   0f 44 f1                cmove  %ecx,%esi
   119:   83 c5 08                add    $0x8,%ebp
   11c:   ff e2                   jmp    *%edx

Reviewed By: austin

Auditors: simonmar

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

5 years agorts: fix unused parameter warning
Austin Seipp [Fri, 17 Oct 2014 16:58:07 +0000 (11:58 -0500)] 
rts: fix unused parameter warning

Summary:
If `pthread_setname_np` is not available, then a regular
./validate will fail due to warnings; the `name` parameter to
`createOSThread` becomes unused.

Signed-off-by: Austin Seipp <austin@well-typed.com>
Test Plan: iiam

Reviewers: simonmar, nomeata, jstolarek, hvr

Reviewed By: nomeata, jstolarek, hvr

Subscribers: nomeata, thomie, carter, ezyang, simonmar

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

5 years agoUpdate T6056 output
Joachim Breitner [Fri, 17 Oct 2014 14:54:22 +0000 (16:54 +0200)] 
Update T6056 output

according to travis (and proably Harbormaster), although I just cannot
reproduce it here.

5 years agoAvoid printing uniques in specialization rules
Joachim Breitner [Fri, 17 Oct 2014 09:09:16 +0000 (11:09 +0200)] 
Avoid printing uniques in specialization rules

Akio found an avoidable cause of non-determinisim: The names of RULES
generated by Specialise had uniques in them:
    "SPEC $cshowsPrec_a2QX @ [GHC.Types.Char]" [ALWAYS] forall ...
By using showSDocForUser instead of showSDocDump when building the rule
name, this is avoided:
    "SPEC $cshowsPrec @ [Char]" [ALWAYS] forall ...
See #4012, comments 61ff.

5 years agoDeclare official GitHub home of libraries/deepseq
Herbert Valerio Riedel [Thu, 16 Oct 2014 07:47:31 +0000 (09:47 +0200)] 
Declare official GitHub home of libraries/deepseq

Effective immediately, `deepseq` is maintained officially by the
core-library-comittee.  Moreover, pushing to libraries/deepseq requires
pushing to ssh://git@github.com/haskell/deepseq.git from now on.

[skip ci]

5 years agoMake tails a good producer (#9670)
David Feuer [Thu, 16 Oct 2014 07:44:25 +0000 (09:44 +0200)] 
Make tails a good producer (#9670)

Reviewed By: nomeata, austin
Differential Revision: https://phabricator.haskell.org/D325

5 years agoMake Data.List.Inits fast
David Feuer [Thu, 16 Oct 2014 07:42:27 +0000 (09:42 +0200)] 
Make Data.List.Inits fast

Fixes #9345. Use a modified banker's queue to achieve amortized optimal
performance for inits. The previous implementation was extremely slow.

Reviewed By: nomeata, ekmett, austin

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

5 years agoAdd a configure test for pthread_setname_np
Simon Marlow [Mon, 13 Oct 2014 17:30:30 +0000 (18:30 +0100)] 
Add a configure test for pthread_setname_np

5 years agoFix comment typos: lll -> ll, THe -> The
Jan Stolarek [Tue, 14 Oct 2014 12:38:16 +0000 (14:38 +0200)] 
Fix comment typos: lll -> ll, THe -> The

5 years agoActually put in new perf number for T4801
Joachim Breitner [Mon, 13 Oct 2014 21:33:45 +0000 (23:33 +0200)] 
Actually put in new perf number for T4801

which I just put it in comments. Thanks Yuras for noticing, and sorry
for the noise.

5 years agoT9675: Allow Much wider range of values
Joachim Breitner [Mon, 13 Oct 2014 17:20:44 +0000 (19:20 +0200)] 
T9675: Allow Much wider range of values

to include at least what’s observed on ghc-speed and my laptop, and
hopefully also Harbormaster.

5 years agoUpdate more performance numbers due to stricter seqDmdType
Joachim Breitner [Mon, 13 Oct 2014 14:37:15 +0000 (16:37 +0200)] 
Update more performance numbers due to stricter seqDmdType

including T9675 itself. Maybe its memory behaviour is too spiky for
max_bytes_used and peak_megabytes_allocated to be used sensibly at all.

5 years agoseqDmdType needs to seq the DmdEnv as well
Joachim Breitner [Mon, 13 Oct 2014 10:44:56 +0000 (12:44 +0200)] 
seqDmdType needs to seq the DmdEnv as well

otherwise this can retain large lazy calculations. This fixed one space
leak pointed out in #9675.

5 years agoAdjust T9675 baseline numbers based on ghc-speed
Joachim Breitner [Mon, 13 Oct 2014 11:49:55 +0000 (13:49 +0200)] 
Adjust T9675 baseline numbers based on ghc-speed

although I obtained them originally from a clean validate tree on my
laptop, they did not match what I found on the build bot host.

5 years agoCompiler performance benchmark for #9675
Joachim Breitner [Mon, 13 Oct 2014 09:27:17 +0000 (11:27 +0200)] 
Compiler performance benchmark for #9675

so that whoever improves the situation can feel good about it.

5 years agoUpdate `time` submodule to address linker issue
Herbert Valerio Riedel [Mon, 13 Oct 2014 07:56:28 +0000 (09:56 +0200)] 
Update `time` submodule to address linker issue

See also https://github.com/haskell/time/issues/2

However, while the `time-1.5` package now loads successful in GHCi,
the linker warnings as reported in #9297 occur (which let the
testsuite fail for a dozen of testcases due to this additional
output)

5 years agoFix build on some platforms
Simon Marlow [Sun, 12 Oct 2014 16:39:23 +0000 (17:39 +0100)] 
Fix build on some platforms

5 years agoRefactor to avoid need for `Unicode.hs-boot`
Herbert Valerio Riedel [Sat, 11 Oct 2014 10:35:28 +0000 (12:35 +0200)] 
Refactor to avoid need for `Unicode.hs-boot`

This avoids the import-cycle caused by the import of `Foreign.C.Types`
by using `Int` instead of `CInt` for the Unicode classification
functions. This refactoring also allows to remove a couple of
`fromIntegral`s.

Reviewed By: rwbarton, ekmett

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

5 years agoExtend windows detection in testsuite to recognize MSYS target
Gintautas Miliauskas [Wed, 17 Sep 2014 18:57:39 +0000 (20:57 +0200)] 
Extend windows detection in testsuite to recognize MSYS target

Currently, the detection recognizes the following `uname -s` strings:

 - `CYGWIN_NT-6.3`
 - `MINGW32_NT-6.3`
 - `MINGW64_NT_6.3`

However, MSYS2 provides an additional target, in which case `uname -s`
returns a string such as `MSYS_NT-6.3`. In all these cases, the system
ought to be recognized as being a `windows` os by the testsuite runner.

See also #9604

5 years agoFallback to `ctypes.cdll` if `ctypes.windll` unavailable
Gintautas Miliauskas [Wed, 17 Sep 2014 18:57:04 +0000 (20:57 +0200)] 
Fallback to `ctypes.cdll` if `ctypes.windll` unavailable

On Windows, we may be using a native build of Python or a mingw/msys build. The
former exports `ctypes.windll`, the latter exports `cdll`. Previously the code
threw an exception when using the msys Python because it expected `windll` to
always be available on Windows.

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

5 years agoRemove a few redundant `.hs-boot` files
Herbert Valerio Riedel [Fri, 10 Oct 2014 22:44:54 +0000 (00:44 +0200)] 
Remove a few redundant `.hs-boot` files

There don't seem to be any corresponding `{-# SOURCE #-}` for the removed
`.hs-boot`-files anymore (if there ever was any in the first place).

This also removes a commented out `{-# SOURCE #-}` import which turns up when
grepping the source for `{-# SOURCE #-}` occurences.

5 years agorts: don't crash on 'hs_init(NULL, NULL)' in debug rts
Sergei Trofimovich [Fri, 10 Oct 2014 20:43:30 +0000 (21:43 +0100)] 
rts: don't crash on 'hs_init(NULL, NULL)' in debug rts

Caught by T6006 as a NULL dereference:

  Command: ./T6006

  Invalid read of size 8
     at 0x660ED9: hs_init_ghc (RtsStartup.c:168)
     by 0x660D90: hs_init (RtsStartup.c:112)
     by 0x40504D: main (in /home/slyfox/dev/git/ghc-validate/testsuite/tests/rts/T6006)
   Address 0x0 is not stack'd, malloc'd or (recently) free'd

The regression was introduced by commit
cb0a503a44bf016de3d9042906c6ac0c0821ffea

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
5 years agoName worker threads using pthread_setname_np
Simon Marlow [Fri, 10 Oct 2014 13:26:19 +0000 (14:26 +0100)] 
Name worker threads using pthread_setname_np

This helps identify threads in gdb particularly in processes with a
lot of threads.

5 years agoRewrite section 1 of the Backpack manual. [skip ci]
Edward Z. Yang [Fri, 10 Oct 2014 07:01:57 +0000 (00:01 -0700)] 
Rewrite section 1 of the Backpack manual. [skip ci]

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
5 years agoUpdate haddock submodule with lazy IO fix.
Edward Z. Yang [Fri, 10 Oct 2014 04:40:41 +0000 (21:40 -0700)] 
Update haddock submodule with lazy IO fix.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
5 years agoIgnore exe files in base (from tests)
Edward Z. Yang [Fri, 3 Oct 2014 22:15:52 +0000 (15:15 -0700)] 
Ignore exe files in base (from tests)

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
5 years agoMake the linker more robust to errors
Simon Marlow [Wed, 1 Oct 2014 12:15:05 +0000 (13:15 +0100)] 
Make the linker more robust to errors

Summary:
When linking fails because there was a problem with the supplied
object file, then we should not barf() or exit, we should emit a
suitable error message and return an error code to the caller.  We
should also free all memory that might have been allocated during
linking, and generally not do any damage.  This patch fixes most
common instances of this problem.

Test Plan: validate

Reviewers: rwbarton, austin, ezyang

Reviewed By: ezyang

Subscribers: simonmar, ezyang, carter, thomie

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

5 years agoPreemptive performance number updates
Joachim Breitner [Wed, 8 Oct 2014 08:07:39 +0000 (10:07 +0200)] 
Preemptive performance number updates

5 years agoUpdate T4801 perf numbers
Joachim Breitner [Wed, 8 Oct 2014 07:41:35 +0000 (09:41 +0200)] 
Update T4801 perf numbers

5 years agoMake Data.List.takeWhile fuse: fix #9132
Joachim Breitner [Wed, 8 Oct 2014 06:53:26 +0000 (08:53 +0200)] 
Make Data.List.takeWhile fuse: fix #9132

Summary:
Rewrites takeWhile to a build/foldr form; fuses repeated
applications of takeWhile.

Reviewers: nomeata, austin

Reviewed By: nomeata

Subscribers: thomie, carter, ezyang, simonmar

Projects: #ghc

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

GHC Trac Issues: #9132

5 years agoUpdate some out-of-date things in Backpack implementation doc [skip ci]
Edward Z. Yang [Wed, 8 Oct 2014 05:38:48 +0000 (23:38 -0600)] 
Update some out-of-date things in Backpack implementation doc [skip ci]

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
5 years agoInitial commit of the Backpack manual [skip ci]
Edward Z. Yang [Wed, 8 Oct 2014 05:20:33 +0000 (23:20 -0600)] 
Initial commit of the Backpack manual [skip ci]

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
5 years agoUse Data.Map.mergeWithKey
Joachim Breitner [Tue, 7 Oct 2014 15:07:36 +0000 (17:07 +0200)] 
Use Data.Map.mergeWithKey

Summary: now that we can rely on having containers > 0.5.

Reviewers: austin

Subscribers: thomie, carter, ezyang, simonmar

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

5 years agoBump haddock.base perf numbers
Reid Barton [Tue, 7 Oct 2014 20:27:41 +0000 (16:27 -0400)] 
Bump haddock.base perf numbers

We were so close to the max that the test failed if the pathname to
the GHC repository was more than a few dozen characters, causing the
haddock.base test to fail on Phab but not locally.

5 years agotestsuite: T5486 requires integer-gmp internals
Sergei Trofimovich [Tue, 7 Oct 2014 20:49:19 +0000 (21:49 +0100)] 
testsuite: T5486 requires integer-gmp internals

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
5 years agoCode size micro-optimizations in the X86 backend
Reid Barton [Tue, 7 Oct 2014 13:24:15 +0000 (09:24 -0400)] 
Code size micro-optimizations in the X86 backend

Summary:
Carter Schonwald suggested looking for opportunities to replace
instructions in GHC's output by equivalent ones that are shorter,
as recommended by the Intel optimization manuals.

This patch reduces the module sizes as reported by nofib
by about 1.5% on x86_64.

Test Plan:
Built an i386 cross-compiler and ran the test suite; the same
(rather large) set of tests failed before and after this commit.
Will let Harbormaster validate on x86_64.

Reviewers: austin

Subscribers: thomie, carter, ezyang, simonmar

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

5 years agoMake scanl fuse; add scanl'
David Feuer [Tue, 7 Oct 2014 18:51:25 +0000 (20:51 +0200)] 
Make scanl fuse; add scanl'

Summary:
Make scanl a good producer and a good consumer for fold/build
fusion. Add strictly-accumulating scanl', which is required for
Data.List.inits.

Reviewers: nomeata, austin

Reviewed By: austin

Subscribers: spacekitteh, thomie, carter, ezyang, simonmar

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

GHC Trac Issues: #9356

5 years agoFix closing parenthesis
Matt Kraai [Tue, 7 Oct 2014 13:51:30 +0000 (08:51 -0500)] 
Fix closing parenthesis

Reviewers: rwbarton, austin

Reviewed By: rwbarton, austin

Subscribers: rwbarton, thomie, carter, ezyang, simonmar

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

5 years agoClean up and remove todo.
Joel Burget [Tue, 7 Oct 2014 13:51:13 +0000 (08:51 -0500)] 
Clean up and remove todo.

Summary:
The code is equivalent, just formatted nicely and without the
enthusiastic message to clean it up.

Test Plan: None

Reviewers: austin

Reviewed By: austin

Subscribers: simonmar, ezyang, carter, thomie

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

5 years agoconfigure in base: add msys to windows check
Yuras Shumovich [Tue, 7 Oct 2014 13:49:25 +0000 (08:49 -0500)] 
configure in base: add msys to windows check

Summary:
I'm building ghc on windows x86 under msys2, and found that libraries/base/configure isn't able to detect msys as windows platform.

I'm not 100% sure it is the right solution. Probably I have local misconfiguration somewhere. So feel free to reject.

Test Plan: not necessary

Reviewers: austin

Reviewed By: austin

Subscribers: simonmar, ezyang, carter, thomie

Projects: #ghc

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

5 years agoFix configure check for 9439 bug
Yuras Shumovich [Tue, 7 Oct 2014 13:49:13 +0000 (08:49 -0500)] 
Fix configure check for 9439 bug

Summary: We should escape path to ghc.On wondows usually ghc comes from HP, which is installed somewhere in "...\Haskell Platform\..." Note space in the middle.

Test Plan: not necessary

Reviewers: rwbarton, hvr, austin

Reviewed By: rwbarton, hvr, austin

Subscribers: rwbarton, simonmar, ezyang, carter, thomie

Projects: #ghc

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

5 years agoAdd support for LINE pragma in template-haskell
Eric Mertens [Tue, 7 Oct 2014 13:48:37 +0000 (08:48 -0500)] 
Add support for LINE pragma in template-haskell

Summary:
Provide a way to generate {-# LINE #-} pragmas when generating
Decs in Template Haskell. This allows more meaningful line
numbers to be reported in compile-time errors for dynamically
generated code.

Test Plan: Run test suite

Reviewers: austin, hvr

Reviewed By: austin

Subscribers: hvr, simonmar, ezyang, carter, thomie

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

5 years agoRemove unused hashName declaration
Jack Henahan [Tue, 7 Oct 2014 13:48:18 +0000 (08:48 -0500)] 
Remove unused hashName declaration

Summary:
With the exception of the todo added in 2012, this function has been
untouched since 2007. It is not used anywhere else in GHC, so it appears
to be safe to remove. The accompanying comment refers to hashExpr, which
I couldn't find anywhere in the sources, either.

Test Plan: Removed declaration and export. Compiler built succesfully. No test cases exist to fail, and no other module appears to use it.

Reviewers: thomie, austin

Reviewed By: thomie, austin

Subscribers: simonmar, ezyang, carter, thomie

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

5 years agoDelete __GLASGOW_HASKELL__ ifdefs for stage0 < 7.6.
Thomas Miedema [Tue, 7 Oct 2014 13:48:06 +0000 (08:48 -0500)] 
Delete __GLASGOW_HASKELL__ ifdefs for stage0 < 7.6.

Summary:
My understanding is that ghc 7.10 should be buildable with the last 3 versions
of ghc, i.e 7.6, 7.8 and 7.10 itself.

Test Plan: x

Reviewers: austin

Reviewed By: austin

Subscribers: hvr, simonmar, ezyang, carter, thomie

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

5 years agoRemove RAWCPP_FLAGS
Thomas Miedema [Tue, 7 Oct 2014 13:47:52 +0000 (08:47 -0500)] 
Remove RAWCPP_FLAGS

Summary:
#9094 mentions to "remove the RAW_CPP bits from the ghc build system because
they're not longer needed", "once the CPP settings ticket is merged #8683"

#8683 was merged with 34f7e9a3c99850859901ca74370f55f1d4e2279a, Phab:D26.

Test Plan: harbormaster

Reviewers: carter, austin

Reviewed By: austin

Subscribers: simonmar, ezyang, carter

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

GHC Trac Issues: #9094

5 years agoFix a typo in an error message
Gabor Greif [Tue, 7 Oct 2014 08:20:08 +0000 (10:20 +0200)] 
Fix a typo in an error message

5 years agoMerge branch 'master' of http://git.haskell.org/ghc
Simon Peyton Jones [Tue, 7 Oct 2014 07:03:58 +0000 (08:03 +0100)] 
Merge branch 'master' of git.haskell.org/ghc

5 years agoUse correct precedence when printing contexts with class operators
Simon Peyton Jones [Thu, 2 Oct 2014 16:47:21 +0000 (17:47 +0100)] 
Use correct precedence when printing contexts with class operators

Fixes Trac #9658

5 years agotestsuite: fix seward-space-leak build aganst Prelude/Main 'traverse' clash
Sergei Trofimovich [Mon, 6 Oct 2014 21:01:14 +0000 (22:01 +0100)] 
testsuite: fix seward-space-leak build aganst Prelude/Main 'traverse' clash

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
5 years agotestsuite: fix T1735_Help/State.hs build failure (AMP)
Sergei Trofimovich [Mon, 6 Oct 2014 20:55:02 +0000 (21:55 +0100)] 
testsuite: fix T1735_Help/State.hs build failure (AMP)

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
5 years agotestsuite: fix T5751 build failure (AMP)
Sergei Trofimovich [Mon, 6 Oct 2014 20:46:26 +0000 (21:46 +0100)] 
testsuite: fix T5751 build failure (AMP)

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
5 years agotestsuite: fix tcrun036 build against Prelude/Main 'traverse' clash
Sergei Trofimovich [Mon, 6 Oct 2014 20:43:42 +0000 (21:43 +0100)] 
testsuite: fix tcrun036 build against Prelude/Main 'traverse' clash

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
5 years agorts: unrust 'libbfd' debug symbols parser
Sergei Trofimovich [Sun, 5 Oct 2014 20:20:39 +0000 (21:20 +0100)] 
rts: unrust 'libbfd' debug symbols parser

Summary:
Patch does the following:
- fixes detection of working libbfd on modern linux
  platforms (where bfd_uncompress_section_contents is a macro)
- disables 'bfd' by default and adds '--enable-bfd-debug'
  configure option. As bfd's ABI is unstable
  the feature is primarily useful by ghc hackers.

Not done (subject for another patch):
- one-time bfd object memory leak in DEBUG_LoadSymbols
- in '-dynamic' mode debugging symbols are loaded only for
  current executable, not all libraries it is linked against.

Fixes Issue #8790

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Test Plan: built unregisterised ghc on amd64 and ran './hello +RTS -Di' there

Reviewers: simonmar, austin

Reviewed By: simonmar, austin

Subscribers: thomie, simonmar, ezyang, carter

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

GHC Trac Issues: #8790

5 years agoImplement `MIN_VERSION_GLASGOW_HASKELL()` macro
Herbert Valerio Riedel [Sun, 5 Oct 2014 20:35:22 +0000 (22:35 +0200)] 
Implement `MIN_VERSION_GLASGOW_HASKELL()` macro

This exposes the `cProjectPatchLevel{1,2}` value at the CPP level to
allow it to be used in CPP conditionals. Concretely, GHC 7.10.2.20150623
would result in

  #define __GLASGOW_HASKELL__             710
  #define __GLASGOW_HASKELL_PATCHLEVEL1__ 2
  #define __GLASGOW_HASKELL_PATCHLEVEL2__ 20150623

while GHC 7.10.3 results in

  #define __GLASGOW_HASKELL__             710
  #define __GLASGOW_HASKELL_PATCHLEVEL1__ 3

and finally GHC 7.9.20141009 results in

  #define __GLASGOW_HASKELL__             709
  #define __GLASGOW_HASKELL_PATCHLEVEL1__ 20141009

As it's error-prone to properly express CPP conditionals for testing GHC
multi-component versions, a new macro `MIN_VERSION_GLASGOW_HASKELL()` is
provided (also via the new CPP include file `ghcversion.h`)

Finally, in order to make it easier to define the new CPP macro
`MIN_VERSION_GLASGOW_HASKELL()`, a new default-included
`include/ghcversion.h` is used for the new CPP definitions.

Reviewed By: ekmett, austin, #ghc

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

5 years agoghc.mk: fix list for dll-split on GHCi-less builds
Sergei Trofimovich [Sat, 4 Oct 2014 19:48:22 +0000 (20:48 +0100)] 
ghc.mk: fix list for dll-split on GHCi-less builds

To reproduce build failure it's enough to try
to build GHC on amd64 with the following setup:

    $ cat mk/build.mk
    # for #9552
    GhcWithInterpreter = NO

It gives:

    Reachable modules from DynFlags out of date
    Please fix compiler/ghc.mk, or building DLLs on Windows may break (#7780)
    Redundant modules: Bitmap BlockId ... <list of 42 modules>
    <make error>

dll-split among other things makes sure
all mentioned modules are used by DynFlags.
'#ifdef GHCI' keeps is from happening.

Patch moves those 42 modules under
'GhcWithInterpreter' guard.

Fixes Issue #9552

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
5 years agoFix typo in section name: no leading period.
Edward Z. Yang [Fri, 3 Oct 2014 22:05:50 +0000 (15:05 -0700)] 
Fix typo in section name: no leading period.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
5 years agoCheck for staticclosures section in Windows linker.
Edward Z. Yang [Fri, 3 Oct 2014 21:12:51 +0000 (14:12 -0700)] 
Check for staticclosures section in Windows linker.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
5 years agoRestore spaces instead of tabs, caused by revert of Python 3
Krzysztof Gogolewski [Fri, 3 Oct 2014 17:56:00 +0000 (19:56 +0200)] 
Restore spaces instead of tabs, caused by revert of Python 3

The git hook does not allow to reinsert tabs.

5 years agoRevert "Basic Python 3 support for testsuite driver (Trac #9184)"
Krzysztof Gogolewski [Fri, 3 Oct 2014 17:18:38 +0000 (19:18 +0200)] 
Revert "Basic Python 3 support for testsuite driver (Trac #9184)"

This reverts commit 084d241b316bfa12e41fc34cae993ca276bf0730.

This is a possible culprit of Windows breakage reported at ghc-devs.

5 years agoComments only (instances for Proxy are lazy)
Reid Barton [Fri, 3 Oct 2014 13:02:45 +0000 (09:02 -0400)] 
Comments only (instances for Proxy are lazy)

5 years agoarclint: Don't complain about tabs unless it's inside the diff.
Edward Z. Yang [Thu, 2 Oct 2014 22:01:47 +0000 (15:01 -0700)] 
arclint: Don't complain about tabs unless it's inside the diff.

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

Test Plan: none

Reviewers: austin

Subscribers: simonmar, ezyang, carter, thomie

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

5 years agoReally fix dropWhileEndLE commit
Joachim Breitner [Thu, 2 Oct 2014 21:31:06 +0000 (23:31 +0200)] 
Really fix dropWhileEndLE commit

which I fixed before, but failed to pass -a to "git commit --amend"

5 years agorts/PrimOps.cmm: follow '_static_closure' update
Sergei Trofimovich [Thu, 2 Oct 2014 20:30:26 +0000 (21:30 +0100)] 
rts/PrimOps.cmm: follow '_static_closure' update

Caught by UNREG build failure:

      rts_dist_HC rts/dist/build/PrimOps.o
    /tmp/ghc8613_0/ghc8613_2.hc: In function 'cf8_entry':

    /tmp/ghc8613_0/ghc8613_2.hc:1942:13:
         error: 'base_ControlziExceptionziBase_nestedAtomically_static_closure' undeclared (first use in this function)
         R1.w = (W_)&base_ControlziExceptionziBase_nestedAtomically_static_closure;
                     ^

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
5 years agoUse dropWhileEndLE p instead of reverse . dropWhile p . reverse
David Feuer [Wed, 1 Oct 2014 21:34:29 +0000 (23:34 +0200)] 
Use dropWhileEndLE p instead of reverse . dropWhile p . reverse

Summary: Using `dropWhileEndLE` tends to be faster and easier to read
than the `reverse . dropWhile p . reverse` idiom. This also cleans up
some other, nearby, messes. Fix #9616 (incorrect number formatting
potentially leading to incorrect numbers in output).

Test Plan: Run validate

Reviewers: thomie, rwbarton, nomeata, austin

Reviewed By: nomeata, austin

Subscribers: simonmar, ezyang, carter, thomie

Projects: #ghc

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

GHC Trac Issues: #9623, #9616

Conflicts:
compiler/basicTypes/OccName.lhs

5 years agoRevert "Use dropWhileEndLE p instead of reverse . dropWhile p . reverse"
Austin Seipp [Thu, 2 Oct 2014 19:51:34 +0000 (14:51 -0500)] 
Revert "Use dropWhileEndLE p instead of reverse . dropWhile p . reverse"

This reverts commit 2a8856884de7d476e26b4ffa829ccb3a14d6f63e.

5 years agoRename _closure to _static_closure, apply naming consistently.
Edward Z. Yang [Mon, 26 Aug 2013 22:23:15 +0000 (15:23 -0700)] 
Rename _closure to _static_closure, apply naming consistently.

Summary:
In preparation for indirecting all references to closures,
we rename _closure to _static_closure to ensure any old code
will get an undefined symbol error.  In order to reference
a closure foobar_closure (which is now undefined), you should instead
use STATIC_CLOSURE(foobar).  For convenience, a number of these
old identifiers are macro'd.

Across C-- and C (Windows and otherwise), there were differing
conventions on whether or not foobar_closure or &foobar_closure
was the address of the closure.  Now, all foobar_closure references
are addresses, and no & is necessary.

CHARLIKE/INTLIKE were not changed, simply alpha-renamed.

Part of remove HEAP_ALLOCED patch set (#8199)

Depends on D265

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

Reviewers: simonmar, austin

Subscribers: simonmar, ezyang, carter, thomie

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

GHC Trac Issues: #8199

5 years agoProperly generate info tables for static closures in C--.
Edward Z. Yang [Thu, 29 Aug 2013 05:07:07 +0000 (22:07 -0700)] 
Properly generate info tables for static closures in C--.

Summary:
Previously, we assumed all objects declared in C-- were not-static, even
ones which were CONSTR_NOCAF_STATIC.  This used to be harmless, but now
we need this information to be correct.

Part of remove HEAP_ALLOCED patch set (#8199)

Depends on D264

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

Reviewers: simonmar, austin

Subscribers: simonmar, ezyang, carter, thomie

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

GHC Trac Issues: #8199

5 years agoBC-breaking changes to C-- CLOSURE syntax.
Edward Z. Yang [Mon, 26 Aug 2013 21:52:37 +0000 (14:52 -0700)] 
BC-breaking changes to C-- CLOSURE syntax.

Summary:
Previously, there were two variants of CLOSURE in C--:

    - Top-level CLOSURE(foo_closure, foo, lits...), which defines a new
      static closure and gives it a name, and

    - Array CLOSURE(foo, lits...), which was used for the static char
      and integer arrays.

They used the same name, were confusing, and didn't even generate
the correct internal label representation!  So now, we have two
new forms:

    - Top-level CLOSURE(foo, lits...) which automatically generates
      foo_closure (along with foo_info, which we were doing already)

    - Array ANONYMOUS_CLOSURE(foo, lits...) which doesn't generate
      a foo_closure identifier.

Part of remove HEAP_ALLOCED patch set (#8199)

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

Reviewers: simonmar, austin

Subscribers: simonmar, ezyang, carter, thomie

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

GHC Trac Issues: #8199

5 years agoPlace static closures in their own section.
Edward Z. Yang [Mon, 26 Aug 2013 20:34:15 +0000 (13:34 -0700)] 
Place static closures in their own section.

Summary:
The primary reason for doing this is assisting debuggability:
if static closures are all in the same section, they are
guaranteed to be adjacent to one another.  This will help
later when we add some code that takes section start/end and
uses this to sanity-check the sections.

Part of remove HEAP_ALLOCED patch set (#8199)

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

Reviewers: simonmar, austin

Subscribers: simonmar, ezyang, carter, thomie

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

GHC Trac Issues: #8199

5 years agoUse LinkerInternals.h for exitLinker.
Edward Z. Yang [Tue, 9 Sep 2014 19:03:48 +0000 (12:03 -0700)] 
Use LinkerInternals.h for exitLinker.

Part of remove HEAP_ALLOCED patch set (#8199)

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

Test Plan: validate

Reviewers: simonmar, austin

Subscribers: simonmar, ezyang, carter, thomie

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

GHC Trac Issues: #8199

5 years agoBasic Python 3 support for testsuite driver (Trac #9184)
Krzysztof Gogolewski [Wed, 1 Oct 2014 21:41:27 +0000 (23:41 +0200)] 
Basic Python 3 support for testsuite driver (Trac #9184)

Summary:
Most of the changes is adaptation of old Python 2 only code.
My priority was not breaking Python 2, and so I avoided bigger
changes to the driver. In particular, under Python 3 the output
is a str and buffering cannot be disabled.

To test, define PYTHON=python3 in testsuite/mk/boilerplate.mk.

Thanks to aspidites <emarshall85@gmail.com> who provided the initial patch.

Test Plan: validate under 2 and 3

Reviewers: hvr, simonmar, thomie, austin

Reviewed By: thomie, austin

Subscribers: aspidites, thomie, simonmar, ezyang, carter

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

GHC Trac Issues: #9184

5 years agoUse dropWhileEndLE p instead of reverse . dropWhile p . reverse
David Feuer [Wed, 1 Oct 2014 21:34:29 +0000 (23:34 +0200)] 
Use dropWhileEndLE p instead of reverse . dropWhile p . reverse

Summary: Using `dropWhileEndLE` tends to be faster and easier to read
than the `reverse . dropWhile p . reverse` idiom. This also cleans up
some other, nearby, messes. Fix #9616 (incorrect number formatting
potentially leading to incorrect numbers in output).

Test Plan: Run validate

Reviewers: thomie, rwbarton, nomeata, austin

Reviewed By: nomeata, austin

Subscribers: simonmar, ezyang, carter, thomie

Projects: #ghc

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

GHC Trac Issues: #9623, #9616

Conflicts:
compiler/basicTypes/OccName.lhs

5 years ago[ci skip] Kill unused count_bytes script
Austin Seipp [Wed, 1 Oct 2014 21:36:59 +0000 (16:36 -0500)] 
[ci skip] Kill unused count_bytes script

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years ago[ci skip] Kill tabs in md5.h
Austin Seipp [Wed, 1 Oct 2014 21:35:39 +0000 (16:35 -0500)] 
[ci skip] Kill tabs in md5.h

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years ago[ci skip] compiler: Kill last remaining tabs in CallArity
Austin Seipp [Wed, 1 Oct 2014 21:34:11 +0000 (16:34 -0500)] 
[ci skip] compiler: Kill last remaining tabs in CallArity

Signed-off-by: Austin Seipp <austin@well-typed.com>
5 years agorts/includes: Fix up .dir-locals.el
Austin Seipp [Wed, 1 Oct 2014 21:28:46 +0000 (16:28 -0500)] 
rts/includes: Fix up .dir-locals.el

After 23bb90460, these were slightly busted for `c-mode`.

Signed-off-by: Austin Seipp <austin@well-typed.com>