ghc.git
3 years agoTestsuite cleanup
Jan Stolarek [Fri, 11 Sep 2015 20:02:35 +0000 (22:02 +0200)] 
Testsuite cleanup

As a result of fixing #10836 it is now possible to merge 11 different
tests for #6018 into one

3 years agoImprove documentation of comprehensions
Simon Peyton Jones [Fri, 11 Sep 2015 16:02:58 +0000 (17:02 +0100)] 
Improve documentation of comprehensions

Suggestion from Jeremy Gibbons

3 years agoFix broken links in documentation
Simon Peyton Jones [Fri, 11 Sep 2015 16:01:33 +0000 (17:01 +0100)] 
Fix broken links in documentation

3 years agoImprove documentation for transform list-comps
Simon Peyton Jones [Fri, 11 Sep 2015 15:23:35 +0000 (16:23 +0100)] 
Improve documentation for transform list-comps

Thanks to Jeremy Gibbons for spotting the infelictity

3 years agoA CFunEqCan can be Derived
Simon Peyton Jones [Fri, 11 Sep 2015 15:23:06 +0000 (16:23 +0100)] 
A CFunEqCan can be Derived

This fixes the ASSERTION failures in
  indexed-types/should_fail/T5439
  typecheck/should_fail/T5490
when GHC is compiled with -DDEBUG

See Phab:D202 attached to Trac #6018

3 years agoAdd a test for Trac #10806
Simon Peyton Jones [Fri, 11 Sep 2015 14:55:29 +0000 (15:55 +0100)] 
Add a test for Trac #10806

3 years agoImprove rejigConRes (again)
Simon Peyton Jones [Fri, 11 Sep 2015 14:54:39 +0000 (15:54 +0100)] 
Improve rejigConRes (again)

I think this patch finally works around the delicacy in the strictness
of TcTyClsDecls.rejigConRes.   See the notes with that function and
Note [Checking GADT return types].

As a result, we fix Trac #10836, and improve Trac #7175

3 years agoComments on oneShot
Simon Peyton Jones [Thu, 27 Aug 2015 15:23:46 +0000 (16:23 +0100)] 
Comments on oneShot

3 years agoDon't check in autogenerated hs files for recomp013.
Edward Z. Yang [Thu, 10 Sep 2015 05:02:48 +0000 (22:02 -0700)] 
Don't check in autogenerated hs files for recomp013.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
3 years agoTestsuite: comment out `setnumcapabilities001` (#10860)
Thomas Miedema [Wed, 9 Sep 2015 11:56:53 +0000 (13:56 +0200)] 
Testsuite: comment out `setnumcapabilities001` (#10860)

Don't mark it expect_broken, because it fails only sometimes.

3 years agoForbid annotations when Safe Haskell safe mode is enabled.
David Kraeutmann [Tue, 8 Sep 2015 16:35:33 +0000 (11:35 -0500)] 
Forbid annotations when Safe Haskell safe mode is enabled.

For now, this fails compliation immediately with an error. If desired, this
can be a warning that annotations in Safe Haskell are ignored.

Signed-off-by: David Kraeutmann <kane@kane.cx>
Reviewed By: goldfire, austin

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

GHC Trac Issues: #10826

3 years agoHeapStackCheck: Small refactoring
Ben Gamari [Tue, 8 Sep 2015 16:30:43 +0000 (11:30 -0500)] 
HeapStackCheck: Small refactoring

Use modern Cmm argument syntax in stg_block_blackhole definition.

Reviewed By: simonmar, austin

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

3 years agoBuild system: check for inconsistent settings (#10157)
Thomas Miedema [Tue, 8 Sep 2015 11:51:44 +0000 (13:51 +0200)] 
Build system: check for inconsistent settings (#10157)

`configure` currently detects when the docbook and hscolour tools aren't
available, and instead of failing outright (as it does for missing alex
and happy), sets some variables in mk/config.mk to tell `make` not to
build the documentation.

Sometimes, however, you want to really make sure all documentation gets
built, fully colourized. For example when making a release. To do so,
you can override the mentioned variables from mk/config.mk in
mk/build.mk (e.g. set HSCOLOUR_SRCS=YES).

This patch adds some error checking to make sure that doing so will not
result in weird build failures when those tools are still missing.

Test Plan: ran `make` a couple of times, with different mk/config.mk settings.

Reviewed by: austin

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

3 years agoMove GeneralCategory et al to GHC.Unicode
Ben Gamari [Tue, 8 Sep 2015 13:38:40 +0000 (08:38 -0500)] 
Move GeneralCategory et al to GHC.Unicode

This allows these to be used from Text.Read.Lex import cycles.

Reviewed By: thomie, austin

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

GHC Trac Issues: #10444

3 years agoBuild system: cleanup BUILD_DIRS + add lots of Notes
Thomas Miedema [Fri, 10 Jul 2015 22:50:58 +0000 (00:50 +0200)] 
Build system: cleanup BUILD_DIRS + add lots of Notes

Summary:
See Note [CrossCompiling vs Stage1Only] in mk/config.mk.in.
See Note [Stage1Only vs stage=1] in mk/config.mk.in.
See Note [No stage2 packages when CrossCompiling or Stage1Only].

Also:
  * use stage2 to build mkUserGuidePart, as was probably intended.
    Now the following represent the same set of packages:
    - packages that we build with ghc-stage2
    - packages that depend on the ghc library
    Those packages are: haddock, mkUserGuidePart and ghctags.
  * don't let utils that don't depend on the ghc library depend on its
    package-data.mk file. Instead, let those utils directly depend on
    the package-data.mk files of the stage1 packages. Not sure if it
    improves anything, but I found it easier to explain what's going on
    this way.

(partially) reviewed by: austin

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

3 years agoBuild system: make *-cross BuildFlavours consistent (#10223)
Thomas Miedema [Tue, 25 Aug 2015 17:20:39 +0000 (19:20 +0200)] 
Build system: make *-cross BuildFlavours consistent (#10223)

This is a follow up to 841924c9587c10488a18e307b573720977bf4f13,
where `-fllvm` was explicitly removed from GhcStage1HcOpts for
perf-cross.

After removing -fllvm from GhcStage1HcOpts, it should be removed from
SRC_HC_OPTS as well, because SRC_HC_OPTS are added to every Haskell
compilation. That's what this patch does.

BuildFlavour bench-cross (added in ddf79ebf69fe4a6e69d69d451a6040a53b1ea12c),
is probably never used. But for consistency, also use -fllvm here, for
building stage2 and the libraries.

Reviewed by: austin

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

3 years agoBuild system: delete the InstallExtraPackages variable
Thomas Miedema [Tue, 25 Aug 2015 15:30:18 +0000 (17:30 +0200)] 
Build system: delete the InstallExtraPackages variable

Just install all packages that are built. Don't make an exception for
the dph and extra packages.

You can control whether the dph and extra packages should be build using
the variables BUILD_DPH and BUILD_EXTRA_PKGS. These variables didn't
exist before. But now that they do, InstallExtraPackages isn't really
needed anymore.

Reviewed by: austin

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

3 years agoBuild system: remove hack for Mac OSX in configure.ac (#10476)
Thomas Miedema [Mon, 7 Sep 2015 13:58:33 +0000 (15:58 +0200)] 
Build system: remove hack for Mac OSX in configure.ac (#10476)

Cross-compilation on Mac OSX currently doesn't work. While building
stage 1, the build system uses the `ar` for the target architecture
instead of the `ar` for build/host architecture.

The cause is a hack added in 24746fe78024a1edab843bc710c79c55998ab134
(2010), to supporting bootstrap compilers built with older versions of
Xcode. Xcode 4.3 started installing command line tools in a different
location. Assuming this all behind us now, and the paths didn't change
again (you never now), we can delete the hack.

Deleting the hack fixes the cross compilation issue. Tested by Trac user
jakzale.

Reviewed by: austin

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

3 years agoBuild system: detect when user cloned from GitHub
Thomas Miedema [Mon, 7 Sep 2015 13:28:30 +0000 (15:28 +0200)] 
Build system: detect when user cloned from GitHub

Cloning the ghc repository from GitHub doesn't work out of the box. It
requires installing some special url rewrites into ~/.gitconfig. The
build fails mysteriously if you forget. This patch tries to detect when
you cloned from GitHub, and warns you if you didn't set those url
rewrites.

This hopefully lowers to barrier to contribute to GHC by a tiny bit. At
least one /r/haskell user ran into this recently.

Test Plan:
cloned from github, ran ./boot, saw the message. Installed url
rewrites, and ran ./boot again, didn't see the message.

Reviewed by: austin

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

3 years agoFurther simplify the story around minimum/maximum
Joachim Breitner [Mon, 7 Sep 2015 11:48:10 +0000 (13:48 +0200)] 
Further simplify the story around minimum/maximum

After I have found out that I should look at -ddump-prep and not
-ddump-core, I noticed that these days, GHC is perfectly capeable of
turning (the equivalent) of foldl to (the equivalent) of foldl' if the
operation in question is strict. So instead of using rewrite rules to
rewrite maximum to a strictMaximum for certain types, we simply use
SPECIALIZE.

This also marks maximum/minimum as INLINEABLE, so that client code can
get similar specializations, hopefully even automatically. And inded,
minimum applied to [Double] produces good code (although due to
inlineing, not due to specialization, it seems).

I checked (by looking at the core) that this still fixes #10788.

Differential revision: https://phabricator.haskell.org/D1229

3 years agoSPECIALIZE strictMinimum for Int and Integer
Joachim Breitner [Mon, 7 Sep 2015 11:19:50 +0000 (13:19 +0200)] 
SPECIALIZE strictMinimum for Int and Integer

This fixes a regression reported in #10788, where due to less inlining
compared to earlier versions, we’d get worse code. With the SPECIALIZE,
we get the good code, and moreover, the good code is in List.hs and
_not_ inlined to the use site, so smaller code size and less compilation
time.

3 years agoBuild system: cleanup utils/ghc-pkg/ghc.mk
Thomas Miedema [Thu, 9 Jul 2015 23:02:31 +0000 (01:02 +0200)] 
Build system: cleanup utils/ghc-pkg/ghc.mk

There used to be a lot of custom make code to build ghc-pkg with the
stage0 compiler. Commit ac5a314504554ddef0e855ef9e2fcf51e961f4a6
thankfully cleaned this up, by using the build settings from the
ghc-pkg.cabal file.

This commit removes some remains of the old way of installing ghc-pkg
when Stage1Only=YES. Notably, we called both `build-prog` as
`shell-wrapper`. This is surely wrong, because `build-prog` already
calls `shell-wrapper`. It isn't needed to set WANT_INSTALLED_WRAPPER
either; build-prog does that for us.

This prevents the following warnings when Stage1Only=YES:
  utils/ghc-pkg/ghc.mk:46: warning:
    overriding commands for target `install_utils/ghc-pkg_dist_wrapper'
  utils/ghc-pkg/ghc.mk:37: warning:
    ignoring old commands for target `install_utils/ghc-pkg_dist_wrapper'

Also add more comments and restructure a bit.

Reviewed by: austin

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

3 years agoBuild system: simplify *-llvm BuildFlavours (#10223)
Thomas Miedema [Tue, 25 Aug 2015 15:49:32 +0000 (17:49 +0200)] 
Build system: simplify *-llvm BuildFlavours (#10223)

Note that SRC_HC_OPTS are added to every Haskell compilation. So
there isn't any need to also add `-fllvm` to GhcStage1HcOpts,
GhcStage2HcOpts and GhcLibHcOpts.

Small bug fix: make sure we test for -fllvm in SRC_HC_OPTS, to check
whether the bootstrap compiler is affected by bug #9439.

Reviewed by: austin

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

3 years agoBuild system: put each BuildFlavour in a separate file (#10223)
Thomas Miedema [Mon, 31 Aug 2015 12:39:47 +0000 (14:39 +0200)] 
Build system: put each BuildFlavour in a separate file (#10223)

This allows easier diffing of different BuildFlavours, including
`mk/flavours/validate.mk`.

Reviewed By: bgamari, austin

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

3 years agotracing: Kill EVENT_STARTUP
Ben Gamari [Mon, 31 Aug 2015 20:39:13 +0000 (22:39 +0200)] 
tracing: Kill EVENT_STARTUP

This has been unnecessary for quite some time due to the create/delete
capability events.

3 years agoEventLog: Factor out ensureRoomFor*Event
Ben Gamari [Mon, 31 Aug 2015 20:00:10 +0000 (22:00 +0200)] 
EventLog: Factor out ensureRoomFor*Event

3 years agouser-guide: Add missing <para> tags around <listitem> body
Ben Gamari [Fri, 4 Sep 2015 16:49:23 +0000 (18:49 +0200)] 
user-guide: Add missing <para> tags around <listitem> body

Otherwise this is ill-formed DocBook

3 years agoghc-pkg: don't print ignored errors when verbosity=0
Thomas Miedema [Fri, 4 Sep 2015 14:59:44 +0000 (16:59 +0200)] 
ghc-pkg: don't print ignored errors when verbosity=0

Lines like the following are filling up the build logs:

  binary-0.7.5.0: cannot find any of
  ["Data/Binary.hi","Data/Binary.p_hi","Data/Binary.dyn_hi"] (ignoring)

3 years agoBuild system: implement `make install-strip` (#1851)
Thomas Miedema [Sat, 15 Aug 2015 15:45:57 +0000 (17:45 +0200)] 
Build system: implement `make install-strip` (#1851)

Reviewed by: bgamari

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

3 years agoFix T6018th test failure
Jan Stolarek [Fri, 4 Sep 2015 03:15:06 +0000 (05:15 +0200)] 
Fix T6018th test failure

3 years agoMake Data.List.foldr1 inline
Joachim Breitner [Wed, 2 Sep 2015 22:58:38 +0000 (15:58 -0700)] 
Make Data.List.foldr1 inline

Previously, foldr1 would be defiend recursively and thus not inline.
This is bad, for example, when maximumBy has a strict comparison
function: Before the BBP, it was implemented via foldl1, which inlined
and yielded good code. With BBP, it goes via foldr1, so we better inline
this as well. Fixes #10830.

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

3 years agoTestsuite: ignore line number differences in call stacks (#10834)
Thomas Miedema [Thu, 3 Sep 2015 12:56:50 +0000 (14:56 +0200)] 
Testsuite: ignore line number differences in call stacks (#10834)

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

3 years agoTestsuite: only print msg when timeout kills process unexpectedly
Thomas Miedema [Thu, 3 Sep 2015 14:13:42 +0000 (16:13 +0200)] 
Testsuite: only print msg when timeout kills process unexpectedly

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

3 years agoTestsuite: fix tcfail220 - Maybe is wired-in now
Thomas Miedema [Thu, 3 Sep 2015 15:01:10 +0000 (17:01 +0200)] 
Testsuite: fix tcfail220 - Maybe is wired-in now

This fixes validate.

374457809de343f409fbeea0a885877947a133a2 (D202) mentions: "This patch
also wires-in Maybe data type".

A conflicting definition of a wired-in type in a .hsig file doesn't seem
to cause compilation to fail. This is probably a bug, but a small one.
Since SPJ in ffc21506894c7887d3620423aaf86bc6113a1071 swept this under
the rug, by removing `data Bool a b c d = False` from tcfail220.hsig,
I'm going to do the same here.

D1098 touches these files, so ezyang can decide whether this problem
warrants fixing when doing a rebase.

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

3 years agoAccept underscores in the module parser. (Thanks spinda for the fix.)
Edward Z. Yang [Thu, 3 Sep 2015 21:16:03 +0000 (14:16 -0700)] 
Accept underscores in the module parser. (Thanks spinda for the fix.)

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
3 years agoAdd test for T10836 (expected broken)
Jan Stolarek [Thu, 3 Sep 2015 17:28:44 +0000 (19:28 +0200)] 
Add test for T10836 (expected broken)

3 years agoInjective type families
Jan Stolarek [Fri, 11 Jul 2014 11:54:45 +0000 (13:54 +0200)] 
Injective type families

For details see #6018, Phab:D202 and the wiki page:

https://ghc.haskell.org/trac/ghc/wiki/InjectiveTypeFamilies

This patch also wires-in Maybe data type and updates haddock submodule.

Test Plan: ./validate

Reviewers: simonpj, goldfire, austin, bgamari

Subscribers: mpickering, bgamari, alanz, thomie, goldfire, simonmar,
             carter

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

GHC Trac Issues: #6018

3 years agoTestsuite: delete dead code
Thomas Miedema [Thu, 27 Aug 2015 23:00:31 +0000 (01:00 +0200)] 
Testsuite: delete dead code

3 years agoTestsuite: by default run all tests for a single way
Thomas Miedema [Thu, 27 Aug 2015 10:44:15 +0000 (12:44 +0200)] 
Testsuite: by default run all tests for a single way

`make test` now runs all tests for a single way only. Use `make slowtest` to
get the previous behaviour (i.e. run all tests for all ways).

The intention is to use this new `make test` setting for Phabricator, as
a reasonable compromise between `make fasttest` (what it previously
used) and a fullblown `make slowtest` (which runs all tests for all
ways).

See Note [validate and testsuite speed] in toplevel Makefile.

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

3 years agoFix some tests that were broken by D861
Eric Seidel [Wed, 2 Sep 2015 18:17:01 +0000 (20:17 +0200)] 
Fix some tests that were broken by D861

I didn't realize that `./validate` does not run every test :(

Test Plan: ./validate --slow

Update submodule hpc.

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

3 years agoTestsuite: mark 4 tests expect_broken_for(#10712, opt_ways)
Thomas Miedema [Wed, 2 Sep 2015 16:49:25 +0000 (18:49 +0200)] 
Testsuite: mark 4 tests expect_broken_for(#10712, opt_ways)

Please revert when #10712 is fixed.

3 years agoTestsuite: update expected output
Thomas Miedema [Wed, 2 Sep 2015 16:30:07 +0000 (18:30 +0200)] 
Testsuite: update expected output

3 years agoTestsuite: don't warn about missing specialisations
Thomas Miedema [Wed, 2 Sep 2015 13:45:57 +0000 (15:45 +0200)] 
Testsuite: don't warn about missing specialisations

They can only occur with `-O`, but we want tests to produce the same
output for all test ways.

This brings us closer to passing the complete testsuite.

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

3 years agostm: Fix test case
Ben Gamari [Wed, 2 Sep 2015 13:34:56 +0000 (09:34 -0400)] 
stm: Fix test case

Updates stm submodule.

3 years agoImprove the error messages for class instance errors
Simon Peyton Jones [Wed, 2 Sep 2015 12:05:36 +0000 (14:05 +0200)] 
Improve the error messages for class instance errors

Summary: See Note [Displaying potential instances].

Reviewers: austin

Subscribers: KaneTW, thomie

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

3 years agoExpand declaration QQs first (#10047)
Michael Smith [Wed, 2 Sep 2015 11:57:44 +0000 (13:57 +0200)] 
Expand declaration QQs first (#10047)

Declaration QuasiQuoters do not cause a group split like $(...)
splices, and are run and expanded before other declarations in
the group.

Resolves the lingering issue with #10047, and fixes broken tests
qq007 and qq008.

Test Plan: validate

Reviewers: goldfire, austin, bgamari

Reviewed By: bgamari

Subscribers: goldfire, simonpj, thomie, spinda

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

GHC Trac Issues: #10047

3 years agoAllow annotations though addTopDecls (#10486)
Michael Smith [Wed, 2 Sep 2015 11:56:27 +0000 (13:56 +0200)] 
Allow annotations though addTopDecls (#10486)

addTopDecls restricts what declarations it can be used to add. Adding
annotations via this method works fine with no special changes apart
from adding AnnD to the declaration whitelist.

Test Plan: validate

Reviewers: austin, goldfire, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #10486

3 years agoUse a response file for linker command line arguments #10777
Michael Snoyman [Wed, 2 Sep 2015 11:31:25 +0000 (13:31 +0200)] 
Use a response file for linker command line arguments #10777

On Windows, we're constrained to 32k bytes total for command line
arguments.  When building large projects, this limit can be exceeded.
This patch changes GHC to always use response files for linker
arguments, a feature first used by Microsoft compilers and added to GCC
(over a decade ago).

Alternatives here include:

* Only use this method on Windows systems
* Check the length of the command line arguments and use that to decide
  whether to use this method

I did not pursue either of these, as I believe it would make the patch
more likely to break in less tested situations.

Test Plan:
Confirm that linking still works in general. Ideally: compile a very
large project on Windows with this patch. (I am attempting to do that
myself now, but having trouble getting the Windows build tool chain up
and running.)

Reviewers: goldfire, hvr, rwbarton, austin, thomie, bgamari, Phyx

Reviewed By: thomie, bgamari, Phyx

Subscribers: erikd, awson, #ghc_windows_task_force, thomie

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

GHC Trac Issues: #8596, #10777

3 years agoAdd test for updating a record with existentially quantified fields.
Matthew Pickering [Wed, 2 Sep 2015 11:28:34 +0000 (13:28 +0200)] 
Add test for updating a record with existentially quantified fields.

Test Plan: ./validate

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

3 years agoFix trac #10413
Ben Gamari [Wed, 2 Sep 2015 11:26:22 +0000 (13:26 +0200)] 
Fix trac #10413

Test Plan: Validate.

Reviewers: austin, tibbe, bgamari

Reviewed By: tibbe, bgamari

Subscribers: thomie

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

GHC Trac Issues: #10413

3 years agoUse IP based CallStack in error and undefined
Eric Seidel [Wed, 2 Sep 2015 08:22:01 +0000 (10:22 +0200)] 
Use IP based CallStack in error and undefined

This patch modifies `error`, `undefined`, and `assertError` to use
implicit call-stacks to provide better error messages to users.

There are a few knock-on effects:

- `GHC.Classes.IP` is now wired-in so it can be used in the wired-in
  types for `error` and `undefined`.

- `TysPrim.tyVarList` has been replaced with a new function
  `TysPrim.mkTemplateTyVars`. `tyVarList` made it easy to introduce
  subtle bugs when you need tyvars of different kinds. The naive

  ```
  tv1 = head $ tyVarList kind1
  tv2 = head $ tyVarList kind2
  ```

  would result in `tv1` and `tv2` sharing a `Unique`, thus substitutions
  would be applied incorrectly, treating `tv1` and `tv2` as the same
  tyvar. `mkTemplateTyVars` avoids this pitfall by taking a list of kinds
  and producing a single tyvar of each kind.

- The types `GHC.SrcLoc.SrcLoc` and `GHC.Stack.CallStack` now live in
  ghc-prim.

- The type `GHC.Exception.ErrorCall` has a new constructor
  `ErrorCallWithLocation` that takes two `String`s instead of one, the
  2nd one being arbitrary metadata about the error (but usually the
  call-stack). A bi-directional pattern synonym `ErrorCall` continues to
  provide the old API.

Updates Cabal, array, and haddock submodules.

Reviewers: nh2, goldfire, simonpj, hvr, rwbarton, austin, bgamari

Reviewed By: simonpj

Subscribers: rwbarton, rodlogic, goldfire, maoe, simonmar, carter,
liyang, bgamari, thomie

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

GHC Trac Issues: #5273

3 years agoTestsuite: refactoring only
Thomas Miedema [Fri, 28 Aug 2015 10:03:30 +0000 (12:03 +0200)] 
Testsuite: refactoring only

* Rename `platform_wordsize_qualify` to `find_expected_file`, and make
  it return a filename instead of an (absolute) filepath.

* Replace most usages of `qualify` by `in_testdir`. Others usage sites
  will be deleted in a later commit.

These changes will be useful in a later commit, when we'll distinguish
between files in the source directory and those in a (newly created)
test directory.

Reviewed by: austin, bgamari

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

3 years agoAnchor type family instances deterministically
Bartosz Nitka [Mon, 31 Aug 2015 15:10:34 +0000 (16:10 +0100)] 
Anchor type family instances deterministically

Summary:
This is very similar to D1073. It makes type family instances to be
attached to a binding with a least `OccName`, therefore not depending on `Unique` ordering.

Test Plan:
* this makes `Language.Haskell.Exts.SrcLoc` deterministic
* ./validate

Reviewers: simonmar, austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: thomie

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

GHC Trac Issues: #4012

3 years agoFix typo in pattern synonym documentation.
Matthew Pickering [Sun, 30 Aug 2015 16:31:01 +0000 (18:31 +0200)] 
Fix typo in pattern synonym documentation.

`MkT` is the name of the constructor whilst `T` is the name of
the type.

Reviewers: bgamari, austin

Subscribers: thomie

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

GHC Trac Issues: #10787

3 years agoFix 7.10 validate
Matthew Pickering [Sun, 30 Aug 2015 16:30:51 +0000 (18:30 +0200)] 
Fix 7.10 validate

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

3 years agoStgCmmHeap: Re-add check for large static allocations
Ben Gamari [Thu, 27 Aug 2015 12:08:01 +0000 (14:08 +0200)] 
StgCmmHeap: Re-add check for large static allocations

This should at least help alleviate the annoyance of #4505. This
reintroduces a compile-time check originally added in
a278f3f02d09bc32b0a75d4a04d710090cde250f but dropped with the new code
generator.

3 years agointeger-gmp: optimise bitBigNat
Herbert Valerio Riedel [Sat, 29 Aug 2015 10:25:45 +0000 (12:25 +0200)] 
integer-gmp: optimise bitBigNat

This is a somewhat minor optimisation exploiting the static knowledge
of the operands involved allowing to save a few allocations.

Reviewers: austin, rwbarton, goldfire, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

3 years agoghc-pkg --enable-multi-instance should not complain about case sensitivity.
Edward Z. Yang [Sat, 29 Aug 2015 10:25:28 +0000 (12:25 +0200)] 
ghc-pkg --enable-multi-instance should not complain about case sensitivity.

Test Plan: validate

Reviewers: simonmar, bgamari, austin

Reviewed By: bgamari, austin

Subscribers: thomie

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

3 years agoFix identifier parsing in hp2ps
Yuras Shumovich [Sat, 29 Aug 2015 10:25:14 +0000 (12:25 +0200)] 
Fix identifier parsing in hp2ps

Now identifiers can start with a package key, which is a hash, so they
may also start with a digit. Identifiers always appear at the beginning
of a line, and numbers never appear here, soit's safe to allow
identifiers to start with a digit.

Test Plan: `concprog002` passes under `threaded2_hT` way

Reviewers: austin, bgamari, thomie

Reviewed By: austin, bgamari, thomie

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

GHC Trac Issues: #10661

3 years agoDwarf: Produce .dwarf_aranges section
Ben Gamari [Sat, 29 Aug 2015 10:25:04 +0000 (12:25 +0200)] 
Dwarf: Produce .dwarf_aranges section

Test Plan: Check with `readelf --debug-dump=ranges`

Reviewers: scpmw, austin

Subscribers: thomie

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

3 years agoDwarf: Produce {low,high}_pc attributes for compilation units
Ben Gamari [Sat, 29 Aug 2015 10:24:54 +0000 (12:24 +0200)] 
Dwarf: Produce {low,high}_pc attributes for compilation units

Some libraries (e.g. elfutils) need these otherwise they ignore our
DWARF annotations.

Test Plan: Test with elfutils' `readelf --debug-dump=cu_index`

Reviewers: scpmw, austin

Subscribers: thomie

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

3 years agoDwarf: Fix DW_AT_use_UTF8 attribute
Ben Gamari [Sat, 29 Aug 2015 10:24:14 +0000 (12:24 +0200)] 
Dwarf: Fix DW_AT_use_UTF8 attribute

Previously this was given in the body but not in the abbreviation table.
Who knows what sort of havoc this was wrecking.

Test Plan: Verify against DWARF4 specification

Reviewers: scpmw, austin

Subscribers: Tarrasch, thomie

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

3 years agoRespect GHC_CHARENC environment variable #10762
Michael Snoyman [Sat, 29 Aug 2015 10:23:48 +0000 (12:23 +0200)] 
Respect GHC_CHARENC environment variable #10762

Only supports UTF-8 as a value right now. I expect some discussion to go
on around the naming of this variable and whether it's valid to backport
it to GHC 7.10 (which would be my preference). The motivation here is
that, when capturing the output of GHC to a file, we often want to
ensure that the output is UTF-8, regardless of the actual character
encoding of the terminal/console.

On the other hand, we don't want to necessary change the
terminal/console encoding. The reason being:

* On Windows, this requires a global-esque change to the console
  codepage, which adversely affects other processes in the same console

* On all OSes, this can break features like smart quote auto-detection.

Test Plan:
Set LANG to C, GHC_CHARENC to UTF-8, and compile a Haskell source
file with a non-ASCII warning produced. The output who include the UTF-8
sequence instead of replacing it with ?.

Reviewers: austin, rwbarton, bgamari

Reviewed By: bgamari

Subscribers: hsyl20, thomie

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

GHC Trac Issues: #10762

3 years agoMake Generic (Proxy t) instance poly-kinded (fixes #10775)
RyanGlScott [Sat, 29 Aug 2015 10:23:31 +0000 (12:23 +0200)] 
Make Generic (Proxy t) instance poly-kinded (fixes #10775)

This amounts to enabling PolyKinds in GHC.Generics. However, explicit
kind signatures must be applied to the datatypes and typeclasses in
GHC.Generics to ensure that the Core which TcGenGenerics generates
is properly kinded.

Several of the typeclasses in GHC.Generics could be poly-kinded, but
this differential does not attempt to address this, since D493 already
addresses this.

Test Plan: ./validate

Reviewers: hvr, austin, dreixel, bgamari

Reviewed By: austin, dreixel, bgamari

Subscribers: goldfire, thomie

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

GHC Trac Issues: #10775

3 years agoAdd testcase for #7411
Ben Gamari [Thu, 27 Aug 2015 13:04:29 +0000 (15:04 +0200)] 
Add testcase for #7411

3 years agoRTS: Reduce MBLOCK_SPACE_SIZE on AArch64
Erik de Castro Lopo [Tue, 25 Aug 2015 02:07:45 +0000 (02:07 +0000)] 
RTS: Reduce MBLOCK_SPACE_SIZE on AArch64

Commit 0d1a8d09f4 added a two step allocator for 64 bit systems. This
allocator mmaps a huge (1 TB) chunk of memory out of which it does
smaller allocations. On AArch64/Arm64 linux, this mmap was failing
due to the Arm64 Linux kernel parameter CONFIG_ARM64_VA_BITS
defaulting to 39 bits.

Therefore reducing the AArch64 value for MBLOCK_SPACE_SIZE to make
this allocation 1/4 TB while remaining 1 TB for other archs.

Reviewers: ezyang, austin, bgamari

Subscribers: thomie

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

GHC Trac Issues: #10682

3 years agobase: Remove a redundant 'return'
Simon Peyton Jones [Thu, 26 Mar 2015 11:06:12 +0000 (11:06 +0000)] 
base: Remove a redundant 'return'

3 years agoTysWiredIn: Shuffle code around
Ben Gamari [Wed, 26 Aug 2015 16:19:31 +0000 (18:19 +0200)] 
TysWiredIn: Shuffle code around

3 years agoMkIface: Introduce PatSynId, ReflectionId, DefMethId
Ben Gamari [Wed, 26 Aug 2015 16:14:31 +0000 (18:14 +0200)] 
MkIface: Introduce PatSynId, ReflectionId, DefMethId

Currently we don't persist these three "advisory" IdInfos through
interface files.  We easily could if needed.

3 years agoIfaceEnv: Clean up updNameCache a bit
Ben Gamari [Wed, 26 Aug 2015 16:10:21 +0000 (18:10 +0200)] 
IfaceEnv: Clean up updNameCache a bit

3 years agoMove newImplicitBinder to from IfaceEnv to BuildTyCl
Ben Gamari [Thu, 27 Aug 2015 06:01:21 +0000 (08:01 +0200)] 
Move newImplicitBinder to from IfaceEnv to BuildTyCl

3 years agoPrelNames: introduce dcQual in place of conName
Ben Gamari [Wed, 26 Aug 2015 16:03:00 +0000 (18:03 +0200)] 
PrelNames: introduce dcQual in place of conName

3 years agoRevert "Clean up handling of knownKeyNames"
Ben Gamari [Wed, 26 Aug 2015 23:00:52 +0000 (01:00 +0200)] 
Revert "Clean up handling of knownKeyNames"

This reverts commit 792446906c718a08f0870b58acbdf2cfdeb77770.

This commit was a failed part of an effort to split up D757. I'll need
to try again and make sure I build-test next time.

3 years agoClean up handling of knownKeyNames
Ben Gamari [Wed, 26 Aug 2015 15:58:25 +0000 (17:58 +0200)] 
Clean up handling of knownKeyNames

3 years agoBinIface: Clean up whitespace
Ben Gamari [Wed, 26 Aug 2015 15:56:06 +0000 (17:56 +0200)] 
BinIface: Clean up whitespace

3 years agoPrelNames: Clean up list a bit
Ben Gamari [Wed, 26 Aug 2015 15:50:33 +0000 (17:50 +0200)] 
PrelNames: Clean up list a bit

3 years agoTcDeriv: Kill dead code
Ben Gamari [Wed, 26 Aug 2015 15:46:22 +0000 (17:46 +0200)] 
TcDeriv: Kill dead code

3 years agotcRnDeclsi can use tcRnSrcDecls
Simon Peyton Jones [Mon, 23 Mar 2015 14:32:31 +0000 (14:32 +0000)] 
tcRnDeclsi can use tcRnSrcDecls

I'm not sure why tcRnDeclsi didn't call tcRnSrcDecls before, but now it
does.  About 20 lines of code vanish. Hooray.

3 years agoImplement lookupGlobal in TcEnv, and use it
Simon Peyton Jones [Fri, 20 Mar 2015 12:38:42 +0000 (12:38 +0000)] 
Implement lookupGlobal in TcEnv, and use it

This localises the (revolting) initTcForLookup function, exposing
instead the more civilised interface for lookupGlobal

3 years agoComments and white space
Simon Peyton Jones [Fri, 20 Mar 2015 12:36:22 +0000 (12:36 +0000)] 
Comments and white space

3 years agoFix algorithm.tex build and update with some new info.
Edward Z. Yang [Wed, 26 Aug 2015 17:16:05 +0000 (10:16 -0700)] 
Fix algorithm.tex build and update with some new info.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
3 years agoconfigure.ac: Allow disabling of large-address-space
Erik de Castro Lopo [Tue, 25 Aug 2015 01:33:32 +0000 (11:33 +1000)] 
configure.ac: Allow disabling of large-address-space

Recent changes (commit 0d1a8d09f4) for 64 bit platforms allowed GHC
to mmap one huge (currently 1 terrabyte) memory region from which to
do its own allocations. This is enabled by default, but it would be
nice (even just from the point of view of testing) to be able to
disable this at configure time.

Test Plan: configure and grep mk/config.h for USE_LARGE_ADDRESS_SPACE

Reviewers: austin, ezyang, bgamari, rwbarton

Subscribers: thomie

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

GHC Trac Issues: #10791

3 years agofix 64bit two-stage allocator on Solaris/AMD64 platform (#10790)
Karel Gardas [Tue, 25 Aug 2015 12:06:29 +0000 (14:06 +0200)] 
fix 64bit two-stage allocator on Solaris/AMD64 platform (#10790)

Test Plan: tested on Solaris 11/AMD64 when previous build failed

Reviewers: bgamari, austin, simonmar, gcampax, ezyang

Subscribers: thomie

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

3 years agoDelete ExtsCompat46 (#8330)
Thomas Miedema [Tue, 21 Jul 2015 12:59:55 +0000 (14:59 +0200)] 
Delete ExtsCompat46 (#8330)

We require ghc-7.8 to build HEAD (ghc-7.11).

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

3 years agoCheck options before warning about source imports.
Alex Rozenshteyn [Fri, 21 Aug 2015 19:42:16 +0000 (21:42 +0200)] 
Check options before warning about source imports.

Summary: Fixes T10637

Reviewers: austin, bgamari, thomie

Subscribers: dfordivam, simonpj, thomie

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

GHC Trac Issues: #10637

3 years agoBuild system: delete unused distrib/Makefile
Thomas Miedema [Sat, 15 Aug 2015 17:07:52 +0000 (19:07 +0200)] 
Build system: delete unused distrib/Makefile

3 years agoBuild system: simplify install.mk.in
Thomas Miedema [Sat, 15 Aug 2015 12:18:07 +0000 (14:18 +0200)] 
Build system: simplify install.mk.in

This will allow fixing #1851 more easily
("make install-strip" should work).

This reverts 57e2a81c589103b50da80a9e378b1a11285bd521:
  "On Cygwin, use a Cygwin-style path for /bin/install's destination"

Update submodule haddock and hsc2hs.

3 years agoRefactor: delete most of the module FastTypes
Thomas Miedema [Fri, 21 Aug 2015 08:44:54 +0000 (10:44 +0200)] 
Refactor: delete most of the module FastTypes

This reverses some of the work done in #1405, and goes back to the
assumption that the bootstrap compiler understands GHC-haskell.

In particular:
  * use MagicHash instead of _ILIT and _CLIT
  * pattern matching on I# if possible, instead of using iUnbox
    unnecessarily
  * use Int#/Char#/Addr# instead of the following type synonyms:
    - type FastInt   = Int#
    - type FastChar  = Char#
    - type FastPtr a = Addr#
  * inline the following functions:
    - iBox           = I#
    - cBox           = C#
    - fastChr        = chr#
    - fastOrd        = ord#
    - eqFastChar     = eqChar#
    - shiftLFastInt  = uncheckedIShiftL#
    - shiftR_FastInt = uncheckedIShiftRL#
    - shiftRLFastInt = uncheckedIShiftRL#
  * delete the following unused functions:
    - minFastInt
    - maxFastInt
    - uncheckedIShiftRA#
    - castFastPtr
    - panicDocFastInt and pprPanicFastInt
  * rename panicFastInt back to panic#

These functions remain, since they actually do something:
  * iUnbox
  * bitAndFastInt
  * bitOrFastInt

Test Plan: validate

Reviewers: austin, bgamari

Subscribers: rwbarton

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

GHC Trac Issues: #1405

3 years agoDelete FastBool
Thomas Miedema [Fri, 21 Aug 2015 08:38:06 +0000 (10:38 +0200)] 
Delete FastBool

This reverses some of the work done in Trac #1405, and assumes GHC is
smart enough to do its own unboxing of booleans now.

I would like to do some more performance measurements, but the code
changes can be reviewed already.

Test Plan:
With a perf build:
./inplace/bin/ghc-stage2 nofib/spectral/simple/Main.hs -fforce-recomp
+RTS -t --machine-readable

before:
```
  [("bytes allocated", "1300744864")
  ,("num_GCs", "302")
  ,("average_bytes_used", "8811118")
  ,("max_bytes_used", "24477464")
  ,("num_byte_usage_samples", "9")
  ,("peak_megabytes_allocated", "64")
  ,("init_cpu_seconds", "0.001")
  ,("init_wall_seconds", "0.001")
  ,("mutator_cpu_seconds", "2.833")
  ,("mutator_wall_seconds", "4.283")
  ,("GC_cpu_seconds", "0.960")
  ,("GC_wall_seconds", "0.961")
  ]
```

after:
```
  [("bytes allocated", "1301088064")
  ,("num_GCs", "310")
  ,("average_bytes_used", "8820253")
  ,("max_bytes_used", "24539904")
  ,("num_byte_usage_samples", "9")
  ,("peak_megabytes_allocated", "64")
  ,("init_cpu_seconds", "0.001")
  ,("init_wall_seconds", "0.001")
  ,("mutator_cpu_seconds", "2.876")
  ,("mutator_wall_seconds", "4.474")
  ,("GC_cpu_seconds", "0.965")
  ,("GC_wall_seconds", "0.979")
  ]
```

CPU time seems to be up a bit, but I'm not sure. Unfortunately CPU time
measurements are rather noisy.

Reviewers: austin, bgamari, rwbarton

Subscribers: nomeata

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

GHC Trac Issues: #1405

3 years agoImplement getSizeofMutableByteArrayOp primop
Ben Gamari [Fri, 21 Aug 2015 08:37:39 +0000 (10:37 +0200)] 
Implement getSizeofMutableByteArrayOp primop

Now since ByteArrays are mutable we need to be more explicit about when
the size is queried.

Test Plan: Add testcase and validate

Reviewers: goldfire, hvr, austin

Subscribers: thomie

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

GHC Trac Issues: #9447

3 years agoBag: Add Foldable instance
Ben Gamari [Tue, 18 Aug 2015 17:17:50 +0000 (19:17 +0200)] 
Bag: Add Foldable instance

3 years agoGhcMake: Fix spelling in comment
Ben Gamari [Tue, 18 Aug 2015 17:17:22 +0000 (19:17 +0200)] 
GhcMake: Fix spelling in comment

3 years agoDelete sync-all
Thomas Miedema [Thu, 20 Aug 2015 22:47:16 +0000 (00:47 +0200)] 
Delete sync-all

3 years agoBuild system: delete half-baked Cygwin support
Thomas Miedema [Sat, 15 Aug 2015 09:36:44 +0000 (11:36 +0200)] 
Build system: delete half-baked Cygwin support

We only support building GHC on mys2 nowadays, see
https://ghc.haskell.org/trac/ghc/wiki/Building/Preparation/Windows.

This (partially) reverts various commits from a few years ago, among which:
  * 5775d5142da227d65fb86994d363eb16841ee642
    "Add OSTYPE build-system variable, and use it"
  * 3fb8c431824aa2f3bd979e35d1a283546fcfbe74
    "Fix building libgmp on cygwin"
  * cdbb4720c424500adb57cbbef69721d0b039fa46
    "Fix cmd invocation by libffi cuild system on Windows 7 cygwin"
  * e8121501ee3549a35e954726ccfd871ac9d51f83
    "Fix dblatex and xml* tool detection on Windows"

Reviewed by: austin, Phyx

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

3 years agoComments reformating/corrections
Divam [Tue, 18 Aug 2015 16:08:26 +0000 (18:08 +0200)] 
Comments reformating/corrections

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

3 years agoAdd selectors for common fields (DataCon/PatSyn) to ConLike
Matthew Pickering [Tue, 18 Aug 2015 16:07:18 +0000 (18:07 +0200)] 
Add selectors for common fields (DataCon/PatSyn) to ConLike

When pattern synonyms were introduced a new sum type was used
in places where DataCon used to be used. PatSyn and DataCon share many
of the same fields, this patch adds selectors to ConLike for these
fields.

Reviewers: austin, goldfire, bgamari

Subscribers: thomie

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

3 years agorts/Printer.c: speed up '-Da' printer for 'LIBBFD' build
Sergei Trofimovich [Tue, 18 Aug 2015 16:06:41 +0000 (18:06 +0200)] 
rts/Printer.c: speed up '-Da' printer for 'LIBBFD' build

Patch switches from linear lookup in unordered array
to a hash table lookup.

When debugging GHC array contains 658_445 elements.

Found performance gap when tried to debug blackholes.

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

Subscribers: thomie

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

3 years agoFix rdynamic flag and test on Windows
Tamar Christina [Tue, 18 Aug 2015 15:59:04 +0000 (17:59 +0200)] 
Fix rdynamic flag and test on Windows

The rdynamic tests and feature are marked broken on windows.
This is because the flag used doesn't exist and the symbol lookup
in the test did not account for platform differences in name mangling.

This commit fixes the flag and tests for rdynamic on windows.

Test Plan:
make TEST="rdynamic"

on both x86 and x86_64

Reviewers: austin, thomie, bgamari

Reviewed By: thomie, bgamari

Subscribers: #ghc_windows_task_force

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

GHC Trac Issues: #9381

3 years agoDump files always use UTF8 encoding #10762
Michael Snoyman [Tue, 18 Aug 2015 15:58:36 +0000 (17:58 +0200)] 
Dump files always use UTF8 encoding #10762

When the Windows codepage or *nix LANG variable is something besides
UTF-8, dumping to file can cause GHC to exit currently. This changes the
output encoding for files to match the defined input encoding for
Haskell source code (UTF-8), making it easier for users and build tools
to capture this output.

Test Plan:
Create a Haskell source file with non-Latin characters for identifier
names and
compile with:

LANG=C ghc -ddump-to-file -ddump-hi filename.hs -fforce-recomp

Without this patch, it will fail. With this patch, it succeeds

Reviewers: austin, rwbarton, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #10762

3 years agoTransliterate unknown characters at output
Michael Snoyman [Tue, 18 Aug 2015 15:58:02 +0000 (17:58 +0200)] 
Transliterate unknown characters at output

This avoids the compiler from crashing when, for example, a warning
contains a non-Latin identifier and the LANG variable is set to C.
Fixes #6037.

Test Plan:
Create a Haskell source file containing an identifier with non-Latin
characters and no type signature. Compile with `LANG=C ghc -Wall
foo.hs`, and it should fail. With this patch, it will succeed.

Reviewers: austin, rwbarton, bgamari

Subscribers: thomie

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

GHC Trac Issues: #6037, #10762