[Git][ghc/ghc][wip/head-hackage-validate] 5 commits: Correct `exitWith` Haddocks

Matthew Pickering (@mpickering) gitlab at gitlab.haskell.org
Tue Dec 20 08:43:01 UTC 2022



Matthew Pickering pushed to branch wip/head-hackage-validate at Glasgow Haskell Compiler / GHC


Commits:
6fe2d778 by amesgen at 2022-12-18T19:33:49-05:00
Correct `exitWith` Haddocks

The `IOError`-specific `catch` in the Prelude is long gone.

- - - - -
b3eacd64 by Ben Gamari at 2022-12-18T19:34:24-05:00
rts: Drop racy assertion

0e274c39bf836d5bb846f5fa08649c75f85326ac added an assertion in
`dirty_MUT_VAR` checking that the MUT_VAR being dirtied was clean.
However, this isn't necessarily the case since another thread may have
raced us to dirty the object.

- - - - -
761c1f49 by Ben Gamari at 2022-12-18T19:35:00-05:00
rts/libdw: Silence uninitialized usage warnings

As noted in #22538, previously some GCC versions warned that various
locals in Libdw.c may be used uninitialized. Although this wasn't
strictly true (since they were initialized in an inline assembler block)
we fix this by providing explicit empty initializers.

Fixes #22538
- - - - -
3245484b by Matthew Pickering at 2022-12-20T08:42:57+00:00
head.hackage: Use slow-validate bindist for linting jobs

This enables the SLOW_VALIDATE env var for the linting head.hackage
jobs, namely the jobs enabled manually, by the label or on the nightly
build now use the deb10-numa-slow-validate bindist which has assertions
enabled.

See #22623 for a ticket which was found by using this configuration
already!

The head.hackage jobs triggered by upstream CI are now thusly:

hackage-lint: Can be triggered on any MR, normal validate pipeline or nightly build.
              Runs head.hackage with -dlint and a slow-validate bindist

hackage-label-lint: Trigged on MRs with "user-facing" label, runs the slow-validate
                    head.hackage build with -dlint.

nightly-hackage-lint: Runs automatically on nightly pipelines with slow-validate + dlint config.

nightly-hackage-perf: Runs automaticaly on nightly pipelines with release build and eventlogging enabled.

release-hackage-lint: Runs automatically on release pipelines with -dlint on a release bindist.

- - - - -
fec566ae by Matthew Pickering at 2022-12-20T08:42:57+00:00
ci: Don't run abi-test-nightly on release jobs

The test is not configured to get the correct dependencies for the
release pipelines (and indeed stops the release pipeline being run at
all)

- - - - -


4 changed files:

- .gitlab-ci.yml
- libraries/base/System/Exit.hs
- rts/Libdw.c
- rts/sm/Storage.c


Changes:

=====================================
.gitlab-ci.yml
=====================================
@@ -481,7 +481,6 @@ abi-test-nightly:
       - out
   rules:
     - if: $NIGHTLY
-    - if: '$RELEASE_JOB == "yes"'
 
 ############################################################
 # Packaging
@@ -679,19 +678,21 @@ test-bootstrap:
 # access to an unprivileged access token with the ability to query the ghc/ghc
 # project such that it can find the job ID of the fedora33 job for the current
 # pipeline.
+#
+# hackage-lint: Can be triggered on any MR, normal validate pipeline or nightly build.
+#               Runs head.hackage with -dlint and a slow-validate bindist
+#
+# hackage-label-lint: Trigged on MRs with "user-facing" label, runs the slow-validate
+#                     head.hackage build with -dlint.
+#
+# nightly-hackage-lint: Runs automatically on nightly pipelines with slow-validate + dlint config.
+#
+# nightly-hackage-perf: Runs automaticaly on nightly pipelines with release build and eventlogging enabled.
+#
+# release-hackage-lint: Runs automatically on release pipelines with -dlint on a release bindist.
 
 .hackage:
   stage: testing
-  needs:
-    - job: x86_64-linux-fedora33-release
-      optional: true
-      artifacts: false
-    - job: nightly-x86_64-linux-fedora33-release
-      optional: true
-      artifacts: false
-    - job: release-x86_64-linux-fedora33-release
-      optional: true
-      artifacts: false
   variables:
     UPSTREAM_PROJECT_PATH: "$CI_PROJECT_PATH"
     UPSTREAM_PROJECT_ID: "$CI_PROJECT_ID"
@@ -703,30 +704,56 @@ test-bootstrap:
     strategy: "depend"
 
 hackage-lint:
+  needs:
+    - job: x86_64-linux-deb10-numa-slow-validate
+      optional: true
+      artifacts: false
+    - job: nightly-x86_64-linux-deb10-numa-slow-validate
+      optional: true
+      artifacts: false
   extends: .hackage
   variables:
-    EXTRA_HC_OPTS: "-dcore-lint"
+    SLOW_VALIDATE: 1
+    EXTRA_HC_OPTS: "-dlint"
+  # No for release jobs because there isn't a slow-valdate bindist. There is an
+  # automatic pipeline for release bindists (see release-hackage-lint)
+  rules:
+    - if: '$RELEASE_JOB != "yes"'
   when: manual
 
 hackage-label-lint:
+  needs:
+    - job: x86_64-linux-deb10-numa-slow-validate
+      optional: true
+      artifacts: false
   extends: .hackage
   variables:
-    EXTRA_HC_OPTS: "-dcore-lint"
+    SLOW_VALIDATE: 1
+    EXTRA_HC_OPTS: "-dlint"
   rules:
     - if: '$CI_MERGE_REQUEST_LABELS =~ /.*user-facing.*/'
 
-# The head.hackage job is split into two jobs because enabling `-dcore-lint`
+# The head.hackage job is split into two jobs because enabling `-dlint`
 # affects the total allocation numbers for the simplifier portion significantly.
 nightly-hackage-lint:
+  needs:
+    - job: nightly-x86_64-linux-deb10-numa-slow-validate
+      optional: true
+      artifacts: false
   rules:
     - if: $NIGHTLY
       variables:
         NIGHTLY: "$NIGHTLY"
   extends: .hackage
   variables:
-    EXTRA_HC_OPTS: "-dcore-lint"
+    SLOW_VALIDATE: 1
+    EXTRA_HC_OPTS: "-dlint"
 
 nightly-hackage-perf:
+  needs:
+    - job: nightly-x86_64-linux-fedora33-release
+      optional: true
+      artifacts: false
   rules:
     - if: $NIGHTLY
       variables:
@@ -738,6 +765,18 @@ nightly-hackage-perf:
     # Ask head.hackage to generate eventlogs
     EVENTLOGGING: 1
 
+release-hackage-lint:
+  needs:
+    - job: release-x86_64-linux-fedora33-release
+      optional: true
+      artifacts: false
+  rules:
+    - if: '$RELEASE_JOB == "yes"'
+  extends: .hackage
+  variables:
+    # No slow-validate bindist on release pipeline
+    EXTRA_HC_OPTS: "-dlint"
+
 ############################################################
 # Nofib testing
 # (Disabled: See #21859)


=====================================
libraries/base/System/Exit.hs
=====================================
@@ -45,16 +45,14 @@ import GHC.IO.Exception
 -- A program that terminates successfully without calling 'exitWith'
 -- explicitly is treated as if it had called 'exitWith' 'ExitSuccess'.
 --
--- As an 'ExitCode' is not an 'IOError', 'exitWith' bypasses
--- the error handling in the 'IO' monad and cannot be intercepted by
--- 'catch' from the "Prelude".  However it is a 'Control.Exception.SomeException', and can
--- be caught using the functions of "Control.Exception".  This means
--- that cleanup computations added with 'Control.Exception.bracket'
--- (from "Control.Exception") are also executed properly on 'exitWith'.
+-- As an 'ExitCode' is an 'Control.Exception.Exception', it can be
+-- caught using the functions of "Control.Exception".  This means that
+-- cleanup computations added with 'Control.Exception.bracket' (from
+-- "Control.Exception") are also executed properly on 'exitWith'.
 --
 -- Note: in GHC, 'exitWith' should be called from the main program
 -- thread in order to exit the process.  When called from another
--- thread, 'exitWith' will throw an 'ExitException' as normal, but the
+-- thread, 'exitWith' will throw an 'ExitCode' as normal, but the
 -- exception will not cause the process itself to exit.
 --
 exitWith :: ExitCode -> IO a


=====================================
rts/Libdw.c
=====================================
@@ -290,7 +290,7 @@ static bool set_initial_registers(Dwfl_Thread *thread, void *arg);
 #if defined(x86_64_HOST_ARCH)
 static bool set_initial_registers(Dwfl_Thread *thread,
                                   void *arg STG_UNUSED) {
-    Dwarf_Word regs[17];
+    Dwarf_Word regs[17] = {};
     __asm__ ("movq %%rax, 0x00(%0)\n\t"
              "movq %%rdx, 0x08(%0)\n\t"
              "movq %%rcx, 0x10(%0)\n\t"
@@ -318,7 +318,7 @@ static bool set_initial_registers(Dwfl_Thread *thread,
 #elif defined(i386_HOST_ARCH)
 static bool set_initial_registers(Dwfl_Thread *thread,
                                   void *arg STG_UNUSED) {
-    Dwarf_Word regs[9];
+    Dwarf_Word regs[9] = {};
     __asm__ ("movl %%eax, 0x00(%0)\n\t"
              "movl %%ecx, 0x04(%0)\n\t"
              "movl %%edx, 0x08(%0)\n\t"
@@ -339,7 +339,7 @@ static bool set_initial_registers(Dwfl_Thread *thread,
 #elif defined(s390x_HOST_ARCH)
 static bool set_initial_registers(Dwfl_Thread *thread,
                                   void *arg STG_UNUSED) {
-    Dwarf_Word regs[32];
+    Dwarf_Word regs[32] = {};
     __asm__ ("stmg %%r0,%%r15,0(%0)\n\t"
              "std  %%f0,  128(0,%0)\n\t"
              "std  %%f2,  136(0,%0)\n\t"


=====================================
rts/sm/Storage.c
=====================================
@@ -1404,7 +1404,10 @@ allocatePinned (Capability *cap, W_ n /*words*/, W_ alignment /*bytes*/, W_ alig
 void
 dirty_MUT_VAR(StgRegTable *reg, StgMutVar *mvar, StgClosure *old)
 {
+#if defined(THREADED_RTS)
+    // This doesn't hold in the threaded RTS as we may race with another thread.
     ASSERT(RELAXED_LOAD(&mvar->header.info) == &stg_MUT_VAR_CLEAN_info);
+#endif
 
     Capability *cap = regTableToCapability(reg);
     // No barrier required here as no other heap object fields are read. See



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/015ad1dba71238a877931edf2dadf986088afc8a...fec566aed45e2cc82de8b56b8753eef30ec2a923

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/015ad1dba71238a877931edf2dadf986088afc8a...fec566aed45e2cc82de8b56b8753eef30ec2a923
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/20221220/8c7d900d/attachment-0001.html>


More information about the ghc-commits mailing list