ruby-changes:37309
From: nobu <ko1@a...>
Date: Fri, 23 Jan 2015 23:57:26 +0900 (JST)
Subject: [ruby-changes:37309] nobu:r49390 (trunk): vm_insnhelper.c: break from nested rescue
nobu 2015-01-23 23:57:08 +0900 (Fri, 23 Jan 2015) New Revision: 49390 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49390 Log: vm_insnhelper.c: break from nested rescue * vm_insnhelper.c (vm_throw_start): search the target to break from a block with nested rescue, from the nested blocks. [ruby-core:67765] [Bug #10775] [Fix GH-820] Modified files: trunk/ChangeLog trunk/bootstraptest/test_block.rb trunk/vm_insnhelper.c Index: ChangeLog =================================================================== --- ChangeLog (revision 49389) +++ ChangeLog (revision 49390) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Jan 23 23:57:05 2015 Misumi Rize <r@a...> + + * vm_insnhelper.c (vm_throw_start): search the target to break + from a block with nested rescue, from the nested blocks. + [ruby-core:67765] [Bug #10775] [Fix GH-820] + Fri Jan 23 20:00:59 2015 Nobuyoshi Nakada <nobu@r...> * marshal.c (w_object, marshal_dump): use indetity tables for Index: bootstraptest/test_block.rb =================================================================== --- bootstraptest/test_block.rb (revision 49389) +++ bootstraptest/test_block.rb (revision 49390) @@ -597,3 +597,17 @@ assert_equal 'true', %q{ https://github.com/ruby/ruby/blob/trunk/bootstraptest/test_block.rb#L597 C1.new.foo{} } +assert_equal 'ok', %q{ + 1.times do + begin + raise + rescue + begin + raise + rescue + break + end + end + end + 'ok' +} Index: vm_insnhelper.c =================================================================== --- vm_insnhelper.c (revision 49389) +++ vm_insnhelper.c (revision 49390) @@ -609,13 +609,11 @@ vm_throw_start(rb_thread_t * const th, r https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L609 rb_iseq_t *base_iseq = GET_ISEQ(); escape_cfp = reg_cfp; - search_parent: - if (base_iseq->type != ISEQ_TYPE_BLOCK) { + while (base_iseq->type != ISEQ_TYPE_BLOCK) { if (escape_cfp->iseq->type == ISEQ_TYPE_CLASS) { escape_cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(escape_cfp); ep = escape_cfp->ep; base_iseq = escape_cfp->iseq; - goto search_parent; } else { ep = VM_EP_PREV_EP(ep); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/