[llvm-commits] [vmkit] r52404 - /vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Tue Jun 17 07:19:35 PDT 2008


Author: geoffray
Date: Tue Jun 17 09:19:35 2008
New Revision: 52404

URL: http://llvm.org/viewvc/llvm-project?rev=52404&view=rev
Log:
Unlock the allocation lock before finalization. Call finalization methods
before freeing memory.


Modified:
    vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp

Modified: vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp?rev=52404&r1=52403&r2=52404&view=diff

==============================================================================
--- vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp (original)
+++ vmkit/trunk/lib/Mvm/GCMmap2/gccollector.cpp Tue Jun 17 09:19:35 2008
@@ -81,12 +81,11 @@
   finalizable.attrape(unused_nodes);
 
   status = stat_alloc;
-#ifdef HAVE_PTHREAD
-  threads->collectionFinished();
-#endif
   
+  unlock();
+
   /* kill everyone */
-  GCChunkNode *next;
+  GCChunkNode *next = 0;
 
   for(cur=finalizable.next(); cur!=&finalizable; cur=next) {
 #ifdef SERVICE_GC
@@ -98,10 +97,20 @@
     destructor_t dest = c->getDestructor();
     if (dest)
       dest(c);
-    
+  }
+  
+  next = 0;
+  for(cur=finalizable.next(); cur!=&finalizable; cur=next) {
     //printf("    !!!! reject %p [%p]\n", cur->chunk()->_2gc(), cur);
+    next = cur->next();
     allocator->reject_chunk(cur);
   }
+
+  lock();
+
+#ifdef HAVE_PTHREAD
+  threads->collectionFinished();
+#endif
 }
 
 void GCCollector::collect_unprotect() {





More information about the llvm-commits mailing list