Implementation of transfers out of closures
mark at twistedbanana.demon.co.uk
Mon Jul 14 12:09:50 PDT 2008
On 14 Jul 2008, at 01:11, Neal Gafter wrote:
> I have the following design constraints:
> The "normal" case should be relatively fast. Specifically, there
> should be no capturing of a stack trace when the transfer is
> The structure of the generated code should take advantage of
> existing hotspot optimizations and enable new ones.
I've had a quick play with the code, using a very artificial and
unfair recursive test designed to examine how well this technique
On my machine, this test executes in around 250ms using normal return
statements, and around 10000ms after being translated to use Jump and
However, manually inlining the call to transfer() within the try
block has a nice effect: the test completes in under 2200ms:
Presumably this change is sufficient to trigger a particular hotspot
optimisation which isn't performed in the non-inlined version, such
as a straightforward branch to the code in the catch block.
Quite promising I think.
More information about the closures-dev