X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fincludes%2FStable.h;h=d3dfb589a04f01a8286b64f1ea63a56bf34e6c26;hb=2b4d4dcc7f2bb1e90a7c06f111c8460b6348920a;hp=960ac271800797ce98ee563305488187f257d769;hpb=21462c00b3241f15de3b145ac92ee5b266b5733a;p=ghc-hetmet.git diff --git a/ghc/includes/Stable.h b/ghc/includes/Stable.h index 960ac27..d3dfb58 100644 --- a/ghc/includes/Stable.h +++ b/ghc/includes/Stable.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Stable.h,v 1.4 1999/03/02 19:44:16 sof Exp $ + * $Id: Stable.h,v 1.6 2000/09/04 15:09:49 simonmar Exp $ * * (c) The GHC Team, 1998-1999 * @@ -35,28 +35,29 @@ extern DLL_IMPORT_RTS unsigned int SPT_size; extern inline StgPtr deRefStablePtr(StgStablePtr sp) { - ASSERT(stable_ptr_table[sp & ~STABLEPTR_WEIGHT_MASK].weight > 0); - return stable_ptr_table[sp & ~STABLEPTR_WEIGHT_MASK].addr; + ASSERT(stable_ptr_table[stgCast(StgWord,sp) & ~STABLEPTR_WEIGHT_MASK].weight > 0); + return stable_ptr_table[stgCast(StgWord,sp) & ~STABLEPTR_WEIGHT_MASK].addr; } extern inline void freeStablePtr(StgStablePtr sp) { - StgWord sn = sp & ~STABLEPTR_WEIGHT_MASK; + StgWord sn = stgCast(StgWord,sp) & ~STABLEPTR_WEIGHT_MASK; ASSERT(sn < SPT_size && stable_ptr_table[sn].addr != NULL && stable_ptr_table[sn].weight > 0); - stable_ptr_table[sn].weight += (sp & STABLEPTR_WEIGHT_MASK) >> STABLEPTR_WEIGHT_SHIFT; + stable_ptr_table[sn].weight += + 1 << ((((StgWord)sp & STABLEPTR_WEIGHT_MASK) >> STABLEPTR_WEIGHT_SHIFT) - 1); } extern inline StgStablePtr splitStablePtr(StgStablePtr sp) { /* doesn't need access to the stable pointer table */ - StgWord weight = (sp & STABLEPTR_WEIGHT_MASK) / 2; - return (sp & ~STABLEPTR_WEIGHT_MASK) + weight; + StgWord weight = (stgCast(StgWord,sp) & STABLEPTR_WEIGHT_MASK) / 2; + return stgCast(StgStablePtr,(stgCast(StgWord,sp) & ~STABLEPTR_WEIGHT_MASK) + weight); } /* No deRefStableName, because the existence of a stable name doesn't