[Haskell-cafe] STG questions

Andrew Harris andrew.unit at gmail.com
Tue Oct 19 13:53:51 EDT 2004


Hi -

   I am reading Simon Peyton Jones's "Implementing lazy functional
languages on stock hardware: the Spineless Tagless G-Machine" (I have
version 2.5) paper.  I would like very much to understand the contents
of Figure 5 which illustrate the mapping of the "map" function from
STG code to C.  However I have some questions.  For example,

* It looks like map_closure is the "closure" in that it has an array
of StgWords and the first word is a pointer to an info table.  This
info table contains map_entry as the entry code.  I am curious about
the relationship between map_entry and map_direct.  Why isn't the
stuff in map_direct done in map_entry?

* The ret_vec1 is a continuation that's placed on the B stack.  I am
assuming this is a "non-vectored" return that has contents similar to
Figure 7 (which is for vectored returns), but is this true?  Also, the
"upd_nil" and "upd_cons" functions aren't defined in the example. 
Maybe they just don't do anything?

* In the return_cons1() function, how did the head and tail get put
into the RegData1 and RegData2 registers?

* I may have missed it, but it looks like the fy and mfy use three
contiguous words of heap each.  Can I assume that the triple {Hp[-5],
Hp[-4], Hp[-3]} are of a structure similar to figure 4, the "Layout of
a closure", which in this case would have some pointer/non-pointer
words?

thanks for any help,
-andrew


More information about the Haskell-Cafe mailing list