[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 2 commits: rts: fix checkClosure error message
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Wed Sep 4 07:00:05 UTC 2024
Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
e58eade2 by Cheng Shao at 2024-09-04T02:59:58-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.
- - - - -
17961736 by Sven Tennie at 2024-09-04T02:59:59-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.)
- - - - -
4 changed files:
- compiler/GHC/CmmToAsm/AArch64/CodeGen.hs
- compiler/GHC/CmmToAsm/AArch64/Instr.hs
- compiler/GHC/CmmToAsm/AArch64/Ppr.hs
- rts/sm/Sanity.c
Changes:
=====================================
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
=====================================
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)
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/50ce9af142800d839d5f988d7db06499dd86115c...1796173632b68c8878976fc04ac9973f16b3619d
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/50ce9af142800d839d5f988d7db06499dd86115c...1796173632b68c8878976fc04ac9973f16b3619d
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/94d1468d/attachment-0001.html>
More information about the ghc-commits
mailing list