[MLton-devel] flattening

Stephen Weeks MLton@mlton.org
Thu, 16 Jan 2003 14:38:19 -0800

> I'm concerned about the SSA flattening pass having a negative impact on
> allocation performance. 
> Now, I was hoping to cut at least some of the allocation by not
> reallocating three elements of the tuple.  But, I get exactly the same
> allocation behavior.  I assume this is due to flattening.  Is this a
> reasonable assumption?  Is this "ok" behavior of flattening?

It could be due to flattening.  One way to learn something is to try
compiling with -drop-pass flatten.

I think this is not reasonable behavior for flatten.  In fact, the
comment at the top of flatten.fun would seem to indicate that it
shouldn't happen.

 * Flatten arguments to jumps, constructors, and functions.
 * If a tuple is explicitly available at all uses of a jump (resp. function)
 * then
 *   - The formals and call sites are changed so that the components of the
 *     tuple are passed.
 *   - The tuple is reconstructed at the beginning of the body of the jump.
 * Similarly, if a tuple is explicitly available at all uses of a constructor,
 *   - The constructor argument type is changed to flatten the tuple type.
 *   - The tuple is passed flat at each ConApp.
 *   - The tuple is reconstructed at each Case target.

If indeed this is what flattening does, it should never increase
allocation.  So there are three possibilities.

1. The problem isn't due to flattening.
2. Some other pass is inserting tuple constructions and tricking
3. There is a bug in flattening and it isn't doing what the comment

This SF.NET email is sponsored by: Thawte.com
Understand how to protect your customers personal information by implementing
SSL on your Apache Web Server. Click here to get our FREE Thawte Apache 
Guide: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0029en
MLton-devel mailing list