ruby-changes:35257
From: usa <ko1@a...>
Date: Sun, 31 Aug 2014 16:39:27 +0900 (JST)
Subject: [ruby-changes:35257] usa:r47339 (ruby_2_0_0): merge revision(s) 46463: [Backport #9957]
usa 2014-08-31 16:39:15 +0900 (Sun, 31 Aug 2014) New Revision: 47339 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47339 Log: merge revision(s) 46463: [Backport #9957] * vm_core.h: add VM_FRAME_MAGIC_RESCUE to recognize normal block or rescue clause. * vm.c (vm_exec): use VM_FRAME_MAGIC_RESCUE on at rescue/ensure. * test/ruby/test_settracefunc.rb: should not invoke b_return at rescue clause. [Bug #9957] * vm_dump.c (control_frame_dump): check VM_FRAME_MAGIC_RESCUE. * vm_dump.c (vm_stack_dump_each): ditto. Modified directories: branches/ruby_2_0_0/ Modified files: branches/ruby_2_0_0/ChangeLog branches/ruby_2_0_0/test/ruby/test_settracefunc.rb branches/ruby_2_0_0/version.h branches/ruby_2_0_0/vm.c branches/ruby_2_0_0/vm_core.h branches/ruby_2_0_0/vm_dump.c Index: ruby_2_0_0/ChangeLog =================================================================== --- ruby_2_0_0/ChangeLog (revision 47338) +++ ruby_2_0_0/ChangeLog (revision 47339) @@ -1,3 +1,18 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1 +Sun Aug 31 16:38:26 2014 Koichi Sasada <ko1@a...> + + * vm_core.h: add VM_FRAME_MAGIC_RESCUE to recognize normal block or + rescue clause. + + * vm.c (vm_exec): use VM_FRAME_MAGIC_RESCUE on at rescue/ensure. + + * test/ruby/test_settracefunc.rb: should not invoke b_return at rescue + clause. + [Bug #9957] + + * vm_dump.c (control_frame_dump): check VM_FRAME_MAGIC_RESCUE. + + * vm_dump.c (vm_stack_dump_each): ditto. + Sun Aug 31 16:32:10 2014 Hiroshi Shirosaki <h.shirosaki@g...> * lib/test/unit/parallel.rb: fix test-all parallel failure if a test Index: ruby_2_0_0/vm_core.h =================================================================== --- ruby_2_0_0/vm_core.h (revision 47338) +++ ruby_2_0_0/vm_core.h (revision 47339) @@ -730,7 +730,8 @@ enum vm_special_object_type { https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/vm_core.h#L730 #define VM_FRAME_MAGIC_IFUNC 0x81 #define VM_FRAME_MAGIC_EVAL 0x91 #define VM_FRAME_MAGIC_LAMBDA 0xa1 -#define VM_FRAME_MAGIC_MASK_BITS 8 +#define VM_FRAME_MAGIC_RESCUE 0xb1 +#define VM_FRAME_MAGIC_MASK_BITS 8 #define VM_FRAME_MAGIC_MASK (~(~0<<VM_FRAME_MAGIC_MASK_BITS)) #define VM_FRAME_TYPE(cfp) ((cfp)->flag & VM_FRAME_MAGIC_MASK) Index: ruby_2_0_0/vm.c =================================================================== --- ruby_2_0_0/vm.c (revision 47338) +++ ruby_2_0_0/vm.c (revision 47339) @@ -1099,6 +1099,7 @@ vm_frametype_name(const rb_control_frame https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/vm.c#L1099 case VM_FRAME_MAGIC_IFUNC: return "ifunc"; case VM_FRAME_MAGIC_EVAL: return "eval"; case VM_FRAME_MAGIC_LAMBDA: return "lambda"; + case VM_FRAME_MAGIC_RESCUE: return "rescue"; default: rb_bug("unknown frame"); } @@ -1395,7 +1396,7 @@ vm_exec(rb_thread_t *th) https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/vm.c#L1396 /* push block frame */ cfp->sp[0] = err; - vm_push_frame(th, catch_iseq, VM_FRAME_MAGIC_BLOCK, + vm_push_frame(th, catch_iseq, VM_FRAME_MAGIC_RESCUE, cfp->self, cfp->klass, VM_ENVVAL_PREV_EP_PTR(cfp->ep), catch_iseq->iseq_encoded, Index: ruby_2_0_0/version.h =================================================================== --- ruby_2_0_0/version.h (revision 47338) +++ ruby_2_0_0/version.h (revision 47339) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1 #define RUBY_VERSION "2.0.0" #define RUBY_RELEASE_DATE "2014-08-31" -#define RUBY_PATCHLEVEL 539 +#define RUBY_PATCHLEVEL 540 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 8 Index: ruby_2_0_0/vm_dump.c =================================================================== --- ruby_2_0_0/vm_dump.c (revision 47338) +++ ruby_2_0_0/vm_dump.c (revision 47339) @@ -73,6 +73,9 @@ control_frame_dump(rb_thread_t *th, rb_c https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/vm_dump.c#L73 case VM_FRAME_MAGIC_EVAL: magic = "EVAL"; break; + case VM_FRAME_MAGIC_RESCUE: + magic = "RESCUE"; + break; case 0: magic = "------"; break; @@ -268,15 +271,17 @@ vm_stack_dump_each(rb_thread_t *th, rb_c https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/vm_dump.c#L271 /* stack trace header */ - if (VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_METHOD || - VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_TOP || + if (VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_METHOD|| + VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_TOP || VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_BLOCK || VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_CLASS || - VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_PROC || - VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_LAMBDA || + VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_PROC || + VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_LAMBDA|| VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_CFUNC || VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_IFUNC || - VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_EVAL) { + VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_EVAL || + VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_RESCUE) + { VALUE *ptr = ep - local_size; Index: ruby_2_0_0/test/ruby/test_settracefunc.rb =================================================================== --- ruby_2_0_0/test/ruby/test_settracefunc.rb (revision 47338) +++ ruby_2_0_0/test/ruby/test_settracefunc.rb (revision 47339) @@ -1104,4 +1104,40 @@ class TestSetTraceFunc < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_settracefunc.rb#L1104 ], events, bug59398) end + + def method_test_rescue_should_not_cause_b_return + begin + raise + rescue + return + end + end + + def method_test_ensure_should_not_cause_b_return + begin + raise + ensure + return + end + end + + def test_rescue_and_ensure_should_not_cause_b_return + curr_thread = Thread.current + trace = TracePoint.new(:b_call, :b_return){ + next if curr_thread != Thread.current + flunk("Should not reach here because there is no block.") + } + + begin + trace.enable + method_test_rescue_should_not_cause_b_return + begin + method_test_ensure_should_not_cause_b_return + rescue + # ignore + end + ensure + trace.disable + end + end end Property changes on: ruby_2_0_0 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r46463 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/