[Ironruby-core] Code Review: Control Flow Optimizations

Tomas Matousek Tomas.Matousek at microsoft.com
Mon Feb 8 16:37:09 EST 2010


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100208/a987e9a7/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CFOptimization4.diff
Type: application/octet-stream
Size: 92447 bytes
Desc: CFOptimization4.diff
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20100208/a987e9a7/attachment-0001.obj>


More information about the Ironruby-core mailing list