2 ms·
Have you looked at how GHC provides a GC for its LLVM backend?
by aphexairlines 15y ago
Have you looked at how GHC provides a GC for its LLVM backend?
- wbhart 15y agoNo. I did read an article about the GHC LLVM backend and it mentions the Cmm language (a variant of C--). But there was no mention of GC. In fact, this thesis: http://www.cse.unsw.edu.au/~pls/thesis/davidt-thesis.pdf http://www.cse.unsw.edu.au/~pls/thesis/davidt-thesis.pdf seems to state that Cmm implements almost everything but the runtime aspects of C--. In particular GC and exception handling are done more directly by Haskell without the need for direct support in the back end. I do know some hooks were added to LLVM to support Haskell, e.g. the calling conventions used by GHC. If you have any references regarding the GHC garbage collection, I'd be interested in seeing them. Of course I can also dig some up for myself. I assume they do something clever. (Pretty much everything that is clever that is missing from Scala, from a mathematician's point of view, is in Haskell or Lisp I suppose. Shame, because most mathematicians refuse to learn something as mind bending as Haskell.) Edit: OK, now based on what I do know, I'm going to take a guess at this. The GHC GC is written in Haskell? Now that's gonna bake someone's noodle.
- eru 15y agoLots of Lisps have GCs written in those Lisps, too. But I guess it's harder for Haskell, since you can not just "not cons" and mutate in Haskell.