tiny GC optimisation
authorSimon Marlow <marlowsd@gmail.com>
Mon, 29 Mar 2010 14:45:51 +0000 (14:45 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Mon, 29 Mar 2010 14:45:51 +0000 (14:45 +0000)
rts/sm/Evac.c
rts/sm/GCAux.c
rts/sm/Storage.c

index 37cbee5..9577b2d 100644 (file)
@@ -415,8 +415,7 @@ loop:
           * on the CAF list, so don't do anything with it here (we'll
           * scavenge it later).
           */
-         if (((StgIndStatic *)q)->saved_info == NULL) {
-             if (*IND_STATIC_LINK((StgClosure *)q) == NULL) {
+          if (*IND_STATIC_LINK((StgClosure *)q) == NULL) {
 #ifndef THREADED_RTS
                  *IND_STATIC_LINK((StgClosure *)q) = gct->static_objects;
                  gct->static_objects = (StgClosure *)q;
@@ -429,7 +428,6 @@ loop:
                       gct->static_objects = (StgClosure *)q;
                   }
 #endif
-             }
          }
          return;
          
index 404e9bb..3962bf0 100644 (file)
@@ -126,7 +126,7 @@ revertCAFs( void )
        c->saved_info = NULL;
        // could, but not necessary: c->static_link = NULL; 
     }
-    revertible_caf_list = NULL;
+    revertible_caf_list = END_OF_STATIC_LIST;
 }
 
 void
@@ -134,12 +134,14 @@ markCAFs (evac_fn evac, void *user)
 {
     StgIndStatic *c;
 
-    for (c = (StgIndStatic *)caf_list; c != NULL; 
+    for (c = (StgIndStatic *)caf_list;
+         c != (StgIndStatic*)END_OF_STATIC_LIST; 
         c = (StgIndStatic *)c->static_link) 
     {
        evac(user, &c->indirectee);
     }
-    for (c = (StgIndStatic *)revertible_caf_list; c != NULL; 
+    for (c = (StgIndStatic *)revertible_caf_list; 
+         c != (StgIndStatic*)END_OF_STATIC_LIST; 
         c = (StgIndStatic *)c->static_link) 
     {
        evac(user, &c->indirectee);
index 0234400..3b9775e 100644 (file)
@@ -177,8 +177,8 @@ initStorage( void )
   allocNurseries();
 
   weak_ptr_list = NULL;
-  caf_list = NULL;
-  revertible_caf_list = NULL;
+  caf_list = END_OF_STATIC_LIST;
+  revertible_caf_list = END_OF_STATIC_LIST;
    
   /* initialise the allocate() interface */
   alloc_blocks_lim = RtsFlags.GcFlags.minAllocAreaSize;
@@ -231,9 +231,8 @@ freeStorage (void)
      
       - builds a BLACKHOLE in the heap
       - pushes an update frame pointing to the BLACKHOLE
-      - invokes UPD_CAF(), which:
-          - calls newCaf, below
-         - updates the CAF with a static indirection to the BLACKHOLE
+      - calls newCaf, below
+      - updates the CAF with a static indirection to the BLACKHOLE
       
    Why do we build an BLACKHOLE in the heap rather than just updating
    the thunk directly?  It's so that we only need one kind of update