1. 30 Nov, 2016 4 commits
    • Tamar Christina's avatar
      Update Mingw-w64 bindist for Windows · 20c06143
      Tamar Christina authored
      This updates the binary dists for windows to GCC 6.2.0 and
      binutils 2.27.2 which has fixes required for LLVM.
      
      Test Plan: ./validate
      
      Reviewers: simonmar, erikd, austin, bgamari
      
      Reviewed By: simonmar, bgamari
      
      Subscribers: thomie, #ghc_windows_task_force
      
      Differential Revision: https://phabricator.haskell.org/D2749
      
      GHC Trac Issues: #12871, #8974
      20c06143
    • Ben Gamari's avatar
      testsuite: Use python3 by default · 605bb9b4
      Ben Gamari authored
      Summary:
      It turns out that Phyx's fix for #12554 (D2684) still fails with mingw-w64
      python 2.7. However, Python 3 (both msys2 and mingw-w64) work fine. Given that
      supporting Python 2 has already become rather tiresome (as @thomie warned it
      would), let's just move to python3 by default.
      
      Test Plan: Validate
      
      Reviewers: austin, Phyx
      
      Reviewed By: Phyx
      
      Subscribers: Phyx, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2766
      
      GHC Trac Issues: #12554
      605bb9b4
    • Tamar Christina's avatar
      Update test output for Windows · dd9ba503
      Tamar Christina authored
      Following D2684 these two tests need to be updated:
      
       * T7037: timeout.exe now waits until all processes are finished.
                this makes T7037 reliable. So enabled.
      
       * T876: Unknown reason, allocations are much lower than before.
      
      Test Plan: ./validate
      
      Reviewers: austin, simonmar, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie, #ghc_windows_task_force
      
      Differential Revision: https://phabricator.haskell.org/D2759
      
      GHC Trac Issues: #12725, #12004
      dd9ba503
    • Tamar Christina's avatar
      Fix testsuite threading, timeout, encoding and performance issues on Windows · 0ce59be3
      Tamar Christina authored
      In a land far far away, a project called Cygwin was born.
      Cygwin used newlib as it's standard C library implementation.
      
      But Cygwin wanted to emulate POSIX systems as closely as possible.
      So it implemented `execv` using the Windows function `spawnve`.
      
      Specifically
      
      ```
      spawnve (_P_OVERLAY, path, argv, cur_environ ())
      ```
      
      `_P_OVERLAY` is crucial, as it makes the function behave *sort of*
      like execv on linux. the child process replaces the original process.
      
      With one major difference because of the difference in process models
      on Windows: the original process signals the caller that it's done.
      
      this is why the file is still locked. because it's still running,
      control was returned because the parent process was destroyed,
      but the child is still running.
      
      I think it's just pure dumb luck, that the older runtimes are slow
      enough to give the process time to terminate before we tried deleting
      the file.  Which explains why you do have sporadic failures even on
      older runtimes like 2.5.0, of a test or two (like T7307).
      
      So this patch fixes a couple of things. I leverage the existing
      `timeout.exe` to implement a workaround for this issue.
      
      a) The old timeout used to start the process then assign it to the job.
         This is slightly faulty since child processes are only assigned to a
         job is their parent were assigned at the time they started. So this
         was a race condition. I now create the process suspended, assign it
         to the job and then resume it. Which means all child processes are
         not running under the same job.
      
      b) First things, Is to prevent dangling child processes. I mark the job
         with `JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE` so when the last process in
         the job is done, it insures all processes under the job are killed.
      
      c) Secondly, I change the way we wait for results. Instead of waiting
         for the parent process to terminate, I wait for the job itself to
         terminate.
      
         There's a slight subtlety there, we can't wait on the job itself.
         Instead we have to create an I/O Completion port and wait for signals
         on it.  See
         https://blogs.msdn.microsoft.com/oldnewthing/20130405-00/?p=4743
      
      This fixes the issues on all runtimes for me and makes T7307 pass
      consistenly.
      
      The threading was also simplified by hiding all the locking in a single
      semaphore and a completion class. Futhermore some additional error
      reporting was added.
      
      For encoding the testsuite now no longer passes a file handle to the
      subprocess since on windows, sh.exe seems to acquire a lock on the file
      that is not released in a timely fashion.
      
      I suspect this because cygwin seems to emulate console handles by
      creating file handles and using those for std handles. So when we give
      it an existing file handle it just locks the file. I what's happening is
      that it's not releasing the handle until all shared cygwin processes are
      dead. Which explains why it worked in single threaded mode.
      
      So now instead we pass a pipe and do not interpret the resulting data.
      
      Any bytes written to stdin or read out of stdout/stderr are done so in
      binary mode and we do not interpret the data. The reason for this is
      that we have encoding tests in GHC which pass invalid utf-8. If we try
      to handle the data as text then python will throw an exception instead
      of a test comparison failing.
      
      Also I have fixed the ability to override `PYTHON` when calling `make
      tests`. This now works the same as with `.\validate`.
      
      Finally, after cleaning up the locks I was able to make the abort
      behavior work correctly as I believe it was intended: when you press
      Ctrl+C and send an interrupt signal, the testsuite finishes the active
      tests and then gracefully exits showing you a report of the progress it
      did make. So using Ctrl+C will not just *die* as it did before.
      
      These changes lift the restriction on which python version you use
      (msys/mingw) or which runtime or python 3 or python 2.  All combinations
      should now be supported.
      
      Test Plan:
      PATH=/usr/local/bin:/mingw64/bin:$APPDATA/cabal/bin:$PATH &&
      PYTHON=/usr/bin/python THREADS=9 make test
      THREADS=9 make test
      PATH=/usr/local/bin:/mingw64/bin:$APPDATA/cabal/bin:$PATH &&
      PYTHON=/usr/bin/python ./validate --quiet --testsuite-only
      
      Reviewers: erikd, RyanGlScott, bgamari, austin
      
      Subscribers: jrtc27, mpickering, thomie, #ghc_windows_task_force
      
      Differential Revision: https://phabricator.haskell.org/D2684
      
      GHC Trac Issues: #12725, #12554, #12661, #12004
      0ce59be3
  2. 29 Nov, 2016 26 commits
  3. 28 Nov, 2016 5 commits
    • Simon Peyton Jones's avatar
      Comments only (related to #12789) · 3aa93689
      Simon Peyton Jones authored
      It took me some time to find the right Note for the
      fix to #12789.  This comment patch tries to add pointers
      from relevant places.
      3aa93689
    • Simon Peyton Jones's avatar
      Test Trac #12885 · 27a6bdf0
      Simon Peyton Jones authored
      ...which is fixed by
      
        commit 0476a64e
        Author: Simon Peyton Jones <simonpj@microsoft.com>
        Date:   Tue Oct 25 15:22:17 2016 +0100
      
          Fix a bug in mk_superclasses_of
      27a6bdf0
    • Simon Peyton Jones's avatar
      Test Trac #12776 · 605af54a
      Simon Peyton Jones authored
      605af54a
    • Gabor Greif's avatar
      Typos in comments only [ci skip] · 52388421
      Gabor Greif authored
      52388421
    • Simon Peyton Jones's avatar
      Fix an long-standing bug in OccurAnal · 6ec2304f
      Simon Peyton Jones authored
      This bug was beautifully characterised in Trac #12776,
      which showed a small program for which the inliner went
      into an infinite loop.  Eeek.
      
      It turned out to be a genuine and long-standing bug in
      the occurrence analyer, specifically in the bit that
      identifies loop breakers.  In this line
      
        pairs | isEmptyVarSet weak_fvs
              = reOrderNodes   0 bndr_set weak_fvs tagged_nodes []
              | otherwise
              = loopBreakNodes 0 bndr_set weak_fvs loop_breaker_edges []
      
      the 'tagged_nodes' should be 'loop_breaker_edges'.
      That's it!
      
      The diff looks a lot bigger because I did some work on
      comments and variable naming, but that's all it is.  We
      were using the wrong set of dependencies!
      
      I'm astonished that this bug has not caused more trouble.
      It dates back to at least 2011 and maybe further.
      6ec2304f
  4. 25 Nov, 2016 5 commits
    • Simon Peyton Jones's avatar
      Be a bit more selective about improvement · f8c966c7
      Simon Peyton Jones authored
      This patch makes [W] constraints not participate in
      improvement.   See Note [Do not do improvement for WOnly]
      in TcSMonad.
      
      Removes some senseless work duplication in some cases (notably
      Trac #12860); should not change behaviour.
      f8c966c7
    • Simon Peyton Jones's avatar
      A tiny bit more tc tracing · 086b4836
      Simon Peyton Jones authored
      086b4836
    • Simon Peyton Jones's avatar
      Fix inference of partial signatures · 1bfff60f
      Simon Peyton Jones authored
      When we had
        f :: ( _ ) => blah
      we were failing to call growThetaTyVars, as we do in the
      no-type-signature case, and that meant that we weren't generalising
      over the right type variables.  I'm quite surprised this didn't cause
      problems earlier.
      
      Anyway Trac #12844 showed it up and this patch fixes it
      1bfff60f
    • Simon Peyton Jones's avatar
      Refactor functional dependencies a bit · eb55ec29
      Simon Peyton Jones authored
      * Rename CoAxiom.Eqn = Pair Type to TypeEqn,
        and use it for fundeps
      
      * Use the FunDepEqn for injectivity, which lets us share a bit
        more code, and (more important) brain cells
      
      * When generating fundeps, take the max depth of the two
        constraints.  This aimed at tackling the strange loop in
        Trac #12860, but there is more to come for that.
      
      * Improve pretty-printing with -ddump-tc-trace
      eb55ec29
    • Simon Peyton Jones's avatar
      Improve pretty-printing of types · 5f349fe2
      Simon Peyton Jones authored
      In this commit
         commit 6c0f10fa
         Author: Ben Gamari <bgamari.foss@gmail.com>
         Date:   Sun Nov 13 16:17:37 2016 -0500
      
          Kill Type pretty-printer
      
      we switched to pretty-printing a type by converting it to an
      IfaceType and pretty printing that.  Very good.
      
      This patch fixes two things
      
      * The new story is terrible for debug-printing with -ddump-tc-trace,
        because all the extra info in an open type was discarded ty the
        conversion to IfaceType.
      
        This patch adds IfaceTcTyVar to IfaceType, to carry a TcTyVar in
        debug situations.  Quite an easy change, happily.  These things
        never show up in interface files.
      
      * Now that we are going via IfaceType, it's essential to tidy before
        converting; otherwise
           forall k_23 k_34. blah
        is printed as
           forall k k. blah
        which is very unhelpful.  Again this only shows up in debug
        printing.
      5f349fe2