[Git][ghc/ghc][wip/T23490-part2] 8 commits: rts: fix checkClosure error message

Matthew Craven (@clyring) gitlab at gitlab.haskell.org
Wed Sep 4 17:29:07 UTC 2024



Matthew Craven pushed to branch wip/T23490-part2 at Glasgow Haskell Compiler / GHC


Commits:
0d3bc2fa by Cheng Shao at 2024-09-04T07:20:06-04:00
rts: fix checkClosure error message

This patch fixes an error message in checkClosure() when the closure
has already been evacuated. The previous logic was meant to print the
evacuated closure's type in the error message, but it was completely
wrong, given info was not really an info table, but a tagged pointer
that points to the closure's new address.

- - - - -
fb0a4e5c by Sven Tennie at 2024-09-04T07:20:43-04:00
MO_AcquireFence: Less restrictive barrier

GCC and CLang translate the built-in `atomic_thread_fence(memory_order_acquire)`
to `dmb ishld`, which is a bit less restrictive than `dmb ish` (which
also implies stores.)

- - - - -
05b0816d by Matthew Craven at 2024-09-04T13:26:14-04:00
Bump transformers submodule

The svg image files mentioned in transformers.cabal were
previously not checked in, which broke sdist generation.

- - - - -
76e7295c by Matthew Craven at 2024-09-04T13:27:53-04:00
Remove reference to non-existent file in haddock.cabal

- - - - -
228e48bc by Matthew Craven at 2024-09-04T13:27:53-04:00
Update hackage index state

- - - - -
266a978b by Matthew Craven at 2024-09-04T13:27:53-04:00
Move tests T11462 and T11525 into tests/tcplugins

- - - - -
58090b05 by Matthew Craven at 2024-09-04T13:28:24-04:00
Repair the 'build-cabal' hadrian target

Fixes #23117. Fixes #23281. Fixes #23490.

This required:
 * Updating the bit-rotted compiler/Setup.hs and its setup-depends
 * Listing a few recently-added libraries and utilities
   in cabal.project-reinstall
 * Setting allow-boot-library-installs to 'True' since Cabal
   now considers the 'ghc' package itself a boot library for
   the purposes of this flag

Additionally, the allow-newer block in cabal.project-reinstall
was removed.  This block was probably added because when the
libraries/Cabal submodule is too new relative to the cabal-install
executable, solving the setup-depends for any package with a custom
setup requires building an old Cabal (from Hackage) against the
in-tree version of base, and this can fail un-necessarily due to
tight version bounds on base.  However, the blind allow-newer can
also cause the solver to go berserk and choose a stupid build plan
that has no business succeeding, and the failures when this happens
are dreadfully confusing. (See #23281 and #24363.)

Why does setup-depends solving insist on an old version of Cabal? See:
  https://github.com/haskell/cabal/blob/0a0b33983b0f022b9697f7df3a69358ee9061a89/cabal-install/src/Distribution/Client/ProjectPlanning.hs#L1393-L1410

The right solution here is probably to use the in-tree cabal-install
from libraries/Cabal/cabal-install with the build-cabal target rather
than whatever the environment happens to provide.  But this is left
for future work.

- - - - -
a547477e by Matthew Craven at 2024-09-04T13:28:33-04:00
Revert "CI: Disable the test-cabal-reinstall job"

This reverts commit 38c3afb64d3ffc42f12163c6f0f0d5c414aa8255.

- - - - -


18 changed files:

- .gitlab-ci.yml
- .gitlab/ci.sh
- cabal.project-reinstall
- compiler/GHC/CmmToAsm/AArch64/CodeGen.hs
- compiler/GHC/CmmToAsm/AArch64/Instr.hs
- compiler/GHC/CmmToAsm/AArch64/Ppr.hs
- compiler/Setup.hs
- compiler/ghc.cabal.in
- hadrian/cabal.project
- libraries/transformers
- rts/sm/Sanity.c
- testsuite/tests/typecheck/should_compile/T11462.hs → testsuite/tests/tcplugins/T11462.hs
- testsuite/tests/typecheck/should_compile/T11462_Plugin.hs → testsuite/tests/tcplugins/T11462_Plugin.hs
- testsuite/tests/typecheck/should_compile/T11525.hs → testsuite/tests/tcplugins/T11525.hs
- testsuite/tests/typecheck/should_compile/T11525_Plugin.hs → testsuite/tests/tcplugins/T11525_Plugin.hs
- testsuite/tests/tcplugins/all.T
- testsuite/tests/typecheck/should_compile/all.T
- utils/haddock/haddock.cabal


Changes:

=====================================
.gitlab-ci.yml
=====================================
@@ -489,21 +489,16 @@ stack-hadrian-build:
 # Testing reinstallable ghc codepath
 ####################################
 
-# As documented on the original ticket #19896, this feature already has a long
-# way to go before it can actually be used. Meanwhile, parts of it have
-# bit-rotted, possibly related to some Cabal change. The job is disabled for
-# now.
-#
-# test-cabal-reinstall-x86_64-linux-deb10:
-#   extends: nightly-x86_64-linux-deb10-validate
-#   stage: full-build
-#   variables:
-#     REINSTALL_GHC: "yes"
-#     BUILD_FLAVOUR: validate
-#     TEST_ENV: "x86_64-linux-deb10-cabal-install"
-#   rules:
-#     - if: $NIGHTLY
-#     - if: '$CI_MERGE_REQUEST_LABELS =~ /.*test-reinstall.*/'
+test-cabal-reinstall-x86_64-linux-deb10:
+  extends: nightly-x86_64-linux-deb10-validate
+  stage: full-build
+  variables:
+    REINSTALL_GHC: "yes"
+    BUILD_FLAVOUR: validate
+    TEST_ENV: "x86_64-linux-deb10-cabal-install"
+  rules:
+    - if: $NIGHTLY
+    - if: '$CI_MERGE_REQUEST_LABELS =~ /.*test-reinstall.*/'
 
 ########################################
 # Testing ABI is invariant across builds


=====================================
.gitlab/ci.sh
=====================================
@@ -7,7 +7,7 @@
 set -Eeuo pipefail
 
 # Configuration:
-HACKAGE_INDEX_STATE="2024-05-13T15:04:38Z"
+HACKAGE_INDEX_STATE="2024-06-27T02:07:41Z"
 MIN_HAPPY_VERSION="1.20"
 MIN_ALEX_VERSION="3.2.6"
 


=====================================
cabal.project-reinstall
=====================================
@@ -12,11 +12,13 @@ packages: ./compiler
           -- ./libraries/deepseq/
           ./libraries/directory/
           ./libraries/exceptions/
+          ./libraries/file-io/
           ./libraries/filepath/
           -- ./libraries/ghc-bignum/
            ./libraries/ghc-boot/
           -- ./libraries/ghc-boot-th/
           ./libraries/ghc-compact
+          ./libraries/ghc-experimental
           ./libraries/ghc-heap
           ./libraries/ghci
           -- ./libraries/ghc-prim
@@ -25,6 +27,7 @@ packages: ./compiler
           ./libraries/hpc
           -- ./libraries/integer-gmp
           ./libraries/mtl/
+          ./libraries/os-string/
           ./libraries/parsec/
           -- ./libraries/pretty/
           ./libraries/process/
@@ -39,7 +42,10 @@ packages: ./compiler
           ./libraries/Win32/
           ./libraries/xhtml/
           ./utils/ghc-pkg
+          ./utils/ghc-toolchain
+          ./utils/ghc-toolchain/exe
           ./utils/haddock
+          ./utils/haddock/haddock-api
           ./utils/hp2ps
           ./utils/hpc
           ./utils/hsc2hs
@@ -61,15 +67,10 @@ constraints: ghc +internal-interpreter +dynamic-system-linke,
              any.pretty installed,
              any.template-haskell installed
 
-allow-newer:
-  ghc-paths:Cabal,
-  *:base,
-  *:ghc-prim,
-  tree-diff:time
 
 benchmarks: False
 tests: False
-allow-boot-library-installs: False
+allow-boot-library-installs: True
 
 -- Workaround for https://github.com/haskell/cabal/issues/7297
 package *


=====================================
compiler/GHC/CmmToAsm/AArch64/CodeGen.hs
=====================================
@@ -1990,9 +1990,13 @@ genCCall target dest_regs arg_regs = do
         MO_SubIntC    _w -> unsupported mop
 
         -- Memory Ordering
-        MO_AcquireFence     ->  return (unitOL DMBISH)
-        MO_ReleaseFence     ->  return (unitOL DMBISH)
-        MO_SeqCstFence      ->  return (unitOL DMBISH)
+        -- Set flags according to their C pendants (stdatomic.h):
+        -- atomic_thread_fence(memory_order_acquire); // -> dmb ishld
+        MO_AcquireFence     ->  return . unitOL $ DMBISH DmbLoad
+        -- atomic_thread_fence(memory_order_release); // -> dmb ish
+        MO_ReleaseFence     ->  return . unitOL $ DMBISH DmbLoadStore
+        -- atomic_thread_fence(memory_order_seq_cst); // -> dmb ish
+        MO_SeqCstFence      ->  return . unitOL $ DMBISH DmbLoadStore
         MO_Touch            ->  return nilOL -- Keep variables live (when using interior pointers)
         -- Prefetch
         MO_Prefetch_Data _n -> return nilOL -- Prefetch hint.


=====================================
compiler/GHC/CmmToAsm/AArch64/Instr.hs
=====================================
@@ -134,7 +134,7 @@ regUsageOfInstr platform instr = case instr of
   LDAR _ dst src           -> usage (regOp src, regOp dst)
 
   -- 8. Synchronization Instructions -------------------------------------------
-  DMBISH                   -> usage ([], [])
+  DMBISH _                 -> usage ([], [])
 
   -- 9. Floating Point Instructions --------------------------------------------
   FMOV dst src             -> usage (regOp src, regOp dst)
@@ -281,7 +281,7 @@ patchRegsOfInstr instr env = case instr of
     LDAR f o1 o2   -> LDAR f (patchOp o1) (patchOp o2)
 
     -- 8. Synchronization Instructions -----------------------------------------
-    DMBISH         -> DMBISH
+    DMBISH c       -> DMBISH c
 
     -- 9. Floating Point Instructions ------------------------------------------
     FMOV o1 o2     -> FMOV (patchOp o1) (patchOp o2)
@@ -649,7 +649,7 @@ data Instr
     | BCOND Cond Target   -- branch with condition. b.<cond>
 
     -- 8. Synchronization Instructions -----------------------------------------
-    | DMBISH
+    | DMBISH DMBISHFlags
     -- 9. Floating Point Instructions
     -- move to/from general purpose <-> floating, or floating to floating
     | FMOV Operand Operand
@@ -672,6 +672,9 @@ data Instr
     -- - fnmadd: d = - r1 * r2 - r3
     | FMA FMASign Operand Operand Operand Operand
 
+data DMBISHFlags = DmbLoad | DmbLoadStore
+  deriving (Eq, Show)
+
 instrCon :: Instr -> String
 instrCon i =
     case i of


=====================================
compiler/GHC/CmmToAsm/AArch64/Ppr.hs
=====================================
@@ -527,7 +527,8 @@ pprInstr platform instr = case instr of
   LDAR _f o1 o2 -> op2 (text "\tldar") o1 o2
 
   -- 8. Synchronization Instructions -------------------------------------------
-  DMBISH -> line $ text "\tdmb ish"
+  DMBISH DmbLoadStore -> line $ text "\tdmb ish"
+  DMBISH DmbLoad -> line $ text "\tdmb ishld"
 
   -- 9. Floating Point Instructions --------------------------------------------
   FMOV o1 o2 -> op2 (text "\tfmov") o1 o2


=====================================
compiler/Setup.hs
=====================================
@@ -1,4 +1,4 @@
-{-# LANGUAGE RecordWildCards #-}
+{-# LANGUAGE NamedFieldPuns #-}
 module Main where
 
 import Distribution.Simple
@@ -52,10 +52,12 @@ primopIncls =
     , ("primop-vector-tys-exports.hs-incl", "--primop-vector-tys-exports")
     , ("primop-vector-tycons.hs-incl"     , "--primop-vector-tycons")
     , ("primop-docs.hs-incl"              , "--wired-in-docs")
+    , ("primop-deprecations.hs-incl"      , "--wired-in-deprecations")
     ]
 
 ghcAutogen :: Verbosity -> LocalBuildInfo -> IO ()
-ghcAutogen verbosity lbi at LocalBuildInfo{..} = do
+ghcAutogen verbosity lbi at LocalBuildInfo{pkgDescrFile,withPrograms,componentNameMap}
+  = do
   -- Get compiler/ root directory from the cabal file
   let Just compilerRoot = takeDirectory <$> pkgDescrFile
 
@@ -77,7 +79,7 @@ ghcAutogen verbosity lbi at LocalBuildInfo{..} = do
   -- Call genprimopcode to generate *.hs-incl
   forM_ primopIncls $ \(file,command) -> do
     contents <- readProcess "genprimopcode" [command] primopsStr
-    rewriteFileEx verbosity (buildDir </> file) contents
+    rewriteFileEx verbosity (buildDir lbi </> file) contents
 
   -- Write GHC.Platform.Constants
   let platformConstantsPath = autogenPackageModulesDir lbi </> "GHC/Platform/Constants.hs"


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


=====================================
hadrian/cabal.project
=====================================
@@ -12,7 +12,7 @@ packages: ./
 
 -- This essentially freezes the build plan for hadrian
 -- It would be wise to keep this up to date with the state set in ci.sh
-index-state: 2024-05-13T15:04:38Z
+index-state: 2024-06-27T02:07:41Z
 
 -- unordered-containers-0.2.20-r1 requires template-haskell < 2.22
 -- ghc-9.10 has template-haskell-2.22.0.0


=====================================
libraries/transformers
=====================================
@@ -1 +1 @@
-Subproject commit ba3503905dec072acc6515323c884706efd4dbb4
+Subproject commit ac377ff5abfb65d84988a5b9edb2231df1c0cea3


=====================================
rts/sm/Sanity.c
=====================================
@@ -357,7 +357,8 @@ checkClosure( const StgClosure* p )
     info = ACQUIRE_LOAD(&p->header.info);
 
     if (IS_FORWARDING_PTR(info)) {
-        barf("checkClosure: found EVACUATED closure %d", info->type);
+        ASSERT(LOOKS_LIKE_CLOSURE_PTR(info));
+        barf("checkClosure: found EVACUATED closure %u", GET_INFO((StgClosure*)UN_FORWARDING_PTR(info))->type);
     }
 
 #if defined(PROFILING)


=====================================
testsuite/tests/typecheck/should_compile/T11462.hs → testsuite/tests/tcplugins/T11462.hs
=====================================


=====================================
testsuite/tests/typecheck/should_compile/T11462_Plugin.hs → testsuite/tests/tcplugins/T11462_Plugin.hs
=====================================


=====================================
testsuite/tests/typecheck/should_compile/T11525.hs → testsuite/tests/tcplugins/T11525.hs
=====================================


=====================================
testsuite/tests/typecheck/should_compile/T11525_Plugin.hs → testsuite/tests/tcplugins/T11525_Plugin.hs
=====================================


=====================================
testsuite/tests/tcplugins/all.T
=====================================
@@ -106,3 +106,10 @@ test('TcPlugin_CtId'
     , [ 'TcPlugin_CtId.hs'
       , '-dynamic -package ghc' if have_dynamic() else '-package ghc' ]
     )
+
+test('T11462', [js_broken(22261), req_th], multi_compile,
+     [None, [('T11462_Plugin.hs', '-package ghc'), ('T11462.hs', '')],
+      '-dynamic' if have_dynamic() else ''])
+test('T11525', [js_broken(22261), req_th], multi_compile,
+     [None, [('T11525_Plugin.hs', '-package ghc'), ('T11525.hs', '')],
+      '-dynamic' if have_dynamic() else ''])


=====================================
testsuite/tests/typecheck/should_compile/all.T
=====================================
@@ -491,9 +491,6 @@ test('T10592', normal, compile, [''])
 test('T11305', normal, compile, [''])
 test('T11254', normal, compile, [''])
 test('T11379', normal, compile, [''])
-test('T11462', [js_broken(22261), req_th], multi_compile,
-     [None, [('T11462_Plugin.hs', '-package ghc'), ('T11462.hs', '')],
-      '-dynamic' if have_dynamic() else ''])
 test('T11480', normal, compile, [''])
 test('RebindHR', normal, compile, [''])
 test('RebindNegate', normal, compile, [''])
@@ -559,9 +556,6 @@ test('T11723', normal, compile, [''])
 test('T12987', normal, compile, [''])
 test('T11736', normal, compile, [''])
 test('T13248', expect_broken(13248), compile, [''])
-test('T11525', [js_broken(22261), req_th], multi_compile,
-     [None, [('T11525_Plugin.hs', '-package ghc'), ('T11525.hs', '')],
-      '-dynamic' if have_dynamic() else ''])
 test('T12923_1', normal, compile, [''])
 test('T21208', normal, compile, [''])
 test('T12923_2', normal, compile, [''])


=====================================
utils/haddock/haddock.cabal
=====================================
@@ -43,7 +43,6 @@ extra-source-files:
   doc/README.md
   doc/*.rst
   doc/conf.py
-  haddock-api/src/haddock.sh
   html-test/src/*.hs
   html-test/ref/*.html
   hypsrc-test/src/*.hs



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/dc86ccc205c68eb632661894689724dec4174192...a547477e49eb032a0d653c3c88f51fc3eca8171a

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/dc86ccc205c68eb632661894689724dec4174192...a547477e49eb032a0d653c3c88f51fc3eca8171a
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/20240904/cd544f95/attachment-0001.html>


More information about the ghc-commits mailing list