[commit: ghc] wip/gadtpm: Overhaul the Overhauled Pattern Match Checker (b5df2cc)

git at git.haskell.org git at git.haskell.org
Mon Feb 1 12:27:20 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/gadtpm
Link       : http://ghc.haskell.org/trac/ghc/changeset/b5df2cc6cf2af4508a4f34a718320a6d79f9adca/ghc

>---------------------------------------------------------------

commit b5df2cc6cf2af4508a4f34a718320a6d79f9adca
Author: George Karachalias <george.karachalias at gmail.com>
Date:   Mon Feb 1 11:43:12 2016 +0100

    Overhaul the Overhauled Pattern Match Checker
    
    * Changed the representation of Value Set Abstractions. Instead
      of using a prefix tree, we now use a list of Value Vector
      Abstractions. The set of constraints Delta for every Value
      Vector Abstraction is the oracle state so that we solve
      everything only once.
    
    * Instead of doing everything lazily, we prune at once (and in
      general everything is much stricter). A case writtern with
      pattern guards is not checked in almost the same time as the
      equivalent with pattern matching.
    
    * Do not store the covered and the divergent sets at all. Since
      what we only need is a yes/no (does this clause cover anything?
      Does it force any thunk?) We just keep a boolean for each.
    
    * Removed flags `-Wtoo-many-guards` and `-ffull-guard-reasoning`.
      Replaced with `fmax-pmcheck-iterations=n`. Still debatable what
      should the default `n` be.
    
    * When a guard is for sure not going to contribute anything, we
      treat it as such: The oracle is not called and cases `CGuard`,
      `UGuard` and `DGuard` from the paper are not happening at all
      (the generation of a fresh variable, the unfolding of the
      pattern list etc.). his combined with the above seems to be
      enough to drop the memory increase for test T783 down to 18.7%.
    
    * Do not export function `dsPmWarn` (it is now called directly
      from within `checkSingle` and `checkMatches`).
    
    * Make `PmExprVar` hold a `Name` instead of an `Id`. The term
      oracle does not handle type information so using `Id` was a
      waste of time/space.
    
    * Added testcases T11195, T11303b (data families) and T11374
    
    The patch addresses at least the following:
        #11195, #11276, #11303, #11374, #11162


>---------------------------------------------------------------

b5df2cc6cf2af4508a4f34a718320a6d79f9adca
 compiler/deSugar/Check.hs                          | 1236 +++++++++-----------
 compiler/deSugar/DsMonad.hs                        |   39 +-
 compiler/deSugar/Match.hs                          |   16 +-
 compiler/deSugar/PmExpr.hs                         |   31 +-
 compiler/deSugar/TmOracle.hs                       |   34 +-
 compiler/ghci/RtClosureInspect.hs                  |    3 -
 compiler/main/DynFlags.hs                          |   12 +-
 compiler/nativeGen/Dwarf/Constants.hs              |    4 -
 compiler/typecheck/TcRnTypes.hs                    |    3 +-
 compiler/types/OptCoercion.hs                      |    4 +-
 docs/users_guide/8.0.1-notes.rst                   |    9 -
 docs/users_guide/bugs.rst                          |   10 -
 docs/users_guide/using-warnings.rst                |   34 -
 libraries/base/Foreign/C/Error.hs                  |    1 -
 testsuite/tests/pmcheck/should_compile/T11195.hs   |  189 +++
 testsuite/tests/pmcheck/should_compile/T11303b.hs  |   25 +
 testsuite/tests/pmcheck/should_compile/T11374.hs   |   59 +
 .../tests/pmcheck/should_compile/T2204.stderr      |    6 +-
 .../tests/pmcheck/should_compile/T9951b.stderr     |    6 +-
 testsuite/tests/pmcheck/should_compile/all.T       |    3 +
 .../tests/pmcheck/should_compile/pmc001.stderr     |   12 +-
 .../tests/pmcheck/should_compile/pmc007.stderr     |   12 +-
 utils/mkUserGuidePart/Options/Warnings.hs          |   13 -
 23 files changed, 911 insertions(+), 850 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc b5df2cc6cf2af4508a4f34a718320a6d79f9adca


More information about the ghc-commits mailing list