>  > 2) you are allocating a new exception every time; the optimization
>  > described here [1] works only if the exception is pre-allocated.
>  > [1] http://blogs.sun.com/jrose/entry/longjumps_considered_inexpensive
>
>  I think that is not thread safe. Specifically, when the branch conveys
>  information (passed as arguments using a tail call, or embedded in the
>  exception) then you must use a locally allocated exception, right?

>From TFA:
"A similar technique, not so widely used yet, is to clone a
pre-allocated exception and throw the clone. This can be handy if
there is information (such as a return value) which differs from use
to use; the variable information can be attached to the exception by
subclassing and adding a field. The generated code can still collapse
to a simple goto, and the extra information will stay completely in
registers, assuming complete escape analysis of the exception. (This
level of EA is on the horizon.)"

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to