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

ruby-changes:38946

From: ko1 <ko1@a...>
Date: Thu, 25 Jun 2015 17:37:47 +0900 (JST)
Subject: [ruby-changes:38946] ko1:r51027 (trunk): * vm_method.c (rb_method_entry_create): need to call

ko1	2015-06-25 17:37:27 +0900 (Thu, 25 Jun 2015)

  New Revision: 51027

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

  Log:
    * vm_method.c (rb_method_entry_create): need to call
      method_definition_reset() if def is given.
      Actually, `me' is a new object, so we don't need to call it.
      It is just to make sure.
    * vm_method.c (method_definition_reset): remove duplicated insertion.
    * vm_method.c (rb_method_entry_clone): assgine dst->def here,
      not in method_definition_reset().

  Modified files:
    trunk/ChangeLog
    trunk/vm_method.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 51026)
+++ ChangeLog	(revision 51027)
@@ -1,3 +1,16 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Jun 25 17:32:33 2015  Koichi Sasada  <ko1@a...>
+
+	* vm_method.c (rb_method_entry_create): need to call
+	  method_definition_reset() if def is given.
+
+	  Actually, `me' is a new object, so we don't need to call it.
+	  It is just to make sure.
+
+	* vm_method.c (method_definition_reset): remove duplicated insertion.
+
+	* vm_method.c (rb_method_entry_clone): assgine dst->def here,
+	  not in method_definition_reset().
+
 Thu Jun 25 16:44:54 2015  Koichi Sasada  <ko1@a...>
 
 	* vm_method.c: make a rb_method_definition_t data (def) *after* making
Index: vm_method.c
===================================================================
--- vm_method.c	(revision 51026)
+++ vm_method.c	(revision 51027)
@@ -283,9 +283,9 @@ method_definition_set(rb_method_entry_t https://github.com/ruby/ruby/blob/trunk/vm_method.c#L283
 }
 
 static void
-method_definition_reset(const rb_method_entry_t *me, rb_method_definition_t *def)
+method_definition_reset(const rb_method_entry_t *me)
 {
-    *(rb_method_definition_t **)&me->def = def;
+    rb_method_definition_t *def = me->def;
 
     switch(def->type) {
       case VM_METHOD_TYPE_ISEQ:
@@ -338,6 +338,7 @@ rb_method_entry_create(ID called_id, VAL https://github.com/ruby/ruby/blob/trunk/vm_method.c#L338
 {
     rb_method_entry_t *me = (rb_method_entry_t *)rb_imemo_new(imemo_ment, (VALUE)def, (VALUE)called_id, (VALUE)klass, 0);
     METHOD_ENTRY_FLAGS_SET(me, visi, ruby_running ? FALSE : TRUE, rb_safe_level());
+    if (def != NULL) method_definition_reset(me);
     return me;
 }
 
@@ -353,7 +354,8 @@ rb_method_entry_clone(const rb_method_en https://github.com/ruby/ruby/blob/trunk/vm_method.c#L354
 void
 rb_method_entry_copy(rb_method_entry_t *dst, const rb_method_entry_t *src)
 {
-    method_definition_reset(dst, method_definition_addref(src->def));
+    *(rb_method_definition_t **)&dst->def = method_definition_addref(src->def);
+    method_definition_reset(dst);
     dst->called_id = src->called_id;
     RB_OBJ_WRITE((VALUE)dst, &dst->klass, src->klass);
 }

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

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