[commit: ghc] wip/gadtpm: Several important performance/memory fixes (771ed2c)

git at git.haskell.org git at git.haskell.org
Fri Aug 14 09:25:37 UTC 2015


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

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

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

commit 771ed2cffb96d6f0fa92d42f65fdb7e3ab1e684b
Author: George Karachalias <george.karachalias at gmail.com>
Date:   Fri Aug 14 11:26:01 2015 +0200

    Several important performance/memory fixes
    
      * Added literals in the pattern language. We generate far less constraints
        this way, since literal pattern matching is handled immediately instead
        of generating semantically empty value set abstractions.
        (Treated similarly to data constructors).
    
      * Changed translation of as-patterns: Instead of generating [x, p <- x] for
        an as-pattern x at p, we instead generate [p, x <- p]. Hence, we record the
        equality of `x' and `p' but the main pattern to be checked is `p' and not
        the variable `x' and less non-satisfiable cases are generated (For this
        change to work, a pattern vector has to be cast into an expression, hence
        function `coercePmPat').
    
      * Replace guards we cannot reason about with a single such guard. In
        `translateGuards' we replace all guards of the form (p <- e) where
          * p can fail (not a variable)
          * e is really arbitrary (the solver will ignore)
        with a single guard (True <- x). Instead of branching for every guard and
        feeding the solver with cases it cannot reason about, we denote the
        possibility of failure of such cases with a single guard we cannot reason
        about.
    
      * Short circuit guard handling if there is an `otherwise'. In `process_guards'
        we do not call `patVectProc' on the guards if we know that it's impossible
        to fail (still needs to be improved)
    
      * Stopped pruning the uncovered set on every step. Since Delta is always
        extended (we never remove constraints from it), it is semantically
        equivalent to prune it once at the end.
    
      * Do not run the algorithm on generated code (deriving etc). `handleWarnings'
        used to ignore the results of the check but call it nonetheless. Insted, if
        the results are going to be ignored, do not run it at all.


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

771ed2cffb96d6f0fa92d42f65fdb7e3ab1e684b
 compiler/deSugar/Check.hs    | 226 +++++++++++++++++++++++++++++++++++++------
 compiler/deSugar/Match.hs    |   6 +-
 compiler/deSugar/TmOracle.hs |  85 +++++++++-------
 3 files changed, 250 insertions(+), 67 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 771ed2cffb96d6f0fa92d42f65fdb7e3ab1e684b


More information about the ghc-commits mailing list