[Git][ghc/ghc][wip/tsan/prep] rts: Simplify atomicModifyMutVar2# implementation

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Mon Jul 24 17:59:34 UTC 2023



Ben Gamari pushed to branch wip/tsan/prep at Glasgow Haskell Compiler / GHC


Commits:
04b2fc72 by Ben Gamari at 2023-07-24T13:59:28-04:00
rts: Simplify atomicModifyMutVar2# implementation

Previously we would perform a redundant load in the non-threaded RTS in
atomicModifyMutVar2# implementation for the benefit of the non-moving
GC's write barrier. Eliminate this.

- - - - -


1 changed file:

- rts/PrimOps.cmm


Changes:

=====================================
rts/PrimOps.cmm
=====================================
@@ -785,12 +785,13 @@ stg_atomicModifyMutVar2zh ( gcptr mv, gcptr f )
     (h) = prim %cmpxchgW(mv + SIZEOF_StgHeader + OFFSET_StgMutVar_var, x, y);
     if (h != x) { goto retry; }
 #else
-    h = StgMutVar_var(mv);
     StgMutVar_var(mv) = y;
 #endif
 
-    if (GET_INFO(mv) == stg_MUT_VAR_CLEAN_info) {
-        ccall dirty_MUT_VAR(BaseReg "ptr", mv "ptr", h "ptr");
+    W_ info;
+    info = %relaxed GET_INFO(mv);
+    if (info == stg_MUT_VAR_CLEAN_info) {
+        ccall dirty_MUT_VAR(BaseReg "ptr", mv "ptr", x "ptr");
     }
 
     return (x,z);



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/04b2fc724b86703c619d55f17c7047efdf297b8c

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/04b2fc724b86703c619d55f17c7047efdf297b8c
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/20230724/91369749/attachment-0001.html>


More information about the ghc-commits mailing list