[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 4 commits: ghc-prim: Generalize keepAlive#/touch# in state token type

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Wed May 10 10:39:06 UTC 2023



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


Commits:
b3195922 by Ben Gamari at 2023-05-10T05:06:45-04:00
ghc-prim: Generalize keepAlive#/touch# in state token type

Closes #23163.

- - - - -
1e6861dd by Cheng Shao at 2023-05-10T05:07:25-04:00
Bump hsc2hs submodule

Fixes #22981.

- - - - -
c004f052 by Matthew Pickering at 2023-05-10T06:38:54-04:00
Build vanilla alpine bindists

We currently attempt to build and distribute fully static alpine
bindists (ones which could be used on any linux platform) but most
people who use the alpine bindists want to use alpine to build their own
static applications (for which a fully static bindist is not necessary).
We should build and distribute these bindists for these users whilst the
fully-static bindist is still unusable.

Fixes #23349

- - - - -
875d394a by Rodrigo Mesquita at 2023-05-10T06:38:56-04:00
Move "target has RTS linker" out of settings

We move the "target has RTS linker" information out of configure into a
predicate in GHC, and remove this option from the settings file where it
is unnecessary -- it's information statically known from the platform.

Note that previously we would consider `powerpc`s and `s390x`s other
than `powerpc-ibm-aix*` and `s390x-ibm-linux` to have an RTS linker,
but the RTS linker supports neither platform.

Closes #23361

- - - - -


16 changed files:

- .gitlab/gen_ci.hs
- .gitlab/jobs.yaml
- .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py
- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Platform.hs
- configure.ac
- distrib/configure.ac.in
- hadrian/bindist/Makefile
- hadrian/bindist/config.mk.in
- hadrian/cfg/system.config.in
- hadrian/src/Oracles/Setting.hs
- hadrian/src/Rules/Generate.hs
- hadrian/src/Settings/Builders/RunTest.hs
- libraries/ghc-prim/changelog.md
- utils/hsc2hs


Changes:

=====================================
.gitlab/gen_ci.hs
=====================================
@@ -424,7 +424,7 @@ distroVariables Alpine = mconcat
     -- T10458, ghcilink002: due to #17869
     -- linker_unload_native: due to musl not supporting any means of probing dynlib dependencies
     -- (see Note [Object unloading]).
-  , "BROKEN_TESTS" =: "encoding004 T10458 ghcilink002 linker_unload_native"
+  , "BROKEN_TESTS" =: "encoding004 T10458 linker_unload_native"
   ]
 distroVariables Centos7 = mconcat [
   "HADRIAN_ARGS" =: "--docs=no-sphinx"
@@ -903,8 +903,11 @@ job_groups =
      , standardBuildsWithConfig AArch64 (Linux Debian10) (splitSectionsBroken vanilla)
      , disableValidate (validateBuilds AArch64 (Linux Debian10) llvm)
      , standardBuildsWithConfig I386 (Linux Debian9) (splitSectionsBroken vanilla)
-     , standardBuildsWithConfig Amd64 (Linux Alpine) (splitSectionsBroken static)
-     , disableValidate (allowFailureGroup (standardBuildsWithConfig Amd64 (Linux Alpine) staticNativeInt))
+     -- Fully static build, in theory usable on any linux distribution.
+     , fullyStaticBrokenTests (standardBuildsWithConfig Amd64 (Linux Alpine) (splitSectionsBroken static))
+     -- Dynamically linked build, suitable for building your own static executables on alpine
+     , disableValidate (standardBuildsWithConfig Amd64 (Linux Alpine) (splitSectionsBroken vanilla))
+     , fullyStaticBrokenTests (disableValidate (allowFailureGroup (standardBuildsWithConfig Amd64 (Linux Alpine) staticNativeInt)))
      , validateBuilds Amd64 (Linux Debian11) (crossConfig "aarch64-linux-gnu" (Emulator "qemu-aarch64 -L /usr/aarch64-linux-gnu") Nothing)
      , validateBuilds Amd64 (Linux Debian11) (crossConfig "javascript-unknown-ghcjs" (Emulator "js-emulator") (Just "emconfigure")
         )
@@ -919,6 +922,10 @@ job_groups =
      ]
 
   where
+
+    -- ghcilink002 broken due to #17869
+    fullyStaticBrokenTests = modifyJobs (addVariable "BROKEN_TESTS" "ghcilink002 ")
+
     hackage_doc_job = rename (<> "-hackage") . modifyJobs (addVariable "HADRIAN_ARGS" "--haddock-base-url")
 
     tsan_jobs =


=====================================
.gitlab/jobs.yaml
=====================================
@@ -597,7 +597,7 @@
     "variables": {
       "BIGNUM_BACKEND": "native",
       "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_12-int_native-validate+fully_static",
-      "BROKEN_TESTS": "encoding004 T10458 ghcilink002 linker_unload_native",
+      "BROKEN_TESTS": "ghcilink002  encoding004 T10458 linker_unload_native",
       "BUILD_FLAVOUR": "validate+fully_static",
       "CONFIGURE_ARGS": "--disable-ld-override ",
       "HADRIAN_ARGS": "--docs=no-sphinx",
@@ -606,6 +606,68 @@
       "XZ_OPT": "-9"
     }
   },
+  "nightly-x86_64-linux-alpine3_12-validate": {
+    "after_script": [
+      ".gitlab/ci.sh save_cache",
+      ".gitlab/ci.sh clean",
+      "cat ci_timings"
+    ],
+    "allow_failure": false,
+    "artifacts": {
+      "expire_in": "8 weeks",
+      "paths": [
+        "ghc-x86_64-linux-alpine3_12-validate.tar.xz",
+        "junit.xml"
+      ],
+      "reports": {
+        "junit": "junit.xml"
+      },
+      "when": "always"
+    },
+    "cache": {
+      "key": "x86_64-linux-alpine3_12-$CACHE_REV",
+      "paths": [
+        "cabal-cache",
+        "toolchain"
+      ]
+    },
+    "dependencies": [],
+    "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-alpine3_12:$DOCKER_REV",
+    "needs": [
+      {
+        "artifacts": false,
+        "job": "hadrian-ghc-in-ghci"
+      }
+    ],
+    "rules": [
+      {
+        "if": "($CI_MERGE_REQUEST_LABELS !~ /.*fast-ci.*/) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY) && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"true\" == \"true\")",
+        "when": "on_success"
+      }
+    ],
+    "script": [
+      "sudo chown ghc:ghc -R .",
+      ".gitlab/ci.sh setup",
+      ".gitlab/ci.sh configure",
+      ".gitlab/ci.sh build_hadrian",
+      ".gitlab/ci.sh test_hadrian"
+    ],
+    "stage": "full-build",
+    "tags": [
+      "x86_64-linux"
+    ],
+    "variables": {
+      "BIGNUM_BACKEND": "gmp",
+      "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_12-validate",
+      "BROKEN_TESTS": "encoding004 T10458 linker_unload_native",
+      "BUILD_FLAVOUR": "validate",
+      "CONFIGURE_ARGS": "--disable-ld-override ",
+      "HADRIAN_ARGS": "--docs=no-sphinx",
+      "INSTALL_CONFIGURE_ARGS": "--disable-ld-override",
+      "TEST_ENV": "x86_64-linux-alpine3_12-validate",
+      "XZ_OPT": "-9"
+    }
+  },
   "nightly-x86_64-linux-alpine3_12-validate+fully_static": {
     "after_script": [
       ".gitlab/ci.sh save_cache",
@@ -659,7 +721,7 @@
     "variables": {
       "BIGNUM_BACKEND": "gmp",
       "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_12-validate+fully_static",
-      "BROKEN_TESTS": "encoding004 T10458 ghcilink002 linker_unload_native",
+      "BROKEN_TESTS": "ghcilink002  encoding004 T10458 linker_unload_native",
       "BUILD_FLAVOUR": "validate+fully_static",
       "CONFIGURE_ARGS": "--disable-ld-override ",
       "HADRIAN_ARGS": "--docs=no-sphinx",
@@ -2472,7 +2534,7 @@
     "variables": {
       "BIGNUM_BACKEND": "native",
       "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_12-int_native-release+fully_static",
-      "BROKEN_TESTS": "encoding004 T10458 ghcilink002 linker_unload_native",
+      "BROKEN_TESTS": "ghcilink002  encoding004 T10458 linker_unload_native",
       "BUILD_FLAVOUR": "release+fully_static",
       "CONFIGURE_ARGS": "--disable-ld-override ",
       "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx",
@@ -2535,7 +2597,7 @@
     "variables": {
       "BIGNUM_BACKEND": "gmp",
       "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_12-release+fully_static+no_split_sections",
-      "BROKEN_TESTS": "encoding004 T10458 ghcilink002 linker_unload_native",
+      "BROKEN_TESTS": "ghcilink002  encoding004 T10458 linker_unload_native",
       "BUILD_FLAVOUR": "release+fully_static+no_split_sections",
       "CONFIGURE_ARGS": "--disable-ld-override ",
       "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx",
@@ -2545,6 +2607,69 @@
       "XZ_OPT": "-9"
     }
   },
+  "release-x86_64-linux-alpine3_12-release+no_split_sections": {
+    "after_script": [
+      ".gitlab/ci.sh save_cache",
+      ".gitlab/ci.sh clean",
+      "cat ci_timings"
+    ],
+    "allow_failure": false,
+    "artifacts": {
+      "expire_in": "1 year",
+      "paths": [
+        "ghc-x86_64-linux-alpine3_12-release+no_split_sections.tar.xz",
+        "junit.xml"
+      ],
+      "reports": {
+        "junit": "junit.xml"
+      },
+      "when": "always"
+    },
+    "cache": {
+      "key": "x86_64-linux-alpine3_12-$CACHE_REV",
+      "paths": [
+        "cabal-cache",
+        "toolchain"
+      ]
+    },
+    "dependencies": [],
+    "image": "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-alpine3_12:$DOCKER_REV",
+    "needs": [
+      {
+        "artifacts": false,
+        "job": "hadrian-ghc-in-ghci"
+      }
+    ],
+    "rules": [
+      {
+        "if": "($CI_MERGE_REQUEST_LABELS !~ /.*fast-ci.*/) && ($RELEASE_JOB == \"yes\") && ($NIGHTLY == null) && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"true\" == \"true\") && (\"true\" == \"true\")",
+        "when": "on_success"
+      }
+    ],
+    "script": [
+      "sudo chown ghc:ghc -R .",
+      ".gitlab/ci.sh setup",
+      ".gitlab/ci.sh configure",
+      ".gitlab/ci.sh build_hadrian",
+      ".gitlab/ci.sh test_hadrian"
+    ],
+    "stage": "full-build",
+    "tags": [
+      "x86_64-linux"
+    ],
+    "variables": {
+      "BIGNUM_BACKEND": "gmp",
+      "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_12-release+no_split_sections",
+      "BROKEN_TESTS": "encoding004 T10458 linker_unload_native",
+      "BUILD_FLAVOUR": "release+no_split_sections",
+      "CONFIGURE_ARGS": "--disable-ld-override ",
+      "HADRIAN_ARGS": "--hash-unit-ids --docs=no-sphinx",
+      "IGNORE_PERF_FAILURES": "all",
+      "INSTALL_CONFIGURE_ARGS": "--disable-ld-override",
+      "TEST_ENV": "x86_64-linux-alpine3_12-release+no_split_sections",
+      "XZ_OPT": "-9"
+    }
+  },
   "release-x86_64-linux-centos7-release+no_split_sections": {
     "after_script": [
       ".gitlab/ci.sh save_cache",
@@ -3581,7 +3706,7 @@
     "variables": {
       "BIGNUM_BACKEND": "gmp",
       "BIN_DIST_NAME": "ghc-x86_64-linux-alpine3_12-validate+fully_static",
-      "BROKEN_TESTS": "encoding004 T10458 ghcilink002 linker_unload_native",
+      "BROKEN_TESTS": "ghcilink002  encoding004 T10458 linker_unload_native",
       "BUILD_FLAVOUR": "validate+fully_static",
       "CONFIGURE_ARGS": "--disable-ld-override ",
       "HADRIAN_ARGS": "--docs=no-sphinx",


=====================================
.gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py
=====================================
@@ -30,6 +30,7 @@ def job_triple(job_name):
         'release-x86_64-linux-deb9-release': 'x86_64-deb9-linux',
         'release-x86_64-linux-centos7-release': 'x86_64-centos7-linux',
         'release-x86_64-linux-alpine3_12-release+fully_static': 'x86_64-alpine3_12-linux-static',
+        'release-x86_64-linux-alpine3_12-release': 'x86_64-alpine3_12-linux',
         'release-x86_64-linux-alpine3_12-int_native-release+fully_static': 'x86_64-alpine3_12-linux-static-int_native',
         'release-x86_64-darwin-release': 'x86_64-apple-darwin',
         'release-i386-linux-deb9-release': 'i386-deb9-linux',


=====================================
compiler/GHC/Builtin/primops.txt.pp
=====================================
@@ -3407,7 +3407,7 @@ primop  FinalizeWeakOp "finalizeWeak#" GenPrimOp
    out_of_line      = True
 
 primop TouchOp "touch#" GenPrimOp
-   v -> State# RealWorld -> State# RealWorld
+   v -> State# s -> State# s
    with
    code_size = { 0 }
    has_side_effects = True
@@ -3723,7 +3723,7 @@ section "Controlling object lifetime"
 -- and "p" is the same as "b" except representation-polymorphic.
 -- See Note [Levity and representation polymorphic primops]
 primop KeepAliveOp "keepAlive#" GenPrimOp
-   v -> State# RealWorld -> (State# RealWorld -> p) -> p
+   v -> State# s -> (State# s -> p) -> p
    { @'keepAlive#' x s k@ keeps the value @x@ alive during the execution
      of the computation @k at .
 


=====================================
compiler/GHC/Driver/Session.hs
=====================================
@@ -4830,8 +4830,9 @@ compilerInfo dflags
        ("Target platform",             platformMisc_targetPlatformString $ platformMisc dflags),
        ("Have interpreter",            showBool $ platformMisc_ghcWithInterpreter $ platformMisc dflags),
        ("Object splitting supported",  showBool False),
-       ("Have native code generator",  showBool $ platformNcgSupported (targetPlatform dflags)),
-       ("Target default backend",      show $ platformDefaultBackend (targetPlatform dflags)),
+       ("Have native code generator",  showBool $ platformNcgSupported platform),
+       ("target has RTS linker",       showBool $ platformHasRTSLinker platform),
+       ("Target default backend",      show     $ platformDefaultBackend platform),
        -- Whether or not we support @-dynamic-too@
        ("Support dynamic-too",         showBool $ not isWindows),
        -- Whether or not we support the @-j@ flag with @--make at .


=====================================
compiler/GHC/Platform.hs
=====================================
@@ -29,6 +29,7 @@ module GHC.Platform
    , platformInIntRange
    , platformInWordRange
    , platformCConvNeedsExtension
+   , platformHasRTSLinker
    , PlatformMisc(..)
    , SseVersion (..)
    , BmiVersion (..)
@@ -271,6 +272,23 @@ platformCConvNeedsExtension platform = case platformArch platform of
     | OSDarwin <- platformOS platform -> True
   _            -> False
 
+-- | Does this platform have an RTS linker?
+platformHasRTSLinker :: Platform -> Bool
+-- Note that we've inlined this logic in hadrian's
+-- Settings.Builders.RunTest.inTreeCompilerArgs.
+-- If you change this, be sure to change it too
+platformHasRTSLinker p = case archOS_arch (platformArchOS p) of
+  ArchPPC           -> False -- powerpc
+  ArchPPC_64 ELF_V1 -> False -- powerpc64
+  ArchPPC_64 ELF_V2 -> False -- powerpc64le
+  ArchS390X         -> False
+  ArchRISCV64       -> False
+  ArchLoongArch64   -> False
+  ArchJavaScript    -> False
+  ArchWasm32        -> False
+  _                 -> True
+
+
 
 --------------------------------------------------
 -- Instruction sets


=====================================
configure.ac
=====================================
@@ -330,18 +330,6 @@ if test x"$TablesNextToCode" = xYES; then
 fi
 AC_SUBST(TablesNextToCode)
 
-dnl ** Does target have runtime linker support?
-dnl --------------------------------------------------------------
-case "$target" in
-    powerpc64-*|powerpc64le-*|powerpc-ibm-aix*|s390x-ibm-linux|riscv64-*|wasm*|javascript-*|loongarch64-*)
-        TargetHasRTSLinker=NO
-        ;;
-    *)
-        TargetHasRTSLinker=YES
-        ;;
-esac
-AC_SUBST(TargetHasRTSLinker)
-
 # Requires FPTOOLS_SET_PLATFORMS_VARS to be run first.
 FP_FIND_ROOT
 


=====================================
distrib/configure.ac.in
=====================================
@@ -20,9 +20,6 @@ bootstrap_target=@TargetPlatform@
 
 bootstrap_llvm_target=@LlvmTarget@
 
-TargetHasRTSLinker=@TargetHasRTSLinker@
-AC_SUBST(TargetHasRTSLinker)
-
 TargetHasLibm=@TargetHasLibm@
 AC_SUBST(TargetHasLibm)
 


=====================================
hadrian/bindist/Makefile
=====================================
@@ -116,7 +116,6 @@ lib/settings : config.mk
 	@echo ',("target has GNU nonexec stack", "$(TargetHasGnuNonexecStack)")' >> $@
 	@echo ',("target has .ident directive", "$(TargetHasIdentDirective)")' >> $@
 	@echo ',("target has subsections via symbols", "$(TargetHasSubsectionsViaSymbols)")' >> $@
-	@echo ',("target has RTS linker", "$(TargetHasRTSLinker)")' >> $@
 	@echo ',("target has libm", "$(TargetHasLibm)")' >> $@
 	@echo ',("Unregisterised", "$(GhcUnregisterised)")' >> $@
 	@echo ',("LLVM target", "$(LLVMTarget_CPP)")' >> $@


=====================================
hadrian/bindist/config.mk.in
=====================================
@@ -253,7 +253,6 @@ TargetWordBigEndian = @TargetWordBigEndian@
 TargetHasGnuNonexecStack = @TargetHasGnuNonexecStack@
 TargetHasIdentDirective = @TargetHasIdentDirective@
 TargetHasSubsectionsViaSymbols = @TargetHasSubsectionsViaSymbols@
-TargetHasRTSLinker = @TargetHasRTSLinker@
 TargetHasLibm = @TargetHasLibm@
 TablesNextToCode = @TablesNextToCode@
 


=====================================
hadrian/cfg/system.config.in
=====================================
@@ -173,7 +173,6 @@ target-word-big-endian = @TargetWordBigEndian@
 target-has-gnu-nonexec-stack = @TargetHasGnuNonexecStack@
 target-has-ident-directive = @TargetHasIdentDirective@
 target-has-subsections-via-symbols = @TargetHasSubsectionsViaSymbols@
-target-has-rts-linker = @TargetHasRTSLinker@
 target-has-libm = @TargetHasLibm@
 target-arm-version    = @ARM_ISA@
 


=====================================
hadrian/src/Oracles/Setting.hs
=====================================
@@ -79,7 +79,6 @@ data Setting = BuildArch
              | TargetOsHaskell
              | TargetArmVersion
              | TargetWordSize
-             | TargetHasRtsLinker
              | BourneShell
 
 -- TODO: Reduce the variety of similar flags (e.g. CPP and non-CPP versions).
@@ -181,7 +180,6 @@ setting key = lookupSystemConfig $ case key of
     TargetArchHaskell  -> "target-arch-haskell"
     TargetOsHaskell    -> "target-os-haskell"
     TargetWordSize     -> "target-word-size"
-    TargetHasRtsLinker -> "target-has-rts-linker"
     BourneShell        -> "bourne-shell"
 
 bootIsStage0 :: Stage -> Stage


=====================================
hadrian/src/Rules/Generate.hs
=====================================
@@ -448,7 +448,6 @@ generateSettings = do
         , ("target has GNU nonexec stack", expr $ lookupSystemConfig "target-has-gnu-nonexec-stack")
         , ("target has .ident directive", expr $ lookupSystemConfig "target-has-ident-directive")
         , ("target has subsections via symbols", expr $ lookupSystemConfig "target-has-subsections-via-symbols")
-        , ("target has RTS linker", expr $ lookupSystemConfig "target-has-rts-linker")
         , ("target has libm", expr $  lookupSystemConfig "target-has-libm")
         , ("Unregisterised", expr $ yesNo <$> flag GhcUnregisterised)
         , ("LLVM target", getSetting LlvmTarget)


=====================================
hadrian/src/Settings/Builders/RunTest.hs
=====================================
@@ -134,7 +134,10 @@ inTreeCompilerArgs stg = do
     libdir           <- System.FilePath.normalise . (top -/-)
                     <$> stageLibPath stg
 
-    rtsLinker <- (== "YES") <$> setting TargetHasRtsLinker
+    -- For this information, we need to query ghc --info, however, that would
+    -- require building ghc, which we don't want to do here. Therefore, the
+    -- logic from `platformHasRTSLinker` is duplicated here.
+    let rtsLinker = not $ arch `elem` ["powerpc", "powerpc64", "powerpc64le", "s390x", "riscv64", "loongarch64", "javascript", "wasm32"]
 
     return TestCompilerArgs{..}
 


=====================================
libraries/ghc-prim/changelog.md
=====================================
@@ -14,6 +14,8 @@
     - `sameMutVar#`, `sameTVar#`, `sameMVar#`
     - `sameIOPort#`, `eqStableName#`.
 
+- `keepAlive#` and `touch#` are now polymorphic in their state token (#23163; [CLC#152](https://github.com/haskell/core-libraries-committee/issues/152))
+
 - Several new primops were added:
 
   - `copyMutableByteArrayNonOverlapping#`


=====================================
utils/hsc2hs
=====================================
@@ -1 +1 @@
-Subproject commit 1ba092932f86c1fda15091d355ba7975b8554437
+Subproject commit f70b360b295298e4da10afe02ebf022b21342008



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ab8d351049cf3baaa8af8a8d069da21849f4edbe...875d394a498dbacc7a6527cbc4c5ebd612c1ab36

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ab8d351049cf3baaa8af8a8d069da21849f4edbe...875d394a498dbacc7a6527cbc4c5ebd612c1ab36
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/20230510/c2990b16/attachment-0001.html>


More information about the ghc-commits mailing list