Fix #3320: we forgot to save/restore the GC register variable
authorSimon Marlow <marlowsd@gmail.com>
Thu, 10 Sep 2009 15:16:23 +0000 (15:16 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Thu, 10 Sep 2009 15:16:23 +0000 (15:16 +0000)
rts/sm/GC.c

index d2217b8..febede6 100644 (file)
@@ -1066,6 +1066,11 @@ loop:
 void
 gcWorkerThread (Capability *cap)
 {
 void
 gcWorkerThread (Capability *cap)
 {
+    gc_thread *saved_gct;
+
+    // necessary if we stole a callee-saves register for gct:
+    saved_gct = gct;
+
     cap->in_gc = rtsTrue;
 
     gct = gc_threads[cap->no];
     cap->in_gc = rtsTrue;
 
     gct = gc_threads[cap->no];
@@ -1105,6 +1110,8 @@ gcWorkerThread (Capability *cap)
                gct->thread_index);
     ACQUIRE_SPIN_LOCK(&gct->mut_spin);
     debugTrace(DEBUG_gc, "GC thread %d on my way...", gct->thread_index);
                gct->thread_index);
     ACQUIRE_SPIN_LOCK(&gct->mut_spin);
     debugTrace(DEBUG_gc, "GC thread %d on my way...", gct->thread_index);
+
+    SET_GCT(saved_gct);
 }
 
 #endif
 }
 
 #endif