X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FStable.c;h=97796b89a79b843fb59d69d8e51de2d1a58256cd;hb=b48fc016e9b15c465ba2c2f1d42b6221bcd19b45;hp=046fb3be4277b40a867e9da8969bc79e83c28dd9;hpb=f86e7206ea94b48b94fb61007a1c5d55b8c60f45;p=ghc-hetmet.git diff --git a/rts/Stable.c b/rts/Stable.c index 046fb3b..97796b8 100644 --- a/rts/Stable.c +++ b/rts/Stable.c @@ -6,9 +6,6 @@ * * ---------------------------------------------------------------------------*/ -// Make static versions of inline functions in Stable.h: -#define RTS_STABLE_C - #include "PosixSource.h" #include "Rts.h" #include "Hash.h" @@ -218,6 +215,9 @@ lookupStableName_(StgPtr p) */ p = (StgPtr)removeIndirections((StgClosure*)p); + // register the untagged pointer. This just makes things simpler. + p = (StgPtr)UNTAG_CLOSURE((StgClosure*)p); + sn_tmp = lookupHashTable(addrToStableHash,(W_)p); sn = (StgWord)sn_tmp; @@ -316,6 +316,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