[Git][ghc/ghc][wip/pmcheck-eqs] 6 commits: Restore the --coerce option in 'happy' configuration

Sebastian Graf gitlab at gitlab.haskell.org
Tue May 21 09:20:25 UTC 2019



Sebastian Graf pushed to branch wip/pmcheck-eqs at Glasgow Haskell Compiler / GHC


Commits:
684dc290 by Vladislav Zavialov at 2019-05-14T20:41:19Z
Restore the --coerce option in 'happy' configuration

happy-1.19.10 has been released with a fix for --coerce in the presence
of higher rank types. This should result in about 10% performance
improvement in the parser.

- - - - -
a416ae26 by Alp Mestanogullari at 2019-05-14T20:41:20Z
Hadrian: 'need' source files for various docs in Rules.Documentation

Previously, changing one of the .rst files from the user guide would not cause
the user guide to be rebuilt. This patch take a first stab at declaring the
documentation source files that our documentation rules depend on, focusing
on the .rst files only for now.

We eventually might want to rebuild docs when we, say, change the haddock style
file, but this level of tracking isn't really necessary for now.

This fixes #16645.

- - - - -
7105fb66 by Ben Gamari at 2019-05-16T16:47:59Z
rts: Explicit state that CONSTR tag field is zero-based

This was a bit unclear as we use both one-based and zero-based
tags in GHC.

[skip ci]
- - - - -
5bb80cf2 by David Eichmann at 2019-05-20T14:41:55Z
Improve test runner logging when calculating performance metric baseline #16662

We attempt to get 75 commit hashes via `git log`, but this only gave 10
hashes in a CI run (see #16662). Better logging may help solve this
error if it occurs again in the future.

- - - - -
b46efa2b by David Eichmann at 2019-05-20T18:45:56Z
Recalculate Performance Test Baseline T9630 #16680

Metric Decrease:
    T9630

- - - - -
edf6087f by Sebastian Graf at 2019-05-21T09:20:23Z
Make TmOracle reduce nullary constructor equalities

Previously, `simplifyEqExpr` would just give up on constructor
applications when no argument to either constructor was simplified.

That's unfortunate as all arguments might be equal anyway! A special
case of this is nullary constructors. Currently, the TmOracle would fail
to solve a term equality `False ~ (True = True)` because it can't make
any progress on any of `True`s arguments.

Instead we now try to properly simplify the term equality even when no
simplification of constructor arguments was achieved.

- - - - -


9 changed files:

- .gitlab-ci.yml
- aclocal.m4
- compiler/deSugar/TmOracle.hs
- hadrian/hadrian.cabal
- hadrian/src/Rules/Documentation.hs
- hadrian/src/Settings/Builders/Happy.hs
- includes/rts/storage/InfoTables.h
- mk/config.mk.in
- testsuite/driver/perf_notes.py


Changes:

=====================================
.gitlab-ci.yml
=====================================
@@ -2,7 +2,7 @@ variables:
   GIT_SSL_NO_VERIFY: "1"
 
   # Commit of ghc/ci-images repository from which to pull Docker images
-  DOCKER_REV: cefaee3c742af193e0f7783f87edb0d35374515c
+  DOCKER_REV: ac65f31dcffb09cd7ca7aaa70f447fcbb19f427f
 
   # Sequential version number capturing the versions of all tools fetched by
   # .gitlab/win32-init.sh.
@@ -176,7 +176,7 @@ validate-x86_64-linux-deb8-hadrian:
 hadrian-ghc-in-ghci:
   <<: *only-default
   stage: build
-  image: ghcci/x86_64-linux-deb8:0.1
+  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb8:$DOCKER_REV"
   before_script:
     # workaround for docker permissions
     - sudo chown ghc:ghc -R .


=====================================
aclocal.m4
=====================================
@@ -951,8 +951,8 @@ changequote([, ])dnl
 ])
 if test ! -f compiler/parser/Parser.hs || test ! -f compiler/cmm/CmmParse.hs
 then
-    FP_COMPARE_VERSIONS([$fptools_cv_happy_version],[-lt],[1.19.4],
-      [AC_MSG_ERROR([Happy version 1.19.4 or later is required to compile GHC.])])[]
+    FP_COMPARE_VERSIONS([$fptools_cv_happy_version],[-lt],[1.19.10],
+      [AC_MSG_ERROR([Happy version 1.19.10 or later is required to compile GHC.])])[]
 fi
 HappyVersion=$fptools_cv_happy_version;
 AC_SUBST(HappyVersion)


=====================================
compiler/deSugar/TmOracle.hs
=====================================
@@ -208,10 +208,9 @@ simplifyEqExpr e1 e2 = case (e1, e2) of
             (ts2', bs2) = mapAndUnzip simplifyPmExpr ts2
             (tss, _bss) = zipWithAndUnzip simplifyEqExpr ts1' ts2'
             worst_case  = PmExprEq (PmExprCon c1 ts1') (PmExprCon c2 ts2')
-        in  if | not (or bs1 || or bs2) -> (worst_case, False) -- no progress
-               | all isTruePmExpr  tss  -> (truePmExpr, True)
+        in  if | all isTruePmExpr  tss  -> (truePmExpr, True)
                | any isFalsePmExpr tss  -> (falsePmExpr, True)
-               | otherwise              -> (worst_case, False)
+               | otherwise              -> (worst_case, or bs1 || or bs2)
     | otherwise -> (falsePmExpr, True)
 
   -- We cannot do anything about the rest..


=====================================
hadrian/hadrian.cabal
=====================================
@@ -132,7 +132,7 @@ executable hadrian
                        , transformers         >= 0.4     && < 0.6
                        , unordered-containers >= 0.2.1   && < 0.3
     build-tools:         alex  >= 3.1
-                       , happy >= 1.19.4
+                       , happy >= 1.19.10
     ghc-options:       -Wall
                        -Wincomplete-record-updates
                        -Wredundant-constraints


=====================================
hadrian/src/Rules/Documentation.hs
=====================================
@@ -138,6 +138,9 @@ buildSphinxHtml path = do
     root <- buildRootRules
     root -/- htmlRoot -/- path -/- "index.html" %> \file -> do
         let dest = takeDirectory file
+            rstFilesDir = pathPath path
+        rstFiles <- getDirectoryFiles rstFilesDir ["**/*.rst"]
+        need (map (rstFilesDir -/-) rstFiles)
         build $ target docContext (Sphinx Html) [pathPath path] [dest]
 
 ------------------------------------ Haddock -----------------------------------
@@ -242,6 +245,9 @@ buildSphinxPdf path = do
     root <- buildRootRules
     root -/- pdfRoot -/- path <.> "pdf" %> \file -> do
         withTempDir $ \dir -> do
+            let rstFilesDir = pathPath path
+            rstFiles <- getDirectoryFiles rstFilesDir ["**/*.rst"]
+            need (map (rstFilesDir -/-) rstFiles)
             build $ target docContext (Sphinx Latex) [pathPath path] [dir]
             build $ target docContext Xelatex [path <.> "tex"] [dir]
             copyFileUntracked (dir -/- path <.> "pdf") file


=====================================
hadrian/src/Settings/Builders/Happy.hs
=====================================
@@ -3,7 +3,7 @@ module Settings.Builders.Happy (happyBuilderArgs) where
 import Settings.Builders.Common
 
 happyBuilderArgs :: Args
-happyBuilderArgs = builder Happy ? mconcat [ arg "-ag" -- TODO (int-index): restore the -c option when happy/pull/134 is merged.
+happyBuilderArgs = builder Happy ? mconcat [ arg "-agc"
                                            , arg "--strict"
                                            , arg =<< getInput
                                            , arg "-o", arg =<< getOutput ]


=====================================
includes/rts/storage/InfoTables.h
=====================================
@@ -189,7 +189,7 @@ typedef struct StgInfoTable_ {
     StgHalfWord     type;       /* closure type */
     StgSRTField     srt;
        /* In a CONSTR:
-            - the constructor tag
+            - the zero-based constructor tag
           In a FUN/THUNK
             - if USE_INLINE_SRT_FIELD
               - offset to the SRT (or zero if no SRT)


=====================================
mk/config.mk.in
=====================================
@@ -858,8 +858,7 @@ HAPPY_VERSION		= @HappyVersion@
 #
 # Options to pass to Happy when we're going to compile the output with GHC
 #
-# TODO (int-index): restore the -c option when happy/pull/134 is merged.
-SRC_HAPPY_OPTS		= -ag --strict
+SRC_HAPPY_OPTS		= -agc --strict
 
 #
 # Alex


=====================================
testsuite/driver/perf_notes.py
=====================================
@@ -297,10 +297,19 @@ def baseline_commit_log(commit):
     global _baseline_depth_commit_log
     commit = commit_hash(commit)
     if not commit in _baseline_depth_commit_log:
-        _baseline_depth_commit_log[commit] = \
-            subprocess.check_output(['git', 'log', '--format=%H', \
-                             '-n' + str(BaselineSearchDepth)]) \
-                .decode().split('\n')
+        n = BaselineSearchDepth
+        output = subprocess.check_output(['git', 'log', '--format=%H', '-n' + str(n), commit]).decode()
+        hashes = list(filter(is_commit_hash, output.split('\n')))
+
+        # We only got 10 results (expecting 75) in a CI pipeline (issue #16662).
+        # It's unclear from the logs what went wrong. Since no exception was
+        # thrown, we can assume the `git log` call above succeeded. The best we
+        # can do for now is improve logging.
+        actualN = len(hashes)
+        if actualN != n:
+            print("Expected " + str(n) + " hashes, but git gave " + str(actualN) + ":\n" + output)
+        _baseline_depth_commit_log[commit] = hashes
+
     return _baseline_depth_commit_log[commit]
 
 # Cache of baseline values. This is a dict of dicts indexed on:
@@ -397,7 +406,9 @@ def baseline_metric(commit, name, test_env, metric, way):
     # Searches through previous commits trying local then ci for each commit in.
     def search(useCiNamespace, depth):
         # Stop if reached the max search depth.
-        if depth >= BaselineSearchDepth:
+        # We use len(commit_hashes) instead of BaselineSearchDepth incase
+        # baseline_commit_log() returned fewer than BaselineSearchDepth hashes.
+        if depth >= len(commit_hashes):
             return None
 
         # Check for a metric on this commit.



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/compare/b60b1cac6f6503f3f9df6f250c8cf17e904fe1f5...edf6087f6c79c12ba4518231492c7d42fc6cc0f0

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/compare/b60b1cac6f6503f3f9df6f250c8cf17e904fe1f5...edf6087f6c79c12ba4518231492c7d42fc6cc0f0
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20190521/2ceee4b5/attachment-0001.html>


More information about the ghc-commits mailing list