[Git][ghc/ghc][wip/backports] 7 commits: gitlab-ci: Bump Docker images

Ben Gamari gitlab at gitlab.haskell.org
Wed Jul 15 15:28:00 UTC 2020



Ben Gamari pushed to branch wip/backports at Glasgow Haskell Compiler / GHC


Commits:
408b6714 by Ben Gamari at 2020-07-15T11:26:48-04:00
gitlab-ci: Bump Docker images

- - - - -
410f53a9 by Ben Gamari at 2020-07-15T11:26:48-04:00
hadrian: Eliminate some redundant imports

- - - - -
e2bed3ee by GHC GitLab CI at 2020-07-15T11:26:48-04:00
Accept testsuite changes

- - - - -
5018cad4 by Kevin Buhr at 2020-07-15T11:26:48-04:00
Add "-Iw" RTS flag for minimum wait between idle GCs (#11134)

This wasn't originally slated for 8.10 but the documentation part of
this patch snuck into the ghc-8.10 branch via a backport. Instead of
backing out the documentation and causing further user confusion I've
opted just to backport this functional change as well.

(cherry picked from commit 859ebdd446eda446d38708a587503c255b58c4c6)

- - - - -
edc36a91 by Ben Gamari at 2020-07-15T11:26:48-04:00
user-guide: Add release notes for 8.10.2

- - - - -
46e3ceca by Ben Gamari at 2020-07-15T11:27:30-04:00
rts/ProfHeap: Only allocate the Censuses that we need

When not LDV profiling there is no reason to allocate 32 Censuses; one
will do. This is a very small memory footprint optimisation, but it
comes for free.

(cherry picked from commit 8cc7274b8de254c7266b61fadbc6795dc37bd1e9)

- - - - -
ca146208 by Ben Gamari at 2020-07-15T11:27:40-04:00
rts/ProfHeap: Free old allocations when reinitialising Censuses

Previously when not LDV profiling we would repeatedly reinitialise
`censuses[0]` with `initEra`. This failed to free the `Arena` and
`HashTable` from the old census, resulting in a memory leak.

Fixes #18348.

(cherry picked from commit b835112cbeaa6e34a8bae7b7697bdf2826edaa9a)

- - - - -


16 changed files:

- .gitlab-ci.yml
- + docs/users_guide/8.10.2-notes.rst
- docs/users_guide/index.rst
- hadrian/src/Hadrian/Utilities.hs
- hadrian/src/Settings/Builders/Cabal.hs
- hadrian/src/Settings/Builders/Ghc.hs
- includes/rts/Flags.h
- rts/ProfHeap.c
- rts/RtsFlags.c
- rts/Timer.c
- testsuite/tests/dependent/should_fail/SelfDep.stderr
- testsuite/tests/dependent/should_fail/T16344.stderr
- testsuite/tests/partial-sigs/should_compile/T15039b.stderr
- testsuite/tests/partial-sigs/should_compile/T15039d.stderr
- testsuite/tests/polykinds/PolyKinds06.stderr
- testsuite/tests/typecheck/should_fail/T7892.stderr


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: 408eff66aef6ca2b44446c694c5a56d6ca0460cc
+  DOCKER_REV: 1ac7f435c9312f10422a82d304194778378e2a1a
 
   # Sequential version number capturing the versions of all tools fetched by
   # .gitlab/ci.sh.


=====================================
docs/users_guide/8.10.2-notes.rst
=====================================
@@ -0,0 +1,115 @@
+.. _release-8-10-2:
+
+Release notes for version 8.10.2
+================================
+
+The significant changes to the various parts of the compiler are listed in the
+following sections.
+
+
+Highlights
+----------
+
+- A few important correctness fixes for the low-latency garbage collector.
+
+Full details
+------------
+
+Language
+~~~~~~~~
+
+
+Compiler
+~~~~~~~~
+
+ - A simplifier panic manifesting when DWARF debug information is enabled has
+   been fixed (:ghc-ticket:`18162`, :ghc-ticket:`17619`)
+
+GHC API
+~~~~~~~
+
+
+GHCi
+~~~~
+
+
+Runtime system
+~~~~~~~~~~~~~~
+
+- The RTS now allows the user to specify a minimum time between idle GCs with
+  the :rts-flag:`-Iw ⟨seconds⟩` flag. 8.10.1 contained a users guide reference
+  to this flag but did not include the associated implementation.
+
+ - A memory leak in the cost-center profiler has been fixed
+   (:ghc-ticket:`18348`)
+
+ - A potential integer overflow in the compact normal form import logic has
+   been fixed (:ghc-ticket:`16992`)
+
+ - We now workaround a Linux kernel bug in the implementation of timerfd which
+   could previously result in program crashes (:ghc-ticket:`18033`)
+
+Template Haskell
+~~~~~~~~~~~~~~~~
+
+
+
+``ghc-prim`` library
+~~~~~~~~~~~~~~~~~~~~
+
+
+
+``ghc`` library
+~~~~~~~~~~~~~~~
+
+``base`` library
+~~~~~~~~~~~~~~~~
+
+Build system
+~~~~~~~~~~~~
+
+
+
+Included libraries
+------------------
+
+The package database provided with this distribution also contains a number of
+packages other than GHC itself. See the changelogs provided with these packages
+for further change information.
+
+.. ghc-package-list::
+
+    libraries/array/array.cabal:             Dependency of ``ghc`` library
+    libraries/base/base.cabal:               Core library
+    libraries/binary/binary.cabal:           Dependency of ``ghc`` library
+    libraries/bytestring/bytestring.cabal:   Dependency of ``ghc`` library
+    libraries/Cabal/Cabal/Cabal.cabal:       Dependency of ``ghc-pkg`` utility
+    libraries/containers/containers/containers.cabal:   Dependency of ``ghc`` library
+    libraries/deepseq/deepseq.cabal:         Dependency of ``ghc`` library
+    libraries/directory/directory.cabal:     Dependency of ``ghc`` library
+    libraries/exceptions/exceptions.cabal:   Dependency of ``haskeline`` library
+    libraries/filepath/filepath.cabal:       Dependency of ``ghc`` library
+    compiler/ghc.cabal:                      The compiler itself
+    libraries/ghci/ghci.cabal:               The REPL interface
+    libraries/ghc-boot/ghc-boot.cabal:       Internal compiler library
+    libraries/ghc-boot-th/ghc-boot-th.cabal: Internal compiler library
+    libraries/ghc-compact/ghc-compact.cabal: Core library
+    libraries/ghc-heap/ghc-heap.cabal:       GHC heap-walking library
+    libraries/ghc-prim/ghc-prim.cabal:       Core library
+    libraries/haskeline/haskeline.cabal:     Dependency of ``ghci`` executable
+    libraries/hpc/hpc.cabal:                 Dependency of ``hpc`` executable
+    libraries/integer-gmp/integer-gmp.cabal: Core library
+    libraries/libiserv/libiserv.cabal:       Internal compiler library
+    libraries/mtl/mtl.cabal:                 Dependency of ``Cabal`` library
+    libraries/parsec/parsec.cabal:           Dependency of ``Cabal`` library
+    libraries/pretty/pretty.cabal:           Dependency of ``ghc`` library
+    libraries/process/process.cabal:         Dependency of ``ghc`` library
+    libraries/stm/stm.cabal:                 Dependency of ``haskeline`` library
+    libraries/template-haskell/template-haskell.cabal:     Core library
+    libraries/terminfo/terminfo.cabal:       Dependency of ``haskeline`` library
+    libraries/text/text.cabal:               Dependency of ``Cabal`` library
+    libraries/time/time.cabal:               Dependency of ``ghc`` library
+    libraries/transformers/transformers.cabal: Dependency of ``ghc`` library
+    libraries/unix/unix.cabal:               Dependency of ``ghc`` library
+    libraries/Win32/Win32.cabal:             Dependency of ``ghc`` library
+    libraries/xhtml/xhtml.cabal:             Dependency of ``haddock`` executable


=====================================
docs/users_guide/index.rst
=====================================
@@ -13,6 +13,7 @@ Contents:
    license
    intro
    8.10.1-notes
+   8.10.2-notes
    ghci
    runghc
    usage


=====================================
hadrian/src/Hadrian/Utilities.hs
=====================================
@@ -39,8 +39,8 @@ import Control.Monad.Extra
 import Data.Char
 import Data.Dynamic (Dynamic, fromDynamic, toDyn)
 import Data.HashMap.Strict (HashMap)
+import Data.List.Extra (repeatedly, dropWhileEnd)
 import Data.List (isPrefixOf)
-import Data.List.Extra
 import Data.Maybe
 import Data.Typeable (TypeRep, typeOf)
 import Development.Shake hiding (Normal)


=====================================
hadrian/src/Settings/Builders/Cabal.hs
=====================================
@@ -1,6 +1,5 @@
 module Settings.Builders.Cabal (cabalBuilderArgs) where
 
-import Hadrian.Builder (getBuilderPath, needBuilder)
 import Hadrian.Haskell.Cabal
 
 import Builder


=====================================
hadrian/src/Settings/Builders/Ghc.hs
=====================================
@@ -2,8 +2,6 @@
 
 module Settings.Builders.Ghc (ghcBuilderArgs, haddockGhcArgs) where
 
-import Data.List.Extra (splitOn)
-
 import Hadrian.Haskell.Cabal
 import Hadrian.Haskell.Cabal.Type
 


=====================================
includes/rts/Flags.h
=====================================
@@ -66,6 +66,7 @@ typedef struct _GC_FLAGS {
     bool ringBell;
 
     Time    idleGCDelayTime;    /* units: TIME_RESOLUTION */
+    Time    interIdleGCWait;    /* units: TIME_RESOLUTION */
     bool doIdleGC;
 
     Time    longGCSync;         /* units: TIME_RESOLUTION */


=====================================
rts/ProfHeap.c
=====================================
@@ -260,6 +260,16 @@ LDV_recordDead( const StgClosure *c, uint32_t size )
 STATIC_INLINE void
 initEra(Census *census)
 {
+    // N.B. When not LDV profiling we reinitialise the same Census over
+    // and over again. Consequently, we need to ensure that we free the
+    // resources from the previous census.
+    if (census->hash) {
+        freeHashTable(census->hash, NULL);
+    }
+    if (census->arena) {
+        arenaFree(census->arena);
+    }
+
     census->hash  = allocHashTable();
     census->ctrs  = NULL;
     census->arena = newArena();
@@ -407,18 +417,24 @@ initHeapProfiling(void)
 #if defined(PROFILING)
     if (doingLDVProfiling()) {
         era = 1;
+        n_censuses = 32;
     } else
 #endif
     {
         era = 0;
+        n_censuses = 1;
     }
 
     // max_era = 2^LDV_SHIFT
     max_era = 1 << LDV_SHIFT;
 
-    n_censuses = 32;
     censuses = stgMallocBytes(sizeof(Census) * n_censuses, "initHeapProfiling");
 
+    // Ensure that arena and hash are NULL since otherwise initEra will attempt to free them.
+    for (unsigned int i=0; i < n_censuses; i++) {
+        censuses[i].arena = NULL;
+        censuses[i].hash = NULL;
+    }
     initEra( &censuses[era] );
 
     /* initProfilingLogFile(); */


=====================================
rts/RtsFlags.c
=====================================
@@ -164,6 +164,7 @@ void initRtsFlagsDefaults(void)
     RtsFlags.GcFlags.compactThreshold   = 30.0;
     RtsFlags.GcFlags.sweep              = false;
     RtsFlags.GcFlags.idleGCDelayTime    = USToTime(300000); // 300ms
+    RtsFlags.GcFlags.interIdleGCWait    = 0;
 #if defined(THREADED_RTS)
     RtsFlags.GcFlags.doIdleGC           = true;
 #else
@@ -1180,19 +1181,33 @@ error = true;
                   break;
 
               case 'I': /* idle GC delay */
-                OPTION_UNSAFE;
-                if (rts_argv[arg][2] == '\0') {
-                  /* use default */
-                } else {
-                    Time t = fsecondsToTime(atof(rts_argv[arg]+2));
-                    if (t == 0) {
-                        RtsFlags.GcFlags.doIdleGC = false;
-                    } else {
-                        RtsFlags.GcFlags.doIdleGC = true;
-                        RtsFlags.GcFlags.idleGCDelayTime = t;
-                    }
-                }
-                break;
+                  OPTION_UNSAFE;
+                  switch (rts_argv[arg][2]) {
+                  /* minimum inter-idle GC wait time */
+                  case 'w':
+                      if (rts_argv[arg][3] == '\0') {
+                          /* use default */
+                      } else {
+                          RtsFlags.GcFlags.interIdleGCWait = fsecondsToTime(atof(rts_argv[arg]+3));
+                      }
+                      break;
+                  /* idle delay before GC */
+                  case '\0':
+                      /* use default */
+                      break;
+                  default:
+                      {
+                          Time t = fsecondsToTime(atof(rts_argv[arg]+2));
+                          if (t == 0) {
+                              RtsFlags.GcFlags.doIdleGC = false;
+                          } else {
+                              RtsFlags.GcFlags.doIdleGC = true;
+                              RtsFlags.GcFlags.idleGCDelayTime = t;
+                          }
+                      }
+                      break;
+                  }
+                  break;
 
               case 'T':
                   OPTION_SAFE;


=====================================
rts/Timer.c
=====================================
@@ -28,8 +28,11 @@
 /* ticks left before next pre-emptive context switch */
 static int ticks_to_ctxt_switch = 0;
 
-/* idle ticks left before we perform a GC */
-static int ticks_to_gc = 0;
+/* idle ticks left before GC allowed */
+static int idle_ticks_to_gc = 0;
+
+/* inter-idle GC ticks left before GC allowed  */
+static int inter_gc_ticks_to_gc = 0;
 
 /*
  * Function: handle_tick()
@@ -53,18 +56,21 @@ handle_tick(int unused STG_UNUSED)
   /*
    * If we've been inactive for idleGCDelayTime (set by +RTS
    * -I), tell the scheduler to wake up and do a GC, to check
-   * for threads that are deadlocked.
+   * for threads that are deadlocked.  However, ensure we wait
+   * at least interIdleGCWait (+RTS -Iw) between idle GCs.
    */
   switch (recent_activity) {
   case ACTIVITY_YES:
       recent_activity = ACTIVITY_MAYBE_NO;
-      ticks_to_gc = RtsFlags.GcFlags.idleGCDelayTime /
-                    RtsFlags.MiscFlags.tickInterval;
+      idle_ticks_to_gc = RtsFlags.GcFlags.idleGCDelayTime /
+                         RtsFlags.MiscFlags.tickInterval;
       break;
   case ACTIVITY_MAYBE_NO:
-      if (ticks_to_gc == 0) {
+      if (idle_ticks_to_gc == 0 && inter_gc_ticks_to_gc == 0) {
           if (RtsFlags.GcFlags.doIdleGC) {
               recent_activity = ACTIVITY_INACTIVE;
+              inter_gc_ticks_to_gc = RtsFlags.GcFlags.interIdleGCWait /
+                                       RtsFlags.MiscFlags.tickInterval;
 #if defined(THREADED_RTS)
               wakeUpRts();
               // The scheduler will call stopTimer() when it has done
@@ -86,7 +92,8 @@ handle_tick(int unused STG_UNUSED)
 #endif
           }
       } else {
-          ticks_to_gc--;
+              if (idle_ticks_to_gc) idle_ticks_to_gc--;
+              if (inter_gc_ticks_to_gc) inter_gc_ticks_to_gc--;
       }
       break;
   default:


=====================================
testsuite/tests/dependent/should_fail/SelfDep.stderr
=====================================
@@ -3,4 +3,3 @@ SelfDep.hs:5:11: error:
     • Type constructor ‘T’ cannot be used here
         (it is defined and used in the same recursive group)
     • In the kind ‘T -> *’
-      In the data type declaration for ‘T’


=====================================
testsuite/tests/dependent/should_fail/T16344.stderr
=====================================
@@ -4,3 +4,7 @@ T16344.hs:7:46: error:
     • In the second argument of ‘T’, namely ‘Int’
       In the type ‘(T Type Int Bool)’
       In the definition of data constructor ‘MkT’
+      NB: Type ‘T’ was inferred to use visible dependent quantification.
+      Most types with visible dependent quantification are
+      polymorphically recursive and need a standalone kind
+      signature. Perhaps supply one, with StandaloneKindSignatures.


=====================================
testsuite/tests/partial-sigs/should_compile/T15039b.stderr
=====================================
@@ -52,6 +52,6 @@ T15039b.hs:35:8: warning: [-Wpartial-type-signatures (in -Wdefault)]
     • Found type wildcard ‘_’ standing for ‘Coercible @* a b’
       Where: ‘a’, ‘b’ are rigid type variables bound by
                the inferred type of ex7 :: Coercible @* a b => Coercion @{*} a b
-               at T15039b.hs:36:1-14
+               at T15039b.hs:35:1-44
     • In the type signature:
         ex7 :: _ => Coercion (a :: Type) (b :: Type)


=====================================
testsuite/tests/partial-sigs/should_compile/T15039d.stderr
=====================================
@@ -53,6 +53,6 @@ T15039d.hs:35:8: warning: [-Wpartial-type-signatures (in -Wdefault)]
     • Found type wildcard ‘_’ standing for ‘Coercible @* a b’
       Where: ‘a’, ‘b’ are rigid type variables bound by
                the inferred type of ex7 :: Coercible @* a b => Coercion @{*} a b
-               at T15039d.hs:36:1-14
+               at T15039d.hs:35:1-44
     • In the type signature:
         ex7 :: _ => Coercion (a :: Type) (b :: Type)


=====================================
testsuite/tests/polykinds/PolyKinds06.stderr
=====================================
@@ -3,4 +3,3 @@ PolyKinds06.hs:9:11: error:
     • Type constructor ‘A’ cannot be used here
         (it is defined and used in the same recursive group)
     • In the kind ‘A -> *’
-      In the data type declaration for ‘B’


=====================================
testsuite/tests/typecheck/should_fail/T7892.stderr
=====================================
@@ -1,4 +1,2 @@
 
-T7892.hs:5:4: error:
-    • Expected kind ‘* -> *’, but ‘f’ has kind ‘*’
-    • In the associated type family declaration for ‘F’
+T7892.hs:5:4: error: Expected kind ‘* -> *’, but ‘f’ has kind ‘*’



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/04dce49825c5124d942846902d97b42c33ca26e7...ca146208a210242904edde77633ef857200dd45f

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/04dce49825c5124d942846902d97b42c33ca26e7...ca146208a210242904edde77633ef857200dd45f
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/20200715/329d222d/attachment-0001.html>


More information about the ghc-commits mailing list