[MLton-devel] eliminating HandlerPush/Pop

Stephen Weeks MLton@mlton.org
Fri, 10 Jan 2003 07:33:25 -0800

> Can you explain what "simple" does, i.e., what statements are
> inserted before call, raise, and return?

Here's the code that decides what gets prefixed.

		case transfer of
		   Call {args, func, return} =>
		      (case return of
			  Return.Dead => Vector.new0 ()
			| Return.NonTail {cont, handler} =>
			     (case handler of
				 Handler.Caller =>
				    Vector.new1 SetExnStackSlot
			       | Handler.Dead => Vector.new0 ()
			       | Handler.Handle l =>
				    Vector.new2 (SetHandler l,
			| Return.Tail =>
			     Vector.new1 SetExnStackSlot)
		 | Raise _ => Vector.new1 SetExnStackSlot
		 | Return _ => Vector.new1 SetExnStackSlot
		 | _ => Vector.new0 ()

The other thing you need to know is that the start of the function is
prefixed with a SetSlotExnStack.

> By "redundant assignments" do you mean multiple handlerpush
> (handlerpop) operations for a given handler without intervening
> handlerpushes (handlerpop) for other handlers?

SetHandler l is redundant if the handler slot already contains l.

SetExnStackLocal is redundant if the exn stack already points at the
	local frame.

SetExnStackSlot is redundant if the exn stack already contains the
	slot value.

This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
MLton-devel mailing list