shrinker checked in

Matthew Fluet Matthew Fluet <fluet@CS.Cornell.EDU>
Wed, 14 Nov 2001 11:48:41 -0500 (EST)


> The SSA shrinker now works.  

How does the shrinker deal with blocks that do nothing but goto another
block?  The way the SSA shrinker works, it is completely nullifying the
effect of commonBlock.  I can also find a number of instances of
gotos-to-gotos that aren't eliminated.


>   - Added mayRaise: bool to functions to record whether or not a function may
>     raise.

Would it be worth replacing mayRaise with raises : Type.t vector option to
match returns?  I know that this vector should be identical in all
functions, but it would make things a little more uniform.

>   - Changed returns to the following datatype
> 
> 	    datatype t =
> 	       Dead
> 	     | HandleOnly
> 	     | NonTail of {cont: Label.t, handler: Handler.t}
> 	     | Tail

Seems a little complicated to me, but if it works.

I still don't quite understand why Caller/None is disallowed.  If the
callee doesn't raise, won't the exception stack be exactly the same as it
was at the call when the callee returns -- even if the callee installs and
uninstalls handlers?  Maybe I'm missing some aspect of what a callee is
allowed to do when it is called with a continuation or handler of None.  I
was thinking that while the callee won't return to either the continuation
or exception stack, it should preserve both stacks.  For example, we could
conceivable implement a None/None (Dead) call by a "tail call" that
adjusts the stack all the way to stackBottom; i.e., trash the entire stack
(continuation and exception) because we can't possibly return to them.
But, we don't.  We implement it as a normal tail call, preserving (at
least) the continuation stack, and I would think the exception stack as
well.  Similarly, None/Caller (HandleOnly) is implemented as a normal tail
call.  This makes sense, because the handler stack is intertwined in the
continuation stack, so we can't really trash the continuation stack; 
although, again, conceivably we could implement it as a tail call that
trashes the stack down to the frame that has the top handler. 

Maybe I want to divorce the SSA IL a little too much from the
implementation details of exceptions.