[commit: ghc] master: Fix a race condition when PROFILING (#8453) (1082f21)

git at git.haskell.org git at git.haskell.org
Sat Nov 2 20:58:31 UTC 2013


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/1082f21b1eaf7b380daefb864959e6cfad1aeec7/ghc

>---------------------------------------------------------------

commit 1082f21b1eaf7b380daefb864959e6cfad1aeec7
Author: Takano Akio <aljee at hyper.cx>
Date:   Thu Oct 17 22:50:43 2013 +0900

    Fix a race condition when PROFILING (#8453)
    
    Signed-off-by: Austin Seipp <austin at well-typed.com>


>---------------------------------------------------------------

1082f21b1eaf7b380daefb864959e6cfad1aeec7
 rts/sm/Evac.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/rts/sm/Evac.c b/rts/sm/Evac.c
index 223e2f3..577edc3 100644
--- a/rts/sm/Evac.c
+++ b/rts/sm/Evac.c
@@ -955,9 +955,15 @@ selector_loop:
 #ifdef PROFILING
               // For the purposes of LDV profiling, we have destroyed
               // the original selector thunk, p.
-              SET_INFO((StgClosure*)p, (StgInfoTable *)info_ptr);
-              OVERWRITING_CLOSURE((StgClosure*)p);
-              SET_INFO((StgClosure*)p, &stg_WHITEHOLE_info);
+              if (era > 0) {
+                  // Only modify the info pointer when LDV profiling is
+                  // enabled.  Note that this is incompatible with parallel GC,
+                  // because it would allow other threads to start evaluating
+                  // the same selector thunk.
+                  SET_INFO((StgClosure*)p, (StgInfoTable *)info_ptr);
+                  OVERWRITING_CLOSURE((StgClosure*)p);
+                  SET_INFO((StgClosure*)p, &stg_WHITEHOLE_info);
+              }
 #endif
 
               // the closure in val is now the "value" of the



More information about the ghc-commits mailing list