[MLton-devel] exceptions

Stephen Weeks MLton@mlton.org
Wed, 8 Jan 2003 06:10:08 -0800

> If we need to walk the stack anyways, would the cost be that much more to
> do it explicitly in ML?  I.e., actually putting a handler in each SSA
> function, which may do nothing but reraise?  If we were to always push a
> handler and a return address, then reraising should just be a stack
> adjustment and an indirect jump, just like a normal return.

The cost of that may be enough that it bothers me, both in terms of
code size and run time.  I would rather store the information in frame
layouts, and have a single piece of code that scans the stack frames
until a frame-with-handler is found, and then execute an indirect

The advantages are:

* one piece of code per program (or one per chunk in the C codegen)
  instead of one per SSA function
* a (very tight) loop followed by one one indirect jump per raise 
  instead of one indirect jump per intervening stack frame 
* the same approach is used in both codegens (until the final indirect
  jump of course)

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