limit check pushed inside loop
Henry Cejtin
henry@sourcelight.com
Thu, 10 Aug 2000 19:04:25 -0500
I mailed Matt, but then I realized that it didn't go out to MLton: The
example he gave, conjecturing that the coalesced limit checks violate safe-
for-space, does not violate it. The guarentee is just that for any fixed
program the O(space) is not changed. Moving limit checks earlier, as done in
MLton, can only increase the space required by O(1), so it is fine.
A worse case, which is still allowed under safe-for-space, is the conversion
of some tail calls to non-tail calls. This never happens in a loop (or else
we would not be safe-for-space) but can multiply the number of live stack
frames by as much as the number of lambda expressions in the program. Again,
this is still ok as far as space safety.