
On Wed, Dec 07, 2005 at 04:38:19PM +0300, Bulat Ziganshin wrote:
may be, John Meacham can say something about it? his JHC compiler uses region analysis to avoid garbage collection - may be these techniques has something in common?
By the time jhc makes any decisions regarding memory management, the code has already been transformed into a first order, strict, imperative language (but with stronger types than normal and in a monad) so I am not sure how much they would have in common. But there definitely are higher level optimizations that achieve similar things, update avoidance being a particular one as it collects pretty much exactly the info we want, when a node will only be referenced once. GHC has some very advanced algorithms for this sort of thing and I believe from first glance they will do a better job than the clean system. The update analysis info in jhc is not propegated all the way to the back end, the grin compiler does do a separate analysis to recapture this type of info after various transformations. I found it somewhat tricky to maintain the annotations all the way through various optimizations so I recalculate it (and perhaps get better results on the simpler program). However figuring out a way to propagate that info would be vital if we wanted user supplied region annotations, which several papers have said can be very beneficial. It is not clear at all what they would look like in a lazy language though since your run-time stack does not follow your program structure. (I'm open to ideas...) John -- John Meacham - ⑆repetae.net⑆john⑈