[前][次][番号順一覧][スレッド一覧]

ruby-changes:50653

From: usa <ko1@a...>
Date: Sun, 18 Mar 2018 23:53:32 +0900 (JST)
Subject: [ruby-changes:50653] usa:r62815 (ruby_2_3): merge revision(s) 59956: [Backport #13705]

usa	2018-03-18 23:53:26 +0900 (Sun, 18 Mar 2018)

  New Revision: 62815

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62815

  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_3/
  Modified files:
    branches/ruby_2_3/ChangeLog
    branches/ruby_2_3/test/ruby/test_settracefunc.rb
    branches/ruby_2_3/version.h
    branches/ruby_2_3/vm.c
Index: ruby_2_3/version.h
===================================================================
--- ruby_2_3/version.h	(revision 62814)
+++ ruby_2_3/version.h	(revision 62815)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1
 #define RUBY_VERSION "2.3.7"
 #define RUBY_RELEASE_DATE "2018-03-18"
-#define RUBY_PATCHLEVEL 416
+#define RUBY_PATCHLEVEL 417
 
 #define RUBY_RELEASE_YEAR 2018
 #define RUBY_RELEASE_MONTH 3
Index: ruby_2_3/vm.c
===================================================================
--- ruby_2_3/vm.c	(revision 62814)
+++ ruby_2_3/vm.c	(revision 62815)
@@ -928,15 +928,17 @@ invoke_bmethod(rb_thread_t *th, const rb https://github.com/ruby/ruby/blob/trunk/ruby_2_3/vm.c#L928
     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_ENVVAL_PREV_EP_PTR(block->ep),
-		  (VALUE)me, /* cref or method (TODO: can we ignore cref?) */
-		  iseq->body->iseq_encoded + opt_pc,
-		  th->cfp->sp + arg_size, iseq->body->local_size - arg_size,
-		  iseq->body->stack_max);
+    rb_control_frame_t *cfp =
+	vm_push_frame(th, iseq, type | VM_FRAME_FLAG_BMETHOD, self,
+		      VM_ENVVAL_PREV_EP_PTR(block->ep),
+		      (VALUE)me, /* cref or method (TODO: can we ignore cref?) */
+		      iseq->body->iseq_encoded + opt_pc,
+		      th->cfp->sp + arg_size, iseq->body->local_size - arg_size,
+		      iseq->body->stack_max);
 
     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->owner, Qnil);
+    cfp->flag |= VM_FRAME_FLAG_FINISH;
     ret = vm_exec(th);
     EXEC_EVENT_HOOK(th, RUBY_EVENT_RETURN, self, me->def->original_id, me->owner, ret);
     RUBY_DTRACE_METHOD_RETURN_HOOK(th, me->owner, me->def->original_id);
Index: ruby_2_3/test/ruby/test_settracefunc.rb
===================================================================
--- ruby_2_3/test/ruby/test_settracefunc.rb	(revision 62814)
+++ ruby_2_3/test/ruby/test_settracefunc.rb	(revision 62815)
@@ -1634,4 +1634,25 @@ class TestSetTraceFunc < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_settracefunc.rb#L1634
                  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_3/ChangeLog
===================================================================
--- ruby_2_3/ChangeLog	(revision 62814)
+++ ruby_2_3/ChangeLog	(revision 62815)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1
+Sun Mar 18 23:52:37 2018  Kazuki Tsujimoto  <kazuki@c...>
+
+	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.
+	  [Bug #13705]
+
 Sun Mar 18 23:36:24 2018  SHIBATA Hiroshi  <hsbt@r...>
 
 	added workaround for APFS file format.
Index: ruby_2_3
===================================================================
--- ruby_2_3	(revision 62814)
+++ ruby_2_3	(revision 62815)

Property changes on: ruby_2_3
___________________________________________________________________
Modified: svn:mergeinfo
## -0,0 +0,1 ##
   Merged /trunk:r59956

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]