From: Simon Marlow Date: Mon, 29 Mar 2010 11:00:36 +0000 (+0000) Subject: Add a 'setKeepCAFs' external function (#3900) X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;ds=sidebyside;h=e74936e39e845923c2e2a239524037d11dee2abd;p=ghc-hetmet.git Add a 'setKeepCAFs' external function (#3900) --- diff --git a/includes/rts/storage/GC.h b/includes/rts/storage/GC.h index 9749c02..15c22ab 100644 --- a/includes/rts/storage/GC.h +++ b/includes/rts/storage/GC.h @@ -171,6 +171,9 @@ void newCAF (StgRegTable *reg, StgClosure *); void newDynCAF (StgRegTable *reg, StgClosure *); void revertCAFs (void); +// Request that all CAFs are retained indefinitely. +void setKeepCAFs (void); + /* ----------------------------------------------------------------------------- This is the write barrier for MUT_VARs, a.k.a. IORefs. A MUT_VAR_CLEAN object is not on the mutable list; a MUT_VAR_DIRTY diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c index d7e5b67..6aedb96 100644 --- a/rts/sm/Storage.c +++ b/rts/sm/Storage.c @@ -268,7 +268,6 @@ freeStorage (void) void newCAF(StgRegTable *reg, StgClosure* caf) { -#ifdef DYNAMIC if(keepCAFs) { // HACK: @@ -289,7 +288,6 @@ newCAF(StgRegTable *reg, StgClosure* caf) RELEASE_SM_LOCK; } else -#endif { // Put this CAF on the mutable list for the old generation. ((StgIndStatic *)caf)->saved_info = NULL; @@ -297,6 +295,13 @@ newCAF(StgRegTable *reg, StgClosure* caf) } } +// External API for setting the keepCAFs flag. see #3900. +void +setKeepCAFs (void) +{ + keepCAFs = 1; +} + // An alternate version of newCaf which is used for dynamically loaded // object code in GHCi. In this case we want to retain *all* CAFs in // the object code, because they might be demanded at any time from an