From a0dcdfd1c91e0b13b5f1bf4c5e49b9593414b1d6 Mon Sep 17 00:00:00 2001 From: Viktor Dukhovni Date: Sat, 2 Jan 2021 01:00:51 -0500 Subject: Maintain invariant: MVars on mut_list are dirty The fix for 18919 was somewhat incomplete: while the MVars were correctly added to the mut_list via dirty_MVAR(), their info table remained "clean". While this is mostly harmless in non-debug builds, it trips an assertion in the debug build, and may result in the MVar being needlessly being added to the mut_list multiple times. Resolves: #19145 --- rts/PrimOps.cmm | 2 ++ rts/Threads.c | 1 + 2 files changed, 3 insertions(+) diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm index 7f7565cfd9..6ce206f139 100644 --- a/rts/PrimOps.cmm +++ b/rts/PrimOps.cmm @@ -1836,6 +1836,7 @@ loop: // Resolve #18919. ccall dirty_MVAR(BaseReg "ptr", mvar "ptr", StgMVar_value(mvar) "ptr"); + info = stg_MVAR_DIRTY_info; } } @@ -1926,6 +1927,7 @@ loop: // Resolve #18919. ccall dirty_MVAR(BaseReg "ptr", mvar "ptr", StgMVar_value(mvar) "ptr"); + info = stg_MVAR_DIRTY_info; } } diff --git a/rts/Threads.c b/rts/Threads.c index 39616655ab..2560a4d765 100644 --- a/rts/Threads.c +++ b/rts/Threads.c @@ -810,6 +810,7 @@ loop: if (info == &stg_MVAR_CLEAN_info) { // Resolve #18919. dirty_MVAR(&cap->r, (StgClosure*)mvar, mvar->value); + info = &stg_MVAR_DIRTY_info; } } -- cgit v1.2.1