X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fincludes%2FStorage.h;h=035088e26b3f3f410da18390a953e260e4497a90;hb=91b07216be1cb09230b7d1b417899ddea8620ff3;hp=69ddef69be8aafc934dc2523d1c76192463a2e84;hpb=0cc009952787f2112365100a04dc73aa3d0fca67;p=ghc-hetmet.git diff --git a/ghc/includes/Storage.h b/ghc/includes/Storage.h index 69ddef6..035088e 100644 --- a/ghc/includes/Storage.h +++ b/ghc/includes/Storage.h @@ -62,12 +62,18 @@ typedef struct step_ { unsigned int n_large_blocks; /* no. of blocks used by large objs */ int is_compacted; /* compact this step? (old gen only) */ + /* During GC, if we are collecting this step, blocks and n_blocks + * are copied into the following two fields. After GC, these blocks + * are freed. */ + bdescr * old_blocks; /* bdescr of first from-space block */ + unsigned int n_old_blocks; /* number of blocks in from-space */ + /* temporary use during GC: */ StgPtr hp; /* next free locn in to-space */ StgPtr hpLim; /* end of current to-space block */ bdescr * hp_bd; /* bdescr of current to-space block */ - bdescr * to_blocks; /* bdescr of first to-space block */ - unsigned int n_to_blocks; /* number of blocks in to-space */ + StgPtr scavd_hp; /* ... same as above, but already */ + StgPtr scavd_hpLim; /* scavenged. */ bdescr * scan_bd; /* block currently being scanned */ StgPtr scan; /* scan pointer in current block */ bdescr * new_large_objects; /* large objects collected so far */ @@ -139,6 +145,7 @@ extern void exitStorage(void); -------------------------------------------------------------------------- */ extern StgPtr allocate ( nat n ); +extern StgPtr allocateLocal ( Capability *cap, nat n ); extern StgPtr allocatePinned ( nat n ); extern lnat allocated_bytes ( void ); @@ -193,11 +200,16 @@ extern void GarbageCollect(void (*get_roots)(evac_fn),rtsBool force_major_gc); */ #if defined(SMP) extern Mutex sm_mutex; +#endif + +#if defined(SMP) #define ACQUIRE_SM_LOCK ACQUIRE_LOCK(&sm_mutex); #define RELEASE_SM_LOCK RELEASE_LOCK(&sm_mutex); +#define ASSERT_SM_LOCK() ASSERT_LOCK_HELD(&sm_mutex); #else #define ACQUIRE_SM_LOCK #define RELEASE_SM_LOCK +#define ASSERT_SM_LOCK() #endif INLINE_HEADER void @@ -251,6 +263,15 @@ recordMutableLock(StgClosure *p) extern rtsBool keepCAFs; /* ----------------------------------------------------------------------------- + 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 + is. When written to, a MUT_VAR_CLEAN turns into a MUT_VAR_DIRTY + and is put on the mutable list. + -------------------------------------------------------------------------- */ + +void dirty_MUT_VAR(StgClosure *p); + +/* ----------------------------------------------------------------------------- DEBUGGING predicates for pointers LOOKS_LIKE_INFO_PTR(p) returns False if p is definitely not an info ptr @@ -369,17 +390,18 @@ INLINE_HEADER StgWord stack_frame_sizeW( StgClosure *frame ) Nursery manipulation -------------------------------------------------------------------------- */ -extern void allocNurseries ( void ); -extern void resetNurseries ( void ); -extern void resizeNurseries ( nat blocks ); -extern void tidyAllocateLists ( void ); -extern lnat countNurseryBlocks ( void ); +extern void allocNurseries ( void ); +extern void resetNurseries ( void ); +extern void resizeNurseries ( nat blocks ); +extern void resizeNurseriesFixed ( nat blocks ); +extern void tidyAllocateLists ( void ); +extern lnat countNurseryBlocks ( void ); /* ----------------------------------------------------------------------------- Functions from GC.c -------------------------------------------------------------------------- */ -extern void threadPaused ( StgTSO * ); +extern void threadPaused ( Capability *cap, StgTSO * ); extern StgClosure * isAlive ( StgClosure *p ); extern void markCAFs ( evac_fn evac ); @@ -397,6 +419,7 @@ extern lnat calcNeeded ( void ); extern void memInventory(void); extern void checkSanity(void); extern nat countBlocks(bdescr *); +extern void checkNurserySanity( step *stp ); #endif #if defined(DEBUG) @@ -415,7 +438,6 @@ extern void newDynCAF(StgClosure *); extern void move_TSO(StgTSO *src, StgTSO *dest); extern StgTSO *relocate_stack(StgTSO *dest, ptrdiff_t diff); -extern StgClosure * RTS_VAR(static_objects); extern StgClosure * RTS_VAR(scavenged_static_objects); extern StgWeak * RTS_VAR(old_weak_ptr_list); extern StgWeak * RTS_VAR(weak_ptr_list);