ghc.git
2 years agoAllow use of the external interpreter in stage1.
Shea Levy [Tue, 20 Dec 2016 01:19:18 +0000 (01:19 +0000)] 
Allow use of the external interpreter in stage1.

Summary:
Now that we have -fexternal-interpreter, we can lose most of the GHCI ifdefs.

This was originally added in https://phabricator.haskell.org/D2826
but that led to a compatibility issue with ghc 7.10.x on Windows.
That's fixed here and the revert reverted.

Reviewers: goldfire, hvr, austin, bgamari, Phyx

Reviewed By: Phyx

Subscribers: thomie

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

GHC Trac Issues: #13008

2 years agoMark T8089 as unbroken since #7325 is now resolved
Ben Gamari [Mon, 19 Dec 2016 23:45:08 +0000 (18:45 -0500)] 
Mark T8089 as unbroken since #7325 is now resolved

2 years agoFix timeout's timeout on Windows
Tamar Christina [Mon, 19 Dec 2016 00:18:57 +0000 (00:18 +0000)] 
Fix timeout's timeout on Windows

Summary:
Timeout has been broken by my previous patch.
The timeout event was not being processed correctly,
as such hanging processes would not be killed as they should
have been.

This corrects it.

Test Plan:
./validate

~/ghc/testsuite/timeout/install-inplace/bin/timeout.exe 10 "sleep 10000s"

Reviewers: austin, RyanGlScott, bgamari

Reviewed By: bgamari

Subscribers: thomie, #ghc_windows_task_force

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

GHC Trac Issues: #13004

2 years agoRevert "Allow use of the external interpreter in stage1."
Tamar Christina [Mon, 19 Dec 2016 19:09:18 +0000 (19:09 +0000)] 
Revert "Allow use of the external interpreter in stage1."

This reverts commit 52ba9470a7e85d025dc84a6789aa809cdd68b566.

2 years agoT8242: disable on NOSMP targets
Sergei Trofimovich [Sun, 18 Dec 2016 17:30:10 +0000 (17:30 +0000)] 
T8242: disable on NOSMP targets

Test calls setNumCapabilities, requires SMP support.

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
2 years agoregalloc_unit_tests: disable on UNREG targets
Sergei Trofimovich [Sun, 18 Dec 2016 17:24:13 +0000 (17:24 +0000)] 
regalloc_unit_tests: disable on UNREG targets

Test requires register allocator to be present
(native code generator).

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
2 years agoT10296a: disable on NOSMP targets
Sergei Trofimovich [Sun, 18 Dec 2016 17:15:37 +0000 (17:15 +0000)] 
T10296a: disable on NOSMP targets

Test uses +RTS -N2, requires SMP support.

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
2 years agoT8209: disable on NOSMP targets
Sergei Trofimovich [Sun, 18 Dec 2016 17:11:56 +0000 (17:11 +0000)] 
T8209: disable on NOSMP targets

Test calls setNumCapabilities, requires SMP support.

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
2 years agoT12035j: disable on NOSMP targets
Sergei Trofimovich [Sun, 18 Dec 2016 17:01:11 +0000 (17:01 +0000)] 
T12035j: disable on NOSMP targets

Test calls setNumCapabilities, requires SMP support.

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
2 years agoFix #12998 by removing CTimer
Ryan Scott [Sun, 18 Dec 2016 15:41:48 +0000 (10:41 -0500)] 
Fix #12998 by removing CTimer

Summary:
CTimer is a wrapper around `timer_t`, which is a typedef for `void*`
on most platforms. The issue is that GHC's `FPTOOLS_CHECK_HTYPE` is not robust
enough to discern pointer types from non-pointer types, so it mistakenly labels
`timer_t` as a `Double` or `Int32` (depending on how many bits a pointer takes
up on your platform). This wreaks havoc when trying to give it certain type
class instances, as noted in
https://phabricator.haskell.org/rGHCffc2327070dbb664bdb407a804121eacb2a7c734.

For now, the simplest thing to do would be removing `CTimer`, since:

1. The original author (@DanielG) didn't have a particular use in mind for
   `timer_t` when he fixed #12795.
2. `CTimer` hasn't appeared in a release of `base` yet.

Fixes #12998.

Reviewers: austin, hvr, bgamari, DanielG, trofi

Reviewed By: bgamari, trofi

Subscribers: thomie, DanielG, erikd

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

GHC Trac Issues: #12795, #12998

2 years agoIntroduce unboxedSum{Data,Type}Name to template-haskell
Ryan Scott [Sun, 18 Dec 2016 15:41:33 +0000 (10:41 -0500)] 
Introduce unboxedSum{Data,Type}Name to template-haskell

Summary:
In D2448 (which introduced Template Haskell support for unboxed
sums), I neglected to add `unboxedSumDataName` and `unboxedSumTypeName`
functions, since there wasn't any way you could write unboxed sum data or type
constructors in prefix form to begin with (see #12514). But even if you can't
write these `Name`s directly in source code, it would still be nice to be able
to use these `Name`s in Template Haskell (for instance, to be able to treat
unboxed sum type constructors like any other type constructors).

Along the way, this uncovered a minor bug in `isBuiltInOcc_maybe` in
`TysWiredIn`, which was calculating the arity of unboxed sum data constructors
incorrectly.

Test Plan: make test TEST=T12478_5

Reviewers: osa1, goldfire, austin, bgamari

Subscribers: thomie

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

GHC Trac Issues: #12478, #12514

2 years agoFix Haddock comment typo.
Edward Z. Yang [Sun, 18 Dec 2016 10:55:04 +0000 (02:55 -0800)] 
Fix Haddock comment typo.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
2 years agoCheck family instance consistency of hs-boot families later, fixes #11062.
Edward Z. Yang [Fri, 16 Dec 2016 02:05:33 +0000 (18:05 -0800)] 
Check family instance consistency of hs-boot families later, fixes #11062.

Summary:
With hs-boot files, some type families may be defined in the
module we are typechecking.  In this case, we are not allowed
to poke these families until after we typecheck our local
declarations.  So we first check everything involving non-recursive
families, and then check the recursive families as we finish
kind-checking them.

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

Reviewers: goldfire, austin, simonpj, bgamari

Subscribers: thomie

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

GHC Trac Issues: #11062

2 years agoAllow use of the external interpreter in stage1.
Shea Levy [Sun, 18 Dec 2016 01:08:58 +0000 (20:08 -0500)] 
Allow use of the external interpreter in stage1.

Now that we have -fexternal-interpreter, we can lose most of the GHCI ifdefs.

Reviewers: simonmar, goldfire, austin, hvr, bgamari

Reviewed By: simonmar

Subscribers: RyanGlScott, mpickering, angerman, thomie

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

2 years agoDocs: Delete duplicate paragraph in user guide
Siddhanathan Shanmugam [Sat, 17 Dec 2016 23:09:13 +0000 (18:09 -0500)] 
Docs: Delete duplicate paragraph in user guide

Removes duplicate paragraph in user guide. The same paragraph is
repeated below this one.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

2 years agoImprove StringBuffer and FastString docs
Phil Ruffwind [Sat, 17 Dec 2016 23:09:06 +0000 (18:09 -0500)] 
Improve StringBuffer and FastString docs

This area of code contains a lot of unsafe functionality, so it might be
worth documenting to reduce the risk of misuse.

Test Plan: inspection

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

2 years agoRun some tests with -fexternal-interpreter -prof
Simon Marlow [Sat, 17 Dec 2016 23:08:59 +0000 (18:08 -0500)] 
Run some tests with -fexternal-interpreter -prof

We don't have any other tests for this, except one Template Haskell
test.  This would have caught the bug I just fixed in D2868, at least
when validating with profiling on.

Test Plan: Ran tests

Reviewers: niteria, austin, erikd, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #5654

2 years agoFix bug in previous fix for #5654
Simon Marlow [Sat, 17 Dec 2016 23:08:48 +0000 (18:08 -0500)] 
Fix bug in previous fix for #5654

I forgot to account for BCOs, which have a different layout from
functions.  This caused crashes when using profiling with GHCi (via
-fexternal-interpreter -prof), which unfortunately is not tested at all
by validate, even when profiling is enabled.  I'm going to add some
testing that would have caught this in a separate patch.

Test Plan:
```
cd nofib/spectral/puzzle && make NoFibWithGHCi=YES
EXTRA_RUNTEST_OPTS='-fexternal-interpreter -prof'
```
New testsuite tests coming in a separate diff.

Reviewers: niteria, austin, erikd, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #5654

2 years agoReexport Language.Haskell.TH.Lib from Language.Haskell.TH
Ryan Scott [Sat, 17 Dec 2016 23:08:36 +0000 (18:08 -0500)] 
Reexport Language.Haskell.TH.Lib from Language.Haskell.TH

Reexporting `Language.Haskell.TH.Lib` from `Language.Haskell.TH` ensures
that `Language.Haskell.TH` will continue to expose all of the functions
that `Language.Haskell.TH.Lib` does in the future.

Fixes #12992.

Test Plan: ./validate

Reviewers: austin, bgamari, goldfire

Reviewed By: bgamari, goldfire

Subscribers: thomie

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

GHC Trac Issues: #12992

2 years agorts/win32/IOManager: Fix integer types
Ben Gamari [Sat, 17 Dec 2016 23:08:00 +0000 (18:08 -0500)] 
rts/win32/IOManager: Fix integer types

This code has been broken on 64-bit systems for some time: the length
and timeout arguments of `addIORequest` and `addDelayRequest`,
respectively, were declared as `int`. However, they were passed Haskell
integers from their respective primops. Integer overflow and madness
ensued. This resulted in #7325 and who knows what else.

Also, there were a few left-over `BOOL`s in here which were not passed
to Windows system calls; these were changed to C99 `bool`s.

However, there is still a bit of signedness inconsistency within the
`delay#` call-chain,

 * `GHC.Conc.IO.threadDelay` and the `delay#` primop accept `Int`
   arguments

 * The `delay#` implementation in `PrimOps.cmm` expects the timeout as
   a `W_`

 * `AsyncIO.c:addDelayRequest` expects an `HsInt` (was `int` prior to
   this patch)

 * `IOManager.c:AddDelayRequest` expects an `HsInt`` (was `int`)

 * The Windows `Sleep` function expects a `DWORD` (which is unsigned)

Test Plan: Validate on Windows

Reviewers: erikd, austin, simonmar, Phyx

Reviewed By: Phyx

Subscribers: thomie

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

GHC Trac Issues: #7325

2 years agoWindows: Improve terminal detection mechanism
Phil Ruffwind [Sat, 17 Dec 2016 23:07:49 +0000 (18:07 -0500)] 
Windows: Improve terminal detection mechanism

The previous detection mechanism allowed environment variables (ANSICON,
ConEmuANSI, TERM) to supersede the fact that the stderr is not a
terminal, which is probably what led to color codes appearing in the
stderr of the tests (see: 847d229346431483b99adcff12e46c7bf6af15da).

This commit changes the detection mechanism to detect Cygwin/MSYS2
terminals in a more reliable manner, avoiding the use of environment
variables entirely.

Test Plan: validate

Reviewers: Phyx, austin, erikd, bgamari

Reviewed By: Phyx, bgamari

Subscribers: RyanGlScott, thomie

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

2 years agoReshuffle levity polymorphism checks.
Richard Eisenberg [Sat, 17 Dec 2016 23:06:34 +0000 (18:06 -0500)] 
Reshuffle levity polymorphism checks.

Previously, GHC checked for bad levity polymorphism to the left of all
arrows in data constructors. This was wrong, as reported in #12911
(where an example is also shown). The solution is to check each
individual argument for bad levity polymorphism.  Thus the check has
been moved from TcValidity to TcTyClsDecls.

A similar situation exists with pattern synonyms, also fixed here.

This patch also nabs #12819 while I was in town.

Test cases: typecheck/should_compile/T12911, patsyn/should_fail/T12819

Test Plan: ./validate

Reviewers: simonpj, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #12819, #12911

2 years agoutils/genargs: delete unused tool
Sergei Trofimovich [Sat, 17 Dec 2016 22:19:29 +0000 (22:19 +0000)] 
utils/genargs: delete unused tool

The tool was added in 2003 but never used at least in ghc tree.

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
2 years agofix OpenBSD linkage (wxneeded)
Sergei Trofimovich [Sat, 17 Dec 2016 20:25:19 +0000 (20:25 +0000)] 
fix OpenBSD linkage (wxneeded)

There is two types of options passed directly to 'ld'
(and not to 'gcc' driver):
    - CONF_LD_LINKER_OPTS_STAGE$4
    - EXTRA_LD_OPTS

This changedoes two things:

- split 'EXTRA_LD_OPTS' into two variables:
    - EXTRA_LD_OPTS (accepts 'gcc' wrapper options)
    - EXTRA_LD_LINKER_OPTS (accepts raw 'ld' options)

- wraps all LD_LINKER options as '-Wl,' when passed
  to 'gcc' driver.

Fixes https://phabricator.haskell.org/D2776

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
2 years agoRevert "Do not init record accessors as exported"
Ben Gamari [Sat, 17 Dec 2016 16:53:59 +0000 (11:53 -0500)] 
Revert "Do not init record accessors as exported"

This reverts commit 3a00ff92a3ee66c096b85b180d247d1a471a6b6e due
to #12993

2 years agoFix Pretty printer tests on Windows
Tamar Christina [Sat, 17 Dec 2016 16:40:11 +0000 (16:40 +0000)] 
Fix Pretty printer tests on Windows

Summary:
D2752 added some tests which escapes string literals. This means newlines are converted
before they get normalized by the IO functions. So on Windows \r\n would be in the output
while \n was expected.

Test Plan: make test -C testsuite/tests/printer

Reviewers: austin, bgamari, alanz

Reviewed By: alanz

Subscribers: thomie

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

GHC Trac Issues: #3384

2 years agorts/Compact.cmm: fix UNREG build failure
Sergei Trofimovich [Sat, 17 Dec 2016 13:39:18 +0000 (13:39 +0000)] 
rts/Compact.cmm: fix UNREG build failure

The change does the following:
- Add explicit declaration of exception closures
  from base. C backend needs those symbols to be
  visible.
- Reorder cmm functions in use order. Again C
  backend needs symbol declaration/definition
  before use. even for module-local cmm functions.

Fixes the following build failure:

  rts_dist_HC rts/dist/build/Compact.o
    In file included from /tmp/ghc3348_0/ghc_4.hc:3:0: error:
    /tmp/ghc3348_0/ghc_4.hc: In function 'stg_compactAddWithSharingzh':

    /tmp/ghc3348_0/ghc_4.hc:27:11: error:
     error: 'stg_compactAddWorkerzh' undeclared (first use in this function)
     JMP_((W_)&stg_compactAddWorkerzh);
               ^
    ...
    /tmp/ghc3348_0/ghc_4.hc:230:13: error:
     error: 'base_GHCziIOziException_cannotCompactMutable_closure'
     undeclared (first use in this function)
     R1.w = (W_)&base_GHCziIOziException_cannotCompactMutable_closure;
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
2 years agorevert '-Wl' prefixing to *_LD_OPTS
Sergei Trofimovich [Sat, 17 Dec 2016 13:30:41 +0000 (13:30 +0000)] 
revert '-Wl' prefixing to *_LD_OPTS

This reverts f48f5a9ebf384e1e157b7b413e1d779f4289ddd2

The prefixing does not work as comma
is stripped by $(addprefix) macro:

The following call
    $$(addprefix -optl-Wl, $$($1_$2_$3_ALL_LD_OPTS))

prefixes options with "-optl-Wl" not with "-optl-Wl,"

The simplest breakage can be seen by adding
    SRC_LD_OPTS += -O1
to mk/build.mk:

  <no location info>: error:
    Warning: Couldn't figure out linker information!
             Make sure you're using GNU ld, GNU gold
             or the built in OS X linker, etc.
  gcc: error: unrecognized command line option '-Wl-O1'

Another problem with original change is loss of ability
to pass options to gcc as a linker driver, for example:
    SRC_LD_OPTS += -flto

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
2 years agoUNREG: include CCS_OVERHEAD to STG
Sergei Trofimovich [Sat, 17 Dec 2016 13:25:43 +0000 (13:25 +0000)] 
UNREG: include CCS_OVERHEAD to STG

Commit 394231b301efb6b56654b0a480ab794fe3b7e4db aded
CCS_OVERHEAD annotation to 'rts/Apply.cmm'.

Before the change CCS_OVERHEAD was used only in C code.

The change exports CCS_OVERHEAD to STG.

Fixes UNREG build failure:
  rts_dist_HC rts/dist/build/Apply.p_o
    /tmp/ghc29563_0/ghc_4.hc: In function 'cm_entry':

    /tmp/ghc29563_0/ghc_4.hc:73:13: error:
     error: 'CCS_OVERHEAD' undeclared (first use in this function)
     *((P_)((W_)&CCS_OVERHEAD+72)) = ...
                 ^~~~~~~~~~~~

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
2 years agotestsuite: Add test for #12993
Ben Gamari [Fri, 16 Dec 2016 21:47:45 +0000 (16:47 -0500)] 
testsuite: Add test for #12993

2 years agoEnable split sections by default where possible
Simon Brenner [Fri, 16 Dec 2016 17:16:05 +0000 (12:16 -0500)] 
Enable split sections by default where possible

On non-windows platforms with GNU ld, enable SplitSections in the GHC
build by default.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: DemiMarie, thomie

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

GHC Trac Issues: #11445

2 years agoFix string merging with -split-sections
Simon Brenner [Fri, 16 Dec 2016 17:14:36 +0000 (12:14 -0500)] 
Fix string merging with -split-sections

The added flags for string literal merging ended up printed in the
middle of the section name when -split-sections was enabled. Break it up
to put the flags after the name.

Test Plan: validate with SplitSections=YES

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #9577

2 years agoMake up a module name for c-- files
Ben Gamari [Fri, 16 Dec 2016 17:00:27 +0000 (12:00 -0500)] 
Make up a module name for c-- files

Summary:
We used to pass a bottoming Module to the NCG, which resulted in panics
when `-v` was used due to debug output (see #11784). Instead we make up
a module name. This is a bit scary since `PIC.howToAccessLabel` might
actually use the Module, but if it wasn't crashing before I suppose it's
fine.

Test Plan: `touch hi.cmm; ghc -v2 -c -dcmm-lint hi.cmm`

Reviewers: austin, simonmar

Reviewed By: simonmar

Subscribers: thomie

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

GHC Trac Issues: #11784

2 years agoCLabel: Kill redundant UnitId argument from labelDynamic
Ben Gamari [Fri, 16 Dec 2016 16:59:49 +0000 (11:59 -0500)] 
CLabel: Kill redundant UnitId argument from labelDynamic

It already has access to the current package's UnitId via the Module.
Edward Yang pointed out that there is one wrinkle, however: the
following invariant isn't true at all stages of compilation,

    if I am compiling the module (this_mod :: Module), then
    thisPackage dflags == moduleUnitId this_mod.

Specifically, this is only true after desugaring; it may be broken when
typechecking an indefinite signature.

However, it's safe to assume this in the native codegen. I've updated
Note to state this invariant more directly.

Test Plan: Validate

Reviewers: austin, ezyang, simonmar

Reviewed By: ezyang, simonmar

Subscribers: thomie

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

2 years agoPackages: Kill unused UnitId argument to isDllName
Ben Gamari [Fri, 16 Dec 2016 16:59:26 +0000 (11:59 -0500)] 
Packages: Kill unused UnitId argument to isDllName

Test Plan: Validate

Reviewers: austin, simonmar

Subscribers: thomie, ezyang

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

2 years agoDynFlags: Rip out remnants of WarnContextQuantification
Ben Gamari [Fri, 16 Dec 2016 16:58:55 +0000 (11:58 -0500)] 
DynFlags: Rip out remnants of WarnContextQuantification

Test Plan: Validate

Reviewers: austin

Subscribers: thomie

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

GHC Trac Issues: #11221

2 years agoTypos in comments
Gabor Greif [Fri, 16 Dec 2016 13:00:15 +0000 (14:00 +0100)] 
Typos in comments

2 years agoVerify that known-key uniques fit in interface file
Ben Gamari [Fri, 16 Dec 2016 00:00:00 +0000 (19:00 -0500)] 
Verify that known-key uniques fit in interface file

Here we introduce a debug check asserting that all uniques in
knownKeyNames will fit in the space allowed in the interface file's
symbol encoding.

Test Plan: Validate

Reviewers: austin

Subscribers: thomie

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

2 years agobase: Add more POSIX types (fixes #12795)
Daniel Gröber [Thu, 15 Dec 2016 23:58:59 +0000 (18:58 -0500)] 
base: Add more POSIX types (fixes #12795)

Test Plan: validate

Reviewers: hvr, austin, RyanGlScott, bgamari

Reviewed By: RyanGlScott, bgamari

Subscribers: RyanGlScott, thomie, erikd

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

GHC Trac Issues: #12795

2 years agoUniqSupply: Use full range of machine word
Ben Gamari [Thu, 15 Dec 2016 23:57:26 +0000 (18:57 -0500)] 
UniqSupply: Use full range of machine word

Currently uniques are 32-bits wide. 8 of these bits are for the unique
class, leaving only 24 for the unique number itself. This seems
dangerously small for a large project. Let's use the full range of the
native machine word.

We also add (now largely unnecessary) overflow check to ensure that the
unique number doesn't overflow.

Test Plan: Validate

Reviewers: simonmar, austin, niteria

Reviewed By: niteria

Subscribers: mpickering, thomie

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

GHC Trac Issues: #12944

2 years agoarray: Check for integer overflow during allocation
Ben Gamari [Thu, 15 Dec 2016 22:47:08 +0000 (17:47 -0500)] 
array: Check for integer overflow during allocation

This fixes #229, where creating a new array can cause array to allocate
a smaller array than it thinks it allocates due to integer overflow,
resulting in memory unsafety.

This breaks the rts/overflow1 test, which relied on this unchecked
overflow. I fix it by reimplementing the test in terms of newByteArray#
directly.

Updates the array submodule.

2 years agotestsuite: Add test for #12966
Ben Gamari [Thu, 15 Dec 2016 20:27:01 +0000 (15:27 -0500)] 
testsuite: Add test for #12966

This isn't exactly a typechecker test, but it was the most appropriate
directory I could think of. The issue being tested is fixed.

Test Plan: Validate

Reviewers: austin

Subscribers: thomie

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

GHC Trac Issues: #12966

2 years agotestsuite: Mark T10294 as fixed
Ben Gamari [Thu, 15 Dec 2016 20:26:39 +0000 (15:26 -0500)] 
testsuite: Mark T10294 as fixed

It seems that c3c702441137dc8f7ee0dd5ac313be96d625459a resolved #10301.
It took a while to notice this since it only broke when tested against a
statically linked GHC, a configuration which Harbormaster doesn't test.

Test Plan: Validate

Reviewers: angerman, austin

Subscribers: thomie, nomeata

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

GHC Trac Issues: #10294, #10301

2 years agotestsuite: Add test for #12971
Ben Gamari [Thu, 15 Dec 2016 20:26:11 +0000 (15:26 -0500)] 
testsuite: Add test for #12971

Test Plan: Validate

Reviewers: austin

Subscribers: thomie

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

GHC Trac Issues: #12971

2 years agobase: Bump version to 4.10.0.0
Ben Gamari [Tue, 15 Nov 2016 15:26:14 +0000 (10:26 -0500)] 
base: Bump version to 4.10.0.0

Updates a number of submodules.

2 years agotestsuite: Separate out Windows results for T5205
Ben Gamari [Thu, 15 Dec 2016 16:18:05 +0000 (11:18 -0500)] 
testsuite: Separate out Windows results for T5205

This test seems to have much different allocation behavior on Windows
and Linux.  Previously we had widened the acceptance window to 7% to
accomodate this, but even this isn't enough any more. Instead of further
widening the window let's just give an expected number for each
platform. Really, this is precisely the issue with our performance
testing model which I've been complaining about in #12758.

Fixes test for #5205 on 64-bit Windows.

Test Plan: Validate on Windows

Reviewers: austin

Subscribers: thomie, Phyx

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

GHC Trac Issues: #5205

2 years agoWarn about missing instance methods that start with an underscore
Ryan Scott [Thu, 15 Dec 2016 16:17:49 +0000 (11:17 -0500)] 
Warn about missing instance methods that start with an underscore

Previously, GHC would not warn whenever there was a class instance that
didn't implement a class method whose name begins with an underscore.

Fixes #12959.

Test Plan: make test TEST=WarnMinimal

Reviewers: austin, bgamari, simonpj

Reviewed By: bgamari, simonpj

Subscribers: thomie

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

GHC Trac Issues: #12959

2 years agoFix pretty printing of MINIMAL signatures
Matthew Pickering [Thu, 15 Dec 2016 16:17:34 +0000 (11:17 -0500)] 
Fix pretty printing of MINIMAL signatures

Reviewers: austin, alanz, bgamari

Reviewed By: alanz, bgamari

Subscribers: thomie

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

2 years agoFix cost-centre-stacks bug (#5654)
Simon Marlow [Thu, 15 Dec 2016 16:17:19 +0000 (11:17 -0500)] 
Fix cost-centre-stacks bug (#5654)

This fixes some cases of wrong stacks being generated by the profiler.
For background and details on the fix see
`Note [Evaluating functions with profiling]` in `rts/Apply.cmm`.

This does have an impact on allocations for some programs when
profiling.  nofib results:

```
   k-nucleotide          +0.0%     +8.8%    +11.0%    +11.0%      0.0%
         puzzle          +0.0%    +12.5%     0.244     0.246      0.0%
      typecheck           0.0%     +8.7%    +16.1%    +16.2%      0.0%
------------------------------------------------------------------------
--------
            Min          -0.0%     -0.0%    -34.4%    -35.5%    -25.0%
            Max          +0.0%    +12.5%    +48.9%    +49.4%    +10.6%
 Geometric Mean          +0.0%     +0.6%     +2.0%     +1.8%     -0.3%

```

But runtimes don't seem to be affected much, and the examples I looked
at were completely legitimate.  For example, in puzzle we have this:

```
position :: ItemType -> StateType ->  BankType
position Bono = bonoPos
position Edge = edgePos
position Larry = larryPos
position Adam = adamPos
```

where the identifiers on the rhs are all record selectors.  Previously
the profiler gave a stack that looked like

```
  position
  bonoPos
  ...
```

i.e. `bonoPos` was at the same level of the call stack as `position`,
but now it looks like

```
  position
   bonoPos
   ...
```

I used the normaliser from the testsuite to diff the profiling output
from other nofib programs and they all looked better.

Test Plan:
* the broken test passes
* validate
* compiled and ran all of nofib, measured perf, diff'd several .prof
files

Reviewers: niteria, erikd, austin, scpmw, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #5654, #10007

2 years agocheck-ppr: Add a --dump flag to aid in debugging
Ben Gamari [Wed, 14 Dec 2016 22:09:02 +0000 (17:09 -0500)] 
check-ppr: Add a --dump flag to aid in debugging

Currently tracking down where two ASTs disagree is quite difficult. Add a --dump
flag to check-ppr which dumps the respective ASTs to files, which can then be
easily compared with diff, etc.

2 years agotestsuite: Specify expected allocations of T12877 for Windows
Ben Gamari [Wed, 14 Dec 2016 21:51:54 +0000 (16:51 -0500)] 
testsuite: Specify expected allocations of T12877 for Windows

This deviated by 12% from the expected allocations on Windows.
Yet another case of #12758.

2 years agoMake unboxedTuple{Type,Data}Name support 0- and 1-tuples
Ryan Scott [Wed, 14 Dec 2016 21:47:53 +0000 (16:47 -0500)] 
Make unboxedTuple{Type,Data}Name support 0- and 1-tuples

Previously, these functions were hardcoded so as to always `error`
whenever given an argument of 0 or 1. This restriction can be lifted
pretty easily, however.

This requires a slight tweak to `isBuiltInOcc_maybe` in `TysWiredIn` to
allow it to recognize `Unit#` (which is the hard-wired `OccName` for
unboxed 1-tuples).

Fixes #12977.

Test Plan: make test TEST=12977

Reviewers: austin, goldfire, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #12977

2 years agoAdd entry to .gitignore to for __.SYMDEF_SORTED
John Leo [Wed, 14 Dec 2016 21:47:18 +0000 (16:47 -0500)] 
Add entry to .gitignore to for __.SYMDEF_SORTED

libraries/integer-gmp/gmp/objs/__.SYMDEF SORTED is created by Mac OS
builds.

Test Plan: validate

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

2 years agoprocPointAnalysis doesn't need UniqSM
Michal Terepeta [Wed, 14 Dec 2016 21:47:05 +0000 (16:47 -0500)] 
procPointAnalysis doesn't need UniqSM

`procPointAnalysis` doesn't need to run in `UniqSM` (it consists of a
single `return` and the call to `analyzeCmm` function which is pure).
Making it non-monadic simplifies the code a bit.

Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
Test Plan: validate

Reviewers: austin, bgamari, simonmar

Reviewed By: simonmar

Subscribers: thomie

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

2 years agotestsuite: Mark T9577 as broken due to #12965
Ben Gamari [Wed, 14 Dec 2016 21:46:46 +0000 (16:46 -0500)] 
testsuite: Mark T9577 as broken due to #12965

Test Plan: validate

Reviewers: austin, Phyx

Reviewed By: Phyx

Subscribers: thomie

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

GHC Trac Issues: #12965

2 years agoFix pprCLabel on platforms without native codegen.
Shea Levy [Wed, 14 Dec 2016 21:46:27 +0000 (16:46 -0500)] 
Fix pprCLabel on platforms without native codegen.

D1290 added a panic in a code path that can be reached when
!cGhcWithNativeCodeGen.  This reverts just that part of that patch.

Reviewers: austin, simonmar, bgamari, xnyhps

Reviewed By: simonmar

Subscribers: xnyhps, thomie

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

2 years agoBuild terminfo on iOS.
Shea Levy [Wed, 14 Dec 2016 21:46:03 +0000 (16:46 -0500)] 
Build terminfo on iOS.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

2 years agoAdds llvm-prof flavour
Moritz Angermann [Wed, 14 Dec 2016 21:45:48 +0000 (16:45 -0500)] 
Adds llvm-prof flavour

Reviewers: austin, bgamari, RyanGlScott

Reviewed By: bgamari, RyanGlScott

Subscribers: RyanGlScott, thomie

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

2 years agoReset FPU precision back to MSVCRT defaults
Tamar Christina [Wed, 14 Dec 2016 21:45:35 +0000 (16:45 -0500)] 
Reset FPU precision back to MSVCRT defaults

Mingw-w64 does a stupid thing. They set the FPU precision to extended
mode by default.  The reasoning is that it's for compatibility with GNU
Linux ported libraries. However the problem is this is incompatible with
the standard Windows double precision mode.  In fact, if we create a new
OS thread then Windows will reset the FPU to double precision mode.  So
we end up with a weird state where the main thread by default has a
different precision than any child threads.

Test Plan: ./validate new test T7289

Reviewers: simonmar, austin, bgamari, erikd

Reviewed By: simonmar

Subscribers: thomie, #ghc_windows_task_force

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

GHC Trac Issues: #7289

2 years agoShow constraints when reporting typed holes
Maciej Bielecki [Wed, 14 Dec 2016 21:43:25 +0000 (16:43 -0500)] 
Show constraints when reporting typed holes

This patch implements the display of constraints in the error message
for typed holes.

Test Plan: validate, read docs

Reviewers: simonpj, austin, bgamari

Reviewed By: simonpj, bgamari

Subscribers: simonpj, thomie

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

GHC Trac Issues: #10614

2 years agomk/config.mk.in: enable SMP on ARMv7+ (Trac #12981)
Sergei Trofimovich [Thu, 15 Dec 2016 09:02:50 +0000 (09:02 +0000)] 
mk/config.mk.in: enable SMP on ARMv7+ (Trac #12981)

Before the change result of expression
    ArchSupportsSMP="$(if $(filter $(ARM_ISA),ARMv5 ARMv6),NO,YES)"
to evaluate to
    ArchSupportsSMP="YES"

After the change it's
    ArchSupportsSMP=YES

Thanks to orion for the fix!

Fixes Trac #12981
Signed-off-by: Sergei Trofimovich <siarheit@google.com>
2 years agoFix typo in users' guide
Ryan Scott [Wed, 14 Dec 2016 18:16:40 +0000 (13:16 -0500)] 
Fix typo in users' guide

[ci skip]

2 years agoLoad orphan interfaces before checking if module implements signature
Edward Z. Yang [Wed, 14 Dec 2016 02:03:47 +0000 (18:03 -0800)] 
Load orphan interfaces before checking if module implements signature

Summary:
If we didn't load the orphans, we might conclude an instance
is not implemented when it is.  See test bkp42.

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

Reviewers: simonpj, austin, bgamari

Subscribers: thomie

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

2 years agoFix pretty printing of top level SCC pragmas
Matthew Pickering [Tue, 13 Dec 2016 19:59:35 +0000 (14:59 -0500)] 
Fix pretty printing of top level SCC pragmas

Reviewers: austin, alanz, bgamari

Reviewed By: alanz, bgamari

Subscribers: thomie

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

2 years agoprint * in unicode correctly (fixes #12550)
John Leo [Tue, 13 Dec 2016 19:57:15 +0000 (14:57 -0500)] 
print * in unicode correctly (fixes #12550)

Test Plan: validate

Reviewers: simonpj, austin, bgamari, goldfire

Reviewed By: bgamari, goldfire

Subscribers: thomie

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

2 years agoFix testcase T12903 on OS X
Alexander Vershilov [Tue, 13 Dec 2016 19:54:36 +0000 (14:54 -0500)] 
Fix testcase T12903 on OS X

Old test used timeouts that leads to the various sporadic errors.
Tet was rewritten to not use timeouts.

Reviewers: austin, erikd, simonmar, bgamari

Reviewed By: simonmar

Subscribers: thomie

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

GHC Trac Issues: #12956

2 years agoFix Win32 x86 build validation after D2756
Tamar Christina [Tue, 13 Dec 2016 19:54:09 +0000 (14:54 -0500)] 
Fix Win32 x86 build validation after D2756

Test Plan: ./validate

Reviewers: austin, bgamari, erikd, simonmar

Reviewed By: simonmar

Subscribers: thomie

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

2 years agoDon't have CPP macros expanding to 'defined'.
Shea Levy [Tue, 13 Dec 2016 19:53:50 +0000 (14:53 -0500)] 
Don't have CPP macros expanding to 'defined'.

Reviewers: austin, simonmar, erikd, bgamari

Reviewed By: erikd, bgamari

Subscribers: angerman, thomie

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

2 years agobase: Make raw buffer IO operations more strict
Ben Gamari [Tue, 13 Dec 2016 19:49:20 +0000 (14:49 -0500)] 
base: Make raw buffer IO operations more strict

Ticket #9696 reported that `readRawBufferPtr` and `writeRawBufferPtr`
allocated unnecessarily. The binding is question was,
```
let {
  buf_s4VD [Dmd=<L,U(U)>] :: GHC.Ptr.Ptr GHC.Word.Word8
  [LclId, Unf=OtherCon []] =
      NO_CCS GHC.Ptr.Ptr! [ds1_s4Vy];
} in
  case
      GHC.IO.FD.$wreadRawBufferPtr
          Main.main5
          0#
          0#
          buf_s4VD
          Main.main4
          Main.main3
          GHC.Prim.void#
  of ...
```
The problem was that GHC apparently couldn't tell that
`readRawBufferPtr` would always demand the buffer. Here we simple add
bang patterns on all of the small arguments of these functions to ensure
that worker/wrappers can eliminate these allocations.

Test Plan: Look at STG produced by testcase in #9696, verify no
allocations

Reviewers: austin, hvr, simonmar

Reviewed By: simonmar

Subscribers: RyanGlScott, simonmar, thomie

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

GHC Trac Issues: #9696

2 years agoRevert "Float unboxed expressions by boxing"
Ben Gamari [Tue, 13 Dec 2016 19:42:10 +0000 (14:42 -0500)] 
Revert "Float unboxed expressions by boxing"

This reverts commit bc3d37dada357b04fc5a35f740b4fe7e05292b06.

2 years agoFix recompilation detection when set of signatures to merge changes.
Edward Z. Yang [Mon, 12 Dec 2016 03:42:29 +0000 (19:42 -0800)] 
Fix recompilation detection when set of signatures to merge changes.

Summary:
Previously, we only checked to recompile if a signature we
previously depended on changed; however, if the -unit-id
settings changed, this could have resulted in more or less
signatures needing to be merged in; we weren't checking
for this case.

(Note that this logic is irrelevant for normal module imports,
which we also check using -unit-id, as we record each import
and redo it, forcing a recompile if the result changed.)

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

Reviewers: simonpj, austin, bgamari

Subscribers: thomie

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

2 years agoSanity check if we pick up an hsig file without -instantiated-with.
Edward Z. Yang [Fri, 9 Dec 2016 03:32:37 +0000 (19:32 -0800)] 
Sanity check if we pick up an hsig file without -instantiated-with.

Summary:
Previously we would just let compilation proceed along until
we tried to pull up the Module for the hsig file, and get
main:A instead of <A>, and get a mysterious error.  Check
for this earlier!

Fixes #12955.

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

Reviewers: simonpj, austin, bgamari

Subscribers: thomie

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

GHC Trac Issues: #12955

2 years agoAdd infix flag for class and data declarations
Alan Zimmerman [Thu, 8 Dec 2016 08:43:32 +0000 (10:43 +0200)] 
Add infix flag for class and data declarations

Summary:
At the moment, data and type declarations using infix formatting produce the
same AST as those using prefix.

So

    type a ++ b = c

and

    type (++) a b = c

cannot be distinguished in the parsed source, without looking at the OccName
details of the constructor being defined.

Having access to the OccName requires an additional constraint which explodes
out over the entire AST because of its recursive definitions.

In keeping with moving the parsed source to more directly reflect the source
code as parsed, add a specific flag to the declaration to indicate the fixity,
as used in a Match now too.

Note: this flag is to capture the fixity used for the lexical definition of the
type, primarily for use by ppr and ghc-exactprint.

Updates haddock submodule.

Test Plan: ./validate

Reviewers: mpickering, goldfire, bgamari, austin

Reviewed By: mpickering

Subscribers: thomie

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

GHC Trac Issues: #12942

2 years agoFloat unboxed expressions by boxing
Simon Peyton Jones [Fri, 9 Dec 2016 00:04:00 +0000 (00:04 +0000)] 
Float unboxed expressions by boxing

This patch makes GHC's floating more robust, by allowing it
to float unboxed expressions of at least some common types.

See Note [Floating MFEs of unlifted type] in SetLevels.

This was all provoked by Trac #12603

2 years agoFix a long-standing bug in CSE
Simon Peyton Jones [Thu, 8 Dec 2016 23:59:47 +0000 (23:59 +0000)] 
Fix a long-standing bug in CSE

I had the environments wrong so that CSE could mis-clone
an expression, if the uniques just happened to be badly
arranged.  It's hard to trigger the bug, so I can't make
a reliable test case.

Happily the fix is easy.

2 years agoDisable T12903 due to flakiness
Tamar Christina [Mon, 12 Dec 2016 13:21:27 +0000 (14:21 +0100)] 
Disable T12903 due to flakiness

Test seems to randomly fail on harbormaster. Disabling it until it can be fixed.

Test Plan: make test TEST=T12903

Reviewers: austin, bgamari, simonmar, mpickering

Reviewed By: mpickering

Subscribers: mpickering, thomie, qnikst

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

GHC Trac Issues: #12903

2 years agoMake dropDerivedSimples restore [WD] constraints
Simon Peyton Jones [Fri, 9 Dec 2016 17:37:28 +0000 (17:37 +0000)] 
Make dropDerivedSimples restore [WD] constraints

I'd forgotten to turn [W] + [D] constraints back into [WD]
in dropDerivedSimples; and that led to Trac #12936.

Fortunately the fix is simple.

2 years agoRefactor pruning of implication constraints
Simon Peyton Jones [Fri, 9 Dec 2016 17:32:07 +0000 (17:32 +0000)] 
Refactor pruning of implication constraints

We try to prune solved implication constraints, but it's a
bit tricky because of our desire to correctly report unused
'givens'.  This patch improves matters a bit... in tracig some
other bug I saw lots of empty constraints lying around!

2 years agoMake globals use sharedCAF
Moritz Angermann [Sun, 11 Dec 2016 11:32:28 +0000 (11:32 +0000)] 
Make globals use sharedCAF

Summary:
The use of globals is quite painful when multiple rts are loaded, e.g.
when plugins are loaded, which bring in a second rts. The sharedCAF
appraoch was employed for the FastStringTable; I've taken the libery
to extend this to the other globals I could find.

This is a reboot of D2575, that should hopefully not exhibit the same
windows build issues.

Reviewers: Phyx, simonmar, goldfire, bgamari, austin, hvr, erikd

Reviewed By: Phyx, simonmar, bgamari

Subscribers: mpickering, thomie

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

2 years agoAutomate GCC driver wrapper
Tamar Christina [Sat, 10 Dec 2016 21:13:40 +0000 (21:13 +0000)] 
Automate GCC driver wrapper

Summary:
Everytime we upgrade the GCC version this wrapper needed updating.
This is a big fragile and we kept forgetting it.

Instead automate it so we don't have to worry about it.

Test Plan: ./validate

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie, #ghc_windows_task_force

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

GHC Trac Issues: #12871

2 years agoAdd `_unlock_file` to RTS symbols
Tamar Christina [Sat, 10 Dec 2016 20:33:53 +0000 (15:33 -0500)] 
Add `_unlock_file` to RTS symbols

Reviewers: bgamari, austin, erikd, simonmar

Subscribers: thomie

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

2 years agorts: Provide _lock_file in symbol table on Windows
Ben Gamari [Sat, 10 Dec 2016 03:00:00 +0000 (22:00 -0500)] 
rts: Provide _lock_file in symbol table on Windows

Test Plan: Validate on Windows, ensure that linking works.

Reviewers: Phyx, austin, erikd, simonmar

Subscribers: thomie

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

2 years agotestsuite: Fix syntax error in rts/all.T
Ben Gamari [Sat, 10 Dec 2016 02:55:34 +0000 (21:55 -0500)] 
testsuite: Fix syntax error in rts/all.T

Yet another reason why no change to too small to validate. Arg.

2 years agotestsuite: Mark prog003 as broken on Windows
Ben Gamari [Fri, 9 Dec 2016 21:57:33 +0000 (16:57 -0500)] 
testsuite: Mark prog003 as broken on Windows

Due to #11317.

2 years agoRename TH constructors for deriving strategies
Ryan Scott [Fri, 9 Dec 2016 20:44:15 +0000 (15:44 -0500)] 
Rename TH constructors for deriving strategies

After talking to Richard, he and I concluded that choosing the rather
common name `Newtype` to represent the corresponding deriving strategy
in Template Haskell was a poor choice of name. I've opted to rename it
to something less common (`NewtypeStrategy`) while we still have time. I
also renamed the corrsponding datatype in the GHC internals so as to
match it.

Reviewers: austin, goldfire, hvr, bgamari

Reviewed By: bgamari

Subscribers: thomie, mpickering

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

GHC Trac Issues: #10598

2 years agoEnsure each test inherits the TEST_HC_OPTS
Phil Ruffwind [Fri, 9 Dec 2016 20:43:02 +0000 (15:43 -0500)] 
Ensure each test inherits the TEST_HC_OPTS

This is so that global test flags that control the error formatting are
propagated correctly.  This patch is kind of related to: D2718

The stderr for API annotations is ignored entirely now per @alanz's
suggestion.

Test Plan: validate

Reviewers: thomie, alanz, austin, bgamari

Reviewed By: bgamari

Subscribers: alanz

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

2 years agotestsuite: make tests respond to SIGINT properly
Phil Ruffwind [Fri, 9 Dec 2016 20:42:36 +0000 (15:42 -0500)] 
testsuite: make tests respond to SIGINT properly

The `std*_buffer` need to be bytes to avoid breaking Python 3.

Also, using a blanket `except` in Python without specifying the
exception types will catch special exceptions such as
`KeyboardInterrupt`, which can prevent the program from being
interrupted properly.

Test Plan: validate

Reviewers: thomie, austin, bgamari

Reviewed By: bgamari

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

2 years agoNCG: Implement trivColorable for PowerPC 64-bit
Peter Trommler [Fri, 9 Dec 2016 20:42:11 +0000 (15:42 -0500)] 
NCG: Implement trivColorable for PowerPC 64-bit

Define constants for 64-bit PowerPC in graph coloring register
allocator.

Test Plan: ./validate

Reviewers: simonmar, austin, erikd, bgamari, hvr

Reviewed By: bgamari

Subscribers: thomie

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

2 years agoFix LLVM TBAA metadata
Demi Obenour [Fri, 9 Dec 2016 20:41:59 +0000 (15:41 -0500)] 
Fix LLVM TBAA metadata

Accesses through a Cmm local are currently reported as having the
"other" type, which can only alias other "other" accesses.  However,
this assumption is incorrect, which can result in silent bad LLVM
codegen.

Fixes #9308.
Fixes #9504.

Test Plan: GHC CI

Reviewers: rwbarton, austin, bgamari

Reviewed By: bgamari

Subscribers: michalt, thomie

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

GHC Trac Issues: #9125, #9308, #9504

2 years agoMark T12903 as broken on OS X
Ben Gamari [Fri, 9 Dec 2016 21:38:10 +0000 (16:38 -0500)] 
Mark T12903 as broken on OS X

Something has recently broken it. See #12956.

2 years agoExport `warningGroups' and `warningHierarchies'
Sylvain Henry [Fri, 9 Dec 2016 15:28:45 +0000 (10:28 -0500)] 
Export `warningGroups' and `warningHierarchies'

Reviewers: austin, mpickering, bgamari

Reviewed By: mpickering, bgamari

Subscribers: thomie

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

2 years agoDisable colors unless printing to stderr
Phil Ruffwind [Fri, 9 Dec 2016 15:28:25 +0000 (10:28 -0500)] 
Disable colors unless printing to stderr

Only print colors when mkLocMessageAnn is called directly from
defaultLogAction.  This prevents ANSI error codes from cluttering up the
dump files.

Test Plan: validate

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #12927

2 years agoScrutinee Constant Folding
Sylvain Henry [Fri, 9 Dec 2016 15:26:34 +0000 (10:26 -0500)] 
Scrutinee Constant Folding

This patch introduces new rules to perform constant folding through
case-expressions.

E.g.,
```
case t -# 10# of _ {  ===> case t of _ {
         5#      -> e1              15#     -> e1
         8#      -> e2              18#     -> e2
         DEFAULT -> e               DEFAULT -> e
```

The initial motivation is that it allows "Merge Nested Cases"
optimization to kick in and to further simplify the code
(see Trac #12877).

Currently we recognize the following operations for Word# and Int#: Add,
Sub, Xor, Not and Negate (for Int# only).

Test Plan: validate

Reviewers: simonpj, austin, bgamari

Reviewed By: simonpj, bgamari

Subscribers: thomie

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

GHC Trac Issues: #12877

2 years agoBump haddock submodule
Ben Gamari [Fri, 9 Dec 2016 15:26:07 +0000 (10:26 -0500)] 
Bump haddock submodule

Fixes Windows build.

2 years agoDisambiguate reified closed type family kinds in TH
Ryan Scott [Fri, 9 Dec 2016 13:50:54 +0000 (08:50 -0500)] 
Disambiguate reified closed type family kinds in TH

Summary:
A continuation of #8953. This fixes an oversight in which the
left-hand sides of closed type families, when reified in Template Haskell,
would not be given kind annotations, even when they are necessary for
disambiguation purposes in the presence of `PolyKinds`.

Fixes #8953 and #12646.

Test Plan: ./validate

Reviewers: hvr, bgamari, austin, goldfire

Reviewed By: goldfire

Subscribers: thomie

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

GHC Trac Issues: #8953, #12646

2 years agorts/PosixSource.h: Define __USE_MINGW_ANSI_STDIO on Windows
Ben Gamari [Fri, 9 Dec 2016 04:05:21 +0000 (23:05 -0500)] 
rts/PosixSource.h: Define __USE_MINGW_ANSI_STDIO on Windows

This was removed in 8dc72f3c33b0e724ddb690c9d494969980c10afd which cleaned up
PosixSource.h. Strangely, this only started breaking for me now.

Test Plan: Validate on Windows

Reviewers: simonmar, erikd, austin, Phyx

Reviewed By: Phyx

Subscribers: thomie

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

GHC Trac Issues: #12951

2 years agoBlockId: remove BlockMap and BlockSet synonyms
Michal Terepeta [Thu, 8 Dec 2016 21:34:10 +0000 (16:34 -0500)] 
BlockId: remove BlockMap and BlockSet synonyms

This continues removal of `BlockId` module in favor of Hoopl's `Label`.
Most of the changes here are mechanical, apart from the orphan
`Outputable` instances for `LabelMap` and `LabelSet`.  For now I've
moved them to `cmm/Hoopl`, since it's already trying to manage all
imports from Hoopl (to avoid any collisions).

Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
Test Plan: validate

Reviewers: bgamari, austin, simonmar

Reviewed By: simonmar

Subscribers: thomie

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

2 years agonativeGen: Fix string merging on Windows
Ben Gamari [Thu, 8 Dec 2016 21:33:42 +0000 (16:33 -0500)] 
nativeGen: Fix string merging on Windows

D1290 places string constants in the `.rodata.str` section with `aMS`
section flags so that the linker can merge them. However, it seems that
ld doesn't understand these flags. It appears that `gcc
-fmerge-constants` uses the `dr` flags on Windows. Make GHC do the same.

Test Plan: Validate on Windows

Reviewers: xnyhps, austin, Phyx

Reviewed By: Phyx

Subscribers: thomie, trommler

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

GHC Trac Issues: #9577

2 years agoUpdate Windows GCC driver.
Tamar Christina [Thu, 8 Dec 2016 21:33:11 +0000 (16:33 -0500)] 
Update Windows GCC driver.

Test Plan: None really, as none of our tests cover this usage. Probably
should add one..

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie, #ghc_windows_task_force

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

GHC Trac Issues: #12871

2 years agotestsuite: Add test for #10249
Ben Gamari [Thu, 8 Dec 2016 21:32:55 +0000 (16:32 -0500)] 
testsuite: Add test for #10249

Test Plan: Validate

Reviewers: austin

Subscribers: thomie

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

GHC Trac Issues: #10249