rts/NonMoving: Fix various Windows build issues
authorBen Gamari <ben@smart-cactus.org>
Thu, 7 Nov 2019 00:20:08 +0000 (19:20 -0500)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Fri, 8 Nov 2019 02:25:36 +0000 (21:25 -0500)
The Windows build seems to be stricter about not providing threading
primitives in the non-threaded RTS.

rts/sm/NonMovingMark.c
rts/sm/NonMovingSweep.c

index 03e3428..b7ab772 100644 (file)
@@ -218,19 +218,18 @@ StgIndStatic *debug_caf_list_snapshot = (StgIndStatic*)END_OF_CAF_LIST;
  *         return x
  *
  */
-static Mutex upd_rem_set_lock;
 bdescr *upd_rem_set_block_list = NULL;
-
 #if defined(THREADED_RTS)
+static Mutex upd_rem_set_lock;
+
 /* Used during the mark/sweep phase transition to track how many capabilities
  * have pushed their update remembered sets. Protected by upd_rem_set_lock.
  */
 static volatile StgWord upd_rem_set_flush_count = 0;
-#endif
-
 
 /* Signaled by each capability when it has flushed its update remembered set */
 static Condition upd_rem_set_flushed_cond;
+#endif
 
 /* Indicates to mutators that the write barrier must be respected. Set while
  * concurrent mark is running.
@@ -244,9 +243,9 @@ MarkQueue *current_mark_queue = NULL;
 
 /* Initialise update remembered set data structures */
 void nonmovingMarkInitUpdRemSet() {
+#if defined(THREADED_RTS)
     initMutex(&upd_rem_set_lock);
     initCondition(&upd_rem_set_flushed_cond);
-#if defined(THREADED_RTS)
     initMutex(&nonmoving_large_objects_mutex);
 #endif
 }
index cf5fcd7..b390959 100644 (file)
@@ -307,9 +307,11 @@ static void freeChain_lock_max(bdescr *bd, int max_dur)
     freeGroup(bd);
     bd = next_bd;
     if (i == max_dur) {
+#if defined(THREADED_RTS)
         RELEASE_SM_LOCK;
         yieldThread();
         ACQUIRE_SM_LOCK;
+#endif
         i = 0;
     }
     i++;