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

ruby-changes:46077

From: nagachika <ko1@a...>
Date: Mon, 27 Mar 2017 20:25:24 +0900 (JST)
Subject: [ruby-changes:46077] nagachika:r58148 (ruby_2_3): merge revision(s) 56592: [Backport #11964]

nagachika	2017-03-27 20:25:19 +0900 (Mon, 27 Mar 2017)

  New Revision: 58148

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

  Log:
    merge revision(s) 56592: [Backport #11964]
    
    * eval.c, method.h, proc.c, vm.c, vm_eval.c, vm_insnhelper.c, vm_method.c:
      TracePoint#method_id should return method_id, not callee_id.
      [ruby-core:77241] [Feature #12747]
    
    * test/ruby/test_settracefunc.rb: change accordingly.

  Modified directories:
    branches/ruby_2_3/
  Modified files:
    branches/ruby_2_3/ChangeLog
    branches/ruby_2_3/eval.c
    branches/ruby_2_3/method.h
    branches/ruby_2_3/proc.c
    branches/ruby_2_3/test/ruby/test_settracefunc.rb
    branches/ruby_2_3/version.h
    branches/ruby_2_3/vm.c
    branches/ruby_2_3/vm_eval.c
    branches/ruby_2_3/vm_insnhelper.c
    branches/ruby_2_3/vm_method.c
Index: ruby_2_3/version.h
===================================================================
--- ruby_2_3/version.h	(revision 58147)
+++ ruby_2_3/version.h	(revision 58148)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1
 #define RUBY_VERSION "2.3.3"
 #define RUBY_RELEASE_DATE "2017-03-27"
-#define RUBY_PATCHLEVEL 260
+#define RUBY_PATCHLEVEL 261
 
 #define RUBY_RELEASE_YEAR 2017
 #define RUBY_RELEASE_MONTH 3
Index: ruby_2_3/proc.c
===================================================================
--- ruby_2_3/proc.c	(revision 58147)
+++ ruby_2_3/proc.c	(revision 58148)
@@ -2135,7 +2135,7 @@ umethod_bind(VALUE method, VALUE recv) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/proc.c#L2135
 	else {
 	    klass = rb_include_class_new(methclass, klass);
 	}
-	RB_OBJ_WRITE(method, &bound->me, rb_method_entry_complement_defined_class(bound->me, klass));
+	RB_OBJ_WRITE(method, &bound->me, rb_method_entry_complement_defined_class(bound->me, bound->me->called_id, klass));
     }
 
     return method;
Index: ruby_2_3/eval.c
===================================================================
--- ruby_2_3/eval.c	(revision 58147)
+++ ruby_2_3/eval.c	(revision 58148)
@@ -763,7 +763,7 @@ rb_raise_jump(VALUE mesg, VALUE cause) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/eval.c#L763
     ID mid = me->called_id;
 
     th->cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp);
-    EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, self, mid, klass, Qnil);
+    EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, self, me->def->original_id, klass, Qnil);
 
     setup_exception(th, TAG_RAISE, mesg, cause);
 
Index: ruby_2_3/vm_insnhelper.c
===================================================================
--- ruby_2_3/vm_insnhelper.c	(revision 58147)
+++ ruby_2_3/vm_insnhelper.c	(revision 58148)
@@ -1628,8 +1628,8 @@ vm_call_cfunc_with_frame(rb_thread_t *th https://github.com/ruby/ruby/blob/trunk/ruby_2_3/vm_insnhelper.c#L1628
     rb_block_t *blockptr = calling->blockptr;
     int argc = calling->argc;
 
-    RUBY_DTRACE_CMETHOD_ENTRY_HOOK(th, me->owner, me->called_id);
-    EXEC_EVENT_HOOK(th, RUBY_EVENT_C_CALL, recv, me->called_id, me->owner, Qundef);
+    RUBY_DTRACE_CMETHOD_ENTRY_HOOK(th, me->owner, me->def->original_id);
+    EXEC_EVENT_HOOK(th, RUBY_EVENT_C_CALL, recv, me->def->original_id, me->owner, Qundef);
 
     vm_push_frame(th, NULL, VM_FRAME_MAGIC_CFUNC, recv,
 		  VM_ENVVAL_BLOCK_PTR(blockptr), (VALUE)me,
@@ -1647,8 +1647,8 @@ vm_call_cfunc_with_frame(rb_thread_t *th https://github.com/ruby/ruby/blob/trunk/ruby_2_3/vm_insnhelper.c#L1647
 
     vm_pop_frame(th);
 
-    EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, recv, me->called_id, me->owner, val);
-    RUBY_DTRACE_CMETHOD_RETURN_HOOK(th, me->owner, me->called_id);
+    EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, recv, me->def->original_id, me->owner, val);
+    RUBY_DTRACE_CMETHOD_RETURN_HOOK(th, me->owner, me->def->original_id);
 
     return val;
 }
@@ -1975,7 +1975,7 @@ aliased_callable_method_entry(const rb_c https://github.com/ruby/ruby/blob/trunk/ruby_2_3/vm_insnhelper.c#L1975
     if (orig_me->defined_class == 0) {
 	VALUE defined_class = find_defined_class_by_owner(me->defined_class, orig_me->owner);
 	VM_ASSERT(RB_TYPE_P(orig_me->owner, T_MODULE));
-	cme = rb_method_entry_complement_defined_class(orig_me, defined_class);
+	cme = rb_method_entry_complement_defined_class(orig_me, me->called_id, defined_class);
 
 	if (me->def->alias_count + me->def->complemented_count == 0) {
 	    RB_OBJ_WRITE(me, &me->def->body.alias.original_me, cme);
Index: ruby_2_3/ChangeLog
===================================================================
--- ruby_2_3/ChangeLog	(revision 58147)
+++ ruby_2_3/ChangeLog	(revision 58148)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1
+Mon Mar 27 20:15:17 2017  Kazuki Tsujimoto  <kazuki@c...>
+
+	* eval.c, method.h, proc.c, vm.c, vm_eval.c, vm_insnhelper.c, vm_method.c:
+	  TracePoint#method_id should return method_id, not callee_id.
+	  [ruby-core:77241] [Feature #12747]
+
+	* test/ruby/test_settracefunc.rb: change accordingly.
+
 Mon Mar 27 20:12:23 2017  Anton Davydov  <mail@d...>
 
 	* lib/uri/mailto.rb: Removed needless `return` and use `.`` instead of `::`
Index: ruby_2_3/vm_method.c
===================================================================
--- ruby_2_3/vm_method.c	(revision 58147)
+++ ruby_2_3/vm_method.c	(revision 58148)
@@ -410,9 +410,9 @@ rb_method_entry_clone(const rb_method_en https://github.com/ruby/ruby/blob/trunk/ruby_2_3/vm_method.c#L410
 }
 
 const rb_callable_method_entry_t *
-rb_method_entry_complement_defined_class(const rb_method_entry_t *src_me, VALUE defined_class)
+rb_method_entry_complement_defined_class(const rb_method_entry_t *src_me, ID called_id, VALUE defined_class)
 {
-    rb_method_entry_t *me = rb_method_entry_alloc(src_me->called_id, src_me->owner, defined_class,
+    rb_method_entry_t *me = rb_method_entry_alloc(called_id, src_me->owner, defined_class,
 						  method_definition_addref_complement(src_me->def));
     METHOD_ENTRY_FLAGS_COPY(me, src_me);
     METHOD_ENTRY_COMPLEMENTED_SET(me);
@@ -811,7 +811,7 @@ prepare_callable_method_entry(VALUE defi https://github.com/ruby/ruby/blob/trunk/ruby_2_3/vm_method.c#L811
 	    VM_ASSERT(callable_method_entry_p(cme));
 	}
 	else {
-	    cme = rb_method_entry_complement_defined_class(me, defined_class);
+	    cme = rb_method_entry_complement_defined_class(me, me->called_id, defined_class);
 	    rb_id_table_insert(mtbl, id, (VALUE)cme);
 	    VM_ASSERT(callable_method_entry_p(cme));
 	}
@@ -944,7 +944,7 @@ rb_resolve_refined_method_callable(VALUE https://github.com/ruby/ruby/blob/trunk/ruby_2_3/vm_method.c#L944
     const rb_method_entry_t *resolved_me = resolve_refined_method(refinements, (const rb_method_entry_t *)me, &defined_class);
 
     if (resolved_me && resolved_me->defined_class == 0) {
-	return rb_method_entry_complement_defined_class(resolved_me, defined_class);
+	return rb_method_entry_complement_defined_class(resolved_me, me->called_id, defined_class);
     }
     else {
 	return (const rb_callable_method_entry_t *)resolved_me;
Index: ruby_2_3/method.h
===================================================================
--- ruby_2_3/method.h	(revision 58147)
+++ ruby_2_3/method.h	(revision 58148)
@@ -205,7 +205,7 @@ void rb_free_method_entry(const rb_metho https://github.com/ruby/ruby/blob/trunk/ruby_2_3/method.h#L205
 void rb_sweep_method_entry(void *vm);
 
 const rb_method_entry_t *rb_method_entry_clone(const rb_method_entry_t *me);
-const rb_callable_method_entry_t *rb_method_entry_complement_defined_class(const rb_method_entry_t *src_me, VALUE defined_class);
+const rb_callable_method_entry_t *rb_method_entry_complement_defined_class(const rb_method_entry_t *src_me, ID called_id, VALUE defined_class);
 void rb_method_entry_copy(rb_method_entry_t *dst, const rb_method_entry_t *src);
 
 void rb_scope_visibility_set(rb_method_visibility_t);
Index: ruby_2_3/vm.c
===================================================================
--- ruby_2_3/vm.c	(revision 58147)
+++ ruby_2_3/vm.c	(revision 58148)
@@ -433,8 +433,8 @@ rb_vm_pop_cfunc_frame(void) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/vm.c#L433
     rb_thread_t *th = GET_THREAD();
     const rb_callable_method_entry_t *me = rb_vm_frame_method_entry(th->cfp);
 
-    EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, th->cfp->self, me->called_id, me->owner, Qnil);
-    RUBY_DTRACE_CMETHOD_RETURN_HOOK(th, me->owner, me->called_id);
+    EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, th->cfp->self, me->def->original_id, me->owner, Qnil);
+    RUBY_DTRACE_CMETHOD_RETURN_HOOK(th, me->owner, me->def->original_id);
     vm_pop_frame(th);
 }
 
@@ -935,11 +935,11 @@ invoke_bmethod(rb_thread_t *th, const rb https://github.com/ruby/ruby/blob/trunk/ruby_2_3/vm.c#L935
 		  th->cfp->sp + arg_size, iseq->body->local_size - arg_size,
 		  iseq->body->stack_max);
 
-    RUBY_DTRACE_METHOD_ENTRY_HOOK(th, me->owner, me->called_id);
-    EXEC_EVENT_HOOK(th, RUBY_EVENT_CALL, self, me->called_id, me->owner, Qnil);
+    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);
     ret = vm_exec(th);
-    EXEC_EVENT_HOOK(th, RUBY_EVENT_RETURN, self, me->called_id, me->owner, ret);
-    RUBY_DTRACE_METHOD_RETURN_HOOK(th, me->owner, me->called_id);
+    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);
     return ret;
 }
 
@@ -1523,7 +1523,7 @@ hook_before_rewind(rb_thread_t *th, rb_c https://github.com/ruby/ruby/blob/trunk/ruby_2_3/vm.c#L1523
 	    if (!will_finish_vm_exec) {
 		/* kick RUBY_EVENT_RETURN at invoke_block_from_c() for bmethod */
 		EXEC_EVENT_HOOK_AND_POP_FRAME(th, RUBY_EVENT_RETURN, th->cfp->self,
-					      rb_vm_frame_method_entry(th->cfp)->called_id,
+					      rb_vm_frame_method_entry(th->cfp)->def->original_id,
 					      rb_vm_frame_method_entry(th->cfp)->owner, Qnil);
 	    }
 	}
@@ -1673,11 +1673,11 @@ vm_exec(rb_thread_t *th) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/vm.c#L1673
 	while (th->cfp->pc == 0 || th->cfp->iseq == 0) {
 	    if (UNLIKELY(VM_FRAME_TYPE(th->cfp) == VM_FRAME_MAGIC_CFUNC)) {
 		EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, th->cfp->self,
-				rb_vm_frame_method_entry(th->cfp)->called_id,
+				rb_vm_frame_method_entry(th->cfp)->def->original_id,
 				rb_vm_frame_method_entry(th->cfp)->owner, Qnil);
 		RUBY_DTRACE_CMETHOD_RETURN_HOOK(th,
 					       rb_vm_frame_method_entry(th->cfp)->owner,
-					       rb_vm_frame_method_entry(th->cfp)->called_id);
+					       rb_vm_frame_method_entry(th->cfp)->def->original_id);
 	    }
 	    th->cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp);
 	}
Index: ruby_2_3/vm_eval.c
===================================================================
--- ruby_2_3/vm_eval.c	(revision 58147)
+++ ruby_2_3/vm_eval.c	(revision 58148)
@@ -117,7 +117,7 @@ vm_call0_cfunc_with_frame(rb_thread_t* t https://github.com/ruby/ruby/blob/trunk/ruby_2_3/vm_eval.c#L117
     rb_block_t *blockptr = calling->blockptr;
 
     RUBY_DTRACE_CMETHOD_ENTRY_HOOK(th, me->owner, mid);
-    EXEC_EVENT_HOOK(th, RUBY_EVENT_C_CALL, recv, mid, me->owner, Qnil);
+    EXEC_EVENT_HOOK(th, RUBY_EVENT_C_CALL, recv, me->def->original_id, me->owner, Qnil);
     {
 	rb_control_frame_t *reg_cfp = th->cfp;
 
@@ -136,7 +136,7 @@ vm_call0_cfunc_with_frame(rb_thread_t* t https://github.com/ruby/ruby/blob/trunk/ruby_2_3/vm_eval.c#L136
 	VM_PROFILE_UP(C2C_POPF);
 	vm_pop_frame(th);
     }
-    EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, recv, mid, me->owner, val);
+    EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, recv, me->def->original_id, me->owner, val);
     RUBY_DTRACE_CMETHOD_RETURN_HOOK(th, me->owner, mid);
 
     return val;
Index: ruby_2_3/test/ruby/test_settracefunc.rb
===================================================================
--- ruby_2_3/test/ruby/test_settracefunc.rb	(revision 58147)
+++ ruby_2_3/test/ruby/test_settracefunc.rb	(revision 58148)
@@ -1153,8 +1153,8 @@ class TestSetTraceFunc < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_settracefunc.rb#L1153
     }
     assert_equal([
       [:call, :size],
-      [:c_call, :original_size],
-      [:c_return, :original_size],
+      [:c_call, :size],
+      [:c_return, :size],
       [:return, :size]
     ], events, "should use alias method name for tracing c methods")
   end
@@ -1287,7 +1287,7 @@ class TestSetTraceFunc < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_settracefunc.rb#L1287
       }.enable{
         p 1
       }
-    }, %w[:p :inspect 1], [], '[Bug #9940]')
+    }, %w[:p :to_s 1], [], '[Bug #9940]')
   end
 
   def method_prefix event

Property changes on: ruby_2_3
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r56592


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

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