From 1373cd3085b8dec456e6118c58e940718cb9d559 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Mon, 29 Mar 2010 14:45:51 +0000 Subject: [PATCH] tiny GC optimisation --- rts/sm/Evac.c | 4 +--- rts/sm/GCAux.c | 8 +++++--- rts/sm/Storage.c | 9 ++++----- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/rts/sm/Evac.c b/rts/sm/Evac.c index 37cbee5..9577b2d 100644 --- a/rts/sm/Evac.c +++ b/rts/sm/Evac.c @@ -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; diff --git a/rts/sm/GCAux.c b/rts/sm/GCAux.c index 404e9bb..3962bf0 100644 --- a/rts/sm/GCAux.c +++ b/rts/sm/GCAux.c @@ -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); diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c index 0234400..3b9775e 100644 --- a/rts/sm/Storage.c +++ b/rts/sm/Storage.c @@ -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 -- 1.7.10.4