[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: exception systems



From: "Guillermo J. Rozas" <gjr@martigny.ai.mit.edu>
Subject: Re: exception systems
Date: Thu, 18 Apr 96 18:25:04 -0400

> |   > In addition, perhaps VSCM and ML don't do this, but cwcc requires some
> |   > additional context saving on top of whatever overhead the actual
> |   > "stack" requires to preserve:
> |   > 
> |   > - interrupt blocking mask
> |   > - dynamic wind context
> |
> |   Dynamic-wind is another thing that I really like to go and never come
> |   back.
> 
> Gee, the complete opposite of what I think. :-)
> 
> Honestly, I can't imagine how you can manage side-effects without it.
> Now wait, you don't believe in side-effects.  I see.  :-)

Dynamic-wind might have its place, but not with call/cc.  I see
call/cc as a low-level mechanism, and we all know how you get a
call-with-context that does take care of dynamic-wind from a low-level
call/cc.

> 
> At any rate, dynamic-wind is not the only such item of information.
> What happens with exception handling state in the presence of
> continuations?

In SML/NJ is it exactly one register.  This register is only special
because the runtime system must know about it in order to deliver
low-level (hardware-) exceptions.  Otherwise one can picture the
current exception handler as just another additional implicit argument
to every function call.  The CPS conversion phase of the compiler
could take care of that, and the register allocator would again put it
into one or the other register (only now we don't know which one.

So, yes -- call/cc in SML/NJ must take exception handling into account
-- but it is just one extra register to save.

-Matthias