[Git][ghc/ghc][master] 2 commits: rts: Initialize Array# header in listThreads#

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Thu Apr 20 22:34:36 UTC 2023



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
52d3e9b4 by Ben Gamari at 2023-04-20T18:34:11-04:00
rts: Initialize Array# header in listThreads#

Previously the implementation of listThreads# failed to initialize the
header of the created array, leading to various nastiness.

Fixes #23071

- - - - -
1db30fe1 by Ben Gamari at 2023-04-20T18:34:11-04:00
testsuite: Add test for #23071

- - - - -


3 changed files:

- rts/Threads.c
- + testsuite/tests/primops/should_run/T23071.hs
- testsuite/tests/primops/should_run/all.T


Changes:

=====================================
rts/Threads.c
=====================================
@@ -872,6 +872,7 @@ StgMutArrPtrs *listThreads(Capability *cap)
     const StgWord size = n_threads + mutArrPtrsCardTableSize(n_threads);
     StgMutArrPtrs *arr =
         (StgMutArrPtrs *)allocate(cap, sizeofW(StgMutArrPtrs) + size);
+    SET_HDR(arr, &stg_MUT_ARR_PTRS_DIRTY_info, CCS_SYSTEM);
     TICK_ALLOC_PRIM(sizeofW(StgMutArrPtrs), n, 0);
     arr->ptrs = n_threads;
     arr->size = size;


=====================================
testsuite/tests/primops/should_run/T23071.hs
=====================================
@@ -0,0 +1,5 @@
+import Control.Monad
+import GHC.Conc.Sync
+
+main = replicateM_ 1000000 $ listThreads >>= print
+


=====================================
testsuite/tests/primops/should_run/all.T
=====================================
@@ -60,3 +60,4 @@ test('UnliftedTVar2', normal, compile_and_run, [''])
 test('UnliftedWeakPtr', normal, compile_and_run, [''])
 
 test('T21624', normal, compile_and_run, [''])
+test('T23071', ignore_stdout, compile_and_run, [''])



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5c8731244bc13a3d813d2a4d53b3188b28dc8355...1db30fe1dd38dd8ffedfadf3845706fcde02933b

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5c8731244bc13a3d813d2a4d53b3188b28dc8355...1db30fe1dd38dd8ffedfadf3845706fcde02933b
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/20230420/b47891a8/attachment-0001.html>


More information about the ghc-commits mailing list