[MLton] ref flattening enabled

Stephen Weeks MLton@mlton.org
Fri, 23 Jul 2004 17:39:11 -0700

> The ref flattening only gets done when you conclude that the access
> are all being done pretty much immediately after de-referencing,
> right?

Ahh, the ever-present angel of space safety whispers in my ear.

There isn't yet anything to prevent a flattened ref from keeping alive
its containing object longer than the object normally would be live.
I'm still thinking about what to do for that, and suggestions are
appreciated.  Here are some preliminary thoughts.

1. If from type information we can determine that the other fields in
   the containing object take only a constant amount of space, then
   there is nothing to worry about.

2. If the containing object is live at the beginning of every basic
   block where an access occurs, then there is nothing to worry

What I would like is to relax (2) to allow non-loop control-flow paths
between the point where the containing object is live and the
reference is accessed.

As a simple first hack, I could disallow flattened refs from being
passed across SSA function calls.