6 years agoMerge branch 'wip/simd'
Geoffrey Mainland [Mon, 23 Sep 2013 04:22:19 +0000 (00:22 -0400)] 
Merge branch 'wip/simd'

This merge revises and extends the current SIMD support in GHC. Notable

 * Support for AVX, AVX2, and AVX-512. Support for AVX-512 is untested.

 * SIMD primops are currently LLVM-only and documented in

 * By default only 128-bit wide SIMD vectors are passed in registers, and then
   only on the X86_64 architecture. There is a "hidden" flag,
   -fllvm-pass-vectors-in-regs, that causes GHC to generate LLVM code that
   assumes all vectors are passed in registers by LLVM. This can be used with a
   suitably patched version of LLVM, and if we get LLVM 3.4 patched, we can
   consider turning it on by default for LLVM 3.4+. This would mean that we
   couldn't mix LLVM <3.4-compiled object files with LLVM >=3.4-compiled object
   files, but I don't see that as much of a problem.

 * utils/genprimcode has been hacked up to allow us to write vector operations
   once and have them instantiated at multiple vector types. I'm not thrilled
   with this solution, but after discussing with Simon PJ, what I've implemented
   seems to be the minimal reasonable solution to the problem of exploding
   primop boilerplate. The changes are documented in

 * Error handling is sub-optimal. My patch checks to make sure that vector
   primops can be compiled efficiently based on the current set of dynamic
   flags. For example, if -mavx is not specified and the user tries to use a
   primop that adds together two 256-bit wide vectors of double-precision
   elements, the user will see an error message like:

     ghc-stage2: sorry! (unimplemented feature or known bug)
       (GHC version 7.7.20130916 for x86_64-unknown-linux):
 256-bit wide floating point SIMD vector instructions require at least -mavx.

6 years agoCheck that SIMD vector instructions are compatible with current set of dynamic flags.
Geoffrey Mainland [Mon, 16 Sep 2013 16:48:30 +0000 (12:48 -0400)] 
Check that SIMD vector instructions are compatible with current set of dynamic flags.

SIMD vector instructions currently require the LLVM back-end. The set of
available instructions also depends on the set of architecture flags specified
on the command line.

6 years agoEnable -msse to be specified by itself.
Geoffrey Mainland [Mon, 16 Sep 2013 16:27:37 +0000 (12:27 -0400)] 
Enable -msse to be specified by itself.

This sets the SSE "version" to 1.0.

6 years agoBy default, only pass 128-bit SIMD vectors in registers on X86-64.
Geoffrey Mainland [Mon, 16 Sep 2013 03:43:29 +0000 (23:43 -0400)] 
By default, only pass 128-bit SIMD vectors in registers on X86-64.

LLVM's GHC calling convention only allows 128-bit SIMD vectors to be passed in
machine registers on X86-64. This may change in LLVM 3.4; the hidden flag
-fllvm-pass-vectors-in-regs causes all SIMD vector widths to be passed in
registers on both X86-64 and on X86-32.

6 years agoAdd 512-bit-wide SIMD primitives.
Geoffrey Mainland [Mon, 16 Sep 2013 02:53:39 +0000 (22:53 -0400)] 
Add 512-bit-wide SIMD primitives.

6 years agoPass 512-bit-wide vectors in registers.
Geoffrey Mainland [Mon, 16 Sep 2013 02:41:31 +0000 (22:41 -0400)] 
Pass 512-bit-wide vectors in registers.

6 years agoAdd support for 512-bit-wide vectors.
Geoffrey Mainland [Sun, 15 Sep 2013 21:20:09 +0000 (17:20 -0400)] 
Add support for 512-bit-wide vectors.

6 years agoAdd Cmm support for 512-bit-wide values.
Geoffrey Mainland [Sun, 15 Sep 2013 20:34:23 +0000 (16:34 -0400)] 
Add Cmm support for 512-bit-wide values.

6 years agoAdd support for -mavx512* flags.
Geoffrey Mainland [Sun, 15 Sep 2013 20:24:04 +0000 (16:24 -0400)] 
Add support for -mavx512* flags.

6 years agoAdd 256-bit-wide SIMD primitives.
Geoffrey Mainland [Thu, 22 Aug 2013 10:03:46 +0000 (11:03 +0100)] 
Add 256-bit-wide SIMD primitives.

6 years agoPass 256-bit-wide vectors in registers.
Geoffrey Mainland [Thu, 14 Feb 2013 23:28:39 +0000 (23:28 +0000)] 
Pass 256-bit-wide vectors in registers.

6 years agoFixup stack spills when generating AVX instructions.
Geoffrey Mainland [Sat, 26 Nov 2011 12:45:23 +0000 (12:45 +0000)] 
Fixup stack spills when generating AVX instructions.

LLVM uses aligned AVX moves to spill values onto the stack, which requires
32-bye aligned stacks. Since the stack in only 16-byte aligned, LLVM inserts
extra instructions that munge the stack pointer. This is very very bad for the
GHC calling convention, so we tell LLVM to assume the stack is 32-byte
aligned. This patch rewrites the spill instructions that LLVM generates so they
do not require an aligned stack.

6 years agoSet LLVM option -stack-alignment=32 when compiling AVX instructions.
Geoffrey Mainland [Thu, 14 Feb 2013 21:25:54 +0000 (21:25 +0000)] 
Set LLVM option -stack-alignment=32 when compiling AVX instructions.

6 years agoAdd support for 256-bit-wide vectors.
Geoffrey Mainland [Thu, 14 Feb 2013 18:52:00 +0000 (18:52 +0000)] 
Add support for 256-bit-wide vectors.

6 years agoAdd Cmm support for 256-bit-wide values.
Geoffrey Mainland [Thu, 14 Feb 2013 18:48:25 +0000 (18:48 +0000)] 
Add Cmm support for 256-bit-wide values.

6 years agoAdd support for -mavx and -mavx2 flags.
Geoffrey Mainland [Wed, 13 Feb 2013 16:33:01 +0000 (16:33 +0000)] 
Add support for -mavx and -mavx2 flags.

6 years agoFlesh out 128-bit wide SIMD primops.
Geoffrey Mainland [Wed, 21 Aug 2013 15:55:26 +0000 (16:55 +0100)] 
Flesh out 128-bit wide SIMD primops.

6 years agoSIMD primops are now generated using schemas that are polymorphic in
Geoffrey Mainland [Wed, 21 Aug 2013 15:18:24 +0000 (16:18 +0100)] 
SIMD primops are now generated using schemas that are polymorphic in
width and element type.

SIMD primops are now polymorphic in vector size and element type, but
only internally to the compiler. More specifically, utils/genprimopcode
has been extended so that it "knows" about SIMD vectors. This allows us
to, for example, write a single definition for the "add two vectors"
primop in primops.txt.pp and have it instantiated at many vector types.
This generates a primop in GHC.Prim for each vector type at which "add
two vectors" is instantiated, but only one data constructor for the
PrimOp data type, so the code generator is much, much simpler.

6 years agoDo not expose LLVM-only primops in GHC.PrimopWrappers.
Geoffrey Mainland [Wed, 21 Aug 2013 11:57:54 +0000 (12:57 +0100)] 
Do not expose LLVM-only primops in GHC.PrimopWrappers.

GHC.PrimopWrappers is only used by GHCi, which cannot evaluate LLVM-only
primops in any case.

6 years agoEnable passing vector arguments in xmm registers on x86-32.
Geoffrey Mainland [Thu, 8 Aug 2013 14:59:42 +0000 (15:59 +0100)] 
Enable passing vector arguments in xmm registers on x86-32.

Note that this will only work with the LLVM back end pending LLVM patches to
change the GHC calling convention appropriately.

6 years agoDo not assume that XMM registers are used to pass floating point arguments.
Geoffrey Mainland [Thu, 8 Aug 2013 14:58:42 +0000 (15:58 +0100)] 
Do not assume that XMM registers are used to pass floating point arguments.

On x86-32, the C calling convention specifies that when SSE2 is enabled, vector
arguments are passed in xmm* registers; however, float and double arguments are
still passed on the stack. This patch allows us to make the same choice for
GHC. Even when SSE2 is enabled, we don't want to pass Float and Double arguments
in registers because this would change the ABI and break the ability to link
with code that was compiled without -msse2.

The next patch will enable passing vector arguments in xmm registers on x86-32.

6 years agoEnsure that globalRegMaybe returns accurate information for XMM registers.
Geoffrey Mainland [Fri, 13 Sep 2013 16:00:05 +0000 (12:00 -0400)] 
Ensure that globalRegMaybe returns accurate information for XMM registers.

6 years agoRelease note blurb.
Austin Seipp [Mon, 23 Sep 2013 01:10:31 +0000 (20:10 -0500)] 
Release note blurb.

GHCi now runs constructors for linked libraries.

Signed-off-by: Austin Seipp <>
6 years agoRestructure compilation pipeline to allow hooks
Austin Seipp [Sun, 22 Sep 2013 23:47:35 +0000 (18:47 -0500)] 
Restructure compilation pipeline to allow hooks

This commit exposes GHC's internal compiler pipeline through a `Hooks`
module in the GHC API. It currently allows you to hook:

 * Foreign import/exports declarations
 * The frontend up to type checking
 * The one shot compilation mode
 * Core compilation, and the module iface
 * Linking and the phases in DriverPhases.hs
 * Quasiquotation

Authored-by: Luite Stegeman <>
Authored-by: Edsko de Vries <>
Signed-off-by: Austin Seipp <>
6 years agousers_guide/ghci: Whitespace cleanup (#7501)
Ben Gamari [Fri, 20 Sep 2013 21:08:00 +0000 (17:08 -0400)] 
users_guide/ghci: Whitespace cleanup (#7501)

6 years agoDocument remaining GHCi commands in users_guide (#7501)
Ben Gamari [Fri, 20 Sep 2013 18:28:51 +0000 (14:28 -0400)] 
Document remaining GHCi commands in users_guide (#7501)

Also a small formatting change in GHCi :help

6 years agoAdd release note entry for `{-# MINIMAL #-}` (#7633)
Herbert Valerio Riedel [Thu, 19 Sep 2013 08:54:47 +0000 (10:54 +0200)] 
Add release note entry for `{-# MINIMAL #-}` (#7633)

6 years agoDocument more stolen syntax (#4196)
Krzysztof Gogolewski [Sat, 21 Sep 2013 06:24:11 +0000 (08:24 +0200)] 
Document more stolen syntax (#4196)

6 years agoFix name of vanilla RTS way in the user's guide
Reid Barton [Thu, 12 Sep 2013 17:21:10 +0000 (13:21 -0400)] 
Fix name of vanilla RTS way in the user's guide

6 years agoTypos
Krzysztof Gogolewski [Fri, 20 Sep 2013 20:23:49 +0000 (22:23 +0200)] 

6 years agoUpdate `Cabal` to 1.18.1 final
Herbert Valerio Riedel [Fri, 20 Sep 2013 18:49:25 +0000 (20:49 +0200)] 
Update `Cabal` to 1.18.1 final

6 years agoComments only
Jan Stolarek [Fri, 20 Sep 2013 14:24:52 +0000 (15:24 +0100)] 
Comments only

6 years agoImprove error message for deriving polykinded Typeable (Trac #7800)
Simon Peyton Jones [Fri, 20 Sep 2013 13:51:41 +0000 (14:51 +0100)] 
Improve error message for deriving polykinded Typeable (Trac #7800)

Thanks to Krzysztof Gogolewski (monoidal) for the first draft of this patch

6 years agoNuke tc-trace that makes the typechecker loop
Simon Peyton Jones [Fri, 20 Sep 2013 13:50:32 +0000 (14:50 +0100)] 
Nuke tc-trace that makes the typechecker loop

The trace was being over-eager, which disturbs the typecheckers
careful knot-tying

6 years agoKill Type.isKindTy in favour of Kind.isKind (same code)
Simon Peyton Jones [Fri, 20 Sep 2013 13:49:36 +0000 (14:49 +0100)] 
Kill Type.isKindTy in favour of Kind.isKind (same code)

6 years agoRefactor AMP warnings a bit
Simon Peyton Jones [Fri, 20 Sep 2013 13:48:47 +0000 (14:48 +0100)] 
Refactor AMP warnings a bit

There was a bit of clutter (tryTc stuff) caused by the
fact that tcLookupImported didn't return a MaybeErr.
Now it does.  That finishes up Trac #8004.

6 years agoIgnore Tickish Breakpoints when serialising Core into interface files
Simon Peyton Jones [Fri, 20 Sep 2013 13:46:13 +0000 (14:46 +0100)] 
Ignore Tickish Breakpoints when serialising Core into interface files

This fixes Trac #8333

Thanks to 'klao', who identified the cause and provided the patch

6 years agoComments only
Jan Stolarek [Thu, 19 Sep 2013 10:48:00 +0000 (11:48 +0100)] 
Comments only

6 years agoUpdate release notes for new comparison primops
Jan Stolarek [Thu, 19 Sep 2013 09:50:10 +0000 (10:50 +0100)] 
Update release notes for new comparison primops

6 years agoDocument -floopification flag in user guide
Jan Stolarek [Thu, 19 Sep 2013 09:40:08 +0000 (10:40 +0100)] 
Document -floopification flag in user guide

6 years agoRemove trailing whitespaces in flags.xml
Jan Stolarek [Thu, 19 Sep 2013 09:39:32 +0000 (10:39 +0100)] 
Remove trailing whitespaces in flags.xml

6 years agoFix egregious blunder in extractRelevantInerts
Simon Peyton Jones [Wed, 18 Sep 2013 15:20:28 +0000 (16:20 +0100)] 
Fix egregious blunder in extractRelevantInerts

6 years agoMake Word# a wired-in TyCon (fix Trac #8280)
Simon Peyton Jones [Wed, 18 Sep 2013 11:37:33 +0000 (12:37 +0100)] 
Make Word# a wired-in TyCon (fix Trac #8280)

wordTyCon was treated as wired-in, but
  * It didn't have a WiredInName
  * It didn't appear in the list of wiredInTyCons

I'm not sure how anything worked!

6 years agoComments only
Simon Peyton Jones [Wed, 18 Sep 2013 11:22:44 +0000 (12:22 +0100)] 
Comments only

6 years agoRestore old names of comparison primops
Jan Stolarek [Mon, 16 Sep 2013 14:04:57 +0000 (15:04 +0100)] 
Restore old names of comparison primops

In 6579a6c we removed existing comparison primops and introduced new ones
returning Int# instead of Bool. This commit (and associated commits in
array, base, dph, ghc-prim, integer-gmp, integer-simple, primitive, testsuite and
template-haskell) restores old names of primops. This allows us to keep
our API cleaner at the price of not having backwards compatibility.

This patch also temporalily disables fix for #8317 (optimization of
tagToEnum# at Core level). We need to fix #8326 first, otherwise
our primops code will be very slow.

6 years agoTrailing whitespaces
Jan Stolarek [Tue, 17 Sep 2013 07:55:35 +0000 (08:55 +0100)] 
Trailing whitespaces

6 years agoTidy up and refactor overflow checking for literals
Simon Peyton Jones [Tue, 17 Sep 2013 23:27:19 +0000 (00:27 +0100)] 
Tidy up and refactor overflow checking for literals

It's much easier (and more efficient) to pattern match on
the HsOverLit than on the desugared version!

6 years agoOptimise (case tagToEnum# x of ..) as in Trac #8317
Simon Peyton Jones [Tue, 17 Sep 2013 21:02:27 +0000 (22:02 +0100)] 
Optimise (case tagToEnum# x of ..) as in Trac #8317

See Note [Optimising tagToEnum#] in Simplify

6 years agoAccommodate Derived constraints in two places (fix Trac #8129, #8134)
Simon Peyton Jones [Tue, 17 Sep 2013 19:55:14 +0000 (20:55 +0100)] 
Accommodate Derived constraints in two places (fix Trac #8129, #8134)

If we have
   class (F a ~ b) => C a b
then we can produce *derived* CFunEqCans.  These were not being
treated properly in two places:

a) in TcMType.zonkFlats (Trac #8134)
b) in TcSMonad.prepareInertsForImplications (Trac #8129)

This patch fixes both.

6 years agoA little refactoring
Simon Peyton Jones [Tue, 17 Sep 2013 19:47:21 +0000 (20:47 +0100)] 
A little refactoring

* Make isCFunEqCan_maybe return Maybe (TyCon, [Type])
* Add insertTM, deleteTM to TrieMap

6 years agoAdd flag to control loopification
Jan Stolarek [Wed, 18 Sep 2013 08:25:56 +0000 (09:25 +0100)] 
Add flag to control loopification

It is off by default, which is meant to be a workaround for #8275.
Once #8275 is fixed we will enable this option by default.

6 years agoTweaks to release notes
Gabor Greif [Wed, 18 Sep 2013 08:31:29 +0000 (10:31 +0200)] 
Tweaks to release notes
If someone also feels that credits should better go into the
release announcement, just nuke the last line of that paragraph.

6 years agoImplement checkable "minimal complete definitions" (#7633)
Twan van Laarhoven [Wed, 11 Sep 2013 13:32:33 +0000 (15:32 +0200)] 
Implement checkable "minimal complete definitions" (#7633)

This commit adds a `{-# MINIMAL #-}` pragma, which defines the possible
minimal complete definitions for a class. The body of the pragma is a
boolean formula of names.

The old warning for missing methods is replaced with this new one.

Note: The interface file format is changed to store the minimal complete

Authored-by: Twan van Laarhoven <>
Signed-off-by: Herbert Valerio Riedel <>
6 years agoLimit upper versions of Alex and Happy
Jan Stolarek [Wed, 18 Sep 2013 07:47:58 +0000 (08:47 +0100)] 
Limit upper versions of Alex and Happy

This is temporary until new bool primops have been pushed.

6 years agoFix-up Docbook XML broken in f4046b508a5a7
Herbert Valerio Riedel [Wed, 18 Sep 2013 06:54:45 +0000 (08:54 +0200)] 
Fix-up Docbook XML broken in f4046b508a5a7

6 years agoSuppress unused variable when OS does not support setuid.
Edward Z. Yang [Wed, 18 Sep 2013 02:59:17 +0000 (19:59 -0700)] 
Suppress unused variable when OS does not support setuid.

Signed-off-by: Edward Z. Yang <>
6 years agoChange role annotation syntax.
Richard Eisenberg [Wed, 11 Sep 2013 04:52:56 +0000 (00:52 -0400)] 
Change role annotation syntax.

This fixes bugs #8185, #8234, and #8246. The new syntax is explained
in the comments to #8185, appears in the "Roles" subsection of the
manual, and on the [wiki:Roles] wiki page.

This change also removes the ability for a role annotation on type
synonyms, as noted in #8234.

6 years agoRelease Notes: New printf features in base
Joachim Breitner [Tue, 17 Sep 2013 08:56:42 +0000 (10:56 +0200)] 
Release Notes: New printf features in base

6 years agoAllow branches with / in them (e.g. wip/) in ./sync-all
Joachim Breitner [Tue, 17 Sep 2013 13:45:48 +0000 (15:45 +0200)] 
Allow branches with / in them (e.g. wip/) in ./sync-all

6 years agoAdd warning comment about Mach-O section name hack.
Edward Z. Yang [Tue, 17 Sep 2013 07:55:46 +0000 (00:55 -0700)] 
Add warning comment about Mach-O section name hack.

Signed-off-by: Edward Z. Yang <>
6 years agoImplement ctors support for Linux.
Edward Z. Yang [Tue, 17 Sep 2013 00:17:35 +0000 (17:17 -0700)] 
Implement ctors support for Linux.

Signed-off-by: Edward Z. Yang <>
6 years agoFurther linguistic improvement of that one line
Joachim Breitner [Mon, 16 Sep 2013 16:09:36 +0000 (18:09 +0200)] 
Further linguistic improvement of that one line

now brought to you by Gabor Greif... ;-)

6 years agoTypo in release notes
Joachim Breitner [Mon, 16 Sep 2013 15:48:10 +0000 (17:48 +0200)] 
Typo in release notes

6 years agos/TypeNats/DataKinds/ in release notes.
Austin Seipp [Mon, 16 Sep 2013 15:45:32 +0000 (10:45 -0500)] 
s/TypeNats/DataKinds/ in release notes.

Signed-off-by: Austin Seipp <>
6 years agoMake sure type literals aren't negative (#8306)
Austin Seipp [Mon, 16 Sep 2013 15:05:44 +0000 (10:05 -0500)] 
Make sure type literals aren't negative (#8306)

As Krzysztof pointed out in #8306, with NegativeLiterals and DataKinds,
definitions such as:

  type T = -1

were accepted, although type literals must be greater than zero.

Signed-off-by: Austin Seipp <>
6 years agoRelease Notes: Document Data.Bool.bool (#8302)
Joachim Breitner [Mon, 16 Sep 2013 15:34:35 +0000 (17:34 +0200)] 
Release Notes: Document Data.Bool.bool (#8302)

6 years agoComment typo only
Gabor Greif [Mon, 16 Sep 2013 10:09:37 +0000 (12:09 +0200)] 
Comment typo only

6 years agoRun ctors initializers backwards, see #5435.
Edward Z. Yang [Mon, 16 Sep 2013 06:53:01 +0000 (23:53 -0700)] 
Run ctors initializers backwards, see #5435.

Signed-off-by: Edward Z. Yang <>
6 years agoDistinguish between hs-main cases when giving rtsopts advice.
Edward Z. Yang [Sat, 14 Sep 2013 05:11:12 +0000 (22:11 -0700)] 
Distinguish between hs-main cases when giving rtsopts advice.

Signed-off-by: Edward Z. Yang <>
6 years agoMention new solver for -XTypeNats in release notes.
Austin Seipp [Sun, 15 Sep 2013 21:06:30 +0000 (16:06 -0500)] 
Mention new solver for -XTypeNats in release notes.

Signed-off-by: Austin Seipp <>
6 years agoFix the type signatures of new copy primops.
Austin Seipp [Sun, 15 Sep 2013 20:15:17 +0000 (15:15 -0500)] 
Fix the type signatures of new copy primops.

They claimed to work over 'ST RealWorld', when instead they should be
parameterized in the state type. This fixes the cgrun070.

Signed-off-by: Austin Seipp <>
6 years agoFix freeHaskellFunPtr crash on iOS.
Austin Seipp [Sun, 15 Sep 2013 17:58:45 +0000 (12:58 -0500)] 
Fix freeHaskellFunPtr crash on iOS.

Authored-by: Stephen Blackheath <>
Signed-off-by: Austin Seipp <>
6 years agoNew primops for byte range copies ByteArray# <-> Addr#
Duncan Coutts [Fri, 13 Sep 2013 08:19:24 +0000 (09:19 +0100)] 
New primops for byte range copies ByteArray# <-> Addr#

We have primops for copying ranges of bytes between ByteArray#s:
 * ByteArray# -> MutableByteArray#
 * MutableByteArray# -> MutableByteArray#
This extends it with three further cases:
 * Addr# -> MutableByteArray#
 * ByteArray# -> Addr#
 * MutableByteArray# -> Addr#
One use case for these is copying between ForeignPtr-based
representations and in-heap arrays (like Text, UArray etc).

The implementation is essentially the same as for the existing
primops, and shares the memcpy stuff in the code generators.

Defficiencies / future directions: none of these primops (existing
or the new ones) let one take advantage of knowing that ByteArray#s
are word-aligned in memory. Though it is unclear that any of the
code generators would make use of this information unless the size
to copy is also known at compile time.

Signed-off-by: Austin Seipp <>
6 years agoCause "make install" to install dynamic libraries (#8194)
Bryan O'Sullivan [Fri, 13 Sep 2013 20:13:04 +0000 (13:13 -0700)] 
Cause "make install" to install dynamic libraries (#8194)

Our special ghc-cabal command needs to be told that we are building with
dynamic library support when it does its copying. We do so by passing an
extra parameter from

6 years ago80 columns
Simon Marlow [Sat, 14 Sep 2013 18:52:36 +0000 (19:52 +0100)] 
80 columns

6 years agoadd stg_MUT_VAR_CLEAN_info and stg_MUT_VAR_DIRTY_info to the symbol table
Simon Marlow [Wed, 24 Jul 2013 09:40:24 +0000 (10:40 +0100)] 
add stg_MUT_VAR_CLEAN_info and stg_MUT_VAR_DIRTY_info to the symbol table

6 years agoNuke tabs in rts/posix/OSMem.c
Austin Seipp [Sat, 14 Sep 2013 17:35:52 +0000 (12:35 -0500)] 
Nuke tabs in rts/posix/OSMem.c

Signed-off-by: Austin Seipp <>
6 years agoFix getPageSize to actually cache the page size.
Austin Seipp [Sat, 14 Sep 2013 17:20:48 +0000 (12:20 -0500)] 
Fix getPageSize to actually cache the page size.

This fixes #8289.

Signed-off-by: Austin Seipp <>
6 years agoMention coerce in the release notes
Joachim Breitner [Sat, 14 Sep 2013 10:52:10 +0000 (12:52 +0200)] 
Mention coerce in the release notes

It is not added to the section on Special built-in functions because
the (from a user POV related) unsafeCoerce has been removed there

6 years agoFix links in #special-ids section
Joachim Breitner [Sat, 14 Sep 2013 10:28:01 +0000 (12:28 +0200)] 
Fix links in #special-ids section

This completes the change from [7ea49661c]: GHC.Exts lives in base, not
in ghc-prim.

6 years agoGive language pragma suggestions without -X
Joachim Breitner [Fri, 13 Sep 2013 11:52:18 +0000 (13:52 +0200)] 
Give language pragma suggestions without -X

for easier copy'n'paste. This fixes: #3647

6 years agoImplement __mod_init_func for Mach-O. Finishes support for init in #5435.
Edward Z. Yang [Sat, 14 Sep 2013 02:15:40 +0000 (19:15 -0700)] 
Implement __mod_init_func for Mach-O. Finishes support for init in #5435.

Signed-off-by: Edward Z. Yang <>
6 years agoImplement .ctor support for PEi386.
Edward Z. Yang [Fri, 6 Sep 2013 06:37:37 +0000 (23:37 -0700)] 
Implement .ctor support for PEi386.

Signed-off-by: Edward Z. Yang <>
6 years agoImplement .init/.init_array support for ELF.
Edward Z. Yang [Sat, 31 Aug 2013 02:18:28 +0000 (19:18 -0700)] 
Implement .init/.init_array support for ELF.

Signed-off-by: Edward Z. Yang <>
6 years agoFix rebase fallout
Joachim Breitner [Fri, 13 Sep 2013 22:07:46 +0000 (00:07 +0200)] 
Fix rebase fallout

To push what was validated, not just what was commited.

6 years agoIntroduce coerce :: Coercible a b -> a -> b
Joachim Breitner [Fri, 13 Sep 2013 16:40:36 +0000 (18:40 +0200)] 
Introduce coerce :: Coercible a b -> a -> b

This is the result of the design at

The goal is to be able to convert between, say [First Int] and [Last
Int] with zero run-time overhead. To that end, we introduce a special
two parameter type class Coercible whose instances are created
automatically and on-the fly. This relies on and exploits the recent
addition of roles to core.

6 years agoExpose tcTyConsOfType as Types.tyConsOfType
Joachim Breitner [Fri, 13 Sep 2013 12:17:40 +0000 (14:17 +0200)] 
Expose tcTyConsOfType as Types.tyConsOfType

and add related function tyConsOfTyCon.

6 years agoOutputable.isOrAre: "is" or "are" for correct grammar
Joachim Breitner [Fri, 13 Sep 2013 12:09:12 +0000 (14:09 +0200)] 
Outputable.isOrAre: "is" or "are" for correct grammar

6 years agoExpose more in the TcS monad
Joachim Breitner [Fri, 13 Sep 2013 12:08:28 +0000 (14:08 +0200)] 
Expose more in the TcS monad

in preparation for the Coercible class implementation.

6 years agoAllow primclass and class constraints in primops
Joachim Breitner [Fri, 13 Sep 2013 12:06:46 +0000 (14:06 +0200)] 
Allow primclass and class constraints in primops

In preparation for the primitive class Coercible

6 years agoRelease note for new `instance Data Data.Version`
Herbert Valerio Riedel [Fri, 13 Sep 2013 16:09:06 +0000 (18:09 +0200)] 
Release note for new `instance Data Data.Version`

Implemented in [e17549c80425f3c8a8a672c65bbff00290839f3c/base]

Signed-off-by: Herbert Valerio Riedel <>
6 years agoUpdate Cabal to current upstream `1.18` branch tip
Herbert Valerio Riedel [Fri, 13 Sep 2013 15:30:38 +0000 (17:30 +0200)] 
Update Cabal to current upstream `1.18` branch tip

The new commits inlcude AMP-warning fixes and support
for the new `instance Data Data.Version` provided by `base`

6 years agoMissing printf path format change
Simon Peyton Jones [Fri, 13 Sep 2013 06:46:47 +0000 (07:46 +0100)] 
Missing printf path format change

6 years agoReplace reference to `Data.Generics` with `Data.Data`
Herbert Valerio Riedel [Fri, 13 Sep 2013 10:51:37 +0000 (12:51 +0200)] 
Replace reference to `Data.Generics` with `Data.Data`

The `Data` definitions were moved from `Data.Generics` to
`Data.Data` via [5a9e76d24776608a3e14ba94f1dfa0cac072c251/base]

Signed-off-by: Herbert Valerio Riedel <>
6 years agoRename -ddump-cmm-rewrite to -ddump-cmm-sink
Jan Stolarek [Fri, 13 Sep 2013 07:48:54 +0000 (08:48 +0100)] 
Rename -ddump-cmm-rewrite to -ddump-cmm-sink

This makes it consistent with the corresponding -cmm-sink flag

6 years agoFix static GHCi build (#8270)
Austin Seipp [Fri, 13 Sep 2013 07:01:33 +0000 (02:01 -0500)] 
Fix static GHCi build (#8270)

When Ryan merged in the atomics branch, he made atomic_inc and
atomic_dec EXTERN_INLINE functions, meaning their definitions
became part of object files in the non-threaded build, instead of being
inlined. As a result, this broke the linker for static GHCi, since it
couldn't properly resolve the now-externally defined functions.

Signed-off-by: Austin Seipp <>
6 years agoAdd support for evaluation of type-level natural numbers.
Iavor S. Diatchki [Fri, 13 Sep 2013 06:19:21 +0000 (23:19 -0700)] 
Add support for evaluation of type-level natural numbers.

This patch implements some simple evaluation of type-level expressions
featuring natural numbers.  We can evaluate *concrete* expressions that
use the built-in type families (+), (*), (^), and (<=?), declared in
GHC.TypeLits.   We can also do some type inference involving these
functions.  For example, if we encounter a constraint such as `(2 + x) ~ 5`
we can infer that `x` must be 3.  Note, however, this is used only to
resolve unification variables (i.e., as a form of a constraint improvement)
and not to generate new facts.  This is similar to how functional
dependencies work in GHC.

The patch adds a new form of coercion, `AxiomRuleCo`, which makes use
of a new form of axiom called `CoAxiomRule`.  This is the form of evidence
generate when we solve a constraint, such as `(1 + 2) ~ 3`.

The patch also adds support for built-in type-families, by adding a new
form of TyCon rhs: `BuiltInSynFamTyCon`.  such built-in type-family
constructors contain a record with functions that are used by the
constraint solver to simplify and improve constraints involving the
built-in function (see `TcInteract`).  The record in defined in `FamInst`.

The type constructors and rules for evaluating the type-level functions
are in a new module called `TcTypeNats`.

6 years agoImprove sinking pass
Jan Stolarek [Thu, 12 Sep 2013 13:29:37 +0000 (14:29 +0100)] 
Improve sinking pass

This commit does two things:

  * Allows duplicating of global registers and literals by inlining
    them. Previously we would only inline global register or literal
    if it was used only once.

  * Changes method of determining conflicts between a node and an
    assignment. New method has two advantages. It relies on
    DefinerOfRegs and UserOfRegs typeclasses, so if a set of registers
    defined or used by a node should ever change, `conflicts` function
    will use the changed definition. This definition also catches
    more cases than the previous one (namely CmmCall and CmmForeignCall)
    which is a step towards making it possible to run sinking pass
    before stack layout (currently this doesn't work).

This patch also adds a lot of comments that are result of about two-week
long investigation of how sinking pass works and why it does what it does.

6 years agoAdd missing semicolon in rts/Linker.c (#8271)
Jan Stolarek [Thu, 12 Sep 2013 10:44:20 +0000 (11:44 +0100)] 
Add missing semicolon in rts/Linker.c (#8271)

And remove some trailing whitespaces from that file.

6 years agoImplement the AMP warning (#8004)
Austin Seipp [Mon, 9 Sep 2013 18:40:06 +0000 (13:40 -0500)] 
Implement the AMP warning (#8004)

This patch implements a warning when definitions conflict with the
Applicative-Monad Proposal (AMP), described in #8004. Namely, this will
cause a warning iff:

    * You have an instance of Monad, but not Applicative
    * You have an instance of MonadPlus, but not Alternative
    * You locally defined a function named join, <*>, or pure.

In GHC 7.10, these warnings will actually be enforced with superclass
constraints through changes in base, so programs will fail to compile

This warning is enabled by default. Unfortunately, not all of
our upstream libraries have accepted the appropriate patches. So we
temporarily fix ./validate by ignoring the AMP warning.

Dan Rosén made an initial implementation of this change, and the
remaining work was finished off by David Luposchainsky. I finally made
some minor refactorings.

Authored-by: Dan Rosén <>
Authored-by: David Luposchainsky <>
Signed-off-by: Austin Seipp <>