X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fincludes%2FRegs.h;h=f1b8597d60e066d7e91c0df604fd27d29c617af8;hb=7c82b4a858411e7363f46d29bbd297e7880ef625;hp=5374972b526ec399a92a7f10bb5cf678f1ba30e5;hpb=bf8219815876579f80b4e30188b982bf3e673199;p=ghc-hetmet.git diff --git a/ghc/includes/Regs.h b/ghc/includes/Regs.h index 5374972..f1b8597 100644 --- a/ghc/includes/Regs.h +++ b/ghc/includes/Regs.h @@ -22,6 +22,7 @@ #ifndef REGS_H #define REGS_H +#include "gmp.h" // Needs MP_INT definition /* * This is the table that holds shadow-locations for all the STG @@ -90,39 +91,19 @@ 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 SMP 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(SMP) || defined(PAR) - StgSparkPool rSparks; /* per-task spark pool */ + StgSparkPool rSparks; /* per-task spark pool */ #endif - StgWord rInHaskell; /* non-zero if we're in Haskell code */ - // If this flag is set, we are running Haskell code. Used to detect - // uses of 'foreign import unsafe' that should be 'safe'. } StgRegTable; - -/* A capability is a combination of a FunTable and a RegTable. In STG - * code, BaseReg normally points to the RegTable portion of this - * structure, so that we can index both forwards and backwards to take - * advantage of shorter instruction forms on some archs (eg. x86). - */ -typedef struct Capability_ { - StgFunTable f; - StgRegTable r; -#if defined(SMP) - struct Capability_ *link; /* per-task register tables are linked together */ -#endif -} Capability; - -/* No such thing as a MainCapability under SMP - each thread must have - * its own Capability. - */ -#ifndef SMP -#if IN_STG_CODE -extern W_ MainCapability[]; -#else -extern DLL_IMPORT_RTS Capability MainCapability; -#endif -#endif - #if IN_STG_CODE /* @@ -321,13 +302,32 @@ GLOBAL_REG_DECL(StgWord64,L1,REG_L1) * concurrent Haskell, MainRegTable otherwise). */ +/* A capability is a combination of a FunTable and a RegTable. In STG + * code, BaseReg normally points to the RegTable portion of this + * structure, so that we can index both forwards and backwards to take + * advantage of shorter instruction forms on some archs (eg. x86). + * This is a cut-down version of the Capability structure; the full + * version is defined in Capability.h. + */ +struct PartCapability_ { + StgFunTable f; + StgRegTable r; +}; + +/* No such thing as a MainCapability under SMP - each thread must have + * its own Capability. + */ +#if IN_STG_CODE && !defined(SMP) +extern W_ MainCapability[]; +#endif + #if defined(REG_Base) && !defined(NO_GLOBAL_REG_DECLS) GLOBAL_REG_DECL(StgRegTable *,BaseReg,REG_Base) #else #ifdef SMP #error BaseReg must be in a register for SMP #endif -#define BaseReg (&((Capability *)MainCapability)[0].r) +#define BaseReg (&((struct PartCapability_ *)MainCapability)->r) #endif #if defined(REG_Sp) && !defined(NO_GLOBAL_REG_DECLS)