X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=includes%2FRegs.h;h=beb71c9184fded30b85f2ead36d583cb29c5f087;hb=5d379cbe65e406d5c3a848fe7fcd090cafbfeb78;hp=b6e29217eb19b2c554cfe2d7d5482f01443ac414;hpb=0065d5ab628975892cea1ec7303f968c3338cbe1;p=ghc-hetmet.git diff --git a/includes/Regs.h b/includes/Regs.h index b6e2921..beb71c9 100644 --- a/includes/Regs.h +++ b/includes/Regs.h @@ -22,34 +22,8 @@ #ifndef REGS_H #define REGS_H -#include "gmp.h" // Needs MP_INT definition - -/* - * Spark pools: used to store pending sparks - * (THREADED_RTS & PARALLEL_HASKELL only) - * This is a circular buffer. Invariants: - * - base <= hd < lim - * - base <= tl < lim - * - if hd==tl, then the pool is empty. - * - if hd == tl+1, then the pool is full. - * Adding to the pool is done by assigning to *tl++ (wrapping round as - * necessary). When adding to a full pool, we have the option of - * throwing away either the oldest (hd++) or the most recent (tl--) entry. - */ -typedef struct StgSparkPool_ { - StgClosure **base; - StgClosure **lim; - StgClosure **hd; - StgClosure **tl; -} StgSparkPool; - -#define ASSERT_SPARK_POOL_INVARIANTS(p) \ - ASSERT((p)->base <= (p)->hd); \ - ASSERT((p)->hd < (p)->lim); \ - ASSERT((p)->base <= (p)->tl); \ - ASSERT((p)->tl < (p)->lim); - typedef struct { + StgWord stgEagerBlackholeInfo; StgFunPtr stgGCEnter1; StgFunPtr stgGCFun; } StgFunTable; @@ -108,18 +82,7 @@ typedef struct StgRegTable_ { struct bdescr_ *rCurrentNursery; /* Hp/HpLim point into this block */ struct bdescr_ *rCurrentAlloc; /* for allocation using allocate() */ StgWord rHpAlloc; /* number of *bytes* being allocated in heap */ - // rmp_tmp1..rmp_result2 are only used in THREADED_RTS builds to - // avoid per-thread temps in bss, but currently always incldue here - // so we just run mkDerivedConstants once - StgInt rmp_tmp_w; - MP_INT rmp_tmp1; - MP_INT rmp_tmp2; - MP_INT rmp_result1; - MP_INT rmp_result2; StgWord rRet; // holds the return code of the thread -#if defined(THREADED_RTS) || defined(PAR) - StgSparkPool rSparks; /* per-task spark pool */ -#endif } StgRegTable; #if IN_STG_CODE @@ -157,15 +120,10 @@ typedef struct StgRegTable_ { #define SAVE_SpLim (CurrentTSO->splim) #define SAVE_Hp (BaseReg->rHp) -#define SAVE_HpLim (BaseReg->rHpLim) #define SAVE_CurrentTSO (BaseReg->rCurrentTSO) #define SAVE_CurrentNursery (BaseReg->rCurrentNursery) #define SAVE_HpAlloc (BaseReg->rHpAlloc) -#define SAVE_SparkHd (BaseReg->rSparks.hd) -#define SAVE_SparkTl (BaseReg->rSparks.tl) -#define SAVE_SparkBase (BaseReg->rSparks.base) -#define SAVE_SparkLim (BaseReg->rSparks.lim) /* We sometimes need to save registers across a C-call, eg. if they * are clobbered in the standard calling convention. We define the @@ -335,7 +293,7 @@ struct PartCapability_ { /* No such thing as a MainCapability under THREADED_RTS - each thread must have * its own Capability. */ -#if IN_STG_CODE && !defined(THREADED_RTS) +#if IN_STG_CODE && !(defined(THREADED_RTS) && !defined(NOSMP)) extern W_ MainCapability[]; #endif @@ -351,7 +309,7 @@ extern W_ MainCapability[]; GLOBAL_REG_DECL(StgRegTable *,BaseReg,REG_Base) #define ASSIGN_BaseReg(e) (BaseReg = (e)) #else -#ifdef THREADED_RTS +#if defined(THREADED_RTS) && !defined(NOSMP) #error BaseReg must be in a register for THREADED_RTS #endif #define BaseReg (&((struct PartCapability_ *)MainCapability)->r) @@ -377,7 +335,7 @@ GLOBAL_REG_DECL(P_,Hp,REG_Hp) #endif #if defined(REG_HpLim) && !defined(NO_GLOBAL_REG_DECLS) -GLOBAL_REG_DECL(P_,HpLim,REG_HpLim) +#error HpLim cannot be in a register #else #define HpLim (BaseReg->rHpLim) #endif @@ -400,30 +358,6 @@ GLOBAL_REG_DECL(bdescr *,HpAlloc,REG_HpAlloc) #define HpAlloc (BaseReg->rHpAlloc) #endif -#if defined(REG_SparkHd) && !defined(NO_GLOBAL_REG_DECLS) -GLOBAL_REG_DECL(bdescr *,SparkHd,REG_SparkHd) -#else -#define SparkHd (BaseReg->rSparks.hd) -#endif - -#if defined(REG_SparkTl) && !defined(NO_GLOBAL_REG_DECLS) -GLOBAL_REG_DECL(bdescr *,SparkTl,REG_SparkTl) -#else -#define SparkTl (BaseReg->rSparks.tl) -#endif - -#if defined(REG_SparkBase) && !defined(NO_GLOBAL_REG_DECLS) -GLOBAL_REG_DECL(bdescr *,SparkBase,REG_SparkBase) -#else -#define SparkBase (BaseReg->rSparks.base) -#endif - -#if defined(REG_SparkLim) && !defined(NO_GLOBAL_REG_DECLS) -GLOBAL_REG_DECL(bdescr *,SparkLim,REG_SparkLim) -#else -#define SparkLim (BaseReg->rSparks.lim) -#endif - /* ----------------------------------------------------------------------------- Get absolute function pointers from the register table, to save code space. On x86, @@ -450,10 +384,11 @@ GLOBAL_REG_DECL(bdescr *,SparkLim,REG_SparkLim) -------------------------------------------------------------------------- */ -#define FunReg ((StgFunTable *)((void *)BaseReg - sizeof(StgFunTable))) +#define FunReg ((StgFunTable *)((void *)BaseReg - STG_FIELD_OFFSET(struct PartCapability_, r))) -#define stg_gc_enter_1 (FunReg->stgGCEnter1) -#define stg_gc_fun (FunReg->stgGCFun) +#define stg_EAGER_BLACKHOLE_info (FunReg->stgEagerBlackholeInfo) +#define stg_gc_enter_1 (FunReg->stgGCEnter1) +#define stg_gc_fun (FunReg->stgGCFun) /* ----------------------------------------------------------------------------- For any registers which are denoted "caller-saves" by the C calling @@ -621,14 +556,6 @@ GLOBAL_REG_DECL(bdescr *,SparkLim,REG_SparkLim) #define CALLER_RESTORE_Hp /* nothing */ #endif -#ifdef CALLER_SAVES_HpLim -#define CALLER_SAVE_HpLim SAVE_HpLim = HpLim; -#define CALLER_RESTORE_HpLim HpLim = SAVE_HpLim; -#else -#define CALLER_SAVE_HpLim /* nothing */ -#define CALLER_RESTORE_HpLim /* nothing */ -#endif - #ifdef CALLER_SAVES_Base #ifdef THREADED_RTS #error "Can't have caller-saved BaseReg with THREADED_RTS" @@ -664,38 +591,6 @@ GLOBAL_REG_DECL(bdescr *,SparkLim,REG_SparkLim) #define CALLER_RESTORE_HpAlloc /* nothing */ #endif -#ifdef CALLER_SAVES_SparkHd -#define CALLER_SAVE_SparkHd SAVE_SparkHd = SparkHd; -#define CALLER_RESTORE_SparkHd SparkHd = SAVE_SparkHd; -#else -#define CALLER_SAVE_SparkHd /* nothing */ -#define CALLER_RESTORE_SparkHd /* nothing */ -#endif - -#ifdef CALLER_SAVES_SparkTl -#define CALLER_SAVE_SparkTl SAVE_SparkTl = SparkTl; -#define CALLER_RESTORE_SparkTl SparkTl = SAVE_SparkTl; -#else -#define CALLER_SAVE_SparkTl /* nothing */ -#define CALLER_RESTORE_SparkTl /* nothing */ -#endif - -#ifdef CALLER_SAVES_SparkBase -#define CALLER_SAVE_SparkBase SAVE_SparkBase = SparkBase; -#define CALLER_RESTORE_SparkBase SparkBase = SAVE_SparkBase; -#else -#define CALLER_SAVE_SparkBase /* nothing */ -#define CALLER_RESTORE_SparkBase /* nothing */ -#endif - -#ifdef CALLER_SAVES_SparkLim -#define CALLER_SAVE_SparkLim SAVE_SparkLim = SparkLim; -#define CALLER_RESTORE_SparkLim SparkLim = SAVE_SparkLim; -#else -#define CALLER_SAVE_SparkLim /* nothing */ -#define CALLER_RESTORE_SparkLim /* nothing */ -#endif - #endif /* IN_STG_CODE */ /* ---------------------------------------------------------------------------- @@ -727,13 +622,8 @@ GLOBAL_REG_DECL(bdescr *,SparkLim,REG_SparkLim) CALLER_SAVE_Sp \ CALLER_SAVE_SpLim \ CALLER_SAVE_Hp \ - CALLER_SAVE_HpLim \ CALLER_SAVE_CurrentTSO \ CALLER_SAVE_CurrentNursery \ - CALLER_SAVE_SparkHd \ - CALLER_SAVE_SparkTl \ - CALLER_SAVE_SparkBase \ - CALLER_SAVE_SparkLim \ CALLER_SAVE_Base #define CALLER_RESTORE_USER \ @@ -760,13 +650,8 @@ GLOBAL_REG_DECL(bdescr *,SparkLim,REG_SparkLim) CALLER_RESTORE_Sp \ CALLER_RESTORE_SpLim \ CALLER_RESTORE_Hp \ - CALLER_RESTORE_HpLim \ CALLER_RESTORE_CurrentTSO \ - CALLER_RESTORE_CurrentNursery \ - CALLER_RESTORE_SparkHd \ - CALLER_RESTORE_SparkTl \ - CALLER_RESTORE_SparkBase \ - CALLER_RESTORE_SparkLim + CALLER_RESTORE_CurrentNursery #else /* not IN_STG_CODE */