[Yhc] CAF vs 0-arity function question
Tom Shackell
shackell at cs.york.ac.uk
Fri May 12 05:20:07 EDT 2006
Hi Rob,
The constant table item constants are somewhat of a legacy. The original
constants were chosen to correspond to nhc's constants, however as far
as the Yhc runtime is concerned:
- A and Z are simply references to heap nodes and are treated in exactly
the same way.
- F, 0, C, P, X are all references to Info structures and are also
treated in exactly the same way.
However, you are quite right, looking at the C code 0 is mistakenly
included with the A&Z code. This has likely not proved a problem because
'0' is infact entirely redundant. The only thing you could do with a
0-arity FInfo is make an application to it, but why would you want to
when you can just push the CAF instead?
Ultimately we should tidy up the constants to a more simple
- Some constant value (i, l, f, d, s)
- References to heap nodes (N)
- References to FInfo or CInfo (I)
For the moment I shall change the C code to make using '0' an error :-)
Thanks
Tom
Robert Dockins wrote:
>The HBC bytecode format has different constant tags for the folloing:
>
>1) CAF, tag 'A'
>2) 0-arity function, tag '0'
>
>http://haskell.org/haskellwiki/Yhc/RTS/hbc
>
>Why the distinction? Maybe I don't fully understand, but I thought that a
>0-arity function _was_ a CAF?
>
>The runtime seems to treat them very much the same (although I can't be quite
>sure -- reading C gives me a headache ;)
>
>
>Rob Dockins
>_______________________________________________
>Yhc mailing list
>Yhc at haskell.org
>http://www.haskell.org//mailman/listinfo/yhc
>
>
More information about the Yhc
mailing list