X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FStable.c;h=b427c94965da2800397f0f7e944181654c873e5f;hb=0a5613f40b0e32cf59966e6b56b807cdbe80aa7b;hp=a2c47d785c64cd1d48c055a2e86d3af2e728edb4;hpb=4d15b247104d9cfe36a4e29f7df00e582e7ec9f0;p=ghc-hetmet.git diff --git a/rts/Stable.c b/rts/Stable.c index a2c47d7..b427c94 100644 --- a/rts/Stable.c +++ b/rts/Stable.c @@ -6,18 +6,12 @@ * * ---------------------------------------------------------------------------*/ -// Make static versions of inline functions in Stable.h: -#define RTS_STABLE_C - #include "PosixSource.h" #include "Rts.h" +#include "RtsAPI.h" + #include "Hash.h" #include "RtsUtils.h" -#include "OSThreads.h" -#include "Storage.h" -#include "RtsAPI.h" -#include "RtsFlags.h" -#include "OSThreads.h" #include "Trace.h" #include "Stable.h" @@ -86,6 +80,8 @@ static unsigned int SPT_size = 0; static Mutex stable_mutex; #endif +static void enlargeStablePtrTable(void); + /* This hash table maps Haskell objects to stable names, so that every * call to lookupStableName on a given object will return the same * stable name. @@ -303,7 +299,7 @@ freeStablePtr(StgStablePtr sp) RELEASE_LOCK(&stable_mutex); } -void +static void enlargeStablePtrTable(void) { nat old_SPT_size = SPT_size; @@ -319,6 +315,23 @@ enlargeStablePtrTable(void) } /* ----------------------------------------------------------------------------- + * We must lock the StablePtr table during GC, to prevent simultaneous + * calls to freeStablePtr(). + * -------------------------------------------------------------------------- */ + +void +stablePtrPreGC(void) +{ + ACQUIRE_LOCK(&stable_mutex); +} + +void +stablePtrPostGC(void) +{ + RELEASE_LOCK(&stable_mutex); +} + +/* ----------------------------------------------------------------------------- * Treat stable pointers as roots for the garbage collector. * * A stable pointer is any stable name entry with a ref > 0. We'll