Simon Peyton Jones [Mon, 18 Apr 2016 14:14:40 +0000 (15:14 +0100)]
Tighten checking for associated type instances
This patch finishes off Trac #11450. Following debate on that ticket,
the patch tightens up the rules for what the instances of an
associated type can look like. Now they must match the instance
header exactly. Eg
class C a b where
type T a x b
With this class decl, if we have an instance decl
instance C ty1 ty2 where ...
then the type instance must look like
type T ty1 v ty2 = ...
with exactly
- 'ty1' for 'a'
- 'ty2' for 'b', and
- a variable for 'x'
For example:
instance C [p] Int
type T [p] y Int = (p,y,y)
Previously we allowed multiple instance equations and now, in effect,
we don't since they would all overlap. If you want multiple cases,
use an auxiliary type family.
This is consistent with the treatment of generic-default instances,
and the user manual always said "WARNING: this facility (multiple
instance equations may be withdrawn in the future".
I also improved error messages, and did other minor refactoring.
Simon Peyton Jones [Mon, 18 Apr 2016 14:01:13 +0000 (15:01 +0100)]
Refactor computing dependent type vars
There should be no change in behaviour here
* Move splitDepVarsOfType(s) from Type to TcType
* Define data type TcType.TcDepVars, document what it means,
and use it where appropriate, notably in splitDepVarsOfType(s)
* Use it in TcMType.quantifyTyVars and friends
Simon Peyton Jones [Mon, 18 Apr 2016 13:54:03 +0000 (14:54 +0100)]
Define TyCoRep.ppSuggestExplicitKinds, and use it
This just defines a useful helper function that was being
duplicated in several places
Simon Peyton Jones [Mon, 18 Apr 2016 13:51:30 +0000 (14:51 +0100)]
Remove unused import of emptyNameEnv
Herbert Valerio Riedel [Tue, 19 Apr 2016 07:00:54 +0000 (09:00 +0200)]
Update `directory` submodule to v1.2.6.2 release
The v1.2.6.1 release uploaded to Hackage is broken, we don't
want to bundle a release that's non-installable from Hackage
Ben Gamari [Mon, 18 Apr 2016 20:32:59 +0000 (22:32 +0200)]
rts: Don't use strndup
Reviewers: austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2125
Ben Gamari [Sun, 10 Apr 2016 22:49:06 +0000 (00:49 +0200)]
rts: Limit maximum backtrace depth
This prevents us from entering an infinite loop in the event of a
hitting bad unwinding information.
Herbert Valerio Riedel [Mon, 18 Apr 2016 20:26:02 +0000 (22:26 +0200)]
Remove obsolete/redundant FLEXIBLE_ARRAY macro
This macro is doubly redundant, first off all, ancient GCCs prior to
version 3.0 are not supported anymore, but more importantly, we require
a ISO C99 compliant compiler, so we can use the proper ISO C syntax
without worrying about compatibility.
Reviewers: austin, bgamari
Reviewed By: bgamari
Subscribers: carter, thomie
Differential Revision: https://phabricator.haskell.org/D2121
Tomas Carnecky [Mon, 18 Apr 2016 20:11:53 +0000 (22:11 +0200)]
Use stdint types to define SIZEOF and ALIGNMENT of INTx/WORDx
Saves us a CPP #if in MachDeps.h since we now can always rely on a
64-bit type being available.
Reviewers: austin, bgamari
Reviewed By: bgamari
Subscribers: thomie, erikd
Differential Revision: https://phabricator.haskell.org/D2099
Ben Gamari [Mon, 18 Apr 2016 13:13:41 +0000 (15:13 +0200)]
relnotes: Add note about #11744 and workaround
Test Plan: Read it
Reviewers: hvr, austin
Subscribers: carter, thomie
Differential Revision: https://phabricator.haskell.org/D2120
GHC Trac Issues: #11744
Bartosz Nitka [Mon, 18 Apr 2016 13:29:37 +0000 (06:29 -0700)]
Make it easy to get hyperlinked sources
The version of `haddock` that ghc has as a submodule has an option
for generating linkified sources. I don't think it hurts to have this
and they are great for exploring the codebase.
I'd be nice if harbormaster or travis published them somewhere, but
I don't know how to do that yet.
Test Plan:
uncomment, run `make` and look at the
nicely linkified sources in `compiler/stage2/doc/html/ghc/`
Reviewers: hvr, austin, bgamari
Reviewed By: bgamari
Subscribers: thomie, simonmar
Differential Revision: https://phabricator.haskell.org/D2119
Herbert Valerio Riedel [Sun, 17 Apr 2016 18:42:43 +0000 (20:42 +0200)]
Update haskeline submodule to 0.7.2.3 release
Herbert Valerio Riedel [Sun, 17 Apr 2016 16:39:36 +0000 (18:39 +0200)]
Silence unused-import warning introduced by
93d85af9fec968b
Herbert Valerio Riedel [Sun, 17 Apr 2016 15:39:13 +0000 (17:39 +0200)]
Update `directory` submodule to v1.2.6.1 release
This fixes a build-failure on OSX
Tamar Christina [Sun, 17 Apr 2016 15:11:02 +0000 (17:11 +0200)]
Resolve symlinks when attempting to find GHC's lib folder on Windows
Summary:
Systools makes some pretty hard assumptions about where GHC is on Windows.
One of these is that ghc be in a folder named `bin` and that `../lib` exists.
This pattern doesn't hold for symlinks as a link `C:\ghc-bin\`
pointing to `C:\ghc\ghc-7.10.3\bin` will break this assumption.
This patch resolves symlinks by finding where they point to and uses that location
as the base for GHC.
This uses an API that's been introduced in Vista. For older systems it falls back to
the current behavior of not resolving symlinks.
Test Plan:
1) Create symlink to GHC's bin folder.
2) Run GHC from that folder.
Reviewers: austin, bgamari
Reviewed By: austin
Subscribers: #ghc_windows_task_force, thomie
Differential Revision: https://phabricator.haskell.org/D2101
GHC Trac Issues: #11759
Erik de Castro Lopo [Sun, 17 Apr 2016 12:44:38 +0000 (14:44 +0200)]
Linker: Clean up #if USE_MMAP usage
Test Plan:
- Run tests on x86_64/linux, x86_64/darwin and powerpc/linux
- Cross compile rts/Linker.c with the i686-w64-mingw32-gcc and
x86_64-w64-mingw32-gcc Linux to Windows cross-compilers.
Reviewers: hvr, austin, thomie, bgamari, simonmar, Phyx
Reviewed By: Phyx
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1437
Andrew Farmer [Sun, 17 Apr 2016 12:43:24 +0000 (14:43 +0200)]
Check CCS tree for pointers into shared object during checkUnload
Prevent shared objects from being unloaded if cost centre stacks point
at the object. This will prevent segfault in #11776, but also prevents
objects from ever being unloaded when profiling. Pruning CCS tree will
enable that in another diff.
Test Plan: make TEST=linker_profiled, examine linker_profiled.run.stderr
Reviewers: austin, simonmar, bgamari
Reviewed By: simonmar, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2069
GHC Trac Issues: #11776
David Luposchainsky [Sun, 17 Apr 2016 12:41:33 +0000 (14:41 +0200)]
Add flag to control number of missing patterns in warnings
Non-exhaustive pattern warnings had their number of patterns to
show hardcoded in the past. This patch implements the TODO remark
that this should be made a command line flag.
-fmax-uncovered-patterns=<n>
can now be used to influence the number of patterns to be shown.
Reviewers: hvr, austin, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2076
Ben Gamari [Sun, 17 Apr 2016 11:25:05 +0000 (13:25 +0200)]
validate: Note existence of config_args variable
Ben Gamari [Sun, 17 Apr 2016 11:21:07 +0000 (13:21 +0200)]
users-guide: Fix typo
Ben Gamari [Sun, 17 Apr 2016 10:58:24 +0000 (12:58 +0200)]
TH: Tweak Haddock language
Iavor S. Diatchki [Sun, 17 Apr 2016 10:56:31 +0000 (12:56 +0200)]
Add TemplateHaskell support for Overlapping pragmas
Reviewers: hvr, goldfire, austin, RyanGlScott, bgamari
Reviewed By: RyanGlScott, bgamari
Subscribers: RyanGlScott, thomie
Differential Revision: https://phabricator.haskell.org/D2118
Tamar Christina [Sun, 17 Apr 2016 11:03:17 +0000 (13:03 +0200)]
Add Windows import library support to the Runtime Linker
Summary:
Import libraries are files ending in `.dll.a` and `.lib` depending on which
compiler creates them (GCC, vs MSVC).
Import Libraries are standard `archive` files that contain object files.
These object files can have two different formats:
1) The normal COFF Object format for object files
(contains all ascii data and very little program code, so do not
try to execute.)
2) "short import" format which just contains a symbol name and
the dll in which the symbol can be found.
Import Libraries are useful for two things:
1) Allowing applications that don't support dynamic linking to
link against the import lib (non-short format) which then
makes calls into the DLL by loading it at runtime.
2) Allow linking of mutually recursive dlls. if `A.DLL` requires
`B.DLL` and vice versa, import libs can be used to break the cycle
as they can be created from the expected exports of the DLLs.
A side effect of having these two capabilities is that Import libs are often
used to hide specific versions of DLLs behind a non-versioned import lib.
e.g. GCC_S.a (non-conventional import lib) will point to the correct
`libGCC` DLL. With this support Windows Haskell files can now just link
to `-lGCC_S` and not have to worry about what the actual name of libGCC is.
Also third party libraries such as `icuuc` use import libs to forward to
versioned DLLs. e.g. `icuuc.lib` points to `icuuc51.dll` etc.
Test Plan:
./validate
Two new tests added T11072gcc T11072msvc
Two binary files have been added to the test folder because the "short"
import library format doesn't seem to be creatable via `dlltool`
and requires Microsoft's `lib.exe`.
Reviewers: bgamari, RyanGlScott, erikd, goldfire, austin, hvr
Reviewed By: RyanGlScott, erikd
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1696
GHC Trac Issues: #11072
Herbert Valerio Riedel [Sun, 17 Apr 2016 09:10:24 +0000 (11:10 +0200)]
Update array submodule to v0.5.1.1 release tag
Herbert Valerio Riedel [Sat, 16 Apr 2016 19:17:03 +0000 (21:17 +0200)]
Update `directory` submodule to v1.2.6.0 release
Herbert Valerio Riedel [Sat, 16 Apr 2016 16:12:09 +0000 (18:12 +0200)]
Rework CC/CC_STAGE0 handling in `configure.ac`
Rather than using the non-standard/idiomatic `--with-{gcc,clang}=...`
scheme use the `CC=...` style scheme.
The basic idea is to have Autoconf's CC/CFLAG/CPPFLAG apply to
stage{1,2,3}, while having a separate _STAGE0 set of env-vars
denote the bootstrap-toolchain flags/programs.
This should be simpler, less confusing, and somewhat more in line with
Autoconf's idioms (allowing us to reuse more of Autoconf rather than
(re)inventing our own confusing non-standard m4 macros to do stuff that
Autoconf could almost do already for us)
Morever, expose CC_STAGE0 as a so-called "precious" variable.
So now we can better control which bootstrapping gcc is used
(by default the one used by the stage0 ghc, unless CC_STAGE0 is
overriden)
```
Some influential environment variables:
CC_STAGE0 C compiler command (bootstrap)
CC C compiler command
CFLAGS C compiler flags
...
Use these variables to override the choices made by `configure' or to
help it to find libraries and programs with nonstandard names/locations.
```
Test Plan: I've tested that cross-compiling with
`--target=powerpc-linux-gnu` still works, and tried a few variants of
settting `CC=` and `CC_STAGE0=`; `./validate` passed as well
Reviewers: erikd, austin, bgamari, simonmar
Reviewed By: simonmar
Subscribers: Phyx, thomie
Differential Revision: https://phabricator.haskell.org/D2078
Ben Gamari [Sat, 16 Apr 2016 15:53:08 +0000 (17:53 +0200)]
Bump haddock submodule
Herbert Valerio Riedel [Sat, 16 Apr 2016 13:25:07 +0000 (15:25 +0200)]
deriveConstants: Verify sanity of nm
Add a sanity check ensuring that nm emits valid hexadecimal output, as
required by POSIX. See #11744 for motivation.
Reviewers: austin, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2113
GHC Trac Issues: #11744
Ben Gamari [Fri, 15 Apr 2016 09:54:54 +0000 (11:54 +0200)]
rts/RetainerProfile: Remove unused local
Reported in #11777.
Ben Gamari [Fri, 15 Apr 2016 09:43:41 +0000 (11:43 +0200)]
libdw: More precise version check
Test Plan: Try configure in an environment with older `libdw`
Reviewers: hvr, austin
Subscribers: thomie, erikd
Differential Revision: https://phabricator.haskell.org/D2103
GHC Trac Issues: #11820
Simon Peyton Jones [Fri, 15 Apr 2016 15:17:54 +0000 (16:17 +0100)]
Improve TcFlatten.flattenTyVar
This patch tides up the structure, simplifying FlattenTvResult.
It also replaces a use of zonkTcType (which I hated) with
coercionKind, in that same function. Happily, the result is
little faster, maybe even a percentage point or two, which is
a lot for a compiler.
This also removes the line
|| not (map binderVisibility bndrs1 == map binderVisibility bndrs2)
from TcCanonical.can_eq_nc', in the ForAllTy/ForAllTy case.
Why? Becuase I can't see why binder-visiblity should matter, and
when we use coercionKind instead of zonkTcType in flattenTyVar,
this case pops up and rejects a program that should pass. I did
discuss this with Richard.
Simon Peyton Jones [Fri, 8 Apr 2016 16:29:41 +0000 (17:29 +0100)]
Comments only, on Type.topSortTyVars
Simon Peyton Jones [Fri, 8 Apr 2016 16:28:44 +0000 (17:28 +0100)]
Remove dead function SimplUtils.countValArgs
Ben Gamari [Fri, 15 Apr 2016 09:41:45 +0000 (11:41 +0200)]
rel-notes: Add note about UndecidableSuperClasses and #11762
Test Plan: Read it
Reviewers: austin, kosmikus
Reviewed By: kosmikus
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2111
GHC Trac Issues: #11318, #11762
Ben Gamari [Fri, 15 Apr 2016 09:41:34 +0000 (11:41 +0200)]
Linker: Fix signedness mismatch
Test Plan: Validate on OS X
Reviewers: erikd, austin, Phyx
Reviewed By: austin, Phyx
Subscribers: Phyx, thomie
Differential Revision: https://phabricator.haskell.org/D2110
GHC Trac Issues: #11828
Ben Gamari [Fri, 15 Apr 2016 09:41:24 +0000 (11:41 +0200)]
testsuite: Add test for #11827
Test Plan: Validate
Reviewers: austin
Reviewed By: austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2109
GHC Trac Issues: #11827
Ben Gamari [Fri, 15 Apr 2016 09:41:12 +0000 (11:41 +0200)]
testsuite: Add T11824
Test Plan: Validate
Reviewers: goldfire, austin
Reviewed By: austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2107
GHC Trac Issues: #11824
Ben Gamari [Fri, 15 Apr 2016 09:41:00 +0000 (11:41 +0200)]
utils: Provide CallStack to expectJust
Test Plan: Validate
Reviewers: gridaphobe, austin
Reviewed By: austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2106
Ben Gamari [Wed, 13 Apr 2016 11:41:09 +0000 (13:41 +0200)]
users-guide: Note change in LLVM support policy
Richard Eisenberg [Tue, 12 Apr 2016 16:00:55 +0000 (12:00 -0400)]
Increase an InScopeSet for a substitution
This is a further fix for #11814
Bartosz Nitka [Fri, 15 Apr 2016 11:48:45 +0000 (04:48 -0700)]
Remove some gratitious varSetElemsWellScoped
Summary:
`varSetElemsWellScoped` uses `varSetElems` under the hood which
introduces unnecessary nondeterminism.
This does the same thing, possibly cheaper, while preserving
determinism.
Test Plan: ./validate
Reviewers: simonmar, goldfire, austin, bgamari, simonpj
Reviewed By: simonpj
Subscribers: thomie, RyanGlScott
Differential Revision: https://phabricator.haskell.org/D2116
GHC Trac Issues: #4012
Simon Peyton Jones [Fri, 15 Apr 2016 10:49:23 +0000 (11:49 +0100)]
Adjust error check for class method types
Fixes Trac #11793. Nothing deep here.
Simon Peyton Jones [Fri, 15 Apr 2016 10:48:47 +0000 (11:48 +0100)]
Comments only
Bartosz Nitka [Fri, 15 Apr 2016 11:46:21 +0000 (04:46 -0700)]
Kill some unnecessary varSetElems
When you do `varSetElems (tyCoVarsOfType x)` it's equivalent to
`tyCoVarsOfTypeList x`.
Why? If you look at the implementation:
```
tyCoVarsOfTypeList ty = runFVList $ tyCoVarsOfTypeAcc ty
tyCoVarsOfType ty = runFVSet $ tyCoVarsOfTypeAcc ty
```
they use the same helper function. The helper function returns a
deterministically ordered list and a set. The only difference
between the two is which part of the result they take. It is redundant
to take the set and then immediately convert it to a list.
This helps with determinism and we eventually want to replace the uses
of `varSetElems` with functions that don't leak the values of uniques.
This change gets rid of some instances that are easy to kill.
I chose not to annotate every place where I got rid of `varSetElems`
with a comment about non-determinism, because once we get rid of
`varSetElems` it will not be possible to do the wrong thing.
Test Plan: ./validate
Reviewers: goldfire, austin, simonmar, bgamari, simonpj
Reviewed By: simonpj
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2115
GHC Trac Issues: #4012
Joachim Breitner [Thu, 31 Mar 2016 08:18:15 +0000 (10:18 +0200)]
Add a final demand analyzer run right before TidyCore
in order to have precise used-once information in the exported
strictness signatures, as well as precise used-once information on
thunks. This avoids the bad effects of #11731.
The subsequent worker-wrapper pass is responsible for removing the
demand environment part of the strictness signature. It does not run
after the final demand analyzer pass, so remove this also in CoreTidy.
The subsequent worker-wrapper pass is also responsible for removing
used-once-information from the demands and strictness signatures, as
these might not be preserved by the simplifier. This is _not_ done by
CoreTidy, because we _do_ want this information, as produced by the last
round of the demand analyzer, to be available to the code generator.
Differential Revision: https://phabricator.haskell.org/D2073
Joachim Breitner [Wed, 30 Mar 2016 10:55:10 +0000 (12:55 +0200)]
Add a test case for #11731.
Bartosz Nitka [Thu, 14 Apr 2016 13:09:17 +0000 (06:09 -0700)]
Remove some old commented out code in StgLint
This looks like some traces of an experiment to check if shadowing is good for
STG. The code refers to things that don't exist anymore and this part of
code hasn't been touched for ages, so I think this should be safe to
remove.
Test Plan: just comments
Reviewers: austin, bgamari, simonpj
Reviewed By: simonpj
Subscribers: thomie, simonmar
Differential Revision: https://phabricator.haskell.org/D2114
Bartosz Nitka [Thu, 14 Apr 2016 12:23:18 +0000 (05:23 -0700)]
Fix typos: tyars -> tyvars
Bartosz Nitka [Thu, 14 Apr 2016 12:16:52 +0000 (05:16 -0700)]
Fix commented out debugging code in ByteCodeGen
It changed from VarSet to DVarSet some time ago.
Richard Eisenberg [Fri, 8 Apr 2016 06:01:34 +0000 (08:01 +0200)]
Teach lookupLocalRdrEnv about Exacts. (#11813)
Richard Eisenberg [Wed, 6 Apr 2016 13:24:34 +0000 (15:24 +0200)]
Fix #11814 by throwing more stuff into InScopeSets
Richard Eisenberg [Wed, 6 Apr 2016 14:37:22 +0000 (16:37 +0200)]
Fix #11797.
DsMeta curiously omitted quantified tyvars in certain circumstances.
This patch means it doesn't.
Test case: th/T11797
Richard Eisenberg [Thu, 7 Apr 2016 14:44:06 +0000 (16:44 +0200)]
Fix #11811.
Previously, I had forgotten to omit variables already in scope
from the TypeInType CUSK check. Simple enough to fix.
Test case: typecheck/should_compile/T11811
Simon Marlow [Sat, 9 Apr 2016 19:49:52 +0000 (20:49 +0100)]
Allocate blocks in the GC in batches
Avoids contention for the block allocator lock in the GC; this can be
seen in the gc_alloc_block_sync counter emitted by +RTS -s.
I experimented with this a while ago, and there was already
commented-out code for it in GCUtils.c, but I've now improved it so that
it doesn't result in significantly worse memory usage.
* The old method of putting spare blocks on ws->part_list was wasteful,
the spare blocks are now shared between all generations and retained
between GCs.
* repeated allocGroup() results in fragmentation, so I switched to using
allocLargeChunk() instead which is fragmentation-friendly; we already
use it for the same reason in nursery allocation.
Simon Marlow [Tue, 12 Apr 2016 02:29:14 +0000 (19:29 -0700)]
Cache the size of part_list/scavd_list (#11783)
After a parallel GC, it is possible to have a long list of blocks in
ws->part_list, if we did a lot of work stealing but didn't fill up the
blocks we stole. These blocks persist until the next load-balanced GC,
which might be a long time, and during every GC we were traversing this
list to find its size. The fix is to maintain the size all the time, so
we don't have to compute it.
Simon Marlow [Mon, 11 Apr 2016 11:59:36 +0000 (04:59 -0700)]
Small simplification (#11777)
DEAD_WEAK used to have a different layout, see
d61c623ed6b2d352474a7497a65015dbf6a72e12
Tamar Christina [Mon, 11 Apr 2016 04:51:44 +0000 (06:51 +0200)]
Add linker notes
Summary: Add linker notes following #11223 and D1805
Reviewers: austin, bgamari, erikd
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2102
GHC Trac Issues: #11223
Herbert Valerio Riedel [Mon, 11 Apr 2016 05:28:15 +0000 (07:28 +0200)]
Use `@since` annotation in GHC.ExecutionStack
While
ad532ded871a9a5180388a2b7cdbdc26e053284c fixed the version
number, this fixes the markup...
RyanGlScott [Mon, 11 Apr 2016 00:53:23 +0000 (02:53 +0200)]
Deriving Functor-like classes should unify kind variables
While the deriving machinery always unifies the kind of the typeclass
argument with the kind of the datatype, this proves not to be sufficient
to produce well kinded instances for some poly-kinded datatypes. For
example:
```
newtype Compose (f :: k2 -> *) (g :: k1 -> k2) (a :: k1)
= Compose (f (g a)) deriving Functor
```
would fail because only `k1` would get unified with `*`, causing the
following
ill kinded instance to be generated:
```
instance (Functor (f :: k2 -> *), Functor (g :: * -> k2)) =>
Functor (Compose f g) where ...
```
To prevent this, we need to take the subtypes and unify their kinds with
`* -> *`.
Fixes #10524 for good.
Test Plan: ./validate
Reviewers: simonpj, hvr, austin, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2097
GHC Trac Issues: #10524, #10561
Shane O'Brien [Mon, 11 Apr 2016 00:53:00 +0000 (02:53 +0200)]
Added (more) missing instances for Identity and Const
* `Identity` and `Const` now have `Num`, `Real`, `Integral`,
`Fractional`, `Floating`, `RealFrac` and `RealFloat` instances
* `Identity` and `Const` now have `Bits` and `FiniteBits` instances
* `Identity` and `Const` now have `IsString` instances
Reviewers: RyanGlScott, austin, hvr, bgamari, ekmett
Reviewed By: ekmett
Subscribers: nomeata, ekmett, RyanGlScott, thomie
Differential Revision: https://phabricator.haskell.org/D2079
GHC Trac Issues: #11790
RyanGlScott [Mon, 11 Apr 2016 00:34:55 +0000 (02:34 +0200)]
Filter out invisible kind arguments during TH reification
Previously, all kind arguments were being reified, which would cause
something like this:
```
type Id a = a
data Proxy (a :: Id k) = Proxy
```
to output
```
data Proxy (a :: Id * k) = Proxy
```
when `Proxy`'s `Info` is reified. The fix is simple: simply call
`filterOutInvisibleTypes` on the kind arguments of a kind synonym
application.
Fixes #11463.
Test Plan: ./validate
Reviewers: austin, bgamari, goldfire
Reviewed By: goldfire
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2081
GHC Trac Issues: #11463
Rik Steenkamp [Mon, 11 Apr 2016 00:26:06 +0000 (02:26 +0200)]
Fix a closed type family error message
Now we check whether a closed type family's equation is headed with
the correct type before we kind-check the equation.
Also, instead of "expected only no parameters" we now generate the
message "expected no parameters".
Fixes #11623.
Reviewers: simonpj, austin, bgamari
Reviewed By: simonpj, bgamari
Subscribers: simonpj, goldfire, thomie
Differential Revision: https://phabricator.haskell.org/D2089
GHC Trac Issues: #11623
Tamar Christina [Sun, 10 Apr 2016 22:38:42 +0000 (00:38 +0200)]
Change runtime linker to perform lazy loading of symbols/sections
The Runtime Linker is currently eagerly loading all object files on all
platforms which do not use the system linker for `GHCi`.
The problem with this approach is that it requires all symbols to be
found. Even those of functions never used/called. This makes the number
of libraries required to link things like `mingwex` quite high.
To work around this the `rts` was relying on a trick. It itself was
compiled with `MingW64-w`'s `GCC`. So it was already linked against
`mingwex`. As such, it re-exported the symbols from itself.
While this worked it made it impossible to link against `mingwex` in
user libraries. And with this means no `C99` code could ever run in
`GHCi` on Windows without having the required symbols re-exported from
the rts.
Consequently this rules out a large number of packages on Windows.
SDL2, HMatrix etc.
After talking with @rwbarton I have taken the approach of loading entire
object files when a symbol is needed instead of doing the dependency
tracking on a per symbol basis. This is a lot less fragile and a lot
less complicated to implement.
The changes come down to the following steps:
1) modify the linker to and introduce a new state for ObjectCode:
`Needed`. A Needed object is one that is required for the linking to
succeed. The initial set consists of all Object files passed as
arguments to the link.
2) Change `ObjectCode`'s to be indexed but not initialized or resolved.
This means we know where we would load the symbols,
but haven't actually done so.
3) Mark any `ObjectCode` belonging to `.o` passed as argument
as required: ObjectState `NEEDED`.
4) During `Resolve` object calls, mark all `ObjectCode`
containing the required symbols as `NEEDED`
5) During `lookupSymbol` lookups, (which is called from `linkExpr`
and `linkDecl` in `GHCI.hs`) is the symbol is in a not-yet-loaded
`ObjectCode` then load the `ObjectCode` on demand and return the
address of the symbol. Otherwise produce an unresolved symbols error
as expected.
6) On `unloadObj` we then change the state of the object and remove
it's symbols from the `reqSymHash` table so it can be reloaded.
This change affects all platforms and OSes which use the runtime linker.
It seems there are no real perf tests for `GHCi`, but performance
shouldn't be impacted much. We gain a lot of time not loading all `obj`
files, and we lose some time in `lookupSymbol` when we're finding
sections that have to be loaded. The actual finding itself is O(1)
(Assuming the hashtnl is perfect)
It also consumes slighly more memory as instead of storing just the
address of a symbol I also store some other information, like if the
symbol is weak or not.
This change will break any packages relying on renamed POSIX functions
that were re-named and re-exported by the rts. Any packages following
the proper naming for functions as found on MSDN will work fine.
Test Plan: ./validate on all platforms which use the Runtime linker.
Reviewers: thomie, rwbarton, simonmar, erikd, bgamari, austin, hvr
Reviewed By: erikd
Subscribers: kgardas, gridaphobe, RyanGlScott, simonmar,
rwbarton, #ghc_windows_task_force
Differential Revision: https://phabricator.haskell.org/D1805
GHC Trac Issues: #11223
Joachim Breitner [Sun, 10 Apr 2016 21:47:25 +0000 (23:47 +0200)]
Typos in Note
Ben Gamari [Sun, 10 Apr 2016 21:28:46 +0000 (23:28 +0200)]
RtsFlags: Un-constify temporary buffer
Otherwise we get a const-ness mismatch when we free the buffer, which
for some reason gcc 5.3 didn't notice.
RyanGlScott [Sun, 10 Apr 2016 20:59:37 +0000 (22:59 +0200)]
Remove the instantiation check when deriving Generic(1)
Previously, deriving `Generic(1)` bailed out when attempting to
instantiate visible type parameters (#5939), but this instantiation
check was quite fragile and doesn't interact well with `-XTypeInType`.
It has been decided that `Generic(1)` shouldn't be subjected to this
check anyway, so it has been removed, and `gen_Generic_binds`'s
machinery has been updated to substitute the type variables in a
generated `Rep`/`Rep1` instance with the user-supplied type arguments.
In addition, this also refactors `Condition` in `TcDeriv` a bit. Namely,
since we no longer need `tc_args` to check any conditions, the `[Type]`
component of `Condition` has been removed.
Fixes #11732.
Test Plan: ./validate
Reviewers: goldfire, kosmikus, simonpj, bgamari, austin
Reviewed By: simonpj, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2061
GHC Trac Issues: #5939, #11732
Ben Gamari [Sun, 10 Apr 2016 18:00:48 +0000 (20:00 +0200)]
base: Fix "since" annotation on GHC.ExecutionStack
I have no idea where "4.11" came from.
Ben Gamari [Sun, 10 Apr 2016 17:34:59 +0000 (19:34 +0200)]
Bump haddock submodule
Fixes #11818, where haddock's documentation broke `make install` when
Sphinx is not available.
Jason Eisenberg [Sun, 10 Apr 2016 17:17:46 +0000 (19:17 +0200)]
Fix suggestions for unbound variables (#11680)
When the typechecker generates the error message for an out-of-scope
variable, it now uses the GlobalRdrEnv with respect to which the
variable is unbound, not the GlobalRdrEnv which is available at the time
the error is reported. Doing so ensures we do not provide suggestions
which themselves are out-of-scope (because they are bound in a later
inter-splice group).
Nonetheless, we do note in the error message if an unambiguous, exact
match to the out-of-scope variable is found in a later inter-splice
group, and we specify where that match is not in scope.
Test Plan: ./validate
Reviewers: goldfire, austin, bgamari
Reviewed By: goldfire
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2000
GHC Trac Issues: #11680
Conal Elliott [Sun, 10 Apr 2016 17:13:44 +0000 (19:13 +0200)]
Export zonkEvBinds from TcHsSyn.
Needed for constructing correct constraint-satisfying code
(particularly type class instances) in a Core-to-Core transformation.
Reviewers: simonpj, austin, bgamari
Reviewed By: austin, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2088
GHC Trac Issues: #11804
Herbert Valerio Riedel [Sun, 10 Apr 2016 17:13:16 +0000 (19:13 +0200)]
Reduce default for -fmax-pmcheck-iterations from 1e7 to 2e6
The commit
28f951edfe50ea5182065144340061ec326781f5 introduced the
`-fmax-pmcheck-iterations` flag and set the default limit to 1e7
iterations.
However, this value is still high enough that it can result GHC to
exhibit memory spikes beyond 1 GiB of RAM usage (heap profile showed
several `(:)`s, as well as `THUNK_2_0`, and `PmCon` during the memory
spikes)
A value of 2e6 seems to be a safer upper bound which still manages to
let the checker not run into the limit in most cases.
Test Plan: Validate, try building a few Hackage packages
Reviewers: austin, gkaracha, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2095
Dominik Bollmann [Sun, 10 Apr 2016 16:57:38 +0000 (18:57 +0200)]
Fix Template Haskell bug reported in #11809.
Record selectors of data types spliced in with Template Haskell are not
renamer-resolved correctly in GHC HEAD. The culprit is
`newRecordSelector` which violates notes `Note [Binders in Template
Haskell] in Convert.hs` and `Note [Looking up Exact RdrNames] in
RnEnv.hs`. This commit fixes `newRecordSelector` accordingly.
Test Plan: ./validate
Reviewers: thomie, mpickering, bgamari, austin, simonpj, goldfire
Reviewed By: goldfire
Differential Revision: https://phabricator.haskell.org/D2091
GHC Trac Issues: #11809
Tomas Carnecky [Sun, 10 Apr 2016 16:56:35 +0000 (18:56 +0200)]
Remove spurious STG_UNUSED annotation
Reviewers: austin, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2096
Herbert Valerio Riedel [Sun, 10 Apr 2016 16:56:11 +0000 (18:56 +0200)]
Remove left-over shell-tools.c
The last user of this file was the "-dynload wrapper"
which was removed in
169f5972d5398e75c4cf7f831b6ce703288ec73c
for addressing #4275
Reviewers: austin, erikd, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2098
GHC Trac Issues: #4275
Chris Martin [Sun, 10 Apr 2016 16:55:45 +0000 (18:55 +0200)]
Add doc to (<=<) comparing its type to (.)
This is another documentation addition similar to D1989, this time
comparing the type of the Kleisli composition operator (<=<) to that
of plain function composition (.).
Reviewers: hvr, austin, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2100
Michael Snoyman [Sun, 10 Apr 2016 16:52:47 +0000 (18:52 +0200)]
Provide an optimized replicateM_ implementation #11795
In my testing, the worker/wrapper transformation applied here
significantly decreases the number of allocations performed when using
replicateM_. Additionally, this version of the function behaves
correctly for negative numbers (namely, it will behave the same as
replicateM_ 0, which is what previous versions of base have done).
Reviewers: bgamari, simonpj, hvr, austin
Reviewed By: bgamari, simonpj, austin
Subscribers: nomeata, simonpj, mpickering, thomie
Differential Revision: https://phabricator.haskell.org/D2086
GHC Trac Issues: #11795
Simon Marlow [Wed, 27 May 2015 11:08:17 +0000 (12:08 +0100)]
Refactor comments about shutdown
Bartosz Nitka [Fri, 8 Apr 2016 15:17:58 +0000 (08:17 -0700)]
Fix a comment: triple -> tuple
Someone must have forgotten to change this.
Joachim Breitner [Fri, 8 Apr 2016 09:09:26 +0000 (11:09 +0200)]
Remove obsolete comment about the implementation of foldl
Joachim Breitner [Fri, 8 Apr 2016 06:33:35 +0000 (08:33 +0200)]
GHC.Base: Use thenIO in instance Applicative IO
Since recent changes to CSE, the previous definition were no longer CSEd
with thenIO, which resulted in extra steps in the simplifier and hence
slightly larger compile times. See ticket:11781#comment:7.
Differential Revision: https://phabricator.haskell.org/D2092
Ben Gamari [Thu, 7 Apr 2016 19:18:58 +0000 (21:18 +0200)]
Revert "testsuite: One more 32-bit performance slip"
This reverts commit
06b7ce21571cc6696ded6126098f0f596f4ba3ca.
Ben Gamari [Thu, 7 Apr 2016 13:26:11 +0000 (15:26 +0200)]
rts: Fix parsing of profiler selectors
69822f0c5b67161b4d7558081bc94f6f3a7c5dbb broke this as it held on to a
reference into the `arg` string, which is later freed. Humbug.
Test Plan: Try using filtering
Reviewers: austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2090
GHC Trac Issues: #11810
Ben Gamari [Wed, 6 Apr 2016 21:40:44 +0000 (23:40 +0200)]
Fix installation of static sphinx assets
Previously the `_static` and `_sources` directories were installed in
the wrong parents. See #11803
Ben Gamari [Wed, 6 Apr 2016 19:36:52 +0000 (21:36 +0200)]
testsuite: One more 32-bit performance slip
(cherry picked from commit
6d36d8e19a7e9cf3d8e715b1820cb656e937e809)
Joachim Breitner [Thu, 7 Apr 2016 07:21:22 +0000 (09:21 +0200)]
Adjust performance numbers
to what phabricator found; not sure why my local validation yielded
different numbers.
Eugene Akentyev [Thu, 7 Apr 2016 03:44:59 +0000 (03:44 +0000)]
runtime: replace hw.ncpu with hw.logicalcpu for Mac OS X
Reviewed By: erikd, austin
Differential Revision: https://phabricator.haskell.org/D2082
GHC Trac Issues: #8594
Facundo DomÃnguez [Thu, 17 Mar 2016 15:21:25 +0000 (12:21 -0300)]
Set tct_closed to TopLevel for closed bindings.
Summary:
Till now tct_closed determined whether the type of a binding is closed.
With this patch tct_closed indicates whether the binding is closed.
Test Plan: ./validate
Reviewers: simonpj, austin, bgamari
Reviewed By: simonpj
Subscribers: mboes, thomie, simonpj
Differential Revision: https://phabricator.haskell.org/D2016
GHC Trac Issues: #11698
Joachim Breitner [Fri, 1 Apr 2016 11:11:18 +0000 (13:11 +0200)]
Demand Analyzer: Do not set OneShot information (second try)
as suggested in ticket:11770#comment:1. This code was buggy
(#11770), and the occurrence analyzer does the same job anyways.
This also elaborates the notes in the occurrence analyzer accordingly.
Previously, the worker/wrapper code would go through lengths to transfer
the oneShot annotations from the original function to both the worker
and the wrapper. We now simply transfer the demand on the worker, and
let the subsequent occurrence analyzer push this onto the lambda
binders.
This also requires the occurrence analyzer to do this more reliably.
Previously, it would not hand out OneShot annotatoins to things that
would not `certainly_inline` (and it might not have mattered, as the
Demand Analysis might have handed out the annotations). Now we hand out
one-shot annotations unconditionally.
Differential Revision: https://phabricator.haskell.org/D2085
Simon Peyton Jones [Fri, 1 Apr 2016 10:24:50 +0000 (12:24 +0200)]
CSE code cleanup and improvement
Triggered by an observation by Joachim, Simon felt the urge to clean up
the CSE code a bit. This is the result.
(Code by Simon, commit message and other leg-work by Joachim)
Differential Revision: https://phabricator.haskell.org/D2074
Joachim Breitner [Wed, 30 Mar 2016 11:22:26 +0000 (13:22 +0200)]
Core pretty printer: Omit wild case binders
as they (especially their id info with absence information) clutter the
output too much. They come back with debug_on.
Differential Revision: https://phabricator.haskell.org/D2072
Ben Gamari [Wed, 6 Apr 2016 16:27:52 +0000 (18:27 +0200)]
testsuite: Update 32-bit performance numbers
It's been quite a while since this has happened for some of our tests.
Ben Gamari [Wed, 6 Apr 2016 15:12:45 +0000 (17:12 +0200)]
T10870: Skip on 32-bit architectures
Shifts by amounts greater-than-or-equal-to the word size are undefined.
Ben Gamari [Wed, 6 Apr 2016 14:51:56 +0000 (16:51 +0200)]
T10272, T4340: Add 32-bit output
Herbert Valerio Riedel [Tue, 5 Apr 2016 13:15:47 +0000 (15:15 +0200)]
Fix misattribution of `-Wunused-local-binds` warnings
This fixes a bug where warnings actually controlled by
- `Opt_WarnUnusedMatches`
- `Opt_WarnUnusedTypePatterns`
- `Opt_WarnUnusedTopBinds`
were incorrectly reported as being controlled by
`Opt_WarnUnusedLocalBinds` as well
This bug was introduced in
bb5afd3c274011c5ea302210b4c290ec1f83209c
while implementing #10752
Test Plan: ./validate still running -- testsuite output wiggles expected
Reviewers: barrucadu, quchen, austin, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2077
Simon Peyton Jones [Tue, 5 Apr 2016 12:44:21 +0000 (13:44 +0100)]
Use exprCtOrigin in tcRnExpr
Richard suggested this, a good idea
Eric Seidel [Mon, 4 Apr 2016 10:05:01 +0000 (12:05 +0200)]
Don't infer CallStacks
We originally wanted CallStacks to be opt-in, but dealing with let
binders complicated things, forcing us to infer CallStacks. It turns
out that the inference is actually unnecessary though, we can let the
wanted CallStacks bubble up to the outer context by refusing to
quantify over them. Eventually they'll be solved from a given CallStack
or defaulted to the empty CallStack if they reach the top.
So this patch prevents GHC from quantifying over CallStacks, getting us
back to the original plan. There's a small ugliness to do with
PartialTypeSignatures, if the partial theta contains a CallStack
constraint, we *do* want to quantify over the CallStack; the user asked
us to!
Note that this means that
foo :: _ => CallStack
foo = getCallStack callStack
will be an *empty* CallStack, since we won't infer a CallStack for the
hole in the theta. I think this is the right move though, since we want
CallStacks to be opt-in. One can always write
foo :: (HasCallStack, _) => CallStack
foo = getCallStack callStack
to get the CallStack and still have GHC infer the rest of the theta.
Test Plan: ./validate
Reviewers: goldfire, simonpj, austin, hvr, bgamari
Reviewed By: simonpj, bgamari
Subscribers: bitemyapp, thomie
Projects: #ghc
Differential Revision: https://phabricator.haskell.org/D1912
GHC Trac Issues: #11573
Ben Gamari [Mon, 4 Apr 2016 09:52:43 +0000 (11:52 +0200)]
Bump binary submodule
Simon Peyton Jones [Mon, 4 Apr 2016 09:34:35 +0000 (10:34 +0100)]
Elaborate test for #11376
This just adds the Prox stuff from the Description in Trac #11376
to the test case,
The class stuff seems weird becuase the type is ambiguous
Jason Eisenberg [Mon, 4 Apr 2016 08:57:39 +0000 (10:57 +0200)]
rts: Make StablePtr derefs thread-safe (#10296)
Stable pointers can now be safely dereferenced while the stable pointer
table is simultaneously being enlarged.
Test Plan: ./validate
Reviewers: ezyang, austin, bgamari, simonmar
Subscribers: carter, thomie
Differential Revision: https://phabricator.haskell.org/D2031
GHC Trac Issues: #10296
Simon Peyton Jones [Mon, 4 Apr 2016 09:18:43 +0000 (10:18 +0100)]
Deeply instantiate in :type
See Trac #11376 and
Note [Deeply instantiate in :type] in TcRnDriver
Sadly this showed up one new problem (Trac #11786) and one opportunity
(Trac #11787), so test T11549 is now marked expect-broken on these two.