Implementation of transfers out of closures
neal at gafter.com
Fri Jul 18 12:08:48 PDT 2008
On Fri, Jul 18, 2008 at 11:53 AM, John Rose <John.Rose at sun.com> wrote:
> In the example code, the dead field is superfluous. The code should just
> set frame$.thread to null. One variable is always better than two, as far
> as the JIT is concerned.
Is that thread-safe? From the same thread, we see the correct value,
and from another thread we see either null or the original thread's
reference; either way we get the right behavior. Yes, good idea.
> It is often better to put the throw early in the code, as soon as you know
> there is going to be a throw, rather than make a method call which never
> returns and throw from inside. Less for the compiler and runtime to unwrap.
> Therefore, you might want to consider making the throwiness of
> Jump.transfer public: Have transfer return a RuntimeEx which the caller
> must then throw. It's no loss of generality: The transfer method does not
> actually need to return on all implementations.
Sounds good. Thanks for the other references, too!
More information about the closures-dev