limit check insertion
Henry Cejtin
henry@sourcelight.com
Mon, 22 Oct 2001 19:07:58 -0500
Sorry, I missed that the requirement was only that V(p, 0) was positive.
Isn't hoisting of limit checks into loops (which do allocation) required by
Stephen's set up? If a loop does an allocation then the fact that there are
an inifinite number of paths from the start which allocate any amount desired
in the loop will mean that without a limit check in the loop there are NO
correct annotations.
I don't think that any amount of moving limit checks can violate our notion
of safe-for-space. The reason is that it only costs you an `arbitrary'
amount for non-tail calls, and then you are still safe for space since you
can charge the fixed overhead to the non-tail call stack frame.
Don't get me wrong: we would be wasting space in the case Matthew mentions,
but it would still be safe-for-space in our sense. I.e., we already waste
that space in other ways (like by turning tail calls into non-tail calls).
As to the final paragraph in Matthew's note, I think that if you don't handle
that case you will do extra limit checks. Not a failure, but not optimal.