X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FStable.c;fp=rts%2FStable.c;h=0ed18bcec2c94992a7af8e7b6d7d4b186944b724;hb=6015a94f9108a502150565577b66c23650796639;hp=e5e8dfbdd0fad046a7944d680e2c929c9c2fe7f0;hpb=04d444716b2e5415fb8f13771e49f1192ef8c8f8;p=ghc-hetmet.git diff --git a/rts/Stable.c b/rts/Stable.c index e5e8dfb..0ed18bc 100644 --- a/rts/Stable.c +++ b/rts/Stable.c @@ -177,6 +177,9 @@ exitStablePtrTable(void) /* * get at the real stuff...remove indirections. + * It untags pointers before dereferencing and + * retags the real stuff with its tag (if there + * is any) when returning. * * ToDo: move to a better home. */ @@ -184,16 +187,18 @@ static StgClosure* removeIndirections(StgClosure* p) { - StgClosure* q = p; + StgWord tag = GET_CLOSURE_TAG(p); + StgClosure* q = UNTAG_CLOSURE(p); while (get_itbl(q)->type == IND || get_itbl(q)->type == IND_STATIC || get_itbl(q)->type == IND_OLDGEN || get_itbl(q)->type == IND_PERM || get_itbl(q)->type == IND_OLDGEN_PERM ) { - q = ((StgInd *)q)->indirectee; + tag = GET_CLOSURE_TAG(q); + q = UNTAG_CLOSURE(((StgInd *)q)->indirectee); } - return q; + return TAG_CLOSURE(tag,q); } static StgWord