[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 4 commits: Fixes for cabal-reinstall CI job

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Tue Jan 31 09:33:55 UTC 2023



Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC


Commits:
f70e049d by Matthew Pickering at 2023-01-31T04:33:43-05:00
Fixes for cabal-reinstall CI job

* Allow filepath to be reinstalled
* Bump some version bounds to allow newer versions of libraries
* Rework testing logic to avoid "install --lib" and package env files

Fixes #22344

- - - - -
08ee861f by Cheng Shao at 2023-01-31T04:33:44-05:00
rts: prevent potential divide-by-zero when tickInterval=0

This patch fixes a few places in RtsFlags.c that may result in
divide-by-zero error when tickInterval=0, which is the default on
wasm. Fixes #22603.

- - - - -
ffb30da4 by Joachim Breitner at 2023-01-31T04:33:44-05:00
Update note at beginning of GHC.Builtin.NAmes

some things have been renamed since it was written, it seems.

- - - - -
ce3c25fd by Cheng Shao at 2023-01-31T04:33:45-05:00
testsuite: use tgamma for cg007

gamma is a glibc-only deprecated function, use tgamma instead. It's
required for fixing cg007 when testing the wasm unregisterised
codegen.

- - - - -


11 changed files:

- .gitlab-ci.yml
- cabal.project-reinstall
- compiler/GHC/Builtin/Names.hs
- compiler/ghc.cabal.in
- hadrian/src/Rules/CabalReinstall.hs
- hadrian/src/Settings/Builders/Cabal.hs
- libraries/ghc-boot/ghc-boot.cabal.in
- linters/lint-commit-msg/lint-commit-msg.cabal
- linters/lint-whitespace/lint-whitespace.cabal
- rts/RtsFlags.c
- testsuite/tests/codeGen/should_compile/cg007.hs


Changes:

=====================================
.gitlab-ci.yml
=====================================
@@ -456,6 +456,7 @@ test-cabal-reinstall-x86_64-linux-deb10:
     TEST_ENV: "x86_64-linux-deb10-cabal-install"
   rules:
     - if: $NIGHTLY
+    - if: '$CI_MERGE_REQUEST_LABELS =~ /.*test-reinstall.*/'
 
 ########################################
 # Testing ABI is invariant across builds


=====================================
cabal.project-reinstall
=====================================
@@ -12,7 +12,7 @@ packages: ./compiler
           -- ./libraries/deepseq/
           ./libraries/directory/
           ./libraries/exceptions/
-          -- ./libraries/filepath/
+          ./libraries/filepath/
           -- ./libraries/ghc-bignum/
            ./libraries/ghc-boot/
           -- ./libraries/ghc-boot-th/
@@ -55,7 +55,6 @@ constraints: ghc +internal-interpreter +dynamic-system-linke,
              any.array installed,
              any.base installed,
              any.deepseq installed,
-             any.filepath installed,
              any.ghc-bignum installed,
              any.ghc-boot-th installed,
              any.integer-gmp installed,


=====================================
compiler/GHC/Builtin/Names.hs
=====================================
@@ -4,22 +4,23 @@
 \section[GHC.Builtin.Names]{Definitions of prelude modules and names}
 
 
-Nota Bene: all Names defined in here should come from the base package
+Nota Bene: all Names defined in here should come from the base package,
+the big-num package or (for plugins) the ghc package.
 
  - ModuleNames for prelude modules,
-        e.g.    pREL_BASE_Name :: ModuleName
+        e.g.    pRELUDE_NAME :: ModuleName
 
  - Modules for prelude modules
-        e.g.    pREL_Base :: Module
+        e.g.    pRELUDE :: Module
 
  - Uniques for Ids, DataCons, TyCons and Classes that the compiler
    "knows about" in some way
-        e.g.    intTyConKey :: Unique
+        e.g.    orderingTyConKey :: Unique
                 minusClassOpKey :: Unique
 
  - Names for Ids, DataCons, TyCons and Classes that the compiler
    "knows about" in some way
-        e.g.    intTyConName :: Name
+        e.g.    orderingTyConName :: Name
                 minusName    :: Name
    One of these Names contains
         (a) the module and occurrence name of the thing
@@ -31,8 +32,9 @@ Nota Bene: all Names defined in here should come from the base package
    foldrName in the environment.
 
  - RdrNames for Ids, DataCons etc that the compiler may emit into
-   generated code (e.g. for deriving).  It's not necessary to know
-   the uniques for these guys, only their names
+   generated code (e.g. for deriving).
+        e.g.    and_RDR :: RdrName
+   It's not necessary to know the uniques for these guys, only their names
 
 
 Note [Known-key names]


=====================================
compiler/ghc.cabal.in
=====================================
@@ -39,7 +39,7 @@ extra-source-files:
 
 
 custom-setup
-    setup-depends: base >= 3 && < 5, Cabal >= 1.6 && <3.9, directory, process, filepath
+    setup-depends: base >= 3 && < 5, Cabal >= 1.6 && <3.10, directory, process, filepath
 
 Flag internal-interpreter
     Description: Build with internal interpreter support.


=====================================
hadrian/src/Rules/CabalReinstall.hs
=====================================
@@ -11,6 +11,7 @@ import qualified System.Directory.Extra as IO
 import Data.Either
 import Rules.BinaryDist
 import Hadrian.Haskell.Cabal (pkgIdentifier)
+import Oracles.Setting
 
 {-
 Note [Testing reinstallable GHC]
@@ -26,18 +27,11 @@ The libdir of the reinstalled GHC points to the libdir of the stage 2 compiler (
 cabalExcludedPackages :: [Package]
 cabalExcludedPackages = [array, base, deepseq, filepath, ghcBignum, ghcBootTh, ghcPrim, integerGmp, integerSimple, pretty, templateHaskell]
 
-findCabalPackageDb :: String -> FilePath
-findCabalPackageDb env = go $ map (\l -> (words l, l)) (lines env)
-  where
-    go [] = error $ "Couldn't find installed package db in " ++ show env
-    go (("package-db":_, l):_) = drop 11 l
-    go (_:xs) = go xs
-
 
 cabalBuildRules :: Rules ()
 cabalBuildRules = do
     root <- buildRootRules
-    root -/- "stage-cabal" -/- "cabal-packages" %> \_ -> do
+    root -/- "stage-cabal" -/- "cabal-packages" %> \outpath -> do
       -- Always rerun to pass onto cabal's own recompilation logic
       alwaysRerun
       all_pkgs <- stagePackages Stage1
@@ -45,6 +39,7 @@ cabalBuildRules = do
         withVerbosity Diagnostic $
           buildWithCmdOptions [] $
             target (vanillaContext Stage2 pkg) (Cabal Install Stage2) [] []
+      liftIO $ writeFile outpath "done"
 
     phony "build-cabal" $ need [root -/- "stage-cabal" -/- "bin" -/- ".stamp"]
 
@@ -73,8 +68,11 @@ cabalBuildRules = do
         createDirectory outputDir
 
         need [root -/- "stage-cabal" -/- "cabal-packages"]
-        env <- liftIO $ readFile $ root -/- "stage-cabal" -/- "cabal-packages"
-        let cabal_package_db = findCabalPackageDb env
+
+        cwd <- liftIO $ IO.getCurrentDirectory
+        version        <- setting ProjectVersion
+
+        let cabal_package_db = cwd -/- root -/- "stage-cabal" -/- "dist-newstyle" -/- "packagedb" -/- "ghc-" ++ version
 
         forM_ (filter ((/= iserv) . fst) bin_targets) $ \(bin_pkg,_bin_path) -> do
             let pgmName pkg


=====================================
hadrian/src/Settings/Builders/Cabal.hs
=====================================
@@ -27,9 +27,10 @@ cabalInstallArgs = builder (Cabal Install) ?  do
         | otherwise     = pkgName pkg
   assertNoBuildRootLeak $
     mconcat [ arg $ "--store-dir="   ++ (root -/- "stage-cabal" -/- "cabal-store")
-            , arg "install"
-            , if isProgram pkg then arg $ "exe:" ++ pgmName else mconcat [arg "--lib", arg $ pkgName pkg]
+            , if isProgram pkg then arg "install" else arg "build"
+            , if isProgram pkg then (arg $ "exe:" ++ pgmName) else (arg $ pkgName pkg)
             , commonReinstallCabalArgs
+            , if isProgram pkg then extraInstallArgs else mempty
             ]
 
 -- | Checks that _build/stageN/lib/* doesn't leak into the arguments for
@@ -45,6 +46,13 @@ assertNoBuildRootLeak args = do
                                        | libPath <- libPaths]) xs)
                 xs
 
+extraInstallArgs :: Args
+extraInstallArgs = do
+    root      <- getBuildRoot
+    mconcat [ arg $ "--install-method=copy"
+            , arg $ "--overwrite-policy=always"
+            , arg $ "--installdir="  ++ (root -/- "stage-cabal" -/- "cabal-bin") ]
+
 commonReinstallCabalArgs :: Args
 commonReinstallCabalArgs = do
     top       <- expr topDirectory
@@ -56,12 +64,7 @@ commonReinstallCabalArgs = do
             , arg $ top -/- "cabal.project-reinstall"
             , arg "--distdir"
             , arg $ root -/- "stage-cabal" -/- "dist-newstyle"
-            , arg ("--ghc-option=-j" ++ show threads)
-            , arg $ "--install-method=copy"
-            , arg $ "--overwrite-policy=always"
             , arg $ "--with-compiler=" ++ top -/- compiler
-            , arg $ "--installdir="  ++ (root -/- "stage-cabal" -/- "cabal-bin")
-            , arg $ "--package-env=" ++ (root -/- "stage-cabal" -/- "cabal-packages")
             , arg "--enable-executable-dynamic"
             , arg "--enable-library-vanilla"
             ]


=====================================
libraries/ghc-boot/ghc-boot.cabal.in
=====================================
@@ -28,7 +28,7 @@ build-type:     Custom
 extra-source-files: changelog.md
 
 custom-setup
-    setup-depends: base >= 3 && < 5, Cabal >= 1.6 && <3.9, directory, filepath
+    setup-depends: base >= 3 && < 5, Cabal >= 1.6 && <3.10, directory, filepath
 
 source-repository head
     type:     git


=====================================
linters/lint-commit-msg/lint-commit-msg.cabal
=====================================
@@ -22,7 +22,7 @@ executable lint-commit-msg
   build-depends:
     linters-common,
     mtl
-      >=2.1 && <2.3,
+      >=2.1 && <2.4,
     base
        >= 4.14 && < 5,
     text


=====================================
linters/lint-whitespace/lint-whitespace.cabal
=====================================
@@ -20,7 +20,7 @@ executable lint-whitespace
   build-depends:
     linters-common,
     mtl
-      >=2.1 && <2.3,
+      >=2.1 && <2.4,
     process
       ^>= 1.6,
     containers


=====================================
rts/RtsFlags.c
=====================================
@@ -243,7 +243,8 @@ void initRtsFlagsDefaults(void)
     RtsFlags.TraceFlags.nullWriter = false;
 #endif
 
-#if defined(PROFILING)
+// See Note [No timer on wasm32]
+#if defined(PROFILING) && !defined(wasm32_HOST_ARCH)
     // When profiling we want a lot more ticks
     RtsFlags.MiscFlags.tickInterval     = USToTime(1000);  // 1ms
 #else
@@ -1853,7 +1854,7 @@ static void normaliseRtsOpts (void)
                     RtsFlags.MiscFlags.tickInterval);
     }
 
-    if (RtsFlags.ConcFlags.ctxtSwitchTime > 0) {
+    if (RtsFlags.ConcFlags.ctxtSwitchTime > 0 && RtsFlags.MiscFlags.tickInterval != 0) {
         RtsFlags.ConcFlags.ctxtSwitchTicks =
             RtsFlags.ConcFlags.ctxtSwitchTime /
             RtsFlags.MiscFlags.tickInterval;
@@ -1861,7 +1862,7 @@ static void normaliseRtsOpts (void)
         RtsFlags.ConcFlags.ctxtSwitchTicks = 0;
     }
 
-    if (RtsFlags.ProfFlags.heapProfileInterval > 0) {
+    if (RtsFlags.ProfFlags.heapProfileInterval > 0 && RtsFlags.MiscFlags.tickInterval != 0) {
         RtsFlags.ProfFlags.heapProfileIntervalTicks =
             RtsFlags.ProfFlags.heapProfileInterval /
             RtsFlags.MiscFlags.tickInterval;
@@ -1869,7 +1870,7 @@ static void normaliseRtsOpts (void)
         RtsFlags.ProfFlags.heapProfileIntervalTicks = 0;
     }
 
-    if (RtsFlags.TraceFlags.eventlogFlushTime > 0) {
+    if (RtsFlags.TraceFlags.eventlogFlushTime > 0 && RtsFlags.MiscFlags.tickInterval != 0) {
         RtsFlags.TraceFlags.eventlogFlushTicks =
             RtsFlags.TraceFlags.eventlogFlushTime /
             RtsFlags.MiscFlags.tickInterval;


=====================================
testsuite/tests/codeGen/should_compile/cg007.hs
=====================================
@@ -21,6 +21,5 @@ In file included from /rts/include/Stg.h:207,
      error: for each function it appears in.)
 -}
 
-foreign import ccall unsafe "math.h gamma"
-    gamma :: CDouble -> CDouble
-
+foreign import ccall unsafe "math.h tgamma"
+    tgamma :: CDouble -> CDouble



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6d90e370ed6cb4723b625ba9cdd24609b53d6248...ce3c25fd19763f618a09321af6ccc171503b960e

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6d90e370ed6cb4723b625ba9cdd24609b53d6248...ce3c25fd19763f618a09321af6ccc171503b960e
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/20230131/2d49033b/attachment-0001.html>


More information about the ghc-commits mailing list