>    \begin{code}
>    primCode [res] IsHNF [arg]
>       = let res'        = amodeToStix res
>             arg'        = amodeToStix arg
>             arg_info    = StInd PtrRep arg'
>             word_32     = StInd WordRep (StIndex PtrRep 
> arg_info (StInt (-1)))
>             masked_le32 = StPrim SrlOp [word_32, StInt 16]
>             masked_be32 = StPrim AndOp [word_32, StInt 65535]
>    #ifdef WORDS_BIGENDIAN
>             ty_info     = masked_le32
>    #else
>             ty_info     = masked_be32
>    #endif
>             not_a_thunk = StPrim IntEqOp [ StPrim AndOp 
> [ty_info, StInt 0x10]
>                                          , StInt 0x0
>                                          ]
>                    -- ToDo: don't hardwire the value of 
> _THUNK from InfoTables.h
>             assign      = StAssign IntRep res' not_a_thunk
>         in
>         returnUs (\ xs -> assign : xs)
>    \end{code} 

This code looks bogus - it is checking a bit in the info table, which
would have been correct when we used to store flags in the info table,
but that changed a while back.

closure_THUNK() works by getting the type field (i.e.
get_itbl(c)->type), and using that to index into the table of closure
flags (see ghc/rts/ClosureFlags.c), and checking the "THU" flag.  This
is the portable way to do it.  The hacky way to do it would be to
compare against the closure types directly - fortunately you can use the
names rather than the constants, see ghc/compiler/codeGen/SMRep.lhs.

Cheers,
        Simon

_______________________________________________
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to