uncurrying

Suresh Jagannathan suresh@research.nj.nec.com
Tue, 14 Sep 1999 12:01:43 -0400


   From: "Stephen Weeks" <sweeks@intertrust.com>
   Content-Type: text/plain; charset=us-ascii
   Date: Mon, 13 Sep 1999 13:48:25 -0700 (PDT)
   Reply-to: MLton@research.nj.nec.com
   X-UIDL: 265f059045f1a25d78c993eeb8cd1f7f


   > Ok, but aren't environment already pretty flat?

   No.  The closure converter produces completely tuplized environments.
   The environment is flat, not linked, but is represented by a single
   pointer.  AHA, now I remember the problem.  For a curried function,
   the body will have to completely destruct the flat environment and
   reconstruct a new one with one more slot, the argument.  This will
   lead to a lot of code -- possibly too much to get inlined.  This has
   nothing to do with the flattening optimization and is simply the
   output of the closure converter.

Can you elaborate?  In particular, I was wondering whether this
would happen in the most common case, namely a curried function
that is always fully applied.  In this case, wouldn't the simplifier
running after closure conversion be able to remove the extra
overhead?

	-- sj