X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=includes%2FStorage.h;h=a830b444b28ce845316094db1057124d77fe1007;hb=fac738e582dcaca1575f5291c83910db01d25284;hp=62d57b1d7bd3bb68728c754b912e50292ae5a817;hpb=2cf1115cd06678e5255c39e9fd56787031c31c06;p=ghc-hetmet.git diff --git a/includes/Storage.h b/includes/Storage.h index 62d57b1..a830b44 100644 --- a/includes/Storage.h +++ b/includes/Storage.h @@ -186,6 +186,9 @@ doYouWantToGC( void ) extern void *allocateExec (nat bytes); extern void freeExec (void *p); +/* for splitting blocks groups in two */ +extern bdescr * splitLargeBlock (bdescr *bd, nat blocks); + /* ----------------------------------------------------------------------------- Performing Garbage Collection @@ -259,11 +262,28 @@ recordMutableGenLock(StgClosure *p, generation *gen) RELEASE_SM_LOCK; } +extern bdescr *allocBlock_sync(void); + +// Version of recordMutableGen() for use in parallel GC. The same as +// recordMutableGen(), except that we surround it with a spinlock and +// call the spinlock version of allocBlock(). INLINE_HEADER void recordMutableGen_GC(StgClosure *p, generation *gen) { + bdescr *bd; + ACQUIRE_SPIN_LOCK(&recordMutableGen_sync); - recordMutableGen(p,gen); + + bd = gen->mut_list; + if (bd->free >= bd->start + BLOCK_SIZE_W) { + bdescr *new_bd; + new_bd = allocBlock_sync(); + new_bd->link = bd; + bd = new_bd; + gen->mut_list = bd; + } + *bd->free++ = (StgWord)p; + RELEASE_SPIN_LOCK(&recordMutableGen_sync); } @@ -525,7 +545,7 @@ extern lnat countOccupied ( bdescr *bd ); extern lnat calcNeeded ( void ); #if defined(DEBUG) -extern void memInventory(void); +extern void memInventory(rtsBool show); extern void checkSanity(void); extern nat countBlocks(bdescr *); extern void checkNurserySanity( step *stp );