[MLton] C-- backend

Matthew Fluet fluet@cs.cornell.edu
Mon, 3 Jul 2006 18:01:33 -0400 (EDT)


> I was recently told that a C-- backend for MLton exists, but the newest
> information I could find was from March of 2005.

That is the most recent info in the mailing list.  I made a couple more 
modifications to the backend in Summer 2005, when one of Norman Ramsey's 
summer undergrad students was thinking about more efficient 
representations of span data.

> Targetting C-- would be pretty handy for us, because some of the 
> optimizations involve weak continuations.  However, the last thing I read 
> on the backend said that it still hasn't implemented callcc (among other 
> features), so that might make things more difficult.

Correct; the qc-- compiler doesn't currently support multiple stacks. 
Since, to use C-- effectively, we aren't using the same trampoline as is 
used in the C backend, there needs to be a C-- stack for every ML stack.

A grad student was working on getting C-- and qc-- to support multiple 
stacks, but I don't believe that they have been fully integrated yet.  And 
they certainly haven't been pushed into the C-- backend.

> I wanted to know what the current state of the C-- backend is, and 
> if/where we could get the source code.

The state is pretty much what was documented in the March 2005 emails. 
(Modulo some bugs fixed in the qc-- compiler.)  It is still very 
experimental, but you're welcome to check it out.  It is available in SVN 
at:
   svn://mlton.org/svnroot/mlton/branches/on-20050420-cmm-branch

IIRC, in order to compile with qc-- using the C-- backend, you'll need to 
copy the lib/qc-- files from the qc-- install directory to build/lib/self 
in the mlton build.