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

ruby-changes:40538

From: ko1 <ko1@a...>
Date: Tue, 17 Nov 2015 19:39:49 +0900 (JST)
Subject: [ruby-changes:40538] ko1:r52617 (trunk): * method.h (METHOD_ENTRY_COMPLEMENTED(_SET)): introduced to recognize

ko1	2015-11-17 19:39:30 +0900 (Tue, 17 Nov 2015)

  New Revision: 52617

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

  Log:
    * method.h (METHOD_ENTRY_COMPLEMENTED(_SET)): introduced to recognize
      complemented method entries or not. There are some cases that callabe
      method entries do not have defined_class.
    
    * vm_method.c (rb_method_entry_complement_defined_class):
      use METHOD_ENTRY_COMPLEMENTED_SET().

  Modified files:
    trunk/ChangeLog
    trunk/method.h
    trunk/vm_method.c
Index: method.h
===================================================================
--- method.h	(revision 52616)
+++ method.h	(revision 52617)
@@ -65,6 +65,8 @@ typedef struct rb_callable_method_entry_ https://github.com/ruby/ruby/blob/trunk/method.h#L65
 
 #define METHOD_ENTRY_VISI(me)  (rb_method_visibility_t)(((me)->flags & (IMEMO_FL_USER0 | IMEMO_FL_USER1)) >> (IMEMO_FL_USHIFT+0))
 #define METHOD_ENTRY_BASIC(me) (int)                   (((me)->flags & (IMEMO_FL_USER2                 )) >> (IMEMO_FL_USHIFT+2))
+#define METHOD_ENTRY_COMPLEMENTED(me)     ((me)->flags & IMEMO_FL_USER3)
+#define METHOD_ENTRY_COMPLEMENTED_SET(me) ((me)->flags = (me)->flags | IMEMO_FL_USER3)
 
 static inline void
 METHOD_ENTRY_VISI_SET(rb_method_entry_t *me, rb_method_visibility_t visi)
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 52616)
+++ ChangeLog	(revision 52617)
@@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Nov 17 19:32:42 2015  Koichi Sasada  <ko1@a...>
+
+	* method.h (METHOD_ENTRY_COMPLEMENTED(_SET)): introduced to recognize
+	  complemented method entries or not. There are some cases that callabe
+	  method entries do not have defined_class.
+
+	* vm_method.c (rb_method_entry_complement_defined_class):
+	  use METHOD_ENTRY_COMPLEMENTED_SET().
+
 Tue Nov 17 19:02:59 2015  NAKAMURA Usaku  <usa@r...>
 
 	* configure.in (BASERUBY): use Kernel#print instead of Kernel#p because
Index: vm_method.c
===================================================================
--- vm_method.c	(revision 52616)
+++ vm_method.c	(revision 52617)
@@ -160,7 +160,7 @@ rb_method_definition_release(rb_method_d https://github.com/ruby/ruby/blob/trunk/vm_method.c#L160
 void
 rb_free_method_entry(const rb_method_entry_t *me)
 {
-    rb_method_definition_release(me->def, RB_TYPE_P(me->owner, T_MODULE) && RB_TYPE_P(me->defined_class, T_ICLASS));
+    rb_method_definition_release(me->def, METHOD_ENTRY_COMPLEMENTED(me));
 }
 
 static inline rb_method_entry_t *search_method(VALUE klass, ID id, VALUE *defined_class_ptr);
@@ -400,9 +400,9 @@ rb_method_entry_complement_defined_class https://github.com/ruby/ruby/blob/trunk/vm_method.c#L400
     rb_method_entry_t *me = rb_method_entry_alloc(src_me->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);
 
     VM_ASSERT(RB_TYPE_P(me->owner, T_MODULE));
-    VM_ASSERT(RB_TYPE_P(me->defined_class, T_ICLASS));
 
     return (rb_callable_method_entry_t *)me;
 }

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

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