Forum: IronRuby Code Review: Control Flow Optimizations

Posted by Tomas Matousek (Guest)
on 2010-02-08 23:12
Attachment: CFOptimization4.diff (90,3 KB)
(Received via mailing list)
1)      Implements a new block return optimization. It targets frame 
unwinding in the cases of returning from (nested) blocks like these:

def foo
  x.times do
    y.times do
       return
    end
  end
end

We were throwing an exception in such cases to unwind the block frames. 
This is unnecessary because we already handle other kinds of 
control-flow (retry) in call sites with a block (x.times and y.times in 
the example above). So adding one more check (for frame unwinding 
return) there enables us to not throw an exception and doesn't slow down 
the fast path (no cross-frame control flow).


2)      Removes an unnecessary allocation in dynamic call sites that 
dispatch to a Ruby method and take a block.

3)      Adds targeted unit tests to increase code coverage of control 
flow constructs.


Tomas
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.