X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FStorage.h;h=fb84740f08eb6ae3b107c9fea45c6e6aae90b87c;hb=0542fa233d82cabb178505ce7e5ebab8ac0ba0e9;hp=838248dfea8bd4ca5ac0fabb85686ec3e8551b47;hpb=557bca7326077b67324b87e4042be83638ff6581;p=ghc-hetmet.git diff --git a/ghc/rts/Storage.h b/ghc/rts/Storage.h index 838248d..fb84740 100644 --- a/ghc/rts/Storage.h +++ b/ghc/rts/Storage.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Storage.h,v 1.48 2003/03/21 16:18:39 sof Exp $ + * $Id: Storage.h,v 1.53 2003/11/12 17:49:11 sof Exp $ * * (c) The GHC Team, 1998-2002 * @@ -63,7 +63,7 @@ extern StgPtr allocate ( nat n ); extern StgPtr allocatePinned ( nat n ); extern lnat allocated_bytes ( void ); -static inline rtsBool +INLINE_HEADER rtsBool doYouWantToGC( void ) { return (alloc_blocks >= alloc_blocks_lim); @@ -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 @@ -131,7 +129,7 @@ extern Mutex sm_mutex; /* ToDo: shouldn't recordMutable and recordOldToNewPtrs acquire some * kind of lock in the SMP case? */ -static inline void +INLINE_HEADER void recordMutable(StgMutClosure *p) { bdescr *bd; @@ -149,7 +147,7 @@ recordMutable(StgMutClosure *p) } } -static inline void +INLINE_HEADER void recordOldToNewPtrs(StgMutClosure *p) { bdescr *bd; @@ -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 @@ -283,7 +287,7 @@ recordOldToNewPtrs(StgMutClosure *p) } #if defined(TICKY_TICKY) || defined(PROFILING) -static inline void +INLINE_HEADER void updateWithPermIndirection(const StgInfoTable *info, StgClosure *p1, StgClosure *p2) { bdescr *bd; @@ -359,50 +363,53 @@ void revertCAFs( void ); Macros for calculating how big a closure will be (used during allocation) -------------------------------------------------------------------------- */ -static __inline__ StgOffset PAP_sizeW ( nat n_args ) +INLINE_HEADER StgOffset PAP_sizeW ( nat n_args ) { return sizeofW(StgPAP) + n_args; } -static __inline__ StgOffset AP_STACK_sizeW ( nat size ) +INLINE_HEADER StgOffset AP_STACK_sizeW ( nat size ) { return sizeofW(StgAP_STACK) + size; } -static __inline__ StgOffset CONSTR_sizeW( nat p, nat np ) +INLINE_HEADER StgOffset CONSTR_sizeW( nat p, nat np ) { return sizeofW(StgHeader) + p + np; } -static __inline__ StgOffset THUNK_SELECTOR_sizeW ( void ) +INLINE_HEADER StgOffset THUNK_SELECTOR_sizeW ( void ) { return sizeofW(StgHeader) + MIN_UPD_SIZE; } -static __inline__ StgOffset BLACKHOLE_sizeW ( void ) +INLINE_HEADER StgOffset BLACKHOLE_sizeW ( void ) { return sizeofW(StgHeader) + MIN_UPD_SIZE; } /* -------------------------------------------------------------------------- Sizes of closures ------------------------------------------------------------------------*/ -static __inline__ StgOffset sizeW_fromITBL( const StgInfoTable* itbl ) +INLINE_HEADER StgOffset sizeW_fromITBL( const StgInfoTable* itbl ) { return sizeofW(StgClosure) + sizeofW(StgPtr) * itbl->layout.payload.ptrs + sizeofW(StgWord) * itbl->layout.payload.nptrs; } -static __inline__ StgOffset ap_stack_sizeW( StgAP_STACK* x ) +INLINE_HEADER StgOffset ap_stack_sizeW( StgAP_STACK* x ) { return AP_STACK_sizeW(x->size); } -static __inline__ StgOffset pap_sizeW( StgPAP* x ) +INLINE_HEADER StgOffset pap_sizeW( StgPAP* x ) { return PAP_sizeW(x->n_args); } -static __inline__ StgOffset arr_words_sizeW( StgArrWords* x ) +INLINE_HEADER StgOffset arr_words_sizeW( StgArrWords* x ) { return sizeofW(StgArrWords) + x->words; } -static __inline__ StgOffset mut_arr_ptrs_sizeW( StgMutArrPtrs* x ) +INLINE_HEADER StgOffset mut_arr_ptrs_sizeW( StgMutArrPtrs* x ) { return sizeofW(StgMutArrPtrs) + x->ptrs; } -static __inline__ StgWord tso_sizeW ( StgTSO *tso ) +INLINE_HEADER StgWord tso_sizeW ( StgTSO *tso ) { return TSO_STRUCT_SIZEW + tso->stack_size; } +INLINE_HEADER StgWord bco_sizeW ( StgBCO *bco ) +{ return bco->size; } + /* ----------------------------------------------------------------------------- Sizes of stack frames -------------------------------------------------------------------------- */ -static inline StgWord stack_frame_sizeW( StgClosure *frame ) +INLINE_HEADER StgWord stack_frame_sizeW( StgClosure *frame ) { StgRetInfoTable *info; @@ -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); }