summaryrefslogtreecommitdiff
path: root/vm_method.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-17 13:18:19 (GMT)
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-17 13:18:19 (GMT)
commit6a533a3ecc23e6cb90e2616231f2b67d15ff3239 (patch)
treead5acc65be41b85ad35922c214e81476f38c61bf /vm_method.c
parent508addd7e06fac19fe36fee957b31035e72097db (diff)
revert r52614, r52615, r52617 because they cause serious errors
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_method.c')
-rw-r--r--vm_method.c35
1 files changed, 9 insertions, 26 deletions
diff --git a/vm_method.c b/vm_method.c
index 685e31f..c881674 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -135,24 +135,19 @@ rb_add_method_cfunc(VALUE klass, ID mid, VALUE (*func)(ANYARGS), int argc, rb_me
}
static void
-rb_method_definition_release(rb_method_definition_t *def, int complemented)
+rb_method_definition_release(rb_method_definition_t *def)
{
if (def != NULL) {
- const int alias_count = def->alias_count;
- const int complemented_count = def->complemented_count;
- VM_ASSERT(alias_count >= 0);
- VM_ASSERT(complemented_count >= 0);
+ const int count = def->alias_count;
+ VM_ASSERT(count >= 0);
- if (alias_count + complemented_count == 0) {
- if (METHOD_DEBUG) fprintf(stderr, "-%p-%s:%d,%d (remove)\n", def, rb_id2name(def->original_id), alias_count, complemented_count);
+ if (count == 0) {
+ if (METHOD_DEBUG) fprintf(stderr, "-%p-%s:%d\n", def, rb_id2name(def->original_id), count);
xfree(def);
}
else {
- if (complemented) def->complemented_count--;
- else if (def->alias_count > 0) def->alias_count--;
-
- if (METHOD_DEBUG) fprintf(stderr, "-%p-%s:%d->%d,%d->%d (dec)\n", def, rb_id2name(def->original_id),
- alias_count, def->alias_count, complemented_count, def->complemented_count);
+ if (METHOD_DEBUG) fprintf(stderr, "-%p-%s:%d->%d\n", def, rb_id2name(def->original_id), count, count-1);
+ def->alias_count--;
}
}
}
@@ -160,7 +155,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, METHOD_ENTRY_COMPLEMENTED(me));
+ rb_method_definition_release(me->def);
}
static inline rb_method_entry_t *search_method(VALUE klass, ID id, VALUE *defined_class_ptr);
@@ -347,14 +342,6 @@ method_definition_addref(rb_method_definition_t *def)
return def;
}
-static rb_method_definition_t *
-method_definition_addref_complement(rb_method_definition_t *def)
-{
- def->complemented_count++;
- if (METHOD_DEBUG) fprintf(stderr, "+%p-%s:%d\n", def, rb_id2name(def->original_id), def->alias_count);
- return def;
-}
-
static rb_method_entry_t *
rb_method_entry_alloc(ID called_id, VALUE owner, VALUE defined_class, const rb_method_definition_t *def)
{
@@ -398,12 +385,8 @@ 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_t *me = rb_method_entry_alloc(src_me->called_id, src_me->owner, defined_class,
- method_definition_addref_complement(src_me->def));
+ method_definition_addref(src_me->def));
METHOD_ENTRY_FLAGS_COPY(me, src_me);
- METHOD_ENTRY_COMPLEMENTED_SET(me);
-
- VM_ASSERT(RB_TYPE_P(me->owner, T_MODULE));
-
return (rb_callable_method_entry_t *)me;
}