1. 20 Jan, 2017 3 commits
    • Simon Peyton Jones's avatar
      Test Trac #11444 · b8f1b018
      Simon Peyton Jones authored
      b8f1b018
    • Simon Peyton Jones's avatar
      Simplify and improve CSE · b78fa759
      Simon Peyton Jones authored
      Trac #13156 showed a lost opportunity for CSE. I found that it was
      easy to fix, and it had the nice side effect of rendering a previous
      nasty case, described in Note [Corner case for case expressions],
      unnecessary.
      
      Simpler code, does more.  Great.
      b78fa759
    • Simon Peyton Jones's avatar
      Fix a nasty bug in exprIsExpandable · 9be18ea4
      Simon Peyton Jones authored
      This bug has been lurking for ages: Trac #13155
      
      The important semantic change is to ensure that exprIsExpandable
      returns False for primop calls.  Previously exprIsExpandable used
      exprIsCheap' which always used primOpIsCheap.
      
      I took the opportunity to combine the code for exprIsCheap' (two
      variants: exprIsCheap and exprIsExpandable) with that for
      exprIsWorkFree.  Result is simpler, tighter, easier to understand.
      And correct (at least wrt this bug)!
      9be18ea4
  2. 19 Jan, 2017 4 commits
    • David Feuer's avatar
      Add explicit foldMap implementation for Maybe · bf1e1f32
      David Feuer authored
      Eric Mertens pointed out that using the default `foldMap`
      implementation for `Maybe` led to an efficiency problem by
      implementing `foldMap f (Just x)` as `f x <> mempty` rather than
      as `f x`. This should solve the problem.
      
      Reviewers: hvr, austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: glguy, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2988
      bf1e1f32
    • dobenour's avatar
      Don't error on missing Perl, just warn and disable object splitting. · f07a6c17
      dobenour authored
      Summary:
      If Perl isn't needed, we don't need to error out.  Since all Perl is
      used for is the splitter, we can just warn.
      
      Test Plan: GHC CI
      
      Reviewers: bgamari, hvr, austin
      
      Reviewed By: bgamari
      
      Subscribers: thomie, erikd
      
      Differential Revision: https://phabricator.haskell.org/D2986
      
      GHC Trac Issues: #13141
      f07a6c17
    • Ryan Scott's avatar
      Fix the GHC 7.10 build · f5bea982
      Ryan Scott authored
      Following e7985ed2. HasDebugCallStack now
      appears in IdInfo, which requires `FlexibleContexts` to be enabled when built
      with GHC 7.10.
      f5bea982
    • Richard Eisenberg's avatar
      Update levity polymorphism · e7985ed2
      Richard Eisenberg authored
      This commit implements the proposal in
      https://github.com/ghc-proposals/ghc-proposals/pull/29 and
      https://github.com/ghc-proposals/ghc-proposals/pull/35.
      
      Here are some of the pieces of that proposal:
      
      * Some of RuntimeRep's constructors have been shortened.
      
      * TupleRep and SumRep are now parameterized over a list of RuntimeReps.
      * This
      means that two types with the same kind surely have the same
      representation.
      Previously, all unboxed tuples had the same kind, and thus the fact
      above was
      false.
      
      * RepType.typePrimRep and friends now return a *list* of PrimReps. These
      functions can now work successfully on unboxed tuples. This change is
      necessary because we allow abstraction over unboxed tuple types and so
      cannot
      always handle unboxed tuples specially as we did before.
      
      * We sometimes have to create an Id from a PrimRep. I thus split PtrRep
      * into
      LiftedRep and UnliftedRep, so that the created Ids have the right
      strictness.
      
      * The RepType.RepType type was removed, as it didn't seem to help with
      * much.
      
      * The RepType.repType function is also removed, in favor of typePrimRep.
      
      * I have waffled a good deal on whether or not to keep VoidRep in
      TyCon.PrimRep. In the end, I decided to keep it there. PrimRep is *not*
      represented in RuntimeRep, and typePrimRep will never return a list
      including
      VoidRep. But it's handy to have in, e.g., ByteCodeGen and friends. I can
      imagine another design choice where we have a PrimRepV type that is
      PrimRep
      with an extra constructor. That seemed to be a heavier design, though,
      and I'm
      not sure what the benefit would be.
      
      * The last, unused vestiges of # (unliftedTypeKind) have been removed.
      
      * There were several pretty-printing bugs that this change exposed;
      * these are fixed.
      
      * We previously checked for levity polymorphism in the types of binders.
      * But we
      also must exclude levity polymorphism in function arguments. This is
      hard to check
      for, requiring a good deal of care in the desugarer. See Note [Levity
      polymorphism
      checking] in DsMonad.
      
      * In order to efficiently check for levity polymorphism in functions, it
      * was necessary
      to add a new bit of IdInfo. See Note [Levity info] in IdInfo.
      
      * It is now safe for unlifted types to be unsaturated in Core. Core Lint
      * is updated
      accordingly.
      
      * We can only know strictness after zonking, so several checks around
      * strictness
      in the type-checker (checkStrictBinds, the check for unlifted variables
      under a ~
      pattern) have been moved to the desugarer.
      
      * Along the way, I improved the treatment of unlifted vs. banged
      * bindings. See
      Note [Strict binds checks] in DsBinds and #13075.
      
      * Now that we print type-checked source, we must be careful to print
      * ConLikes correctly.
      This is facilitated by a new HsConLikeOut constructor to HsExpr.
      Particularly troublesome
      are unlifted pattern synonyms that get an extra void# argument.
      
      * Includes a submodule update for haddock, getting rid of #.
      
      * New testcases:
        typecheck/should_fail/StrictBinds
        typecheck/should_fail/T12973
        typecheck/should_run/StrictPats
        typecheck/should_run/T12809
        typecheck/should_fail/T13105
        patsyn/should_fail/UnliftedPSBind
        typecheck/should_fail/LevPolyBounded
        typecheck/should_compile/T12987
        typecheck/should_compile/T11736
      
      * Fixed tickets:
        #12809
        #12973
        #11736
        #13075
        #12987
      
      * This also adds a test case for #13105. This test case is
      * "compile_fail" and
      succeeds, because I want the testsuite to monitor the error message.
      When #13105 is fixed, the test case will compile cleanly.
      e7985ed2
  3. 18 Jan, 2017 8 commits
  4. 17 Jan, 2017 10 commits
    • Yuras's avatar
      Unbreak build with ghc-7.10.1 · 2b61f52a
      Yuras authored
      Test Plan: build with ghc-7.10.1
      
      Reviewers: austin, bgamari, dfeuer
      
      Reviewed By: dfeuer
      
      Subscribers: dfeuer, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2976
      
      GHC Trac Issues: #13120
      2b61f52a
    • David Feuer's avatar
      Split mkInlineUnfolding into two functions · d360ec39
      David Feuer authored
      Previously, `mkInlineUnfolding` took a `Maybe` argument indicating
      whether the caller requested a specific arity.  This was not
      self-documenting at call sites. Now we distinguish between
      `mkInlineUnfolding` and `mkInlineUnfoldingWithArity`.
      
      Reviewers: simonpj, austin, bgamari
      
      Reviewed By: simonpj, bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2933
      d360ec39
    • Rufflewind's avatar
      Unquote ‘import’ in bad import error message · e195add1
      Rufflewind authored
          In module ‘Prelude’:
            ‘True’ is a data constructor of ‘Bool’
          To import it use
            ‘import’ Prelude( Bool( True ) )
      
      The quotes around `import` don't make any sense.
      
      Test Plan: manual
      
      Reviewers: austin, mpickering, bgamari
      
      Reviewed By: mpickering, bgamari
      
      Subscribers: dfeuer, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2935
      e195add1
    • Ben Gamari's avatar
      event manager: Don't worry if attempt to wake dead manager fails · d5cd505b
      Ben Gamari authored
      This fixes #12038, where the TimerManager would attempt to wake up a
      manager that was already dead, resulting in setnumcapabilities001
      occassionally failing during shutdown with unexpected output on stderr.
      
      I'm frankly still not entirely confident in this solution but perhaps it
      will help to get a few more eyes on this.
      
      My hypothesis is that the TimerManager is racing:
      
        thread                   TimerManager worker
        -------                  --------------------
        requests that thread
        manager shuts down
      
                                 begins to clean up,
                                 closing eventfd
      
        calls wakeManager,
        which tries to write
        to closed eventfd
      
      To prevent this `wakeManager` will need to synchronize with the
      TimerManger worker to ensure that the worker doesn't clean up the
      `Control` while another thread is trying to send a wakeup. However, this
      would add a bit of overhead on every timer interaction, which feels
      rather costly for what is really a problem only at shutdown.  Moreover,
      it seems that the event manager (e.g.  `GHC.Event.Manager`) is also
      afflicted by a similar race.
      
      This patch instead simply tries to catch the write failure after it has
      happened and silence it in the case that the fd has vanished. It feels
      rather hacky but it seems to work.
      
      Test Plan: Run `setnumcapabilities001` repeatedly
      
      Reviewers: hvr, austin, simonmar
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2957
      
      GHC Trac Issues: #12038
      d5cd505b
    • Simon Marlow's avatar
      Some 8.2.1 release notes for my stuff · e7e5f7ac
      Simon Marlow authored
      Test Plan: Built it and looked at it
      
      Reviewers: niteria, erikd, dfeuer, austin, hvr, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: dfeuer, thomie, erikd
      
      Differential Revision: https://phabricator.haskell.org/D2959
      e7e5f7ac
    • Ben Gamari's avatar
      testsuite: Bump allocations for T12234 · 19cc0071
      Ben Gamari authored
      Unfortunately it's not clear why but this has been failing on Harbormaster.
      19cc0071
    • Ben Gamari's avatar
      Bitmap: Use foldl' instead of foldr · b1726c11
      Ben Gamari authored
      These are producing StgWords so foldl' is the natural choice. I'm not
      sure how I didn't notice this when I wrote D1041.
      
      Test Plan: Validate
      
      Reviewers: austin, simonmar
      
      Reviewed By: simonmar
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2955
      
      GHC Trac Issues: #7450
      b1726c11
    • Ben Gamari's avatar
      testsuite/recomp001: Sleep to ensure that GHC notices file change · 769e3ee7
      Ben Gamari authored
      Some operating systems (e.g. Darwin) have very poor file timestamp
      resolution.  On these systems GHC often fails to notice that B.hs
      changes in this testsuite, leading to sporatic test failures. Add a
      sleep to ensure the change is noticed.
      
      Test Plan: Validate
      
      Reviewers: ezyang, austin
      
      Subscribers: mpickering, gracjan, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2964
      769e3ee7
    • Alan Zimmerman's avatar
      Fix API Annotations for unboxed sums · 38f289fa
      Alan Zimmerman authored
      An unboxed tuple such as
      
          (# | b | | | | | #)
      
      Ends up in the parser via `tup_exprs` as
      
          Sum 2 7 lexp
      
      where `lexp` is a `LHsExpr`
      
      From an API annotation perspective, the 5 `AnnVbar`s after the `b` were attached
      to `lexp`, but the leading `AnnVbar`s did not have a home.
      
      This patch attaches them all to the the parent tuple expression. The first (alt
      - 1) of them come before `lexp`, and the remaining (arity - alt) come after.
      
      Test Plan: ./validate
      
      Reviewers: osa1, austin, bgamari
      
      Subscribers: thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D2968
      
      GHC Trac Issues: #12417
      38f289fa
    • Gabor Greif's avatar
      Typos in manual and comments [ci skip] · 715be013
      Gabor Greif authored
      715be013
  5. 16 Jan, 2017 4 commits
    • Simon Peyton Jones's avatar
      Comments about TyBinders (only) · 563d64fd
      Simon Peyton Jones authored
      563d64fd
    • Simon Peyton Jones's avatar
      Refine exprOkForSpeculation · 5a9a1738
      Simon Peyton Jones authored
      This patch implements two related changes, both inspired by
      the discussion on Trac #13027, comment:23:
      
      * exprOkForSpeculation (op# a1 .. an), where op# is a primop,
        now skips over arguments ai of lifted type.  See the comments
        at Note [Primops with lifted arguments] in CoreUtils.
      
        There is no need to treat dataToTag# specially any more.
      
      * dataToTag# is now treated as a can-fail primop.  See
        Note [dataToTag#] in primops.txt.pp
      
      I don't expect this to have a visible effect on anything, but
      it's much more solid than before.
      5a9a1738
    • Tamar Christina's avatar
      Unbreak libGHCi by adding missing symbol. · be792890
      Tamar Christina authored
      Summary:
      Someone committed a new public symbol `purgeObj` again
      without adding it to the symbols table.
      
      Test Plan: ./validate
      
      Reviewers: austin, bgamari, simonmar, erikd
      
      Reviewed By: erikd
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2980
      be792890
    • Tamar Christina's avatar
      Add missing test files for T13082. · 4bfe3d4d
      Tamar Christina authored
      Summary:
      Add two missing test files for T13082.
      The reason they were missing is because the .gitignore
      contains a very harmful and broad wildcard `foo*`. Why?
      
      Test Plan: make test TEST="T13082_good T13082_fail"
      
      Reviewers: austin, bgamari, simonmar, erikd
      
      Reviewed By: erikd
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2981
      
      GHC Trac Issues: #13082
      4bfe3d4d
  6. 15 Jan, 2017 7 commits
    • Alan Zimmerman's avatar
      Add dump-parsed-ast flag and functionality · 1ff3c588
      Alan Zimmerman authored
      Summary:
      This flag causes a dump of the ParsedSource as an AST in textual form, similar
      to the ghc-dump-tree on hackage.
      
      Test Plan: ./validate
      
      Reviewers: mpickering, bgamari, austin
      
      Reviewed By: mpickering
      
      Subscribers: nominolo, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2958
      
      GHC Trac Issues: #11140
      1ff3c588
    • Erik de Castro Lopo's avatar
      LLVM: Tweak TBAA metadata codegen · 9d67f04d
      Erik de Castro Lopo authored
      This change is requred for llvm 4.0. GHC doesn't use that version yet,
      but this change is just as valid for versions eariler than 4.0.
      
      Two changes needed:
      
      * Previously, GHC defined a `topN` node in the TBAA heiarchy and some IR
        instructions referenced that node. With LLVM 4.0 the root node can no
        longer be referenced by IR instructions, so we introduce a new element
        `rootN` and make `topN` a child of that.
      
      * Previously the root TBAA node was rendered as "!0 = !{!"root", null}".
        With LLVM 4.0 that needs to be "!0 = !{!"root"}" which is also
        accepted by earlier versions.
      
      Test Plan: Build with quick-llvm BuildFlavor and run tests
      
      Reviewers: bgamari, drbo, austin, angerman, michalt, DemiMarie
      
      Reviewed By: DemiMarie
      
      Subscribers: mpickering, DemiMarie, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2975
      9d67f04d
    • Matthew Pickering's avatar
      Revert "Record evaluated-ness on workers and wrappers" · 1f48fbc9
      Matthew Pickering authored
      This reverts commit 6b976eb8.
      
      Ben, Ryan and I decided to revert this for now due to T12234 failing
      and causing all harbormaster builds to fail.
      1f48fbc9
    • Ryan Scott's avatar
      Improve access violation reporting on Windows · c13151e5
      Ryan Scott authored
      Summary:
      This patch is courtesy of @awson.
      
      Currently, whenever GHC catches a segfault on Windows, it simply reports the
      somewhat uninformative message
      `Segmentation fault/access violation in generated code`. This patch adds to
      the message the type of violation (read/write/dep) and location information,
      which should help debugging segfaults in the future.
      
      Fixes #13108.
      
      Test Plan: Build on Windows
      
      Reviewers: austin, erikd, bgamari, simonmar, Phyx
      
      Reviewed By: bgamari, Phyx
      
      Subscribers: awson, thomie, #ghc_windows_task_force
      
      Differential Revision: https://phabricator.haskell.org/D2969
      
      GHC Trac Issues: #13108
      c13151e5
    • Ryan Scott's avatar
      Properly introduce CTimer to System.Posix.Types · db91d17e
      Ryan Scott authored
      Summary:
      In ffc23270, an attempt was made at
      adding a Haskell wrapper around the C `timer_t` type. Unfortunately, GHC's
      autoconf macros weren't sophisticated enough at the time to properly detect
      that `timer_t` is represented by a `void *` (i.e., a pointer) on most OSes.
      
      This is a second attempt at `CTimer`, this time using `AC_COMPILE_IFELSE` to
      detect if a type is a pointer type by compiling the following program:
      
      ```
      type val;
      *val;
      ```
      
      This also only derives a small subset of class instances for `CTimer` that are
      known to be compatible with `Ptr` using a new `OPAQUE_TYPE_WITH_CTYPE` macro.
      
      Test Plan: ./validate
      
      Reviewers: erikd, hvr, austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2952
      
      GHC Trac Issues: #12795, #12998
      db91d17e
    • Tamar Christina's avatar
      Fix abort and import lib search on Windows · 331f88d0
      Tamar Christina authored
      Summary:
      Apparently `sysErrorBelch` doesn't terminate the program anymore making
      previously unreachable code now execute. If a dll is not found the error
      message we return needs to be a heap value.
      
      Secondly also allow the pattern `lib<name>` to be allowed for finding an
      import library with the name `lib<name>.dll.a`.
      
      Test Plan: ./validate, new tests T13082_good and T13082_fail
      
      Reviewers: austin, RyanGlScott, hvr, erikd, simonmar, bgamari
      
      Reviewed By: RyanGlScott, bgamari
      
      Subscribers: thomie, #ghc_windows_task_force
      
      Differential Revision: https://phabricator.haskell.org/D2941
      
      GHC Trac Issues: #13082
      331f88d0
    • Tamar Christina's avatar
      Use latin1 code page on Windows for response files. · f63c8ef3
      Tamar Christina authored
      Summary:
      D2917 added a change that will make paths on Windows response files
      use DOS 8.3 shortnames to get around the fact that `libiberty` assumes
      a one byte per character encoding.
      
      This is actually not the problem, the actual problem is that GCC on
      Windows doesn't seem to support Unicode at all.
      
      This comes down to how unicode characters are handled between POSIX and
      Windows. On Windows, Unicode is only supported using a multibyte character
      encoding such as `wchar_t` with calls to the appropriate wide version of
      APIs (name post-fixed with the `W` character). On Posix I believe the standard
      `char` is used and based on the value it is decoded to the correct string.
      
      GCC doesn't seem to make calls to the Wide version of the Windows APIs,
      and even if it did, it's character representation would be wrong. So I
      believe GCC just does not support utf-8 paths on Windows.
      
      So the hack in D2917 is the only way to get Unicode support. The problem is
      however that `GCC` is not the only tool with this issue and we don't use response
      files for every invocation of the tools. Most of the tools probably don't support it.
      
      Furthermore, DOS 8.1 shortnames only exist when the path or file physically exists on
      disk. We pass lots of paths to GCC that don't exist yet, like the output file.
      D2917 works around this by splitting the path from the file and try shortening that.
      
      But this may not always work.
      
      In short, even if we do Unicode correctly (which we don't atm, the GCC driver we build
      uses `char` instead of `wchar_t`) we won't be able to compile using unicode paths that
      need to be passed to `GCC`. So not sure about the point of D2917.
      
      What we can do is support the most common non-ascii characters by writing the response
      files out using the `latin1` code page.
      
      Test Plan: compile + make test TEST=T12971
      
      Reviewers: austin, bgamari, erikd
      
      Reviewed By: bgamari
      
      Subscribers: thomie, #ghc_windows_task_force
      
      Differential Revision: https://phabricator.haskell.org/D2942
      
      GHC Trac Issues: #12971
      f63c8ef3
  7. 13 Jan, 2017 4 commits