ghc.git
2 years agoSpeed up unsafeInterleaveIO wip/dfeuer-interleave-null
David Feuer [Tue, 2 May 2017 21:09:00 +0000 (17:09 -0400)] 
Speed up unsafeInterleaveIO

Summary:
Use an `MVar` and a "null pointer" trick I learned from Edward
Kmett to try to make `unsafeInterleaveIO` faster in the threaded
runtime, where `noDuplicate#` is not always cheap.

Reviewers: austin, hvr, bgamari

Subscribers: rwbarton, thomie

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

2 years agoImprove fixIO
David Feuer [Wed, 3 May 2017 13:57:00 +0000 (09:57 -0400)] 
Improve fixIO

Use `unsafeDupableInterleaveIO` to avoid `noDuplicate` calls. Switch
from `takeMVar` to `readMVar` as multiple entry with `takeMVar`
would lock things up.

Reviewers: austin, hvr, bgamari, simonmar

Reviewed By: simonmar

Subscribers: rwbarton, thomie

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

2 years agoTest #13585 in typecheck/should_compile/T13585
Richard Eisenberg [Tue, 2 May 2017 03:16:20 +0000 (23:16 -0400)] 
Test #13585 in typecheck/should_compile/T13585

2 years agoFix #13233 by checking for lev-poly primops
Richard Eisenberg [Sun, 23 Apr 2017 18:16:32 +0000 (14:16 -0400)] 
Fix #13233 by checking for lev-poly primops

The implementation plan is all in Note [Detecting forced eta expansion]
in DsExpr.

2 years agoFix #13333 by fixing the covar's type in ctEvCoercion
Richard Eisenberg [Sun, 23 Apr 2017 14:24:30 +0000 (10:24 -0400)] 
Fix #13333 by fixing the covar's type in ctEvCoercion

The change is noted in Note [Given in ctEvCoercion]. This patch
also adds a bit more commentary to TcFlatten, documenting some
key invariants of the flattening algorithm. While in the area,
I also removed some stale commentary from TcCanonical.

2 years agoUse mkCastTy in subst_ty.
Richard Eisenberg [Fri, 7 Apr 2017 15:39:51 +0000 (11:39 -0400)] 
Use mkCastTy in subst_ty.

This allows mkCastTy to maintain invariants. Much like how
we use mkAppTy in subst_ty.

2 years agoShave the hair off mkCastTy.
Richard Eisenberg [Fri, 7 Apr 2017 15:38:37 +0000 (11:38 -0400)] 
Shave the hair off mkCastTy.

Previously, mkCastTy went to great lengths to shove casts
around. But this doesn't seem to be necessary. However,
the reflexivity check currently in mkCastTy is not enough.
See the abortive Note [No reflexive casts in types]

2 years agoFix #13233 by checking for lev-poly primops
Richard Eisenberg [Tue, 2 May 2017 22:56:30 +0000 (18:56 -0400)] 
Fix #13233 by checking for lev-poly primops

The implementation plan is all in Note [Detecting forced eta expansion]
in DsExpr.

Test Plan: ./validate, codeGen/should_fail/T13233

Reviewers: simonpj, austin, bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #13233

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

2 years agoTypos in manual and comments
Gabor Greif [Tue, 2 May 2017 11:25:33 +0000 (13:25 +0200)] 
Typos in manual and comments

2 years agoFix loss-of-SpecConstr bug
Simon Peyton Jones [Tue, 2 May 2017 11:04:44 +0000 (12:04 +0100)] 
Fix loss-of-SpecConstr bug

This bug, reported in Trac #13623 has been present since

  commit b8b3e30a6eedf9f213b8a718573c4827cfa230ba
  Author: Edward Z. Yang <ezyang@cs.stanford.edu>
  Date:   Fri Jun 24 11:03:47 2016 -0700

      Axe RecFlag on TyCons.

SpecConstr tries not to specialise indefinitely, and had a
limit (see Note [Limit recursive specialisation]) that made
use of info about whether or not a data constructor was
"recursive".  This info vanished in the above commit, making
the limit fire much more often -- and indeed it fired in this
test case, in a situation where specialisation is /highly/
desirable.

I refactored the test, to look instead at the number of
iterations of the loop of "and now specialise calls that
arise from the specialisation".  Actually less code, and
more robust.

I also added record field names to a couple of constructors,
and renamed RuleInfo to SpecInfo.

2 years agoFix a small Float-Out bug
Simon Peyton Jones [Wed, 26 Apr 2017 16:43:24 +0000 (17:43 +0100)] 
Fix a small Float-Out bug

The float-out pass uses a heuristic based on strictness info.
But it was getting the strictness info mis-aligned; I'd forgotten
that strictness flags only apply to /value/ arguments.

This patch fixes it.  It has some surprising effects!

--------------------------------------------------------------------------------
        Program           Size    Allocs   Runtime   Elapsed  TotalMem
--------------------------------------------------------------------------------
        integer          -0.1%     +9.9%     +0.2%     +0.2%     +0.0%
           lcss          +0.0%     +0.0%    -11.9%    -11.9%     +0.0%
         queens          -0.2%    +29.0%      0.02      0.02     +0.0%
         simple          -0.1%    -22.6%    -21.7%    -21.7%     -3.6%
       treejoin          +0.0%     +0.0%    -12.3%    -12.6%     +0.0%
--------------------------------------------------------------------------------
            Min          -0.2%    -22.6%    -21.7%    -21.7%    -10.0%
            Max          +3.3%    +29.0%    +19.2%    +19.2%    +50.0%
 Geometric Mean          +0.0%     +0.1%     -2.1%     -2.1%     +0.2%

The 'queens' and 'integer' allocation regressions are because, just
before let-floatting, we get
    \v -> foldr k z (case x of I# y -> build ..y..)

Becase of Note [Case MFEs] we don't float the build; so fusion
happens.  This increases allocation in queens because the build
isn't shared; but actaully runtime improves solidly.  Situation
is similar in integer, although I think runtime gets a bit worse.

The bug meant that, because of foldr's type arguments, the
mis-aligned strictness info meant that the entire (case x ...)
was floated, so fusion failed, but sharing happened.

This is all very artificial-benchmark-ish so I'm not losing sleep
over it.

I did see some runtime numbers increasd, but I think it's noise;
the differnce went away when I tried them one by one afterwards.

2 years agoJoin-point refactoring
Simon Peyton Jones [Thu, 27 Apr 2017 16:04:14 +0000 (17:04 +0100)] 
Join-point refactoring

This commit has a raft of refactorings that improve the treatment
of join points.  I wasn't aiming so much as to gain performance as
to make the code simpler.

The two big things are these:

* Make mkDupableCont work for SimplBind as well.  This is simpler than
  I thought and quite neat.  (Luke had aready done StrictArg.)  That's
  a win in its own right. But also now /all/ continuations can be made
  dup-able

* Now that all continuations can be made dup-able, I could simplify
  mkDupableCont to return just one SimplCont, instead of two.
  That really is a worthwhile simlification!  Much easier to think
  about.

Plus a bunch of smaller things:

* Remove the join-arity that had been added to seIdSubst.
  It can be done more simply by putting it in DoneEx, which
  is the only constructor that actually needs it, and now we
  don't need the unsavoury isJoinIdInEnv_maybe.

* Re-order the handling of join points in Simplify, so that we don't need
  the horrible resultTypeOfDupableCont

* Add field names for StrictBind, StrictArg; and use them

* Define simplMonad.newJoinId, and use it

* Rename the seFloats field of SimplEnv to seLetFloats

Binary sizes seem to go up slightly, but allocations generally
improve, sometimes significantly.  I don't believe the runtime numbers
are reliable enough to draw any conclusions about

--------------------------------------------------------------------------------
        Program           Size    Allocs   Runtime   Elapsed  TotalMem
--------------------------------------------------------------------------------
          event          +1.1%    -12.0%     -0.2%     -0.2%     -8.7%
         fulsom          +1.9%    -11.8%    -10.0%    -10.0%     +5.3%
     last-piece          +2.3%     -1.2%     -1.2%     -1.2%     +0.0%
           mate          +0.9%     -1.4%     -0.6%     -0.7%     +0.0%
     multiplier          +1.5%     -8.3%      0.17      0.17     +0.0%
         parser          +2.0%     +1.0%      0.04      0.04     +0.0%
        parstof          +1.5%     +0.7%      0.01      0.01     +0.0%
          sched          +1.3%     -6.1%      0.03      0.03     +0.0%
         simple          +1.8%     +1.0%     +9.7%     +9.6%     +0.0%
--------------------------------------------------------------------------------
            Min          +0.5%    -12.0%    -10.0%    -10.0%     -8.7%
            Max          +3.0%     +1.0%    +14.2%    +14.2%    +50.0%
 Geometric Mean          +1.4%     -0.4%     +0.3%     +0.4%     +0.5%

There's also a tests/perf/compiler improvement of 20% allocation in
T6048.  I think it's because we now generate smaller code.

2 years agoImprove SpecConstr when there are many opportunities
Simon Peyton Jones [Thu, 27 Apr 2017 10:15:00 +0000 (11:15 +0100)] 
Improve SpecConstr when there are many opportunities

SpecConstr has -fspec-contr-count=N which limits the maximum
number of specialisations we make for any particular function.
But until now, if that limit was exceeded we discarded all the
candidates!  So adding a new specialisaiton opportunity (by
adding a new call site, or improving the optimiser) could result
in less specialisation and worse performance.

This patch instead picks the top N candidates, resulting in
less brittle behaviour.

See Note [Choosing patterns].

2 years agotestsuite: Bump allocations of T3064
Ben Gamari [Tue, 2 May 2017 00:42:38 +0000 (20:42 -0400)] 
testsuite: Bump allocations of T3064

This seems to have regressed due to,

    commit 5c602d2228d28530621cc6c94fbb736b13f474fb
    Author: Reid Barton <rwbarton@gmail.com>
    Date:   Mon May 1 11:17:47 2017 -0400

        Avoid excessive space usage from unfoldings in CoreTidy

2 years agoBump array submodule
Ben Gamari [Mon, 1 May 2017 16:59:36 +0000 (12:59 -0400)] 
Bump array submodule

2 years ago[linker] Add ocInit/ocDeinit for ELF
Moritz Angermann [Mon, 1 May 2017 15:18:14 +0000 (11:18 -0400)] 
[linker] Add ocInit/ocDeinit for ELF

This fills out the extended `info` structs, and will be subsequently
used in the arm and arm64 linker for elf.

Depends on: D3446, D3459

Reviewers: bgamari, austin, erikd, simonmar

Reviewed By: simonmar

Subscribers: rwbarton, thomie

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

2 years agoAvoid excessive space usage from unfoldings in CoreTidy
Reid Barton [Mon, 1 May 2017 15:17:47 +0000 (11:17 -0400)] 
Avoid excessive space usage from unfoldings in CoreTidy

Test Plan: validate

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

GHC Trac Issues: #13564

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

2 years agoPPC NCG: Lower MO_*_Fabs as PowerPC fabs instruction
Peter Trommler [Mon, 1 May 2017 15:17:25 +0000 (11:17 -0400)] 
PPC NCG: Lower MO_*_Fabs as PowerPC fabs instruction

In Phab:D3265 we introduced MO_F32_Fabs and MO_F64_Fabs.
This patch improves code generation by generating PowerPC fabs
instructions.

Test Plan: run numeric/should_run/numrun015 or validate

Reviewers: austin, bgamari, hvr, simonmar, erikd

Reviewed By: erikd

Subscribers: rwbarton, thomie

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

2 years agoMake LLVM output robust to -dead_strip on mach-o platforms
Moritz Angermann [Mon, 1 May 2017 15:13:36 +0000 (11:13 -0400)] 
Make LLVM output robust to -dead_strip on mach-o platforms

This reverses commit 1686f30951292e94bf3076ce8b3eafb0bcbba91d (Mangle
.subsections_via_symbols away., D3287), and implements proper support
for `-dead_strip` via the injection of `.alt_entry` symbols for the
function definition pointing to the beginning of the prefix data.

This is the result of a lengthy discussion with rwbarton, and the
following llvm-dev mailing list thread:
http://lists.llvm.org/pipermail/llvm-dev/2017-March/110733.html

The essential problem is that there is no reference from a function to
its info table.  This combined with `.subsections_via_symbols`, which
llvm emits unconditionally, leads the linker to believe that the prefix
data is unnecessary and stripping it away if presented with the
`-dead_strip` flag.

The NCG has for this purpose special $dsp (dead strip preventer) symbols
and adds a relocation to the end of each function body pointing to that
function's $dsp symbol. We cannot easily do the same thing via LLVM.
Instead we use the `.alt_entry` directive on the function symbol, which
causes the linker to treat it as a continuation of the previous symbol,
namely the $dsp symbol. As a result the function body will not be
separated from its info table.

Reviewers: erikd, austin, rwbarton, bgamari

Reviewed By: bgamari

Subscribers: michalt, thomie

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

2 years agoFix capitalization in message for #13609
Ben Gamari [Mon, 1 May 2017 15:06:08 +0000 (11:06 -0400)] 
Fix capitalization in message for #13609

I had meant to do this before merging but forgot.

2 years agotestsuite: Add test for #13609
Ben Gamari [Mon, 1 May 2017 03:19:26 +0000 (23:19 -0400)] 
testsuite: Add test for #13609

2 years agoIgnore ANN pragmas with no TH and no external interpreter.
Shea Levy [Mon, 1 May 2017 03:20:54 +0000 (23:20 -0400)] 
Ignore ANN pragmas with no TH and no external interpreter.

Reviewers: hvr, austin, bgamari, RyanGlScott

Reviewed By: bgamari

Subscribers: angerman, RyanGlScott, rwbarton, thomie

GHC Trac Issues: #13609

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

2 years agoDisable -Wcpp-undef for now
Ben Gamari [Mon, 1 May 2017 02:41:38 +0000 (22:41 -0400)] 
Disable -Wcpp-undef for now

We at very least need to upstream a patch for the time submodule to compile on
OS X.

2 years agoUpdate broken nm message
Alex Biehl [Sun, 30 Apr 2017 14:24:30 +0000 (16:24 +0200)] 
Update broken nm message

9373994acaf1b73fe0e7cf8e03594c63cec8d235 killed the `--with-*` arguments for `configure`.

2 years agotestsuite: Widen acceptance window of T13379
Ben Gamari [Sun, 30 Apr 2017 13:57:07 +0000 (09:57 -0400)] 
testsuite: Widen acceptance window of T13379

2 years agoRemove unused tidyOccNames and update Note
Joachim Breitner [Sun, 30 Apr 2017 07:29:49 +0000 (09:29 +0200)] 
Remove unused tidyOccNames and update Note

addressing rwbarton’s concerns in
https://phabricator.haskell.org/rGHC18ac80ff729e#66197

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

2 years agoPrefer #if defined to #ifdef
Ben Gamari [Fri, 21 Apr 2017 13:16:48 +0000 (09:16 -0400)] 
Prefer #if defined to #ifdef

Our new CPP linter enforces this.

2 years agoEnable new warning for fragile/incorrect CPP #if usage
Erik de Castro Lopo [Tue, 4 Apr 2017 19:53:46 +0000 (05:53 +1000)] 
Enable new warning for fragile/incorrect CPP #if usage

The C code in the RTS now gets built with `-Wundef` and the Haskell code
(stages 1 and 2 only) with `-Wcpp-undef`. We now get warnings whereever
`#if` is used on undefined identifiers.

Test Plan: Validate on Linux and Windows

Reviewers: austin, angerman, simonmar, bgamari, Phyx

Reviewed By: bgamari

Subscribers: thomie, snowleopard

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

2 years agoImprove code generation for conditionals
Simon Peyton Jones [Wed, 8 Mar 2017 11:05:53 +0000 (11:05 +0000)] 
Improve code generation for conditionals

This patch in in preparation for the fix to Trac #13397

The code generator has a special case for
  case tagToEnum (a>#b) of
    False -> e1
    True  -> e2

but it was not doing nearly so well on
  case a>#b of
    DEFAULT -> e1
    1#      -> e2

This patch arranges to behave essentially identically in
both cases.  In due course we can eliminate the special
case for tagToEnum#, once we've completed Trac #13397.

The changes are:

* Make CmmSink swizzle the order of a conditional where necessary;
  see Note [Improving conditionals] in CmmSink

* Hack the general case of StgCmmExpr.cgCase so that it use
  NoGcInAlts for conditionals.  This doesn't seem right, but it's
  the same choice as the tagToEnum version. Without it, code size
  increases a lot (more heap checks).

  There's a loose end here.

* Add comments in CmmOpt.cmmMachOpFoldM

2 years agoRe-engineer caseRules to add tagToEnum/dataToTag
Simon Peyton Jones [Wed, 8 Mar 2017 10:26:47 +0000 (10:26 +0000)] 
Re-engineer caseRules to add tagToEnum/dataToTag

See Note [Scrutinee Constant Folding] in SimplUtils

* Add cases for tagToEnum and dataToTag. This is the main new
  bit.  It allows the simplifier to remove the pervasive uses
  of     case tagToEnum (a > b) of
            False -> e1
            True  -> e2
  and replace it by the simpler
         case a > b of
            DEFAULT -> e1
            1#      -> e2
  See Note [caseRules for tagToEnum]
  and Note [caseRules for dataToTag] in PrelRules.

* This required some changes to the API of caseRules, and hence
  to code in SimplUtils.  See Note [Scrutinee Constant Folding]
  in SimplUtils.

* Avoid duplication of work in the (unusual) case of
     case BIG + 3# of b
       DEFAULT -> e1
       6#      -> e2

  Previously we got
     case BIG of
       DEFAULT -> let b = BIG + 3# in e1
       3#      -> let b = 6#       in e2

  Now we get
     case BIG of b#
       DEFAULT -> let b = b' + 3# in e1
       3#      -> let b = 6#      in e2

* Avoid duplicated code in caseRules

A knock-on refactoring:

* Move Note [Word/Int underflow/overflow] to Literal, as
  documentation to accompany mkMachIntWrap etc; and get
  rid of PrelRuls.intResult' in favour of mkMachIntWrap

2 years agoMove dataConTagZ to DataCon
Simon Peyton Jones [Tue, 7 Mar 2017 13:28:34 +0000 (13:28 +0000)] 
Move dataConTagZ to DataCon

Just a simple refactoring to remove duplication

2 years agonativeGen: Use SSE2 SQRT instruction
Ben Gamari [Fri, 28 Apr 2017 18:24:53 +0000 (14:24 -0400)] 
nativeGen: Use SSE2 SQRT instruction

Reviewers: austin, dfeuer

Subscribers: dfeuer, rwbarton, thomie

GHC Trac Issues: #13629

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

2 years agoCSE: Fix cut and paste error
Ben Gamari [Fri, 28 Apr 2017 17:25:17 +0000 (13:25 -0400)] 
CSE: Fix cut and paste error

extendCSRecEnv took the map to be extended from cs_map instead of
cs_rec_map.  Oops!

Test Plan: Validate

Reviewers: simonpj, austin

Subscribers: rwbarton, thomie

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

2 years agoUse memcpy in cloneArray
Ben Gamari [Fri, 28 Apr 2017 17:24:47 +0000 (13:24 -0400)] 
Use memcpy in cloneArray

While looking at #13615 I noticed that there was this strange open-coded
memcpy in the definition of the cloneArray macro. I don't see why this
should be preferable to memcpy.

Test Plan: Validate, particularly focusing on array operations

Reviewers: simonmar, tibbe, austin, alexbiehl

Reviewed By: tibbe, alexbiehl

Subscribers: alexbiehl, rwbarton, thomie

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

2 years agoMake the tyvars in TH-reified data family instances uniform
Ryan Scott [Fri, 28 Apr 2017 17:24:31 +0000 (13:24 -0400)] 
Make the tyvars in TH-reified data family instances uniform

It turns out we were using two different sets of type variables when
reifying data family instances in Template Haskell. We were using the
tyvars quantifying over the instance itself for the LHS, but using the
tyvars quantifying over the data family instance constructor for the
RHS. This commit uses the instance tyvars for both the LHS and the RHS,
fixing #13618.

Test Plan: make test TEST=T13618

Reviewers: goldfire, austin, bgamari

Reviewed By: goldfire, bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #13618

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

2 years agoAdd regression test for #12104
Ryan Scott [Fri, 28 Apr 2017 17:24:11 +0000 (13:24 -0400)] 
Add regression test for #12104

Commit 2f9f1f86849ebc18af409c9b3fd809c9cd464021
(#13487) fixes #12104 as well. This adds a regression test for the
program reported in #12104 to keep it fixed.

Test Plan: make test TEST=T12104

Reviewers: bgamari, austin

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #12104

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

2 years agoget-win32-tarballs: Grab perl tarball from haskell.org, not GitHub
Ben Gamari [Fri, 28 Apr 2017 17:20:14 +0000 (13:20 -0400)] 
get-win32-tarballs: Grab perl tarball from haskell.org, not GitHub

Reviewers: austin, dfeuer

Reviewed By: dfeuer

Subscribers: Phyx, rwbarton, thomie

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

2 years agoBe a bit more eager to inline in a strict context
Simon Peyton Jones [Thu, 27 Apr 2017 16:42:01 +0000 (17:42 +0100)] 
Be a bit more eager to inline in a strict context

If we see f (g x), and f is strict, we want to be a bit more eager to
inline g, because it may well expose an eval (on x perhaps) that can
be eliminated or shared.

I saw this in nofib boyer2, function RewriteFuns.onewayunify1.  It
showed up as a consequence of the preceding patch that makes the
simplifier do less work (Trac #13379).  We had

   f d (g x)

where f was a class-op. Previously we simplified both d and
(g x) with a RuleArgCtxt (making g a bit more eager to inline).
But now we simplify only d that way, then fire the rule, and
only then simplify (g x).  Firing the rule produces a strict
funciion, so we want to make a strict function encourage
inlining a bit.

2 years agoCure exponential behaviour in the simplifier
Simon Peyton Jones [Wed, 26 Apr 2017 16:31:36 +0000 (17:31 +0100)] 
Cure exponential behaviour in the simplifier

This patch nails a Bad Bug exposed in Trac #13379. Roughly,
a deeply-nested application like
   f (f (f ....) ) )
could make the simplifier go exponential -- without producing
an exponential-sized result!

The reason was that we
  - simplified a (big) function argument
  - then decided to inline the function
  - then preInilneUnconditionally the argument
  - and then re-simplified the big argument

And if the "big argument" itself had a similar structure
things could get very bad.

Once I'd understood, it was easy to fix:

* See Note Note [Avoiding exponential behaviour] for an overview

* The key change is that Simplify.simplLam now as a case for
  (isSimplified dup). This is what removes the perf bug.

* But I also made simplCast more parsimonious about simplifying,
  avoiding doing so when the coercion is Refl

* And similarly I now try to avoid simplifying arguments
  where possible before applying rules.
  See Note [Trying rewrite rules]

The latter two points tackle common cases, and in those cases make the
simplifier take fewer iterations.

2 years agoEta expansion and join points
Simon Peyton Jones [Wed, 26 Apr 2017 15:57:15 +0000 (16:57 +0100)] 
Eta expansion and join points

CoreArity.etaExpand tried to deal with eta-expanding expressions
with join points.  For example
    let j x = e in \y. b

But it is hard to eta-expand this in the "no-crap" way described in
Note [No crap in eta-expanded code], becuase it would mean pushing
the "apply to y" into the join RHS, and changing its type. And the
join might be recursive, and it might have an unfolding.

Moreover in elaborate cases like this I don't think we need the
no-crap thing.  So for now I'm simplifying the code by generating
   \z. (let j x = e in \y. b) z

Let's see if that gives rise to any problems.
See Note [Eta expansion for join points]

2 years agoComments only
Simon Peyton Jones [Wed, 26 Apr 2017 15:56:33 +0000 (16:56 +0100)] 
Comments only

2 years agoComments only
Simon Peyton Jones [Tue, 25 Apr 2017 12:15:44 +0000 (13:15 +0100)] 
Comments only

2 years agoA bit more tcTrace
Simon Peyton Jones [Tue, 25 Apr 2017 12:15:04 +0000 (13:15 +0100)] 
A bit more tcTrace

2 years agoComments and tiny refactoring
Simon Peyton Jones [Fri, 21 Apr 2017 12:12:15 +0000 (13:12 +0100)] 
Comments and tiny refactoring

2 years agoBump process to 1.6
Ben Gamari [Fri, 21 Apr 2017 16:45:40 +0000 (12:45 -0400)] 
Bump process to 1.6

Also bumps Cabal submodule due to version bound bump.

2 years agoUpdate Cabal submodule, with necessary wibbles.
Edward Z. Yang [Wed, 26 Apr 2017 19:26:56 +0000 (15:26 -0400)] 
Update Cabal submodule, with necessary wibbles.

Test Plan: validate

Reviewers: bgamari, austin

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

2 years agoUpdate hsc2hs submodule to 0.68.2
Ben Gamari [Wed, 26 Apr 2017 17:05:57 +0000 (13:05 -0400)] 
Update hsc2hs submodule to 0.68.2

2 years agoAdd instances for Data.Ord.Down
Adam Sandberg Eriksson [Tue, 25 Apr 2017 22:41:28 +0000 (18:41 -0400)] 
Add instances for Data.Ord.Down

Namely `Num`, `Functor`, `Applicative`, `Monad`, `Semigroup` and
`Monoid` for `Data.Ord.Down` (#13097).

Reviewers: austin, hvr, bgamari, RyanGlScott

Reviewed By: bgamari, RyanGlScott

Subscribers: RyanGlScott, rwbarton, thomie

GHC Trac Issues: #13097

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

2 years agoDocument mkWeak#
Ben Gamari [Tue, 25 Apr 2017 22:39:58 +0000 (18:39 -0400)] 
Document mkWeak#

Reviewers: simonmar, austin

Reviewed By: simonmar

Subscribers: RyanGlScott, rwbarton, thomie

GHC Trac Issues: #10640, #13611

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

2 years agoOnly pretty-print binders in closed type families with -fprint-explicit-foralls
Ryan Scott [Tue, 25 Apr 2017 22:38:34 +0000 (18:38 -0400)] 
Only pretty-print binders in closed type families with -fprint-explicit-foralls

Previously, we were unconditionally pretty-printing all type variable
binders when pretty-printing closed type families (e.g., in the output
of `:info` in GHCi). This threw me for a loop, so let's guard this behind
the `-fprint-explicit-foralls` flag.

Test Plan: make test TEST=T13420

Reviewers: goldfire, austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #13420

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

2 years agoAdd backup url and sync support for Win32 tarball script
Tamar Christina [Tue, 25 Apr 2017 22:38:14 +0000 (18:38 -0400)] 
Add backup url and sync support for Win32 tarball script

This imports @bgamari's sync script into the mirror script
and adds a backup url for packages.

The idea is that the URLs won't need updating when updating
the tarballs from now on.

It will first try haskell.org,
failing that it'll try repo.msys2.org

Test Plan: try new command `mk/get-win32-tarballs.sh sync`

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, bgamari

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

2 years agoPPC NCG: Implement callish prim ops
Peter Trommler [Tue, 25 Apr 2017 22:37:16 +0000 (18:37 -0400)] 
PPC NCG: Implement callish prim ops

Provide PowerPC optimised implementations of callish prim ops.

MO_?_QuotRem
The generic implementation of quotient remainder prim ops uses
a division and a remainder operation. There is no remainder on
PowerPC and so we need to implement remainder "by hand" which
results in a duplication of the divide operation when using the
generic code.

Avoid this duplication by implementing the prim op in the native
code generator.

MO_U_Mul2
Use PowerPC's instructions for long multiplication.

Addition and subtraction
Use PowerPC add/subtract with carry/overflow instructions

MO_Clz and MO_Ctz
Use PowerPC's CNTLZ instruction and implement count trailing
zeros using count leading zeros

MO_QuotRem2
Implement an algorithm given by Henry Warren in "Hacker's Delight"
using PowerPC divide instruction. TODO: Use long division instructions
when available (POWER7 and later).

Test Plan: validate on AIX and 32-bit Linux

Reviewers: simonmar, erikd, hvr, austin, bgamari

Reviewed By: erikd, hvr, bgamari

Subscribers: trofi, kgardas, thomie

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

2 years agoconfigure: Kill off FP_ARG_WITH_*
Ben Gamari [Tue, 25 Apr 2017 22:32:24 +0000 (18:32 -0400)] 
configure: Kill off FP_ARG_WITH_*

This replaces the --with-* configure flags with the usual autoconf
environment variables, as suggested by #13583.

Test Plan: Configure on various platforms

Reviewers: hvr, trofi, thomie, austin

Reviewed By: trofi

Subscribers: rwbarton, erikd

GHC Trac Issues: #13583

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

2 years agoRevert "Remove special casing of Windows in generic files"
Ben Gamari [Tue, 25 Apr 2017 13:28:40 +0000 (09:28 -0400)] 
Revert "Remove special casing of Windows in generic files"

This commit didn't consider the fact that binary distributions on Windows must
have relative toolchain paths. This caused #13560.

This reverts commit 48385cb2fc295eb8af9188cbe140142c1807d5a7 (except for a
helpful comment).

2 years agoDon't describe tuple sections as "Python-style"
Chris Martin [Sat, 22 Apr 2017 22:26:22 +0000 (18:26 -0400)] 
Don't describe tuple sections as "Python-style"

(cherry picked from commit 960589e89da3dbf60e88042d7e064ad4a98fb2ff)

2 years agoDon't setProgramDynFlags on every :load
Simon Marlow [Thu, 30 Mar 2017 09:31:08 +0000 (10:31 +0100)] 
Don't setProgramDynFlags on every :load

Summary:
setProgramDynFlags invalidates the whole module graph, forcing
everything to be re-summarised (including preprocessing) on every
:reload.

Looks like this was a bad regression in 8.0, but we didn't notice
because there was no test for it.  Now there is!

Test Plan:
* validate
* new unit test

Reviewers: bgamari, triple, austin, niteria, erikd, jme

Subscribers: rwbarton, thomie

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

2 years agocore-spec: Simplify the handling of LetRec
Joachim Breitner [Tue, 18 Apr 2017 20:33:38 +0000 (16:33 -0400)] 
core-spec: Simplify the handling of LetRec

We do not need to keep an enrivonment around to implement letrec, as
long as we only do call-by-name. Instead, evaluate letrec by
substituting for all the variables with their RHS wrapped in the letrec
binding.

Since nothing adds to the enrivonment any more, there is no need for a
S_Var rule.

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

2 years agoGuard yet another /bin/sh `for in` loop against empty vars
Herbert Valerio Riedel [Mon, 24 Apr 2017 20:22:32 +0000 (22:22 +0200)] 
Guard yet another /bin/sh `for in` loop against empty vars

This is a follow-up to df6794035f1e4397d89896f329525e5368b7d1cc
which missed `INSTALL_BINS`

2 years agoAdd failing test case for T13611
Joachim Breitner [Mon, 24 Apr 2017 17:15:47 +0000 (13:15 -0400)] 
Add failing test case for T13611

this program should be rejected, but is not (and segfaults).

2 years agotestsuite/driver: Fix deletion retry logic on Windows
Ben Gamari [Mon, 24 Apr 2017 13:41:56 +0000 (09:41 -0400)] 
testsuite/driver: Fix deletion retry logic on Windows

Previously rmtree's error callback would throw an exception, breaking
out of the retry loop.

Test Plan: Validate on Windows

Reviewers: Phyx, austin

Reviewed By: Phyx

Subscribers: rwbarton, thomie

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

2 years agocompiler/cmm/PprC.hs: constify labels in .rodata
Sergei Trofimovich [Mon, 24 Apr 2017 13:41:35 +0000 (09:41 -0400)] 
compiler/cmm/PprC.hs: constify labels in .rodata

Consider one-line module
    module B (v) where v = "hello"
in -fvia-C mode it generates code like
    static char gibberish_str[] = "hello";

It resides in data section (precious resource on ia64!).
The patch switches genrator to emit:
    static const char gibberish_str[] = "hello";

Other types if symbols that gained 'const' qualifier are:

- info tables (from haskell and CMM)
- static reference tables (from haskell and CMM)

Cleanups along the way:

- fixed info tables defined in .cmm to reside in .rodata
- split out closure declaration into 'IC_' / 'EC_'
- added label declaration (based on label type) right before
  each label definition (based on section type) so that C
  compiler could check if declaration and definition matches
  at definition site.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Test Plan: ran testsuite on unregisterised x86_64 compiler

Reviewers: simonmar, ezyang, austin, bgamari, erikd

Reviewed By: bgamari, erikd

Subscribers: rwbarton, thomie

GHC Trac Issues: #8996

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

2 years agoDisable terminfo, if we don’t build it.
Moritz Angermann [Mon, 24 Apr 2017 13:38:14 +0000 (09:38 -0400)] 
Disable terminfo, if we don’t build it.

This is a derivation of a patch from @jophish.

This is necessary due to `haskeline`'s `terminfo` flag being marked as
`Manual` as of 43d7fa106027fcd4ec7f443923a8dd5b8c169f9c.

Reviewers: jophish, bgamari, austin

Reviewed By: bgamari

Subscribers: rwbarton, thomie, jophish

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

2 years agoAdd regression test for #13603
Ryan Scott [Mon, 24 Apr 2017 14:47:51 +0000 (10:47 -0400)] 
Add regression test for #13603

Summary:
Commit b207b536ded40156f9adb168565ca78e1eef2c74 (#11714) happened to
fix #13603 as well. Let's add a regression test so that it stays fixed.

Test Plan: make test TEST=T13603

Reviewers: bgamari, austin, simonpj

Reviewed By: bgamari, simonpj

Subscribers: simonpj, rwbarton, thomie

GHC Trac Issues: #13603

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

2 years agotestsuite: Mark T13075 as broken due to #13075
Ben Gamari [Sun, 23 Apr 2017 22:52:46 +0000 (18:52 -0400)] 
testsuite: Mark T13075 as broken due to #13075

2 years agoExport function for use in GHC API
Alan Zimmerman [Sun, 23 Apr 2017 16:53:33 +0000 (18:53 +0200)] 
Export function for use in GHC API

2 years agotestsuite: Add testcase for #13075
Ben Gamari [Sun, 23 Apr 2017 14:59:02 +0000 (10:59 -0400)] 
testsuite: Add testcase for #13075

2 years agotestsuite: Increase T13056 window size to +/-10%
Ben Gamari [Sat, 22 Apr 2017 14:18:23 +0000 (10:18 -0400)] 
testsuite: Increase T13056 window size to +/-10%

2 years agotestsuite: Add testcase for #13587
Ben Gamari [Sun, 23 Apr 2017 14:04:03 +0000 (10:04 -0400)] 
testsuite: Add testcase for #13587

Test Plan: Validate

Reviewers: austin

Subscribers: rwbarton, thomie

GHC Trac Issues: #13587

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

2 years agotestsuite: Add test for #13591
Ben Gamari [Sun, 23 Apr 2017 14:03:46 +0000 (10:03 -0400)] 
testsuite: Add test for #13591

Reviewers: austin

Subscribers: rwbarton, thomie

GHC Trac Issues: #13591

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

2 years agoOnly build iserv with -threaded if GhcThreaded is set
Reid Barton [Sun, 23 Apr 2017 14:03:22 +0000 (10:03 -0400)] 
Only build iserv with -threaded if GhcThreaded is set

By default GhcThreaded is set by
```
GhcThreaded = $(if $(findstring thr,$(GhcRTSWays)),YES,NO)
```
so it seems incorrect to try to build iserv with -threaded when
GhcThreaded is not set. This came up when I was building GHC with
some strange combination of flavours (debugged and profiled but not
threaded).

Test Plan: harbormaster

Reviewers: simonmar, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie, snowleopard

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

2 years agoDocument the kind generalization behavior observed in #13555
Ryan Scott [Sun, 23 Apr 2017 14:02:45 +0000 (10:02 -0400)] 
Document the kind generalization behavior observed in #13555

The conclusion of #13555 was that a program which began to fail to
typecheck (starting in GHC 8.2) was never correct to begin with. Let's
document why this is the case with respect to `MonoLocalBinds`'
interaction with kind generalization. Also adds the reported program as
a `compile_fail` testcase.

Test Plan: make test TEST=T13555 # Also, read the docs

Reviewers: goldfire, simonpj, austin, bgamari

Reviewed By: goldfire, simonpj, bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #13555

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

2 years ago[linker] Adds elf_compat.h, util.h, elf_util.h
Moritz Angermann [Sun, 23 Apr 2017 14:02:21 +0000 (10:02 -0400)] 
[linker] Adds elf_compat.h, util.h, elf_util.h

Further cleanup of the linker, we'll add elf_compat.h for a more
complete set of relocations.

Also Util.h has been added as suggested in the code already.

Depends on D3444, D3445

Reviewers: bgamari, austin, erikd, simonmar

Reviewed By: simonmar

Subscribers: rwbarton, thomie

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

2 years ago[linker] Adds ElfTypes
Moritz Angermann [Sun, 23 Apr 2017 14:02:02 +0000 (10:02 -0400)] 
[linker] Adds ElfTypes

This diff introduces ElfTypes similar to provide the linker
code with a richer data structure, similar to the approach
taken for mach-o already.

Reviewers: bgamari, austin, erikd, simonmar

Reviewed By: simonmar

Subscribers: rwbarton, thomie

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

2 years agorts: Fix "ASSERT ("s
Ben Gamari [Sun, 23 Apr 2017 14:00:19 +0000 (10:00 -0400)] 
rts: Fix "ASSERT ("s

Reviewers: austin, erikd, simonmar

Reviewed By: erikd

Subscribers: rwbarton, thomie

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

2 years agocpp: Use #pragma once instead of #ifndef guards
Ben Gamari [Sat, 22 Apr 2017 13:34:18 +0000 (09:34 -0400)] 
cpp: Use #pragma once instead of #ifndef guards

This both says what we mean and silences a bunch of spurious CPP linting
warnings. This pragma is supported by all CPP implementations which we
support.

Reviewers: austin, erikd, simonmar, hvr

Reviewed By: simonmar

Subscribers: rwbarton, thomie

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

2 years agowin32/Ticker: Stop ticker on exit
Ben Gamari [Sat, 22 Apr 2017 13:33:31 +0000 (09:33 -0400)] 
win32/Ticker: Stop ticker on exit

While debugging an unrelated issue I noticed that we leak a
TimerQueueTimer on exit since we don't necessarily call stopTicker
before exitTicker. Fix this.

Test Plan: Validate on Windows

Reviewers: simonmar, austin, erikd

Reviewed By: simonmar

Subscribers: rwbarton, thomie

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

2 years agoghc.mk: fix 'make install' for cross-mingw32
Sergei Trofimovich [Sun, 23 Apr 2017 14:31:13 +0000 (15:31 +0100)] 
ghc.mk: fix 'make install' for cross-mingw32

Attempt to install cross-compiled mingw32 GHC built on linux failed as:

    $ make install DESTDIR=$(pwd)/__i__

    "mv" "$(pwd)/__i__/usr/local/lib/ghc-8.3.20170422/bin/ghc-stage2" \
         "$(pwd)/__i__/usr/local/lib/ghc-8.3.20170422/bin/ghc"
    mv: failed to stat
         '$(pwd)/__i__/usr/local/lib/ghc-8.3.20170422/bin/ghc-stage2': \
         No such file or directory

The rename should not be performed for windows targets.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2 years agoghc: tweak cross-compilation to mingw32
Sergei Trofimovich [Sun, 23 Apr 2017 14:10:26 +0000 (15:10 +0100)] 
ghc: tweak cross-compilation to mingw32

The build failure when cross-compiling from
linux to windows looks like:

    HC [stage 1] ghc/stage2/build/tmp/ghc-stage2.exe
      Call hs_init_ghc() from your main() function to set these options.
  /usr/libexec/gcc/i686-w64-mingw32/ld: cannot find -lHSghc-8.3-0

Similar to commit 745032dd02da511067c2939259ed212852187e0f
("rts: tweak cross-compilation to mingw32") decision to split
stage2 should be done based based on TargetOS, not HostOS.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2 years agoFix compilation for !HAVE_FLOCK
Herbert Valerio Riedel [Sun, 23 Apr 2017 13:41:50 +0000 (15:41 +0200)] 
Fix compilation for !HAVE_FLOCK

2 years agoMinor reordering of `#include`s fixing compilation on AIX
Herbert Valerio Riedel [Sun, 23 Apr 2017 13:28:52 +0000 (15:28 +0200)] 
Minor reordering of `#include`s fixing compilation on AIX

This helps ensure that system includes on some more fragile
platforms (like e.g. AIX) see a more consistent set of CPP defines,
and consequently reduce the risk of conflicting typdefs/prototypes
being exposed.

2 years agorts: tweak cross-compilation to mingw32
Sergei Trofimovich [Sun, 23 Apr 2017 10:44:45 +0000 (11:44 +0100)] 
rts: tweak cross-compilation to mingw32

Found the problem on x86_64-linux host where
I tried to cross-compile GHC to windows as:

    $ ./configure --target=i686-w64-mingw32 \
                  Windres=i686-w64-mingw32-windres \
                  DllWrap=i686-w64-mingw32-dllwrap

As a result build failed as POSIX bits of RTS.
For example 'rts/posix/OSMem.c' contains unix-specific
mmap() syscalls and constants and thus can't be compiled
by i686-w64-mingw32 toolchain.

It's caused by the following part of 'rts/ghc.mk':

  ifeq "$(HostOS_CPP)" "mingw32"
  ALL_DIRS += win32
  else
  ALL_DIRS += posix
  endif

In our case _CPP variables are defined this way (project.mk):
  BuildOS_CPP                = linux
  HostOS_CPP                 = linux
  TargetOS_CPP               = mingw32

RTS should never be built for 'BuildOS' or 'HostOS' as it's
always built by ghc-stage1 (targeted at TargetOS).

The change is to flip 'HostOS_CPP' to 'TargetOS_CPP' in 'rts/ghc.mk'.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2 years agoaclocal.m4: treat '*-w64-mingw32' targets as windows
Sergei Trofimovich [Sun, 23 Apr 2017 10:25:29 +0000 (11:25 +0100)] 
aclocal.m4: treat '*-w64-mingw32' targets as windows

Noticed when tried to cross-compile GHC from x86_64-linux
to --target=i686-w64-mingw32. Final ghc executables did
not have '.exe' extensions.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2 years agoconfigure.ac: print paths to dllwrap and windres
Sergei Trofimovich [Sun, 23 Apr 2017 10:22:44 +0000 (11:22 +0100)] 
configure.ac: print paths to dllwrap and windres

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2 years agoFirst update mingw-w64 packages for 8.4
Tamar Christina [Sun, 23 Apr 2017 10:21:18 +0000 (11:21 +0100)] 
First update mingw-w64 packages for 8.4

Summary: Updating to get latest binutils etc.

Test Plan: ./validate

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, snowleopard

GHC Trac Issues: #12913

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

2 years agoskip T13525 when running on Windows.
Tamar Christina [Sun, 23 Apr 2017 09:44:54 +0000 (10:44 +0100)] 
skip T13525 when running on Windows.

2 years agoHaddock submodule update.
Edward Z. Yang [Sun, 23 Apr 2017 03:39:18 +0000 (20:39 -0700)] 
Haddock submodule update.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
2 years agoBump time submodule
Ben Gamari [Fri, 21 Apr 2017 16:42:50 +0000 (12:42 -0400)] 
Bump time submodule

2 years agoBump filepath submodule
Ben Gamari [Fri, 21 Apr 2017 16:39:35 +0000 (12:39 -0400)] 
Bump filepath submodule

2 years agoBump deepseeq submodule
Ben Gamari [Fri, 21 Apr 2017 16:36:33 +0000 (12:36 -0400)] 
Bump deepseeq submodule

2 years agobase: update comment to match the change from e134af01
Andrzej Rybczak [Sat, 22 Apr 2017 00:11:35 +0000 (20:11 -0400)] 
base: update comment to match the change from e134af01

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

2 years agotestsuite: Update performance metrics
Ben Gamari [Sat, 22 Apr 2017 00:06:27 +0000 (20:06 -0400)] 
testsuite: Update performance metrics

2 years agoEdit eventlog-formats.rst to match implementation
Mitsutoshi Aoe [Sun, 16 Apr 2017 21:08:25 +0000 (06:08 +0900)] 
Edit eventlog-formats.rst to match implementation

* Add missing filters in EVENT_HEAP_PROF_BEGIN and reorder them
* EVENT_HEAP_PROF_SAMPLE_COST_CENTRE isn't used in retainer profiling
* Modify EVENT_HEAP_PROF_SAMPLE_STRING's format
* Biography break-down isn't implemented

2 years agoSync up terminfo submodule to 0.4.1.0 release tag
Herbert Valerio Riedel [Fri, 21 Apr 2017 22:50:26 +0000 (00:50 +0200)] 
Sync up terminfo submodule to 0.4.1.0 release tag

2 years agoBuild system: fix bindist for cross-build GHC
Fangrui Song [Fri, 21 Apr 2017 00:03:30 +0000 (17:03 -0700)] 
Build system: fix bindist for cross-build GHC

The change fixes case of installing cross-built GHC
from bindist (BINDIST=YES) on TARGET.

In this case we need to use TARGET tools in `INSTALLED_GHC{,_PKG}_REAL`.

The original change is provided by Fangrui Song
as pull request https://github.com/ghc/ghc/pull/34

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2 years agoBump haskeline and terminfo submodules
Ben Gamari [Fri, 21 Apr 2017 15:33:47 +0000 (11:33 -0400)] 
Bump haskeline and terminfo submodules

2 years agolinters/check-cpp: Demote #if lints to warnings
Ben Gamari [Fri, 21 Apr 2017 16:27:51 +0000 (12:27 -0400)] 
linters/check-cpp: Demote #if lints to warnings

Errors trigger even for lines which the author didn't touch, which is undesired.

2 years agocatch the case where there is no symCmd
Moritz Angermann [Fri, 21 Apr 2017 16:12:01 +0000 (12:12 -0400)] 
catch the case where there is no symCmd

We do check for symCmd, to set the info->nlist value, but forgot to do
the same check for info->names.  Thus when trying to extract stroff from
symCmd, we hit a segfault.

Test Plan: The validation failure on windows is rather suspicious...
let's try this one

Reviewers: bgamari, adinapoli, austin, erikd, simonmar

Reviewed By: adinapoli

Subscribers: thomie, rwbarton

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

2 years agoFix build on DragonflyBSD
Ben Gamari [Fri, 21 Apr 2017 16:11:41 +0000 (12:11 -0400)] 
Fix build on DragonflyBSD

Test Plan: Validate on DragonflyBSD

Reviewers: austin, erikd, simonmar

Reviewed By: erikd

Subscribers: rwbarton, thomie

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

2 years agobase: Fix hWaitForInput with timeout on POSIX
Ben Gamari [Fri, 21 Apr 2017 16:11:28 +0000 (12:11 -0400)] 
base: Fix hWaitForInput with timeout on POSIX

This was previously broken (#13252) by
f46369b8a1bf90a3bdc30f2b566c3a7e03672518, which ported the fdReady
function from `select` to `poll` and in so doing dropping support for
timeouts. Unfortunately, while `select` tells us the amount of time not
slept (on Linux anyways; it turns out this is implementation dependent),
`poll` does not give us this luxury. Consequently, we manually need to
track time slept in this case.

Unfortunately, portably measuring time is hard. Ideally we would use
`clock_gettime` with the monotonic clock here, but sadly this isn't
supported on most versions of Darwin. Consequently, we instead use
`gettimeofday`, running the risk of system time changes messing us up.

Test Plan: Validate

Reviewers: simonmar, austin, hvr

Reviewed By: simonmar

Subscribers: rwbarton, thomie

GHC Trac Issues: #13252

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

2 years agotestsuite: Bump timeout multiplier for T11195
Ben Gamari [Fri, 21 Apr 2017 02:34:21 +0000 (22:34 -0400)] 
testsuite: Bump timeout multiplier for T11195

This test has been occassionally failing on the Darwin build bot for some time
now.

(cherry picked from commit b3a4dd1152884ff1240824137eca0a49cb6e5a2c)