summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-17 10:39:30 (GMT)
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-17 10:39:30 (GMT)
commit551ae37ba3307fb982272413a02b3b94561bf39b (patch)
treef20e22b3f7cf7f063821c282f89adb30aaf84da6
parentc88764f369ddaa9661a0b0c4ca121232f7f1513e (diff)
* 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(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog9
-rw-r--r--method.h2
-rw-r--r--vm_method.c4
3 files changed, 13 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 431f8ca..425beaa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Tue Nov 17 19:32:42 2015 Koichi Sasada <ko1@atdot.net>
+
+ * 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@ruby-lang.org>
* configure.in (BASERUBY): use Kernel#print instead of Kernel#p because
diff --git a/method.h b/method.h
index f069202..315915b 100644
--- a/method.h
+++ b/method.h
@@ -65,6 +65,8 @@ typedef struct rb_callable_method_entry_struct { /* same fields with rb_method_e
#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)
diff --git a/vm_method.c b/vm_method.c
index 657fbbd..685e31f 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -160,7 +160,7 @@ rb_method_definition_release(rb_method_definition_t *def, int complemented)
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(const rb_method_entry_t *src_me, VALUE
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;
}