1. 05 Jan, 2017 4 commits
    • Joachim Breitner's avatar
      Add a CSE pass to Stg (#9291) · 19d5c731
      Joachim Breitner authored
      This CSE pass only targets data constructor applications. This is
      probably the best we can do, as function calls and primitive operations
      might have side-effects.
      
      Introduces the flag -fstg-cse, enabled by default with -O for now. It
      might also be a good candiate for -O2.
      
      Differential Revision: https://phabricator.haskell.org/D2871
      19d5c731
    • Simon Peyton Jones's avatar
      Ensure nested binders have Internal Names · baf9ebe5
      Simon Peyton Jones authored
      This is a long-standing bug.  A nested (non-top-level) binder
      in Core should not have an External Name, like M.x. But
      
      - Lint was not checking this invariant
      
      - The desugarer could generate programs that failed the
        invariant.  An example is in
        tests/deSugar/should_compile/T13043, which had
           let !_ = M.scState in ...
        This desugared to
           let ds = case M.scSate of M.scState { DEFAULT -> () }
           in case ds of () -> ...
      
        We were wrongly re-using that scrutinee as a case binder.
        And Trac #13043 showed that could ultimately lead to two
        top-level bindings with the same closure name.  Alas!
      
      - The desugarer had one other place (in DsUtils.mkCoreAppDs)
        that could generate bogus code
      
      This patch fixes all three bugs, and adds a regression test.
      baf9ebe5
    • Simon Peyton Jones's avatar
      Minor refactoring in CSE · c909e6ec
      Simon Peyton Jones authored
      I noticed that CSE.addBinding was always returning one of its own
      inputs, so I refactored to avoid doing so.
      
      No change in behaviour.
      c909e6ec
    • Simon Peyton Jones's avatar
      Remove a redundant test · 26646418
      Simon Peyton Jones authored
      postInlineUnconditionally was testing for isExportedId, but it was
      /also/ testing for top-level-ness, which is redundant.  This patch
      just removes the redundant test, and documents it.
      26646418
  2. 04 Jan, 2017 1 commit
  3. 03 Jan, 2017 3 commits
  4. 02 Jan, 2017 5 commits
    • Edward Z. Yang's avatar
      Refactor importdecls/topdecls parsing. · 8d63ca98
      Edward Z. Yang authored
      Previously, we had the following parser:
      
          xs : xs ';' x
             | xs ';'
             | x
      
      This is a very clever construction that handles duplicate,
      leading and trailing semicolons well, but it didn't work very
      well with annotations, where we wanted to attach the annotation
      for a semicolon to the *previous* x in the list.  This lead
      to some very disgusting code in the parser.
      
      This commit refactors the parser into this form:
      
          semis1 : semis1 ';'
                 | ';'
          xs_semi : xs x semis1
                  | {- empty -}
          xs : xs_semi x
      
      Now, when we parse one or more semicolons after an x, we can
      attach them immediately, eliminating some very grotty annotations
      swizzling that was previously in the parser.
      
      We now need to write the top-level parser for imports and then
      declarations in a slightly special way now:
      
          top : semis top1
          top1 : importdecls_semi topdecls_semi
               | importdecls_semi topdecls
               | importdecls
      
      This is because the *_semi parsers always require a semicolon,
      but we're allowed to omit that last newline.  So we need
      special cases to handle each of the possible cases where we
      may run out of semicolons. I don't know if there is a better
      way to structure this, but it is not much more complicated
      than what we had before for top (and asymptotically better!)
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      
      Test Plan: validate
      
      Reviewers: simonmar, austin, alanz, bgamari
      
      Reviewed By: alanz, bgamari
      
      Subscribers: thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D2893
      8d63ca98
    • Maciej Bielecki's avatar
      Don't suggest enabling TypeApplications when it's already enabled · b28ca38e
      Maciej Bielecki authored
      Previously when encountering EAsPat in an expression context,
      TypeApplications was suggested even when already enabled. This patch
      replaces the suggestion with more appropriate message.
      
      Test Plan: validate
      
      Reviewers: austin, bgamari, mpickering, goldfire, simonpj
      
      Reviewed By: mpickering, goldfire, simonpj
      
      Subscribers: simonpj, goldfire, mpickering, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2877
      
      GHC Trac Issues: #12879
      b28ca38e
    • Matthew Pickering's avatar
      Update .mailmap · cc0abfa4
      Matthew Pickering authored
      cc0abfa4
    • sean's avatar
      Disallow users to write instances of KnownNat and KnownSym · c5609577
      sean authored
      As noted in #12837, these classes are special and the user should
      not be able to define their own instances.
      
      Test Plan: Validate
      
      Reviewers: adamgundry, goldfire, mpickering, austin, bgamari
      
      Reviewed By: goldfire, mpickering
      
      Subscribers: goldfire, mpickering, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2898
      
      GHC Trac Issues: #12837
      c5609577
    • Edward Z. Yang's avatar
      9ff07382
  5. 01 Jan, 2017 1 commit
  6. 28 Dec, 2016 1 commit
    • Tamar Christina's avatar
      Fix various issues with testsuite code on Windows · a3704409
      Tamar Christina authored
      Summary:
      Previously we would make direct calls to `diff` using `os.system`.
      On Windows `os.system` is implemented using the standard
      idiom `CreateProcess .. WaitForSingleObject ..`.
      
      This again runs afoul with the `_exec` behaviour on Windows. So we ran
      into some trouble where sometimes `diff` would return before it's done.
      
      On tests which run multiple ways, such as `8086` what happens is that
      we think the diff is done and continue. The next way tries to set things
      up again by removing any previous directory. This would then fail with
      and error saying the directory can't be removed. Which is true, because
      the previous diff code/child is still running.
      
      We shouldn't make any external calls to anything using `os.system`.
      Instead just use `runCmd` which uses `timeout`. This also ensures that if
      we hit the cygwin bug where diff or any other utility hangs, we kill it and
      continue and not hang the entire test and leave hanging processes.
      
      Further more we also:
      Ignore error lines from `removeFile` from tools in the testsuite. This is a rather large
      hammer to work around the fact that `hsc2hs` often tries to remove it's own file too early.
      When this is patched the workaround can be removed. See Trac #9775
      
      We mark `prog003` as skip. Since this test randomly fails and passes. For stability it's disabled
      but it is a genuine bug which we should find. It's something with interface files being
      overwritten. See Trac #11317
      
      when `rmtree` hits a readonly file, the `onerror` handler is raised afterwards but not
      during the tree walk. It doesn't allow you to recover and continue as we thought.
      Instead you have to explicitly start again. This is why sometimes even though we
      call `cleanup` before `os.mkdirs`, it would sometimes fail with an error that the
      folder already exists. So we now do a second walk.
      
      A new verbosity level (4) will strip the silent flags from `MAKE` invocations so you can actually
      see what's going on.
      
      Test Plan: ./validate on build bots.
      
      Reviewers: bgamari, austin
      
      Reviewed By: bgamari
      
      Subscribers: mpickering, thomie, #ghc_windows_task_force
      
      Differential Revision: https://phabricator.haskell.org/D2894
      
      GHC Trac Issues: #12661, #11317, #9775
      a3704409
  7. 27 Dec, 2016 4 commits
  8. 26 Dec, 2016 3 commits
    • Joachim Breitner's avatar
      CallArity: Use exprIsCheap to detect thunks · 815099cc
      Joachim Breitner authored
      Originally, everything that is not in WHNF (`exprIsWHNF`) is considered
      a thunk, not eta-expanded, to avoid losing any sharing. This is also how
      the published papers on Call Arity describe it.
      
      In practice, there are thunks that do a just little work, such as
      pattern-matching on a variable, and the benefits of eta-expansion likely
      oughtweigh the cost of doing that repeatedly. Therefore, this
      implementation of Call Arity considers everything that is not cheap
      (`exprIsCheap`) as a thunk.
      
      Nofib reports -2.58% allocations for scs and -40.93% allocation for
      wheel-sieve1; the latter has - 2.92% runtime.
      815099cc
    • Matthew Pickering's avatar
      Remove redudant import from check-ppr · 3c9fbbac
      Matthew Pickering authored
      3c9fbbac
    • Ben Gamari's avatar
      check-ppr: Make --dump the default behavior · 9331e338
      Ben Gamari authored
      9331e338
  9. 23 Dec, 2016 18 commits