X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FStorage.h;h=c938fd8244a4b7ea41b2e6679d33809324ae0976;hb=affe92132329afa642bc83d74d5b07d14187e968;hp=f9424288335df96b993f5b54f26abc5a84229688;hpb=0bffc410964e1688ad80d277d53400659e697ab5;p=ghc-hetmet.git diff --git a/ghc/rts/Storage.h b/ghc/rts/Storage.h index f942428..c938fd8 100644 --- a/ghc/rts/Storage.h +++ b/ghc/rts/Storage.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Storage.h,v 1.46 2002/12/11 15:36:54 simonmar Exp $ + * $Id: Storage.h,v 1.52 2003/04/22 16:25:12 simonmar Exp $ * * (c) The GHC Team, 1998-2002 * @@ -53,7 +53,7 @@ extern void exitStorage(void); lnat allocated_bytes(void) Returns the number of bytes allocated via allocate() since the last GC. - Used in the reoprting of statistics. + Used in the reporting of statistics. SMP: allocate and doYouWantToGC can be used from STG code, they are surrounded by a mutex. @@ -78,14 +78,12 @@ doYouWantToGC( void ) -------------------------------------------------------------------------- */ #define ExtendNursery(hp,hplim) \ - (CurrentNursery->free = (P_)(hp)+1, \ + (CloseNursery(hp), \ CurrentNursery->link == NULL ? rtsFalse : \ (CurrentNursery = CurrentNursery->link, \ OpenNursery(hp,hplim), \ rtsTrue)) -extern void PleaseStopAllocating(void); - /* ----------------------------------------------------------------------------- Performing Garbage Collection @@ -165,15 +163,16 @@ recordOldToNewPtrs(StgMutClosure *p) // We zero out the slop when PROFILING is on. // #ifndef DEBUG #if !defined(DEBUG) && !defined(PROFILING) -#define updateWithIndirection(info, p1, p2) \ +#define updateWithIndirection(info, ind_info, p1, p2, and_then) \ { \ bdescr *bd; \ \ bd = Bdescr((P_)p1); \ if (bd->gen_no == 0) { \ ((StgInd *)p1)->indirectee = p2; \ - SET_INFO(p1,&stg_IND_info); \ + SET_INFO(p1,ind_info); \ TICK_UPD_NEW_IND(); \ + and_then; \ } else { \ ((StgIndOldGen *)p1)->indirectee = p2; \ if (info != &stg_BLACKHOLE_BQ_info) { \ @@ -184,6 +183,7 @@ recordOldToNewPtrs(StgMutClosure *p) } \ SET_INFO(p1,&stg_IND_OLDGEN_info); \ TICK_UPD_OLD_IND(); \ + and_then; \ } \ } #elif defined(PROFILING) @@ -197,7 +197,7 @@ recordOldToNewPtrs(StgMutClosure *p) // the invariants that every closure keeps its creation time in the profiling // field. So, we call LDV_recordCreate(). -#define updateWithIndirection(info, p1, p2) \ +#define updateWithIndirection(info, ind_info, p1, p2, and_then) \ { \ bdescr *bd; \ \ @@ -205,9 +205,10 @@ recordOldToNewPtrs(StgMutClosure *p) bd = Bdescr((P_)p1); \ if (bd->gen_no == 0) { \ ((StgInd *)p1)->indirectee = p2; \ - SET_INFO(p1,&stg_IND_info); \ + SET_INFO(p1,ind_info); \ LDV_recordCreate((p1)); \ TICK_UPD_NEW_IND(); \ + and_then; \ } else { \ ((StgIndOldGen *)p1)->indirectee = p2; \ if (info != &stg_BLACKHOLE_BQ_info) { \ @@ -218,6 +219,7 @@ recordOldToNewPtrs(StgMutClosure *p) } \ SET_INFO(p1,&stg_IND_OLDGEN_info); \ LDV_recordCreate((p1)); \ + and_then; \ } \ } @@ -231,7 +233,7 @@ recordOldToNewPtrs(StgMutClosure *p) * already have been updated (the mutable list will get messed up * otherwise). */ -#define updateWithIndirection(info, p1, p2) \ +#define updateWithIndirection(info, ind_info, p1, p2, and_then) \ { \ bdescr *bd; \ \ @@ -239,8 +241,9 @@ recordOldToNewPtrs(StgMutClosure *p) bd = Bdescr((P_)p1); \ if (bd->gen_no == 0) { \ ((StgInd *)p1)->indirectee = p2; \ - SET_INFO(p1,&stg_IND_info); \ + SET_INFO(p1,ind_info); \ TICK_UPD_NEW_IND(); \ + and_then; \ } else { \ if (info != &stg_BLACKHOLE_BQ_info) { \ { \ @@ -261,6 +264,7 @@ recordOldToNewPtrs(StgMutClosure *p) ((StgIndOldGen *)p1)->indirectee = p2; \ SET_INFO(p1,&stg_IND_OLDGEN_info); \ TICK_UPD_OLD_IND(); \ + and_then; \ } \ } #endif @@ -398,6 +402,9 @@ static __inline__ StgOffset mut_arr_ptrs_sizeW( StgMutArrPtrs* x ) static __inline__ StgWord tso_sizeW ( StgTSO *tso ) { return TSO_STRUCT_SIZEW + tso->stack_size; } +static __inline__ StgWord bco_sizeW ( StgBCO *bco ) +{ return bco->size; } + /* ----------------------------------------------------------------------------- Sizes of stack frames -------------------------------------------------------------------------- */ @@ -412,7 +419,8 @@ static inline StgWord stack_frame_sizeW( StgClosure *frame ) case RET_DYN: { StgRetDyn *dyn = (StgRetDyn *)frame; - return sizeofW(StgRetDyn) + RET_DYN_SIZE + + return sizeofW(StgRetDyn) + RET_DYN_BITMAP_SIZE + + RET_DYN_NONPTR_REGS_SIZE + GET_PTRS(dyn->liveness) + GET_NONPTRS(dyn->liveness); } @@ -420,6 +428,7 @@ static inline StgWord stack_frame_sizeW( StgClosure *frame ) return sizeofW(StgRetFun) + ((StgRetFun *)frame)->size; case RET_BIG: + case RET_VEC_BIG: return 1 + info->i.layout.large_bitmap->size; case RET_BCO: