Implementation of transfers out of closures

Mark Mahieu mark at
Mon Jul 14 12:33:40 PDT 2008

Here are versions which pass the code containing the Jump as a  
closure - not directly comparable to the NormalReturn class:

The inlined version seems to complete in about 50% of the time on the  
non-inlined version.

On 14 Jul 2008, at 20:09, Mark Mahieu wrote:

> 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  
>> successful.
>> 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  
> performs.
> On my machine, this test executes in around 250ms using normal  
> return statements, and around 10000ms after being translated to use  
> Jump and friends:
> 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.
> Regards,
> Mark

More information about the closures-dev mailing list