X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fincludes%2FCmm.h;h=d0dedb8a73a76f42e14e8098087c455f5778c4f8;hb=4684f7171ca9c84d96dce484c8c37c85c77942c0;hp=21c82572af72ab3c27474647bfc843e0625ff57d;hpb=03dc2dd3dd814ad85cc4c45e9cafc7b73163c8be;p=ghc-hetmet.git diff --git a/ghc/includes/Cmm.h b/ghc/includes/Cmm.h index 21c8257..d0dedb8 100644 --- a/ghc/includes/Cmm.h +++ b/ghc/includes/Cmm.h @@ -292,6 +292,8 @@ #error mp_limb_t != StgWord: assumptions in PrimOps.cmm are now false #endif +#define MyCapability() (BaseReg - OFFSET_Capability_r) + /* ------------------------------------------------------------------------- Allocation and garbage collection ------------------------------------------------------------------------- */ @@ -317,14 +319,37 @@ HP_CHK_GEN(alloc,liveness,reentry); \ TICK_ALLOC_HEAP_NOCTR(alloc); +// allocateLocal() allocates from the nursery, so we check to see +// whether the nursery is nearly empty in any function that uses +// allocateLocal() - this includes many of the primops. #define MAYBE_GC(liveness,reentry) \ - if (W_[alloc_blocks] >= W_[alloc_blocks_lim]) { \ + if (bdescr_link(CurrentNursery) == NULL) { \ R9 = liveness; \ R10 = reentry; \ jump stg_gc_gen_hp; \ } /* ----------------------------------------------------------------------------- + Closure headers + -------------------------------------------------------------------------- */ + +/* + * This is really ugly, since we don't do the rest of StgHeader this + * way. The problem is that values from DerivedConstants.h cannot be + * dependent on the way (SMP, PROF etc.). For SIZEOF_StgHeader we get + * the value from GHC, but it seems like too much trouble to do that + * for StgThunkHeader. + */ +#ifdef SMP +#define SIZEOF_StgThunkHeader SIZEOF_StgHeader+SIZEOF_StgSMPThunkHeader +#else +#define SIZEOF_StgThunkHeader SIZEOF_StgHeader +#endif + +#define StgThunk_payload(__ptr__,__ix__) \ + W_[__ptr__+SIZEOF_StgThunkHeader+ WDS(__ix__)] + +/* ----------------------------------------------------------------------------- Closures -------------------------------------------------------------------------- */ @@ -363,8 +388,8 @@ */ #define StgFunInfoExtra_slow_apply(fun_info) \ - (StgFunInfoExtraRev_slow_apply_offset(fun_info) \ - + (fun_info) + SIZEOF_StgFunInfoExtraRev + SIZEOF_StgInfoTable) + (TO_W_(StgFunInfoExtraRev_slow_apply_offset(fun_info)) \ + + (fun_info) + SIZEOF_StgFunInfoExtraRev + SIZEOF_StgInfoTable) #define StgFunInfoExtra_fun_type(i) StgFunInfoExtraRev_fun_type(i) #define StgFunInfoExtra_arity(i) StgFunInfoExtraRev_arity(i) @@ -485,4 +510,10 @@ TICK_BUMP(ALLOC_HEAP_ctr); \ TICK_BUMP_BY(ALLOC_HEAP_tot,n) +/* ----------------------------------------------------------------------------- + Misc junk + -------------------------------------------------------------------------- */ + +#define TICK_MILLISECS (1000/TICK_FREQUENCY) /* ms per tick */ + #endif /* CMM_H */