ghc.git
3 years agoComments only explaining export list parsing.
Matthew Pickering [Thu, 5 May 2016 09:25:12 +0000 (10:25 +0100)] 
Comments only explaining export list parsing.

3 years agorts: Replace `nat` with `uint32_t`
Erik de Castro Lopo [Sun, 1 May 2016 20:37:14 +0000 (06:37 +1000)] 
rts: Replace `nat` with `uint32_t`

The `nat` type was an alias for `unsigned int` with a comment saying
it was at least 32 bits. We keep the typedef in case client code is
using it but mark it as deprecated.

Test Plan: Validated on Linux, OS X and Windows

Reviewers: simonmar, austin, thomie, hvr, bgamari, hsyl20

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

3 years agoKill non-deterministic foldUFM in TrieMap and TcAppMap
Bartosz Nitka [Wed, 4 May 2016 16:22:37 +0000 (09:22 -0700)] 
Kill non-deterministic foldUFM in TrieMap and TcAppMap

Summary:
foldUFM introduces unnecessary non-determinism that actually
leads to different generated code as explained in
Note [TrieMap determinism].

As we're switching from UniqFM to UniqDFM here you might be
concerned about performance. There's nothing that ./validate
detects. nofib reports no change in Compile Allocations, but
Compile Time got better on some tests and worse on some,
yielding this summary:

        -1 s.d.                -----            -3.8%
        +1 s.d.                -----            +5.4%
        Average                -----            +0.7%

This is not a fair comparison as the order of Uniques
changes what GHC is actually doing. One benefit from making
this deterministic is also that it will make the
performance results more stable.

Full nofib results: P108

Test Plan: ./validate, nofib

Reviewers: goldfire, simonpj, simonmar, austin, bgamari

Reviewed By: simonpj

Subscribers: thomie

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

GHC Trac Issues: #4012

3 years agobase: Export runRW# from GHC.Exts
Ben Gamari [Wed, 4 May 2016 16:30:51 +0000 (18:30 +0200)] 
base: Export runRW# from GHC.Exts

Seems like this should be available in GHC.Exts. Thanks for @carter
for pointing this out.

Test Plan: Validate

Reviewers: rwbarton, hvr, austin

Reviewed By: austin

Subscribers: thomie, carter

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

3 years agotestsuite: Add test for #11959
Ben Gamari [Tue, 3 May 2016 20:58:47 +0000 (22:58 +0200)] 
testsuite: Add test for #11959

Test Plan: Validate, expected to fail

Reviewers: goldfire, austin

Reviewed By: austin

Subscribers: thomie

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

GHC Trac Issues: #11959

3 years agoBe more aggressive when checking constraints for custom type errors.
Iavor S. Diatchki [Tue, 3 May 2016 20:55:07 +0000 (22:55 +0200)] 
Be more aggressive when checking constraints for custom type errors.

This fixes #11990.

The current rule is simpler than before: if we encounter an unsolved
constraint that contains any mentions of properly applied `TypeError`,
then we report the type error.

If there are multiple `TypeErrors`, then we just report one of them.

Reviewers: simonpj, bgamari, austin

Reviewed By: simonpj

Subscribers: thomie

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

GHC Trac Issues: #11990

3 years agoMake 'make fast' work for the User Guide
Simon Marlow [Wed, 4 May 2016 11:47:12 +0000 (12:47 +0100)] 
Make 'make fast' work for the User Guide

If you already have mkUserGuidePart compiled.

3 years agoDon't STATIC_INLINE giveCapabilityToTask
Simon Marlow [Wed, 4 May 2016 11:29:06 +0000 (04:29 -0700)] 
Don't STATIC_INLINE giveCapabilityToTask

This causes errors with some versions of gcc (4.4.7 here).

3 years agoschedulePushWork: avoid unnecessary wakeups
Simon Marlow [Sun, 24 Apr 2016 20:31:55 +0000 (21:31 +0100)] 
schedulePushWork: avoid unnecessary wakeups

This function had some pathalogically bad behaviour: if we had 2 threads
on the current capability and 23 other idle capabilities, we would

* grab all 23 capabilities
* migrate one Haskell thread to one of them
* wake up a worker on *all* 23 other capabilities.

This lead to a lot of unnecessary wakeups when using large -N values.

Now, we

* Count how many capabilities we need to wake up
* Start from cap->no+1, so that we don't overload low-numbered capabilities
* Only wake up capabilities that we migrated a thread to (unless we have
  sparks to steal)

This results in a pretty dramatic improvement in our production system.

3 years agoAdd +RTS -AL<size>
Simon Marlow [Sun, 24 Apr 2016 20:31:55 +0000 (21:31 +0100)] 
Add +RTS -AL<size>

+RTS -AL<size> controls the total size of large objects that can be
allocated before a GC is triggered.  Previously this was always just the
value of -A, and the limit mainly existed to prevent runaway allocation
in pathalogical programs that allocate a lot of large objects.  However,
since the limit is shared between all cores, on a large multicore the
default becomes more restrictive, and can end up triggering GC well
before it would normally have been.

Arguably a better default would be A*N, but this is probably excessive.
Adding a flag lets you choose, and I've left the default as it was.

See docs for usage.

3 years agoAllow limiting the number of GC threads (+RTS -qn<n>)
Simon Marlow [Sat, 9 Apr 2016 19:45:50 +0000 (20:45 +0100)] 
Allow limiting the number of GC threads (+RTS -qn<n>)

This allows the GC to use fewer threads than the number of capabilities.
At each GC, we choose some of the capabilities to be "idle", which means
that the thread running on that capability (if any) will sleep for the
duration of the GC, and the other threads will do its work.  We choose
capabilities that are already idle (if any) to be the idle capabilities.

The idea is that this helps in the following situation:

* We want to use a large -N value so as to make use of hyperthreaded
  cores
* We use a large heap size, so GC is infrequent
* But we don't want to use all -N threads in the GC, because that
  thrashes the memory too much.

See docs for usage.

3 years agoAdjust testsuite output to bytestring-0.10.8.0
Joachim Breitner [Wed, 4 May 2016 08:54:39 +0000 (10:54 +0200)] 
Adjust testsuite output to bytestring-0.10.8.0

This is a band-aid; the test suite should not be sensitive to these
messages.

3 years agoExport oneShot from GHC.Exts
Joachim Breitner [Wed, 4 May 2016 07:54:40 +0000 (09:54 +0200)] 
Export oneShot from GHC.Exts

as suggested by carter in #12011.

3 years agoUpdate bytestring submodule to 0.10.8.0 release tag
Herbert Valerio Riedel [Tue, 3 May 2016 22:45:43 +0000 (00:45 +0200)] 
Update bytestring submodule to 0.10.8.0 release tag

3 years agoUpdate libraries/hpc submodule to v0.6.0.3 release tag
Herbert Valerio Riedel [Tue, 3 May 2016 20:11:59 +0000 (22:11 +0200)] 
Update libraries/hpc submodule to v0.6.0.3 release tag

3 years agoCleanups related to MAX_FREE_LIST
Simon Marlow [Mon, 2 May 2016 19:26:15 +0000 (20:26 +0100)] 
Cleanups related to MAX_FREE_LIST

- Rename to the (more correct) NUM_FREE_LISTS

- NUM_FREE_LISTS should be derived from the block and mblock sizes, not
  defined manually.  It was actually too large by one, which caused a
  little bit of (benign) extra work in the form of a redundant loop
  iteration in some cases.

- Add some ASSERTs for input preconditions to log_2() and log_2_ceil()

- Fix some comments

- Fix usage in allocLargeChunk, to account for the fact that
  log_2_ceil() can return NUM_FREE_LISTS.

3 years agoRevert "Revert "Use __builtin_clz() to implement log_1()""
U-THEFACEBOOK\smarlow [Sun, 1 May 2016 07:27:35 +0000 (08:27 +0100)] 
Revert "Revert "Use __builtin_clz() to implement log_1()""

This reverts commit 546f24e4f8a7c086b1e5afcdda624176610cbcf8.

And adds a fix for Windows: we need to use __builtin_clzll() rather than
__builtin_clzl(), because StgWord is unsigned long long on Windows.

3 years agoStaticPointers: Allow closed vars in the static form.
Facundo Domínguez [Thu, 7 Apr 2016 19:20:19 +0000 (16:20 -0300)] 
StaticPointers: Allow closed vars in the static form.

Summary:
With this patch closed variables are allowed regardless of whether
they are bound at the top level or not.

The FloatOut pass is always performed. When optimizations are
disabled, only expressions that go to the top level are floated.
Thus, the applications of the StaticPtr data constructor are always
floated.

The CoreTidy pass makes sure the floated applications appear in the
symbol table of object files. It also collects the floated bindings
and inserts them in the static pointer table.

The renamer does not check anymore if free variables appearing in the
static form are top-level. Instead, the typechecker looks at the
tct_closed flag to decide if the free variables are closed.

The linter checks that applications of StaticPtr only occur at the
top of top-level bindings after the FloatOut pass.

The field spInfoName of StaticPtrInfo has been removed. It used to
contain the name of the top-level binding that contains the StaticPtr
application. However, this information is no longer available when the
StaticPtr is constructed, as the binding name is determined now by the
FloatOut pass.

Test Plan: ./validate

Reviewers: goldfire, simonpj, austin, hvr, bgamari

Reviewed By: simonpj

Subscribers: thomie, mpickering, mboes

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

GHC Trac Issues: #11656

3 years agoMake validDerivPred ignore non-visible arguments to a class type constructor
RyanGlScott [Mon, 2 May 2016 16:38:04 +0000 (12:38 -0400)] 
Make validDerivPred ignore non-visible arguments to a class type constructor

Summary:
GHC choked when trying to derive the following:

```
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE PolyKinds #-}
module Example where

class Category (cat :: k -> k -> *) where
  catId   :: cat a a
  catComp :: cat b c -> cat a b -> cat a c

newtype T (c :: * -> * -> *) a b = MkT (c a b) deriving Category
```

Unlike in #8865, where we were deriving `Category` for a concrete type like
`Either`, in the above example we are attempting to derive an instance of the
form:

```
instance Category * c => Category (T * c) where ...
```

(using `-fprint-explicit-kinds` syntax). But `validDerivPred` is checking if
`sizePred (Category * c)` equals the number of free type variables in
`Category * c`. But note that `sizePred` counts both type variables //and//
type constructors, and `*` is a type constructor! So `validDerivPred`
erroneously rejects the above instance.

The fix is to make `validDerivPred` ignore non-visible arguments to the class
type constructor (e.g., ignore `*` is `Category * c`) by using
`filterOutInvisibleTypes`.

Fixes #11833.

Test Plan: ./validate

Reviewers: goldfire, hvr, simonpj, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #11833

3 years agodocs/users_guide/glasgow_exts.rst: fix merge conflict
Sergei Trofimovich [Mon, 2 May 2016 10:24:23 +0000 (11:24 +0100)] 
docs/users_guide/glasgow_exts.rst: fix merge conflict

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
3 years agoglasgow_exts.rst: fix quoting
Sergei Trofimovich [Thu, 21 Apr 2016 21:43:11 +0000 (22:43 +0100)] 
glasgow_exts.rst: fix quoting

glasgow_exts.rst:6525: WARNING: Inline literal start-string without end-string.

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
3 years agoadded docstring for '-fhistory-size' flag
Sergei Trofimovich [Sun, 3 Jan 2016 11:55:38 +0000 (11:55 +0000)] 
added docstring for '-fhistory-size' flag

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
3 years agoMake sure record pattern synonym selectors are in scope in GHCi.
Matthew Pickering [Sun, 1 May 2016 22:11:30 +0000 (00:11 +0200)] 
Make sure record pattern synonym selectors are in scope in GHCi.

Beforehand, when a record pattern synonym was defined in GHCi
the selectors would not be in scope. This is because of `is_sub_bndr`
in `HscTypes.icExtendGblRdrEnv` was throwing away the selectors.

This was broken by the fix to #10520 but it is easy to resolve.

Reviewers: austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: thomie

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

GHC Trac Issues: #11985

3 years agoRemove unused equivClassesByUniq
Bartosz Nitka [Sun, 1 May 2016 22:09:22 +0000 (00:09 +0200)] 
Remove unused equivClassesByUniq

It uses `eltsUFM` so it can introduce nondeterminism, but it isn't used
so we can delete it.

Test Plan: it builds

Reviewers: simonpj, goldfire, simonmar, austin, bgamari

Reviewed By: austin, bgamari

Subscribers: thomie

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

GHC Trac Issues: #4012

3 years agoExport constructors for IntPtr and WordPtr
RyanGlScott [Sun, 1 May 2016 22:07:14 +0000 (00:07 +0200)] 
Export constructors for IntPtr and WordPtr

This finishes what #5529 started by exporting the constructors for
`IntPtr` and `WordPtr` from `Foreign.Ptr`, allowing them to be used in
`foreign` declarations.

Fixes #11983.

Test Plan: `make TEST=T11983`

Reviewers: simonpj, hvr, bgamari, austin

Reviewed By: simonpj

Subscribers: simonpj, thomie

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

GHC Trac Issues: #11983

3 years agoderiveConstants: Fix nm advice one last time
Ben Gamari [Sun, 1 May 2016 16:05:28 +0000 (18:05 +0200)] 
deriveConstants: Fix nm advice one last time

Missing a close paren.

3 years agoAdd T11747 as a test
Ömer Sinan Ağacan [Sun, 1 May 2016 16:03:05 +0000 (18:03 +0200)] 
Add T11747 as a test

Reviewers: bgamari, austin

Subscribers: thomie

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

GHC Trac Issues: #11747

3 years agoRemove unused getScopedTyVarBinds
Bartosz Nitka [Sun, 1 May 2016 15:56:39 +0000 (17:56 +0200)] 
Remove unused getScopedTyVarBinds

Test Plan: it compiles

Reviewers: simonpj, austin, goldfire, bgamari, simonmar

Reviewed By: simonmar

Subscribers: thomie, simonmar

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

GHC Trac Issues: #4012

3 years agorts/itimer/pthread: Stop timer when ticker is stopped
Ben Gamari [Sun, 1 May 2016 15:41:05 +0000 (17:41 +0200)] 
rts/itimer/pthread: Stop timer when ticker is stopped

This reworks the pthread-based itimer implementation to disarm the timer
when events aren't needed. Thanks to hsyl20 for the nice design.

Test Plan: Validate

Reviewers: hsyl20, simonmar, austin

Reviewed By: simonmar

Subscribers: thomie

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

GHC Trac Issues: #1623, #11965

3 years agoKill Itimer.h
Ben Gamari [Thu, 21 Apr 2016 10:01:12 +0000 (12:01 +0200)] 
Kill Itimer.h

It declared nothing.

3 years agoCatch errors from timerfd_settime
Ben Gamari [Thu, 21 Apr 2016 11:57:18 +0000 (13:57 +0200)] 
Catch errors from timerfd_settime

3 years agorts: Split up Itimer.c
Ben Gamari [Sun, 1 May 2016 11:39:23 +0000 (13:39 +0200)] 
rts: Split up Itimer.c

This shouldn't have any functional changes. It merely splits up what are
essentially three distinct codepaths which are melding together with
CPP.

At the moment I merely #include the implementation to use with CPP
although this really feels very yucky.

Reviewers: erikd, austin, simonmar

Reviewed By: simonmar

Subscribers: thomie

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

3 years agorts: Close livelock window due to rapid ticker enable/disable
Ben Gamari [Sun, 1 May 2016 11:38:38 +0000 (13:38 +0200)] 
rts: Close livelock window due to rapid ticker enable/disable

This fixes #11830, where the RTS would livelock if run with `-I0` due
to a regression introduced by bbdc52f3a6e6a28e209fb8f65699121d4ef3a4e3.
The reason for this is that the new codepath introduced a subtle race
condition:

 1. one thread could request that the ticker stop and would block until
    the ticker in fact stopped
 2. meanwhile, another thread could sneak in and restart the ticker

this was implemented in such a way where thread (1) would end up
blocked forever. The solution here is to simply not block. The worst
that will happen is that timer fires again, but is ignored since the
ticker is stopped.

Test Plan:
Validate, try reproduction case in #11830. Need to find a nice
testcase.

Reviewers: simonmar, erikd, hsyl20, austin

Reviewed By: erikd, hsyl20

Subscribers: erikd, thomie

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

GHC Trac Issues: #11830

3 years agoGreater customization of GHCi prompt
niksaz [Sun, 1 May 2016 11:34:45 +0000 (13:34 +0200)] 
Greater customization of GHCi prompt

This patch is trying to redesign the :set prompt option to take not a
String but a Haskell function, like [String] -> Int -> IO String, where
[String] is the list of the names of the currently loaded modules and
Int is the line number. Currently you may set prompt function with
**:set promt-function [String] -> Int -> IO String** option and old
version is also available - :set prompt String.

So, it looks like I've almost completed this patch:

1) Now we have a lot of escape sequences - 13 to be exact. Most of them
   are similar to bash prompt escape sequences. Thus they are quite handy.

2) We may use the special escape sequence to call shell functions, for
   example "%call(ls -l -a)".

3) We may use :set prompt-function to set PFunction to handle prompt.
   It is just [String] -> Int -> IO String.

Reviewers: erikd, austin, mpickering, bgamari

Reviewed By: mpickering, bgamari

Subscribers: mpickering, thomie

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

GHC Trac Issues: #5850

3 years agoBump haddock submodule
Ben Gamari [Sun, 1 May 2016 11:22:14 +0000 (13:22 +0200)] 
Bump haddock submodule

Fixes documentation installation.

3 years agousers-guide: Add index entry for "environment file"
Ben Gamari [Sun, 1 May 2016 11:21:55 +0000 (13:21 +0200)] 
users-guide: Add index entry for "environment file"

3 years agorts: Remove deprecated C type `lnat`
Erik de Castro Lopo [Sun, 1 May 2016 11:59:50 +0000 (21:59 +1000)] 
rts: Remove deprecated C type `lnat`

Summary:
The `lnat` type was deprecated in 2012 in commit 41737f12f9 with
a note to use `StgWord` instead.

Test Plan: Validate on Linux and OS X

Reviewers: simonmar, austin, Phyx, hvr, bgamari

Reviewed By: simonmar, Phyx, bgamari

Subscribers: thomie

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

3 years agoFix aggressive cleanup of T1407
Tamar Christina [Sun, 1 May 2016 15:25:48 +0000 (17:25 +0200)] 
Fix aggressive cleanup of T1407

Summary:
The aggressive cleanup routine of T1407 is removing files that don't belong to it.
Constrain the test to only removing files it should by putting all it's generated
binaries in it's own output folder.

Test Plan: make test -C testsuite/tests/ghci/linking/dyn

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie, #ghc_windows_task_force

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

GHC Trac Issues: #1407

3 years agoTypos in DmdAnal
Ömer Sinan Ağacan [Sun, 1 May 2016 07:14:29 +0000 (03:14 -0400)] 
Typos in DmdAnal

3 years agoComment typo: unambigious -> unambiguous
Ryan Scott [Sat, 30 Apr 2016 18:34:25 +0000 (14:34 -0400)] 
Comment typo: unambigious -> unambiguous

[ci skip]

3 years agoComment typos: Mkae -> Make, Hsakell -> Haskell
RyanGlScott [Sat, 30 Apr 2016 18:10:30 +0000 (14:10 -0400)] 
Comment typos: Mkae -> Make, Hsakell -> Haskell

[ci skip]

3 years agoFix reference to Note in TcCanonical
RyanGlScott [Sat, 30 Apr 2016 18:06:31 +0000 (14:06 -0400)] 
Fix reference to Note in TcCanonical

Previously, it was referring to Note [Decomposing equalities],
but the name of it is actually  Note [Decomposing equality].

[ci skip]

3 years agoTestsuite: accept new output for 2 partial-sigs tests
Thomas Miedema [Thu, 28 Apr 2016 13:49:24 +0000 (15:49 +0200)] 
Testsuite: accept new output for 2 partial-sigs tests

Test Plan: make TEST='ExtraNumAMROn TidyClash2'

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

GHC Trac Issues: #9478

3 years agoTestsuite: make CLEANUP=1 the default (#9758)
Thomas Miedema [Tue, 26 Apr 2016 13:12:05 +0000 (15:12 +0200)] 
Testsuite: make CLEANUP=1 the default (#9758)

Also move the `cleanup` setting from `default_testopts` to `config`. The
`cleanup` setting is the same for all tests, hence it belongs in
`config`.

Reviewed by: austin

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

3 years agoPPC NCG: Improve pointer de-tagging code
Peter Trommler [Fri, 29 Apr 2016 17:45:10 +0000 (17:45 +0000)] 
PPC NCG: Improve pointer de-tagging code

Generate a clrr[wd]i instruction to clear the tag bits in a pointer.
This saves one instruction and one temporary register.

Optimize signed comparison with zero after andi. operation This saves
one instruction when comparing a pointer tag with zero.

This reduces code size by 0.6 % in all nofib benchmarks.

Test Plan: validate on AIX and 32-bit Linux

Reviewed By: erikd, hvr

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

3 years agoFix typo: Superclases -> Superclasses
Bartosz Nitka [Fri, 29 Apr 2016 14:46:24 +0000 (07:46 -0700)] 
Fix typo: Superclases -> Superclasses

3 years agoTest #11484 in th/T11484
Richard Eisenberg [Tue, 26 Apr 2016 18:07:08 +0000 (14:07 -0400)] 
Test #11484 in th/T11484

3 years agoRemove the incredibly hairy splitTelescopeTvs.
Richard Eisenberg [Tue, 26 Apr 2016 14:50:33 +0000 (10:50 -0400)] 
Remove the incredibly hairy splitTelescopeTvs.

This patch removes splitTelescopeTvs by adding information about
scoped type variables to TcTyCon. Vast simplification!

This also fixes #11821 by bringing only unzonked vars into scope.

Test case: polykinds/T11821

3 years agoRTS: delete BlockedOnGA* + dead code
Thomas Miedema [Sat, 27 Feb 2016 21:02:22 +0000 (22:02 +0100)] 
RTS: delete BlockedOnGA* + dead code

Some old stuff related to the PAR way.

Reviewed by: austin, simonmar

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

3 years agotestsuite: fix up T11223's Makefile
Austin Seipp [Thu, 28 Apr 2016 23:42:55 +0000 (23:42 +0000)] 
testsuite: fix up T11223's Makefile

As reported by Simon on ghc-devs, this causes the build on Windows
to fail because it cannot find the `cc` command. The Makefile here
actually already sets `GCC=gcc`, but for some reason then uses both
`$(GCC)` and `$(CC)` to refer to C compilation.

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

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

3 years agoFix path to the new build system, now called Hadrian.
Andrey Mokhov [Thu, 28 Apr 2016 22:32:14 +0000 (23:32 +0100)] 
Fix path to the new build system, now called Hadrian.

Summary:
The new Shake-based build system has been given a name -- Hadrian,
and now lives in /hadrian directory.

This fixes the path to the configuration file to be populated by
the configure script.

Test Plan: Run Hadrian build.

Reviewers: thomie, bgamari, hvr, austin

Reviewed By: austin

Subscribers: erikd

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

3 years agoRemove unused foldNameEnv
Bartosz Nitka [Thu, 28 Apr 2016 22:27:17 +0000 (15:27 -0700)] 
Remove unused foldNameEnv

foldNameEnv is nondeterministic in the general case and it's
currently unused so we can remove it.

3 years agoRemove unused foldFsEnv
Bartosz Nitka [Thu, 28 Apr 2016 21:56:28 +0000 (14:56 -0700)] 
Remove unused foldFsEnv

foldFsEnv is nondeterministic in the general case and since it's
unused we can just remove it.

3 years agoLinker: Fix implicit function declaration warning on OS X
Erik de Castro Lopo [Tue, 26 Apr 2016 21:01:26 +0000 (07:01 +1000)] 
Linker: Fix implicit function declaration warning on OS X

Introduced in commit 177aec697b3.

Test Plan: Validate on OSX and Linux.

Reviewers: austin, bgamari, hvr

Subscribers: goldfire, thomie

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

3 years agorts/LdvProfile.c: Fix NULL dereference on shutdown
Erik de Castro Lopo [Thu, 28 Apr 2016 21:15:53 +0000 (07:15 +1000)] 
rts/LdvProfile.c: Fix NULL dereference on shutdown

Test Plan: validate

Reviewers: carter, austin, simonmar, bgamari

Reviewed By: simonmar, bgamari

Subscribers: thomie

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

GHC Trac Issues: #11978

3 years agoTestsuite: delete T5054 and T5054_2 (#5054)
Thomas Miedema [Mon, 25 Apr 2016 15:22:55 +0000 (17:22 +0200)] 
Testsuite: delete T5054 and T5054_2 (#5054)

These tests no longer compile, because the hmatrix api has completely
changed. Even if we managed to fix the tests, I don't think they would
provided much value, since the ghc/llvm bug from #5054 was not
reproducible in the first place.

Reviewed by: bgamari

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

3 years agoTestsuite: delete -fesc tests
Thomas Miedema [Mon, 25 Apr 2016 18:28:23 +0000 (20:28 +0200)] 
Testsuite: delete -fesc tests

The -fesc flag does not exist, and has never existed.

Also delete now unused config.compiler_tags, and 'Project version' never
contains a '-'.

Reviewed by: bgamari

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

3 years agoKill mapUniqSet
Bartosz Nitka [Thu, 28 Apr 2016 20:35:14 +0000 (13:35 -0700)] 
Kill mapUniqSet

Note [Unsound mapUniqSet] explains why it got removed.

Test Plan: build ghc

Reviewers: simonpj, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie, simonmar

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

3 years agoAdd uniqSetAny and uniqSetAll and use them
Bartosz Nitka [Thu, 28 Apr 2016 20:32:39 +0000 (13:32 -0700)] 
Add uniqSetAny and uniqSetAll and use them

There are couple of places where we do `foldUniqSet` just to
compute `any` or `all`. `foldUniqSet` is non-deterministic in the
general case and `any` and `all` also read nicer.

Test Plan: ./validate

Reviewers: simonmar, goldfire, simonpj, bgamari, austin

Reviewed By: simonpj

Subscribers: thomie

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

GHC Trac Issues: #4012

3 years agoTestsuite: benign test fixes
Thomas Miedema [Thu, 28 Apr 2016 15:08:53 +0000 (17:08 +0200)] 
Testsuite: benign test fixes

3 years agoTestsuite: fix T11223_simple_(unused_)duplicate_lib
Thomas Miedema [Thu, 28 Apr 2016 09:55:40 +0000 (11:55 +0200)] 
Testsuite: fix T11223_simple_(unused_)duplicate_lib

These tests were failing on Travis when run independently from
eachother.

3 years agoTestsuite: add -ignore-dot-ghci to some ghci tests [skip ci]
Thomas Miedema [Thu, 28 Apr 2016 09:49:02 +0000 (11:49 +0200)] 
Testsuite: add -ignore-dot-ghci to some ghci tests [skip ci]

3 years agoTestsuite: delete accidentally committed .stderr.normalised file
Thomas Miedema [Wed, 27 Apr 2016 15:11:31 +0000 (17:11 +0200)] 
Testsuite: delete accidentally committed .stderr.normalised file

[skip ci]

3 years agoKill unused foldOccSet
Bartosz Nitka [Thu, 28 Apr 2016 16:51:56 +0000 (09:51 -0700)] 
Kill unused foldOccSet

foldOccSet if used would be a potential source of nondeterminism.
Since it's not used we can just remove it.

3 years agoRevert "Use __builtin_clz() to implement log_2()"
Simon Peyton Jones [Thu, 28 Apr 2016 14:20:43 +0000 (15:20 +0100)] 
Revert "Use __builtin_clz() to implement log_2()"

This reverts commit 24864ba5587c1a0447beabae90529e8bb4fa117a.

3 years agoFix debug-only check in CoreLint
Simon Peyton Jones [Thu, 28 Apr 2016 16:27:02 +0000 (17:27 +0100)] 
Fix debug-only check in CoreLint

3 years agoBetter documentation of -XConstrainedClassMethods
Simon Peyton Jones [Thu, 28 Apr 2016 14:56:09 +0000 (15:56 +0100)] 
Better documentation of -XConstrainedClassMethods

3 years agoRefactor RecordPatSynField, FieldLabel
Simon Peyton Jones [Thu, 28 Apr 2016 14:52:29 +0000 (15:52 +0100)] 
Refactor RecordPatSynField, FieldLabel

This patch uses the named fields of
 * FieldLabel
 * RecordPatSynField
in construction and pattern matching. The fields
existed before, but we were often using positional notation.

Also a minor refactor of the API of mkPatSynRecSelBinds

No change in functionality

3 years agoAdd missing solveEqualities
Simon Peyton Jones [Mon, 25 Apr 2016 15:17:34 +0000 (16:17 +0100)] 
Add missing solveEqualities

I'd missed a call to solveEqualities in the partial-type-sig case
of TcBinds.tcUserTypeSig.

Also the checkValidType test done there best done after inference,
in checkInferredPolyId (and is already done there).

Fixes Trac #11976

3 years agoRemove unused unifyType_
Simon Peyton Jones [Mon, 25 Apr 2016 15:17:07 +0000 (16:17 +0100)] 
Remove unused unifyType_

3 years agoComments only
Simon Peyton Jones [Mon, 25 Apr 2016 15:16:49 +0000 (16:16 +0100)] 
Comments only

3 years agoMinor improvement to error message
Simon Peyton Jones [Mon, 25 Apr 2016 15:16:04 +0000 (16:16 +0100)] 
Minor improvement to error message

"One fewer arguments to ..." rather than
"One fewer argument to ..."

3 years agoComments only
Simon Peyton Jones [Mon, 25 Apr 2016 15:13:38 +0000 (16:13 +0100)] 
Comments only

3 years agoKill varSetElems in injImproveEqns
Bartosz Nitka [Thu, 28 Apr 2016 12:40:39 +0000 (05:40 -0700)] 
Kill varSetElems in injImproveEqns

We want to remove varSetElems at the source level because it
might be a source of nondeterminism. I don't think it introduces
nondeterminism here, but it's easy to do the same thing
deterministically for the same price.

instFlexiTcS :: [TKVar] -> TcS (TCvSubst, [TcType])
instFlexiTcS currently gives the range of the produced substitution
as the second element of the tuple, but it's not used anywhere
right now. If it started to be used in the code I'm modifying
it would cause nondeterminism problems.

Test Plan: ./validate

Reviewers: austin, goldfire, bgamari, simonmar, simonpj

Reviewed By: simonpj

Subscribers: thomie

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

GHC Trac Issues: #4012

3 years agoExpand the comment on pprVarSet
Bartosz Nitka [Thu, 28 Apr 2016 12:35:31 +0000 (05:35 -0700)] 
Expand the comment on pprVarSet

3 years agoUpdate nofib submodule to nofib master
Joachim Breitner [Thu, 28 Apr 2016 10:59:12 +0000 (12:59 +0200)] 
Update nofib submodule to nofib master

with changes to nofib-analyse:
 * up-to-date parsing of output lines with recent GHC under
 * a few reporting improvements.

3 years agoRecommend more reliable recourse for broken nm
Ben Gamari [Thu, 28 Apr 2016 08:11:13 +0000 (10:11 +0200)] 
Recommend more reliable recourse for broken nm

xcrun --find seems like the appropriate choice here. Thanks to Brandon
Allbery for suggesting this.

3 years agoDocument -fmax-pmcheck-iterations a bit better
Ben Gamari [Wed, 27 Apr 2016 07:57:41 +0000 (09:57 +0200)] 
Document -fmax-pmcheck-iterations a bit better

3 years agoImplement the state hack without modifiyng OneShotInfo
Joachim Breitner [Wed, 20 Apr 2016 08:46:41 +0000 (10:46 +0200)] 
Implement the state hack without modifiyng OneShotInfo

Previously, the state hack would be implemented in mkLocalId, by looking
at the type, and setting the OneShot flag accordingly.

This patch changes this so that the OneShot flag faithfully represents
what our various analyses found out, and the State Hack is implemented
by adjusting the accessors, in particular isOneShotBndr and
idStateHackOneShotInfo. This makes it easier to understand what's going
on in the analyses, and de-clutters core dumps and interface files.

I don’t expect any change in behaviour, at least not in non-fringe
cases.

3 years agoKill varSetElems in markNominal
Bartosz Nitka [Tue, 26 Apr 2016 20:04:08 +0000 (13:04 -0700)] 
Kill varSetElems in markNominal

varSetElems introduces unnecessary nondeterminism and it was
straighforward to just get a deterministic list.

Test Plan: ./validate

Reviewers: austin, goldfire, bgamari, simonmar, simonpj

Reviewed By: simonpj

Subscribers: thomie

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

GHC Trac Issues: #4012

3 years agoKill varSetElems try_tyvar_defaulting
Bartosz Nitka [Tue, 26 Apr 2016 16:51:26 +0000 (09:51 -0700)] 
Kill varSetElems try_tyvar_defaulting

`varSetElems` introduces unnecessary nondeterminism and we can do
the same thing deterministically for the same price.

Test Plan: ./validate

Reviewers: goldfire, austin, simonmar, bgamari, simonpj

Reviewed By: simonpj

Subscribers: thomie

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

GHC Trac Issues: #4012

3 years agoKill varSetElems in TcErrors
Bartosz Nitka [Tue, 26 Apr 2016 15:47:21 +0000 (08:47 -0700)] 
Kill varSetElems in TcErrors

The uses of varSetElems in these places are unnecessary and while it
doesn't intruduce non-determinism in the ABI the plan is to get
rid of all varSetElems to get some compile time guarantees.

Test Plan: ./validate

Reviewers: austin, simonmar, bgamari, goldfire, simonpj

Reviewed By: simonpj

Subscribers: thomie

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

GHC Trac Issues: #4012

3 years agoJust comments & reformatting
Simon Marlow [Sun, 24 Apr 2016 20:14:43 +0000 (21:14 +0100)] 
Just comments & reformatting

3 years agoUse __builtin_clz() to implement log_2()
Simon Marlow [Sat, 23 Apr 2016 21:14:43 +0000 (22:14 +0100)] 
Use __builtin_clz() to implement log_2()

A microoptimisation in the block allocator.

3 years agoDoc improvement for ApplicativeDo
Simon Marlow [Fri, 15 Apr 2016 23:24:59 +0000 (16:24 -0700)] 
Doc improvement for ApplicativeDo

Make it clearer that the final statement should be exactly
"(return|pure) E".

3 years agoGHCi: use real time instead of CPU time for :set -s
Simon Marlow [Fri, 15 Apr 2016 23:21:56 +0000 (16:21 -0700)] 
GHCi: use real time instead of CPU time for :set -s

CPU time is never very accurate, and it broke completely with
-fexternal-interpreter which runs the interpreted computations in a
separate process.

3 years agoRTS: Add setInCallCapability()
Simon Marlow [Tue, 18 Nov 2014 15:44:14 +0000 (15:44 +0000)] 
RTS: Add setInCallCapability()

This allows an OS thread to specify which capability it should run on
when it makes a call into Haskell.  It is intended for a fairly
specialised use case, when the client wants to have tighter control over
the mapping between OS threads and Capabilities - perhaps 1:1
correspondence, for example.

3 years agoKill varSetElemsWellScoped in quantifyTyVars
Bartosz Nitka [Tue, 26 Apr 2016 12:58:24 +0000 (05:58 -0700)] 
Kill varSetElemsWellScoped in quantifyTyVars

varSetElemsWellScoped introduces unnecessary non-determinism in
inferred type signatures.
Removing this instance required changing the representation of
TcDepVars to use deterministic sets.
This is the last occurence of varSetElemsWellScoped, allowing me to
finally remove it.

Test Plan:
./validate
I will update the expected outputs when commiting, some reordering
of type variables in types is expected.

Reviewers: goldfire, simonpj, austin, bgamari

Reviewed By: simonpj

Subscribers: thomie, simonmar

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

GHC Trac Issues: #4012

3 years agoTestsuite: delete unused concurrent/prog002/FileIO.hs
Thomas Miedema [Mon, 25 Apr 2016 15:54:51 +0000 (17:54 +0200)] 
Testsuite: delete unused concurrent/prog002/FileIO.hs

3 years agoTestsuite: delete Roles9.stderr
Thomas Miedema [Mon, 25 Apr 2016 15:03:20 +0000 (17:03 +0200)] 
Testsuite: delete Roles9.stderr

In 99cd277c181dfb346d5f2d5fc9475379229037d0, goldfire deleted the Roles9
test, but not its stderr file.

3 years agoTestsuite: fixup lots of tests
Thomas Miedema [Mon, 25 Apr 2016 14:58:34 +0000 (16:58 +0200)] 
Testsuite: fixup lots of tests

These aren't run very often, because they require external libraries.
https://ghc.haskell.org/trac/ghc/wiki/Building/RunningTests/Running#AdditionalPackages

maessen-hashtab still doesn't compile, QuickCheck api changed.

Update submodule hpc.

3 years agoTestsuite: Delete test for deprecated "packedstring"
Thomas Miedema [Mon, 25 Apr 2016 12:55:38 +0000 (14:55 +0200)] 
Testsuite: Delete test for deprecated "packedstring"

3 years agoderiveConstants: Fix nm-classic error message
Ben Gamari [Sun, 24 Apr 2016 09:31:51 +0000 (11:31 +0200)] 
deriveConstants: Fix nm-classic error message

Thanks to George Colpitts for the suggestion.

3 years agoGet rid of varSetElemsWellScoped in abstractFloats
Bartosz Nitka [Fri, 22 Apr 2016 16:47:30 +0000 (09:47 -0700)] 
Get rid of varSetElemsWellScoped in abstractFloats

It's possible to get rid of this use site in a local way
and it introduces unneccessary nondeterminism.

Test Plan: ./validate

Reviewers: simonmar, goldfire, austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: thomie

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

GHC Trac Issues: #4012

3 years agoMake benign non-determinism in pretty-printing more obvious
Bartosz Nitka [Mon, 18 Apr 2016 14:32:03 +0000 (07:32 -0700)] 
Make benign non-determinism in pretty-printing more obvious

This change takes us one step closer to being able to remove
`varSetElemsWellScoped`. The end goal is to make every source
of non-determinism obvious at the source level, so that when
we achieve determinism it doesn't get broken accidentally.

Test Plan: compile GHC

Reviewers: simonmar, goldfire, simonpj, austin, bgamari

Reviewed By: simonpj

Subscribers: thomie

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

GHC Trac Issues: #4012

3 years agoRemove unused tyCoVarsOfTelescope
Bartosz Nitka [Fri, 22 Apr 2016 12:51:36 +0000 (05:51 -0700)] 
Remove unused tyCoVarsOfTelescope

Grepping reveals that it's not used. I suspect that it isn't useful
anymore.

Test Plan: grep

Reviewers: goldfire, austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: thomie, simonmar

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

3 years agoTypo: veraibles -> variables
Bartosz Nitka [Fri, 22 Apr 2016 12:20:54 +0000 (05:20 -0700)] 
Typo: veraibles -> variables

3 years agoFix typos: alpah -> alpha
Bartosz Nitka [Fri, 22 Apr 2016 11:02:08 +0000 (04:02 -0700)] 
Fix typos: alpah -> alpha

3 years agoRefactor free tyvars on LHS of rules
Simon Peyton Jones [Fri, 22 Apr 2016 09:47:14 +0000 (10:47 +0100)] 
Refactor free tyvars on LHS of rules

A RULE can have unbound meta-tyvars on the LHS.  Consider
  data T a = C

  foo :: T a -> Int
  foo C = 1

  {-# RULES "myrule"  foo C = 1 #-}

After type checking the LHS becomes (foo alpha (C alpah)) and we do
not want to zap the unbound meta-tyvar 'alpha' to Any, because that
limits the applicability of the rule.  Instead, we want to quantify
over it!

Previously there was a rather clunky implementation of this
quantification, buried in the zonker in TcHsSyn (zonkTvCollecting).

This patch refactors it so that the zonker just turns the meta-tyvar
into a skolem, and the desugarer adds the quantification.  See DsBinds
Note [Free tyvars on rule LHS]. As it happened, the desugarer was
already doing something similar for dictionaries. See DsBinds
Note [Free dictionaries on rule LHS]

No change in functionality, but less cruft.

3 years agoSimplify defaultKindVar and friends
Simon Peyton Jones [Thu, 21 Apr 2016 13:52:16 +0000 (14:52 +0100)] 
Simplify defaultKindVar and friends

I found zonkQuantifiedTyVar rather complicated, especially the two
places where we defaulted RuntimeRep variables. This simplifies and
modularises the story.

Refactoring only.