diff --git a/rts/Proftimer.c b/rts/Proftimer.c index be29c06ec8bc5de3669646c3fb94ecd442b1cb84..4f189b581f842622ed46e925df9691591eaaba50 100644 --- a/rts/Proftimer.c +++ b/rts/Proftimer.c @@ -101,7 +101,7 @@ requestHeapCensus( void ){ void initProfTimer( void ) { - performHeapProfile = false; + RELAXED_STORE_ALWAYS(&performHeapProfile, false); ticks_to_heap_profile = RtsFlags.ProfFlags.heapProfileIntervalTicks; @@ -136,7 +136,7 @@ handleProfTick(void) ticks_to_ticky_sample--; if (ticks_to_ticky_sample <= 0) { ticks_to_ticky_sample = RtsFlags.ProfFlags.heapProfileIntervalTicks; - performTickySample = true; + RELAXED_STORE_ALWAYS(&performTickySample, true); } } #endif @@ -145,7 +145,7 @@ handleProfTick(void) ticks_to_heap_profile--; if (ticks_to_heap_profile <= 0) { ticks_to_heap_profile = RtsFlags.ProfFlags.heapProfileIntervalTicks; - performHeapProfile = true; + RELAXED_STORE_ALWAYS(&performHeapProfile, true); } } } diff --git a/rts/Schedule.c b/rts/Schedule.c index 65ce9b2a6496972a592f1fce3df2e56e52897964..be19aac18e5d7cf637633d80b44728382e46ec5b 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -1386,7 +1386,7 @@ scheduleNeedHeapProfile( bool ready_to_gc ) { // When we have +RTS -i0 and we're heap profiling, do a census at // every GC. This lets us get repeatable runs for debugging. - if (performHeapProfile || + if (RELAXED_LOAD(&performHeapProfile) || (RtsFlags.ProfFlags.heapProfileInterval==0 && RtsFlags.ProfFlags.doHeapProfile && ready_to_gc)) { return true; @@ -1947,7 +1947,7 @@ delete_threads_and_gc: // The heap census itself is done during GarbageCollect(). if (heap_census) { - performHeapProfile = false; + RELAXED_STORE(&performHeapProfile, false); } #if defined(THREADED_RTS) diff --git a/rts/sm/GC.c b/rts/sm/GC.c index 200df4a2f598346f615e2be91cceb03f590a39e2..eef653d1cf67553da1f050c1e9a0be6591696108 100644 --- a/rts/sm/GC.c +++ b/rts/sm/GC.c @@ -979,9 +979,9 @@ GarbageCollect (struct GcConfig config, // Post ticky counter sample. // We do this at the end of execution since tickers are registered in the // course of program execution. - if (performTickySample) { + if (RELAXED_LOAD(&performTickySample)) { emitTickyCounterSamples(); - performTickySample = false; + RELAXED_STORE(&performTickySample, false); } #endif