X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=includes%2FRegs.h;h=beb71c9184fded30b85f2ead36d583cb29c5f087;hb=5d379cbe65e406d5c3a848fe7fcd090cafbfeb78;hp=0bfde5b0c8aa07bb8a49c042e39de95b6a1b54bf;hpb=1143c0e63ab9925697dcd553bbdb65aa8d51fdb5;p=ghc-hetmet.git diff --git a/includes/Regs.h b/includes/Regs.h index 0bfde5b..beb71c9 100644 --- a/includes/Regs.h +++ b/includes/Regs.h @@ -22,38 +22,8 @@ #ifndef REGS_H #define REGS_H -#if defined(HAVE_FRAMEWORK_GMP) -#include -#else -#include "gmp.h" // Needs MP_INT definition -#endif - -/* - * 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; @@ -112,16 +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 - StgWord 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 - StgSparkPool rSparks; /* per-task spark pool */ } StgRegTable; #if IN_STG_CODE @@ -159,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 @@ -379,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 @@ -402,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, @@ -452,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 @@ -623,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" @@ -666,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 */ /* ---------------------------------------------------------------------------- @@ -729,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 \ @@ -762,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 */