Code Review: Control Flow Optimizations

  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).

  1.  Removes an unnecessary allocation in dynamic call sites that 
    

dispatch to a Ruby method and take a block.

  1.  Adds targeted unit tests to increase code coverage of control 
    

flow constructs.

Tomas

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs