ruby-changes:50515
From: nagachika <ko1@a...>
Date: Sun, 4 Mar 2018 11:18:03 +0900 (JST)
Subject: [ruby-changes:50515] nagachika:r62651 (ruby_2_4): merge revision(s) 59956: [Backport #13705]
nagachika 2018-03-04 11:17:58 +0900 (Sun, 04 Mar 2018) New Revision: 62651 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62651 Log: merge revision(s) 59956: [Backport #13705] vm.c: fix `cfp consistency error' which occurs when raising exception in bmethod call event * vm.c (invoke_bmethod): set FINISH flag just before calling vm_exec. [ruby-dev:50162] [Bug #13705] Modified directories: branches/ruby_2_4/ Modified files: branches/ruby_2_4/test/ruby/test_settracefunc.rb branches/ruby_2_4/version.h branches/ruby_2_4/vm.c Index: ruby_2_4/version.h =================================================================== --- ruby_2_4/version.h (revision 62650) +++ ruby_2_4/version.h (revision 62651) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_4/version.h#L1 #define RUBY_VERSION "2.4.4" #define RUBY_RELEASE_DATE "2018-03-04" -#define RUBY_PATCHLEVEL 248 +#define RUBY_PATCHLEVEL 249 #define RUBY_RELEASE_YEAR 2018 #define RUBY_RELEASE_MONTH 3 Index: ruby_2_4/vm.c =================================================================== --- ruby_2_4/vm.c (revision 62650) +++ ruby_2_4/vm.c (revision 62651) @@ -980,7 +980,7 @@ invoke_bmethod(rb_thread_t *th, const rb https://github.com/ruby/ruby/blob/trunk/ruby_2_4/vm.c#L980 int arg_size = iseq->body->param.size; VALUE ret; - vm_push_frame(th, iseq, type | VM_FRAME_FLAG_FINISH | VM_FRAME_FLAG_BMETHOD, self, + vm_push_frame(th, iseq, type | VM_FRAME_FLAG_BMETHOD, self, VM_GUARDED_PREV_EP(captured->ep), (VALUE)me, iseq->body->iseq_encoded + opt_pc, @@ -989,6 +989,7 @@ invoke_bmethod(rb_thread_t *th, const rb https://github.com/ruby/ruby/blob/trunk/ruby_2_4/vm.c#L989 RUBY_DTRACE_METHOD_ENTRY_HOOK(th, me->owner, me->def->original_id); EXEC_EVENT_HOOK(th, RUBY_EVENT_CALL, self, me->def->original_id, me->called_id, me->owner, Qnil); + VM_ENV_FLAGS_SET(th->cfp->ep, VM_FRAME_FLAG_FINISH); ret = vm_exec(th); EXEC_EVENT_HOOK(th, RUBY_EVENT_RETURN, self, me->def->original_id, me->called_id, me->owner, ret); RUBY_DTRACE_METHOD_RETURN_HOOK(th, me->owner, me->def->original_id); Index: ruby_2_4/test/ruby/test_settracefunc.rb =================================================================== --- ruby_2_4/test/ruby/test_settracefunc.rb (revision 62650) +++ ruby_2_4/test/ruby/test_settracefunc.rb (revision 62651) @@ -1745,4 +1745,25 @@ class TestSetTraceFunc < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/ruby_2_4/test/ruby/test_settracefunc.rb#L1745 tp_return_value(:f_break_in_rescue), '[Bug #13369]' end + + def test_trace_point_raising_exception_in_bmethod_call + bug13705 = '[ruby-dev:50162]' + assert_normal_exit %q{ + define_method(:m) {} + + tp = TracePoint.new(:call) do + raise '' + end + + tap do + tap do + begin + tp.enable + m + rescue + end + end + end + }, bug13705 + end end Index: ruby_2_4 =================================================================== --- ruby_2_4 (revision 62650) +++ ruby_2_4 (revision 62651) Property changes on: ruby_2_4 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r59956 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/