limit check insertion via loop forests

Stephen Weeks MLton@sourcelight.com
Thu, 20 Dec 2001 15:15:58 -0800


> is there some notion of minimality on (a) the number of labels where
> limit checks are inserted (while still preserving safety)

Nope, we're not getting this, and don't want it.  The issue is not one
of space safety, it's one of trying to minimize the dynamic number of
checks.  If we wanted to minimize the static number, we would just
insert at loop headers, I think (although there may still be
pathological cases).  But if there is a non-allocating loop followed
by some allocations, we want to avoid moving the limit check into the
loop, where we would expect it to be executed more often.

> (b) the size of required space demanded by V, again that is safe?  

We probably still need to discuss the space safety some more and agree
on what to put in the formalism.

> I wonder if this idea could be further refined to coalesce limit
> checks.  Do loop forests help here in any way?

It is coalescing across blocks.  That's what R does in it's recursive
calls.