[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 3 commits: Correct `exitWith` Haddocks
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Sun Dec 18 07:32:17 UTC 2022
Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
f2f7a5e6 by amesgen at 2022-12-18T02:32:06-05:00
Correct `exitWith` Haddocks
The `IOError`-specific `catch` in the Prelude is long gone.
- - - - -
cc6dc1b0 by Ben Gamari at 2022-12-18T02:32:09-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.
- - - - -
937b3f4e by Ben Gamari at 2022-12-18T02:32:09-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
- - - - -
3 changed files:
- libraries/base/System/Exit.hs
- rts/Libdw.c
- rts/sm/Storage.c
Changes:
=====================================
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/2961d83cd25abc817a097b666ab085a19f6c6d67...937b3f4e66d13bb1882ae90882348651533dcdc4
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2961d83cd25abc817a097b666ab085a19f6c6d67...937b3f4e66d13bb1882ae90882348651533dcdc4
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/20221218/ff400476/attachment-0001.html>
More information about the ghc-commits
mailing list