ghc.git
5 months agoImplement -Wredundant-record-wildcards and -Wunused-record-wildcards wip/wildcards-warn
Matthew Pickering [Mon, 11 Feb 2019 09:24:04 +0000 (09:24 +0000)] 
Implement -Wredundant-record-wildcards and -Wunused-record-wildcards

-Wredundant-record-wildcards warns when a .. pattern binds no variables.

-Wunused-record-wildcards warns when none of the variables bound by a ..
pattern are used.

These flags are not enabled by `-Wall` currently. If people think it
is appropuiate to add them then that is an easy change.

5 months agotestsuite: Report unexpected passes in junit output
Matthew Pickering [Sun, 10 Feb 2019 21:59:38 +0000 (21:59 +0000)] 
testsuite: Report unexpected passes in junit output

5 months agoHadrian: add LLVM flavours
Alec Theriault [Wed, 30 Jan 2019 02:33:20 +0000 (18:33 -0800)] 
Hadrian: add LLVM flavours

This adds a handful of LLVM flavours and the accompanying
documentation. These flavours are mostly uninteresting, but
exist in the Make system.

5 months agoFix Int overflow on 32 bit platform
Peter Trommler [Wed, 6 Feb 2019 21:31:20 +0000 (22:31 +0100)] 
Fix Int overflow on 32 bit platform

5 months agotestsuite: Always skip T15897
Ben Gamari [Tue, 5 Feb 2019 03:02:52 +0000 (22:02 -0500)] 
testsuite: Always skip T15897

See #16193.

5 months agotestsuite: Report stdout and stderr in JUnit output
Ben Gamari [Thu, 24 Jan 2019 19:20:11 +0000 (14:20 -0500)] 
testsuite: Report stdout and stderr in JUnit output

This patch makes the JUnit output more useful as now we also report the
stdout/stderr in the message which can be used to quickly identify why a
test is failing without downloading the log.

This also introduces TestResult,
previously we were simply passing around tuples, making things the
implementation rather difficult to follow and harder to extend.

5 months agoCapture and simplify constraints arising from running typed splices
Matthew Pickering [Sun, 3 Feb 2019 11:46:28 +0000 (11:46 +0000)] 
Capture and simplify constraints arising from running typed splices

This fixes a regression caused by #15471 where splicing in a trivial
program such as `[|| return () ||]` would fail as the dictionary for
`return` would never get bound in the module containing the splice.

Arguably this is symptomatic of a major problem affecting TTH where we
serialise renamed asts and then retype check them. The reference to the
dictionary should be fully determined at the quote site so that splicing
doesn't have to solve any implicits at all. It's a coincidence this
works due to coherence but see #15863 and #15865 for examples where
things do go very wrong.

Fixes #16195

5 months agoRemove ghctags (#16274)
Sylvain Henry [Thu, 7 Feb 2019 00:02:04 +0000 (01:02 +0100)] 
Remove ghctags (#16274)

5 months agoMake CI via Hadrian build docs
Alec Theriault [Tue, 29 Jan 2019 08:54:10 +0000 (00:54 -0800)] 
Make CI via Hadrian build docs

5 months agoFix invalid doc comment
Alec Theriault [Tue, 29 Jan 2019 08:35:24 +0000 (00:35 -0800)] 
Fix invalid doc comment

The invalid doc comments were exposed by 24b39ce53eedad4cefc30f6786542d2072d1f9b0.
The fix is to properly escaped the `{-` and `-}` in the doc comments.
Some other miscallaneous markup issues are also fixed.

5 months agoFix inverted position pragma flag in parser API
Alec Theriault [Tue, 29 Jan 2019 06:11:08 +0000 (22:11 -0800)] 
Fix inverted position pragma flag in parser API

The behviour of `lexTokenStream` around position pragma was
accidentally inverted in 469fe6133646df5568c9486de2202124cb734242.
This fixes that bug.

This also unbreaks #16239.

5 months agoUpgrade to the latest stack resolver
Neil Mitchell [Thu, 7 Feb 2019 14:50:47 +0000 (14:50 +0000)] 
Upgrade to the latest stack resolver

5 months agoSimplify the build.stack.bat script to use 'stack run'
Neil Mitchell [Thu, 7 Feb 2019 14:49:33 +0000 (14:49 +0000)] 
Simplify the build.stack.bat script to use 'stack run'

5 months agoImprove snocView implementation.
klebinger.andreas@gmx.at [Tue, 22 Jan 2019 15:17:40 +0000 (16:17 +0100)] 
Improve snocView implementation.

The new implementation isn't tailrecursive and instead
builds up the initial part of the list as it goes.

This improves allocation numbers as we don't build up an intermediate
list just to reverse it later.

This is slightly slower for lists of size <= 3. But in benchmarks
significantly faster for any list above 5 elements, assuming the
majority of the resulting list will be evaluated.

5 months agoReplace a few uses of snocView with last/lastMaybe.
klebinger.andreas@gmx.at [Mon, 21 Jan 2019 16:55:22 +0000 (17:55 +0100)] 
Replace a few uses of snocView with last/lastMaybe.

These never used the first part of the result from snocView.
Hence replacing them with last[Maybe] is both clearer and
gives better performance.

5 months agoStack: fix name mangling.
Tamar Christina [Sun, 27 Jan 2019 15:54:36 +0000 (15:54 +0000)] 
Stack: fix name mangling.

5 months agoMinor refactor of CUSK handling
Simon Peyton Jones [Thu, 7 Feb 2019 09:51:36 +0000 (09:51 +0000)] 
Minor refactor of CUSK handling

Previously, in getFamDeclInitialKind, we were figuring
out whether the enclosing class decl had a CUSK very
indirectly, via tcTyConIsPoly.  This patch just makes
the computation much more direct and easy to grok.

No change in behaviour.

5 months agoComments only about the binder-swap in OccurAnal
Simon Peyton Jones [Thu, 7 Feb 2019 08:46:48 +0000 (08:46 +0000)] 
Comments only about the binder-swap in OccurAnal

5 months agoComments only
Simon Peyton Jones [Fri, 18 Jan 2019 17:12:13 +0000 (17:12 +0000)] 
Comments only

5 months agoRemove a few undefined prel names
Ömer Sinan Ağacan [Wed, 6 Feb 2019 07:26:00 +0000 (10:26 +0300)] 
Remove a few undefined prel names

- breakpointAuto
- breakpointJump
- breakpointCondJump
- breakpointAutoJump

These Ids are never defined, but there were definitions about those in
PrelNames. Those are now removed.

5 months agoFix optSemi type in Parser.y
Vladislav Zavialov [Wed, 6 Feb 2019 01:01:36 +0000 (20:01 -0500)] 
Fix optSemi type in Parser.y

The definition of 'optSemi' claimed it had type

([Located a],Bool)

Note that its production actually returns ([Located Token],Bool):

  : ';' { ([$1],True) }   -- $1 :: Located Token

Due to an infelicity in the implementation of 'happy -c', it effectively
resulted in 'unsafeCoerce :: Token -> a'.
See https://github.com/simonmar/happy/pull/134

If any consumer of 'optSemi' tried to instantiate 'a' to something not
representationally equal to 'Token', they would experience a segfault.

In addition to that, this definition made it impossible to compile Parser.y
without the -c flag (as it's reliant on this bug to cast 'Token' to 'forall
a. a').

5 months agoCleanup in parser/Ctype.hs
Sylvain Henry [Tue, 5 Feb 2019 14:55:03 +0000 (15:55 +0100)] 
Cleanup in parser/Ctype.hs

* GHC now performs constant folding on bit operations like (.|.) so we
use them and we remove the misleading comment

* we use Word8 instead of Int and we remove the useless conversion to
Int32. Hopefully future releases of GHC could transform the big case in
`charType` into a value table indexing instead of a jump table. Word8
would make the table smaller.

* we use INLINABLE pragma instead of INLINE on `is_ctype`: in my test,
the latter *prevents* `is_ctype` to be inlined because `charType` is
inlined into `is_ctype` (to call charType`s worker on the unboxed Char
directly).

5 months agorts/ProfilerReportJson: Fix format string
Ben Gamari [Tue, 5 Feb 2019 02:42:41 +0000 (21:42 -0500)] 
rts/ProfilerReportJson: Fix format string

This was warning on i386.

5 months agoLexer: Alternate Layout Rule injects actual not virtual braces
Alan Zimmerman [Sun, 3 Feb 2019 08:27:42 +0000 (10:27 +0200)] 
Lexer: Alternate Layout Rule injects actual not virtual braces

When the alternate layout rule is activated via a pragma, it injects
tokens for { and } to make sure that the source is parsed properly.

But it injects ITocurly and ITccurly, rather than their virtual
counterparts ITvocurly and ITvccurly.

This causes problems for ghc-exactprint, which tries to print these.

Likewise, any injected ITsemi should have a zero-width SrcSpan.

Test case (the existing T13087.hs)

    {-# LANGUAGE AlternativeLayoutRule #-}
    {-# LANGUAGE LambdaCase            #-}

    isOne :: Int -> Bool
    isOne = \case 1 -> True
                  _ -> False

    main = return ()

Closes #16279

5 months agoAPI Annotations: parens anns discarded for `(*)` operator
Alan Zimmerman [Sat, 2 Feb 2019 14:29:05 +0000 (16:29 +0200)] 
API Annotations: parens anns discarded for `(*)` operator

The patch from https://phabricator.haskell.org/D4865 introduces

    go _ (HsParTy _ (dL->L l (HsStarTy _ isUni))) acc ann fix
      = do { warnStarBndr l
           ; let name = mkOccName tcClsName (if isUni then "★" else "*")
           ; return (cL l (Unqual name), acc, fix, ann) }

which discards the parens annotations belonging to the HsParTy.

Updates haddock submodule

Closes #16265

5 months agoAPI Annotations: AnnAt disconnected for TYPEAPP
Alan Zimmerman [Wed, 30 Jan 2019 14:20:52 +0000 (16:20 +0200)] 
API Annotations: AnnAt disconnected for TYPEAPP

For the code

    type family F1 (a :: k) (f :: k -> Type) :: Type where
      F1 @Peano a f = T @Peano f a

the API annotation for the first @ is not attached to a SourceSpan in
the ParsedSource

Closes #16236

5 months agoAPI Annotations: more explicit foralls fixup
Alan Zimmerman [Thu, 24 Jan 2019 21:22:59 +0000 (23:22 +0200)] 
API Annotations: more explicit foralls fixup

The AnnForall annotations introduced via Phab:D4894 are not always
attached to the correct SourceSpan.

Closes #16230

5 months agoImplicitParams does not imply FlexibleContexts or FlexibleInstances, fixes #16248
Neil Mitchell [Sun, 3 Feb 2019 20:45:12 +0000 (15:45 -0500)] 
ImplicitParams does not imply FlexibleContexts or FlexibleInstances, fixes #16248

5 months agoUpdate directory submodule
Herbert Valerio Riedel [Fri, 1 Feb 2019 21:48:07 +0000 (22:48 +0100)] 
Update directory submodule

5 months agoUpdate filepath submodule
Herbert Valerio Riedel [Fri, 1 Feb 2019 21:48:40 +0000 (22:48 +0100)] 
Update filepath submodule

5 months agoAdd a changelog for base 4.14.0.0
Langston Barrett [Mon, 4 Feb 2019 16:59:56 +0000 (08:59 -0800)] 
Add a changelog for base 4.14.0.0

5 months agoTestEquality instance for Compose
Langston Barrett [Fri, 1 Feb 2019 20:33:38 +0000 (12:33 -0800)] 
TestEquality instance for Compose

5 months agoFix test for T16180 on Darwin (fix #16128)
Sylvain Henry [Tue, 29 Jan 2019 01:14:12 +0000 (02:14 +0100)] 
Fix test for T16180 on Darwin (fix #16128)

5 months agoHadrian: compile libgmp static on Windows
Tamar Christina [Sun, 27 Jan 2019 21:30:50 +0000 (21:30 +0000)] 
Hadrian: compile libgmp static on Windows

5 months agoUpdate hpc submodule
Herbert Valerio Riedel [Sun, 27 Jan 2019 21:35:35 +0000 (22:35 +0100)] 
Update hpc submodule

5 months agoAllow resizing the stack for the graph allocator.
klebinger.andreas@gmx.at [Fri, 25 Jan 2019 23:26:02 +0000 (00:26 +0100)] 
Allow resizing the stack for the graph allocator.

The graph allocator now dynamically resizes the number of stack
slots when running into the limit.

This fixes #8657.

Also loop membership of basic blocks is now available
in the register allocator for cost heuristics.

5 months agoFix #14729 by making the normaliser homogeneous
Richard Eisenberg [Thu, 24 Jan 2019 15:22:58 +0000 (10:22 -0500)] 
Fix #14729 by making the normaliser homogeneous

This ports the fix to #12919 to the normaliser. (#12919 was about
the flattener.) Because the fix is involved, this is done by
moving the critical piece of code to Coercion, and then calling
this from both the flattener and the normaliser.

The key bit is: simplifying type families in a type is always
a *homogeneous* operation. See #12919 for a discussion of why
this is the Right Way to simplify type families.

Also fixes #15549.

test case: dependent/should_compile/T14729{,kind}
           typecheck/should_compile/T15549[ab]

5 months agotestsuite: Mark T5515 as broken with debugged compiler
Ben Gamari [Mon, 28 Jan 2019 21:58:15 +0000 (16:58 -0500)] 
testsuite: Mark T5515 as broken with debugged compiler

As noted in #16251.

5 months agotestsuite: Mark T14740 and tcfail159 as broken in debugged compiler
Ben Gamari [Sun, 30 Dec 2018 18:32:50 +0000 (13:32 -0500)] 
testsuite: Mark T14740 and tcfail159 as broken in debugged compiler

As noted in #16113, these trigger an assertion in isUnliftedRuntimeRep.

5 months agotestsuite: Mark recomp007 as broken in debugged compiler
Ben Gamari [Sun, 30 Dec 2018 18:30:32 +0000 (13:30 -0500)] 
testsuite: Mark recomp007 as broken in debugged compiler

As noted in #14759, this triggers a warning in ListSetOps.

5 months agotestsuite: Mark T11334b as broken in debugged compiler
Ben Gamari [Sun, 30 Dec 2018 18:28:07 +0000 (13:28 -0500)] 
testsuite: Mark T11334b as broken in debugged compiler

As noted in #16112.

5 months agoRevert "gitlab-ci: More aggressive artifact expiration"
Matthew Pickering [Sun, 3 Feb 2019 11:30:49 +0000 (11:30 +0000)] 
Revert "gitlab-ci: More aggressive artifact expiration"

This reverts commit d87b38a2519212aaf8bad927c65abecc509a7212.

5 months agogitlab-ci: More aggressive artifact expiration
Ben Gamari [Sun, 30 Dec 2018 18:22:38 +0000 (13:22 -0500)] 
gitlab-ci: More aggressive artifact expiration

5 months agogitlab-ci: Add a devel2 build
Ben Gamari [Sat, 22 Dec 2018 05:59:43 +0000 (00:59 -0500)] 
gitlab-ci: Add a devel2 build

5 months agoFix #16287 by checking for more unsaturated synonym arguments
Ryan Scott [Tue, 5 Feb 2019 13:50:59 +0000 (08:50 -0500)] 
Fix #16287 by checking for more unsaturated synonym arguments

Trac #16287 shows that we were checking for unsaturated type synonym
arguments (in `:kind`) when the argument was to a type synonym, but
_not_ when the argument was to some other form of type constructor,
such as a data type. The solution is to use the machinery that
rejects unsaturated type synonym arguments (previously confined to
`check_syn_tc_app`) to `check_arg_type`, which checks these other
forms of arguments. While I was in town, I cleaned up
`check_syn_tc_app` a bit to only invoke `check_arg_type` so as to
minimize the number of different code paths that that function could
go down.

5 months agoAdd int-index as parser/* codeowner
Vladislav Zavialov [Sun, 3 Feb 2019 20:50:58 +0000 (15:50 -0500)] 
Add int-index as parser/* codeowner

5 months agoFix #14579 by defining tyConAppNeedsKindSig, and using it
Ryan Scott [Wed, 6 Feb 2019 00:57:29 +0000 (19:57 -0500)] 
Fix #14579 by defining tyConAppNeedsKindSig, and using it

5 months agoRefactor splice_exp in Parser.y
Vladislav Zavialov [Fri, 1 Feb 2019 06:25:45 +0000 (09:25 +0300)] 
Refactor splice_exp in Parser.y

5 months agoAdd `-fplugin-trustworthy` to avoid marking modules as unsafe
Zejun Wu [Thu, 31 Jan 2019 06:13:42 +0000 (22:13 -0800)] 
Add `-fplugin-trustworthy` to avoid marking modules as unsafe

By default, when a module is compiled with plugins, it will be marked as
unsafe. With this flag passed, all plugins are treated as trustworthy
and the safety inference will no longer be affected.

This fixes Trac #16260.

5 months agogitlab-ci: Don't allow x86_64-linux-deb9-llvm to fail
Ben Gamari [Tue, 29 Jan 2019 00:26:57 +0000 (19:26 -0500)] 
gitlab-ci: Don't allow x86_64-linux-deb9-llvm to fail

5 months agotestsuite: Mark print037 as broken when GHC is built with LLVM
Ben Gamari [Tue, 29 Jan 2019 00:26:10 +0000 (19:26 -0500)] 
testsuite: Mark print037 as broken when GHC is built with LLVM

As noted in #16205 this configuration reliably segfaults.

5 months agotestsuite: Use makefile_test for T16212
Ben Gamari [Sat, 2 Feb 2019 19:35:29 +0000 (14:35 -0500)] 
testsuite: Use makefile_test for T16212

5 months agotestsuite: Skip T15897 in unregisterised way
Ben Gamari [Sat, 2 Feb 2019 17:52:21 +0000 (12:52 -0500)] 
testsuite: Skip T15897 in unregisterised way

As noted in #16227 this test routinely times out when run in the
unregisterised way.

See also #15467.

5 months agoReport multiple errors
Vladislav Zavialov [Fri, 1 Feb 2019 17:39:57 +0000 (20:39 +0300)] 
Report multiple errors

5 months agoAdd werror function to Flavour.hs
Matthew Pickering [Thu, 31 Jan 2019 11:01:04 +0000 (11:01 +0000)] 
Add werror function to Flavour.hs

This function makes it easy to turn on `-Werror` in the correct manner
to mimic how CI turns on -Werror.

5 months agoFix missing space in ppr_cmd for HsCmdArrForm
Vladislav Zavialov [Sat, 2 Feb 2019 14:30:05 +0000 (17:30 +0300)] 
Fix missing space in ppr_cmd for HsCmdArrForm

5 months agodocs: change meta-variable of -interactive-print from expr to name
Zejun Wu [Thu, 31 Jan 2019 01:35:50 +0000 (17:35 -0800)] 
docs: change meta-variable of -interactive-print from expr to name

`-interactive-print` doesn't accept **expr** as `-e` or `:def` does. It must
be a qualified or unqualified **name** in scope.

5 months agoTurn on -Wno-unused-imports in make build system
Matthew Pickering [Fri, 1 Feb 2019 19:10:07 +0000 (19:10 +0000)] 
Turn on -Wno-unused-imports in make build system

This mirrors Hadrian and it good enough to get us unstuck.

5 months agoBump hsc2hs for removed unused match
Sebastian Graf [Fri, 1 Feb 2019 11:43:27 +0000 (12:43 +0100)] 
Bump hsc2hs for removed unused match

5 months agoRemove unused imports
Sebastian Graf [Wed, 30 Jan 2019 12:59:10 +0000 (13:59 +0100)] 
Remove unused imports

5 months agoTurn on -Werror when validating
Matthew Pickering [Wed, 30 Jan 2019 13:29:26 +0000 (08:29 -0500)] 
Turn on -Werror when validating

5 months agoPolished Note [Exceptions and strictness]
Sebastian Graf [Fri, 1 Feb 2019 12:25:42 +0000 (13:25 +0100)] 
Polished Note [Exceptions and strictness]

[ci skip]

5 months agoUpdate user-settings.md with a pointer to `Packages`
Sebastian Graf [Fri, 1 Feb 2019 09:48:41 +0000 (04:48 -0500)] 
Update user-settings.md with a pointer to `Packages`

[skip ci]

5 months agoReject oversaturated VKAs in type family equations
Ryan Scott [Sat, 2 Feb 2019 00:10:55 +0000 (19:10 -0500)] 
Reject oversaturated VKAs in type family equations

5 months agoRemove ExnStr and ThrowsExn business
Sebastian Graf [Fri, 1 Feb 2019 11:46:32 +0000 (06:46 -0500)] 
Remove ExnStr and ThrowsExn business

5 months agoFix #16219: TemplateHaskell causes indefinite package build error
Edward Z. Yang [Fri, 1 Feb 2019 01:00:50 +0000 (20:00 -0500)] 
Fix #16219: TemplateHaskell causes indefinite package build error

It should work to write an indefinite package using TemplateHaskell,
so long as all of the actual TH code lives outside of the package.
However, cleverness we had to build TH code even when building
with -fno-code meant that we attempted to build object code for
modules in an indefinite package, even when the signatures were
not instantiated.  This patch disables said logic in the event
that an indefinite package is being typechecked.

Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Test Plan: validate

Reviewers: simonpj, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, carter

GHC Trac Issues: #16219

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

5 months agoRevert "Performance tests: recover a baseline from ancestor commits and CI results."
Ben Gamari [Fri, 1 Feb 2019 00:47:53 +0000 (19:47 -0500)] 
Revert "Performance tests: recover a baseline from ancestor commits and CI results."

Unfortunately this has broken all future commits due to spurious(?)
performance changes which I have been unable to work around.

This reverts commit cc2261d42f6a954d88e355aaad41f001f65c95da.

5 months agoHadrian: Fix outdated link.
Andrey Mokhov [Sun, 27 Jan 2019 22:42:23 +0000 (22:42 +0000)] 
Hadrian: Fix outdated link.

5 months agoHadrian: Update instructions for building on Windows
Andrey Mokhov [Sun, 27 Jan 2019 22:34:30 +0000 (22:34 +0000)] 
Hadrian: Update instructions for building on Windows

The `hadrian/doc/windows.md` file has falled out of date. In particular
it still points to the old GitHub repository, and uses incorrect path
to GHC. This patch fixes it.

5 months agoUpdate terminfo submodule
Herbert Valerio Riedel [Sun, 27 Jan 2019 21:35:35 +0000 (22:35 +0100)] 
Update terminfo submodule

5 months agoUpdate stm submodule
Herbert Valerio Riedel [Sun, 27 Jan 2019 21:35:35 +0000 (22:35 +0100)] 
Update stm submodule

5 months agoUpdate process submodule
Herbert Valerio Riedel [Sun, 27 Jan 2019 21:35:35 +0000 (22:35 +0100)] 
Update process submodule

5 months agoUpdate parsec submodule
Herbert Valerio Riedel [Sun, 27 Jan 2019 21:35:35 +0000 (22:35 +0100)] 
Update parsec submodule

5 months agoUpdate haskeline submodule
Herbert Valerio Riedel [Sun, 27 Jan 2019 21:35:36 +0000 (22:35 +0100)] 
Update haskeline submodule

5 months agoUpdate deepseq submodule
Herbert Valerio Riedel [Sun, 27 Jan 2019 21:35:36 +0000 (22:35 +0100)] 
Update deepseq submodule

5 months agoUpdate unix submodule
Herbert Valerio Riedel [Sun, 27 Jan 2019 21:35:35 +0000 (22:35 +0100)] 
Update unix submodule

5 months agoUpdate text submodule
Herbert Valerio Riedel [Sun, 27 Jan 2019 21:35:35 +0000 (22:35 +0100)] 
Update text submodule

5 months agoUpdate hsc2hs submodule
Herbert Valerio Riedel [Sun, 27 Jan 2019 14:33:22 +0000 (15:33 +0100)] 
Update hsc2hs submodule

5 months agoPPC NCG: Promote integers to word size in C calls
Peter Trommler [Wed, 23 Jan 2019 22:13:57 +0000 (23:13 +0100)] 
PPC NCG: Promote integers to word size in C calls

Fixes #16222

5 months agoSmall optimizations to BlockLayout.
klebinger.andreas@gmx.at [Thu, 24 Jan 2019 23:08:21 +0000 (00:08 +0100)] 
Small optimizations to BlockLayout.

* Remove `takeL/R 1` occurences by lastOL/headOL.

* Make BlockChain a OrdList newtype by removing the set of blocks.

Initially BlockChain contained both, a set for membership test
and a ordered list of blocks. The set is not used for any
performance sensitive lookups so we get rid of it.

5 months agoReplace BlockSequence with OrdList in BlockLayout.hs
klebinger.andreas@gmx.at [Thu, 24 Jan 2019 22:02:51 +0000 (23:02 +0100)] 
Replace BlockSequence with OrdList in BlockLayout.hs

OrdList does the same thing and more so there is no reason
to have both.

5 months agotestsuite: Add test for #14828
Ben Gamari [Tue, 22 Jan 2019 21:58:04 +0000 (16:58 -0500)] 
testsuite: Add test for #14828

5 months agoIntroduce GhciMonad and generalize types of functions in GHCi.UI
Zejun Wu [Tue, 22 Jan 2019 00:28:01 +0000 (16:28 -0800)] 
Introduce GhciMonad and generalize types of functions in GHCi.UI

Summary:
Introduce `GhciMonad`, which is bascially `GhcMonad` + `HasGhciState`.
Generalize the commands and help functions defined in `GHCi.UI` so they
can be used as both `GHCi a` and `InputT GHCi a`.

The long term plan is to move reusable bits to ghci library and make it
easier to build a customized interactive ui which carries customized state
and provides customized commands.

Most changes are trivial in this diff by relaxing the type constraint or
add/remove lift as necessary. The non-trivial changes are:

* Change `HasGhciState` to `GhciMonad` and expose it.
* Implementation of `reifyGHCi`.

Test Plan:
  ./validate

Reviewers: simonmar, hvr, bgamari

Reviewed By: simonmar

Subscribers: rwbarton, carter

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

5 months agoAdd O2 to hsCompiler on stage0 for most hadrian flavours.
klebinger.andreas@gmx.at [Fri, 25 Jan 2019 00:27:05 +0000 (01:27 +0100)] 
Add O2 to hsCompiler on stage0 for most hadrian flavours.

5 months agoUse O2 on stage1 for faster overall build times with make.
klebinger.andreas@gmx.at [Thu, 24 Jan 2019 19:20:39 +0000 (20:20 +0100)] 
Use O2 on stage1 for faster overall build times with make.

Build times when using the quick flavour:

stage1 opt | time (wall) | time (user)
     -O1   |        13m  |        53m
     -O2   |        13m  |        51m
So even when we compile stage2 with -O0 (quick)
using -O2 on stage1 is already faster.

The difference is even bigger when freezing
stage1 and doing multiple builds or compiling
stage2 with optimizations.

5 months agoAdd -fdefer-diagnostics to defer and group diagnostic messages in make-mode
Zejun Wu [Fri, 28 Dec 2018 08:10:22 +0000 (00:10 -0800)] 
Add -fdefer-diagnostics to defer and group diagnostic messages in make-mode

When loading many modules in parallel there can a lot of warnings and
errors get mixed up with regular output. When the compilation fails,
the relevant error message can be thousands of lines backward and is
hard to find. When the compilation successes, warning message is likely
to be ignored as it is not seen. We can address this by deferring the
warning and error message after the compilation. We also put errors
after warnings so it is more visible.

This idea was originally proposed by Bartosz Nitka in
https://phabricator.haskell.org/D4219.

5 months agohWaitForInput-accurate-stdin test
Ben Gamari [Thu, 31 Jan 2019 04:36:17 +0000 (23:36 -0500)] 
hWaitForInput-accurate-stdin test

5 months agoOptimize pprASCII
Sylvain Henry [Thu, 17 Jan 2019 23:01:45 +0000 (00:01 +0100)] 
Optimize pprASCII

* Use `ByteString.foldr` instead of `(List.foldr . BS.unpack)`
* Avoid calling `chr` and its test that checks for invalid Unicode
codepoints: we stay in the ASCII range so we know we're ok
* Avoid calling `isPrint` (unsafe FFI call): we can check the ASCII
printable range directly
* Use bit operations (`unsafeShiftR`, `.&.`) instead of `div` and `mod`

5 months agoUse ByteString to represent Cmm string literals (#16198)
Sylvain Henry [Thu, 17 Jan 2019 12:34:32 +0000 (13:34 +0100)] 
Use ByteString to represent Cmm string literals (#16198)

Also used ByteString in some other relevant places

5 months agoFix syntax in CODEOWNERS file
Matthew Pickering [Wed, 30 Jan 2019 12:28:08 +0000 (07:28 -0500)] 
Fix syntax in CODEOWNERS file

[skip ci]

5 months agoDon't use X86_64_ELF_NONPIC_HACK for +RTS -xp
Zejun Wu [Sat, 29 Dec 2018 04:48:31 +0000 (20:48 -0800)] 
Don't use X86_64_ELF_NONPIC_HACK for +RTS -xp

Summary:
When `+RTS -xp` is passed, when don't need the X86_64_ELF_NONPIC_HACK,
becasue the relocation offset should only be out of range if

* the object file was not compiled with `-fPIC -fexternal-dynamic-refs`;
* ghc generates non-pic code while it should (e.g. #15723)

In either case, we should print an error message rather that silently
attempt to use a hacky workaround that may not work.

This could have made debugging #15723 and #15729 much easier.

Test Plan:
Run this in a case where ghci used to crash becasue of T15723. Now we
see helpful message like:

```
ghc-iserv-prof: R_X86_64_PC32 relocation out of range:
stmzm2zi4zi4zi1zmJQn4hNPyYjP5m9AcbI88Ve_ControlziConcurrentziSTMziTMVar_readTMVar_C61n_cc
9b95ffac
```

Reviewers: simonmar, bgamari, erikd

Reviewed By: simonmar, bgamari

Subscribers: rwbarton, carter

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

5 months agoAllocate bss section within proper range of other sections
Zejun Wu [Sat, 29 Dec 2018 04:47:33 +0000 (20:47 -0800)] 
Allocate bss section within proper range of other sections

Summary:
This re-applies {D5195} and {D5235}, they were reverted as part of diff
stack to unbreak i386. The proper fix is done in {D5289}.

Allocate bss section within proper range of other sections:

* when `+RTS -xp` is passed, allocate it contiguously as we did for
  jump islands
* when we mmap the code to lower 2Gb, we should allocate bss section
  there too

Test Plan:
1. `./validate`

2.

with

```
DYNAMIC_GHC_PROGRAMS = NO
DYNAMIC_BY_DEFAULT = NO
```

`TEST="T15729" make test` passed in both linux (both i386 and x86_64) and macos.

3.

Also test in a use case where we used to encouter error like:

```
ghc-iserv-prof: R_X86_64_PC32 relocation out of range: (noname) =
b90282ba
```

and now, everything works fine.

Reviewers: simonmar, bgamari, angerman, erikd

Reviewed By: simonmar

Subscribers: rwbarton, carter

GHC Trac Issues: #15729

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

5 months agoAdd a RTS option -xp to load PIC object anywhere in address space
Zejun Wu [Sat, 29 Dec 2018 04:37:13 +0000 (20:37 -0800)] 
Add a RTS option -xp to load PIC object anywhere in address space

Summary:
This re-applies {D5195} with fixes for i386:
* Fix unused label warnings, see {D5230} or {D5273}
* Fix a silly bug introduced by moving `#if`

{P190}

Add a RTS option -xp to load PIC object anywhere in address space. We do
this by relaxing the requirement of <0x80000000 result of
`mmapForLinker` and implying USE_CONTIGUOUS_MMAP.

We also need to change calls to `ocInit` and `ocGetNames` to avoid
dangling pointers when the address of `oc->image` is changed by
`ocAllocateSymbolExtra`.

Test Plan:
See {D5195}, also test under i386:

```
$ uname -a
Linux watashi-arch32 4.18.5-arch1-1.0-ARCH #1 SMP PREEMPT Tue Aug 28
20:45:30 CEST 2018 i686 GNU/Linux
$ cd testsuite/tests/th/ && make test
...
```

will run `./validate` on stacked diff.

Reviewers: simonmar, bgamari, alpmestan, trommler, hvr, erikd

Reviewed By: simonmar

Subscribers: rwbarton, carter

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

5 months agoAPI Annotations: Parens not attached correctly for ClassDecl
Alan Zimmerman [Thu, 24 Jan 2019 08:14:55 +0000 (10:14 +0200)] 
API Annotations: Parens not attached correctly for ClassDecl

The parens around the kinded tyvars should be attached to the class
declaration as a whole, they are attached to the tyvar instead,
outside the span.

An annotation must always be within or after the span it is contained
in.

Closes #16212

5 months agoOnly build vanilla way in devel2 flavour
Matthew Pickering [Fri, 25 Jan 2019 15:48:54 +0000 (15:48 +0000)] 
Only build vanilla way in devel2 flavour

Fixes #16210

5 months agoInclude type info for only some exprs in HIE files
Alec Theriault [Fri, 25 Jan 2019 01:33:52 +0000 (17:33 -0800)] 
Include type info for only some exprs in HIE files

This commit relinquishes some some type information in `.hie` files in
exchange for better performance. See #16233 for more on this.

Using `.hie` files to generate hyperlinked sources is a crucial milestone
towards Hi Haddock (the initiative to move Haddock to work over `.hi`
files and embed docstrings in those). Unfortunately, even after much
optimization on the Haddock side, the `.hie` based solution is still
considerably slower and more memory hungry than the existing implementation
- and the @.hie@ code is to blame.

This changes `.hie` file generation to track type information for only
a limited subset of expressions (specifically, those that might eventually
turn into hyperlinks in the Haddock's hyperlinker backend).

5 months agoUse `NameEnv Id` instead of `Map Name Id`
Alec Theriault [Thu, 24 Jan 2019 21:59:18 +0000 (13:59 -0800)] 
Use `NameEnv Id` instead of `Map Name Id`

This is more consistent with the rest of the GHC codebase.

5 months agomake ghc-pkg shut up
Moritz Angermann [Wed, 23 Jan 2019 02:59:38 +0000 (10:59 +0800)] 
make ghc-pkg shut up

5 months agoAvoid compiling Hadrian dependencies with profiling on Cabal/Linux
Neil Mitchell [Wed, 16 Jan 2019 16:21:00 +0000 (11:21 -0500)] 
Avoid compiling Hadrian dependencies with profiling on Cabal/Linux

5 months agoAvoid compiling Hadrian dependencies with profiling on Cabal/Windows
Neil Mitchell [Wed, 16 Jan 2019 16:20:27 +0000 (11:20 -0500)] 
Avoid compiling Hadrian dependencies with profiling on Cabal/Windows