summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-04 20:25:09 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-04 20:25:09 +0000
commitb4d7d616d9ad8d94df0563f06318c7b9a6a80269 (patch)
tree69415217a5f465a8531c209ccd9843b41f95b560
parent7a17dca09f5390041535876d0fdb327ff6658492 (diff)
downloadruby-b4d7d616d9ad8d94df0563f06318c7b9a6a80269.tar.gz
* method.h, vm_method.c: rename some internal functions related to
rb_method_entry_t. rb_add_method_me() -> rb_method_entry_set(). rb_get_method_entry() -> rb_method_entry_without_cache(). rb_gc_mark_method_entry() -> rb_mark_method_entry(). * class.c, proc.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog10
-rw-r--r--class.c2
-rw-r--r--method.h10
-rw-r--r--proc.c2
-rw-r--r--vm_method.c29
5 files changed, 34 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index c39fdb2198..3181714312 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Wed May 5 05:20:27 2010 Koichi Sasada <ko1@atdot.net>
+
+ * method.h, vm_method.c: rename some internal functions related to
+ rb_method_entry_t.
+ rb_add_method_me() -> rb_method_entry_set().
+ rb_get_method_entry() -> rb_method_entry_without_cache().
+ rb_gc_mark_method_entry() -> rb_mark_method_entry().
+
+ * class.c, proc.c: ditto.
+
Tue May 4 22:59:48 2010 wanabe <s.wanabe@gmail.com>
* compile.c (iseq_build_body): update iseq->ic_size.
diff --git a/class.c b/class.c
index e4d830641c..68cf1a3fbb 100644
--- a/class.c
+++ b/class.c
@@ -134,7 +134,7 @@ clone_method(ID mid, const rb_method_entry_t *me, struct clone_method_data *data
rb_add_method(data->klass, mid, VM_METHOD_TYPE_ISEQ, iseq, me->flag);
}
else {
- rb_add_method_me(data->klass, mid, me, me->flag);
+ rb_method_entry_set(data->klass, mid, me, me->flag);
}
return ST_CONTINUE;
}
diff --git a/method.h b/method.h
index c67667d3d8..98b89f8cf7 100644
--- a/method.h
+++ b/method.h
@@ -83,12 +83,14 @@ typedef struct rb_method_entry_struct {
void rb_add_method_cfunc(VALUE klass, ID mid, VALUE (*func)(ANYARGS), int argc, rb_method_flag_t noex);
rb_method_entry_t *rb_add_method(VALUE klass, ID mid, rb_method_type_t type, void *option, rb_method_flag_t noex);
-rb_method_entry_t *rb_add_method_me(VALUE klass, ID mid, const rb_method_entry_t *, rb_method_flag_t noex);
rb_method_entry_t *rb_method_entry(VALUE klass, ID id);
-rb_method_entry_t *rb_get_method_entry(VALUE klass, ID id);
-#define rb_method_entry_without_cache(klass, id) rb_get_method_entry((klass), (id))
+
+rb_method_entry_t *rb_method_entry_get_without_cache(VALUE klass, ID id);
+rb_method_entry_t *rb_method_entry_set(VALUE klass, ID mid, const rb_method_entry_t *, rb_method_flag_t noex);
+
int rb_method_entry_arity(const rb_method_entry_t *me);
-void rb_gc_mark_method_entry(const rb_method_entry_t *me);
+
+void rb_mark_method_entry(const rb_method_entry_t *me);
void rb_free_method_entry(rb_method_entry_t *me);
#endif /* METHOD_H */
diff --git a/proc.c b/proc.c
index be9f393d98..056fce2cdc 100644
--- a/proc.c
+++ b/proc.c
@@ -1295,7 +1295,7 @@ rb_mod_define_method(int argc, VALUE *argv, VALUE mod)
rb_class2name(rclass));
}
}
- rb_add_method_me(mod, id, &method->me, noex);
+ rb_method_entry_set(mod, id, &method->me, noex);
}
else if (rb_obj_is_proc(body)) {
rb_proc_t *proc;
diff --git a/vm_method.c b/vm_method.c
index c9d99db329..4c3f16000a 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -132,10 +132,12 @@ rb_free_method_entry(rb_method_entry_t *me)
rb_method_definition_t *def = me->def;
if (def) {
- if (def->alias_count == 0)
+ if (def->alias_count == 0) {
xfree(def);
- else if (def->alias_count > 0)
+ }
+ else if (def->alias_count > 0) {
def->alias_count--;
+ }
me->def = 0;
}
xfree(me);
@@ -144,7 +146,8 @@ rb_free_method_entry(rb_method_entry_t *me)
static int rb_method_definition_eq(const rb_method_definition_t *d1, const rb_method_definition_t *d2);
static rb_method_entry_t *
-rb_add_method_def(VALUE klass, ID mid, rb_method_type_t type, rb_method_definition_t *def, rb_method_flag_t noex)
+rb_method_entry_make(VALUE klass, ID mid, rb_method_type_t type,
+ rb_method_definition_t *def, rb_method_flag_t noex)
{
rb_method_entry_t *me;
st_table *mtbl;
@@ -278,7 +281,7 @@ rb_add_method(VALUE klass, ID mid, rb_method_type_t type, void *opts, rb_method_
rb_thread_t *th;
rb_control_frame_t *cfp;
int line;
- rb_method_entry_t *me = rb_add_method_def(klass, mid, type, 0, noex);
+ rb_method_entry_t *me = rb_method_entry_make(klass, mid, type, 0, noex);
rb_method_definition_t *def = ALLOC(rb_method_definition_t);
me->def = def;
def->type = type;
@@ -323,10 +326,10 @@ rb_add_method(VALUE klass, ID mid, rb_method_type_t type, void *opts, rb_method_
}
rb_method_entry_t *
-rb_add_method_me(VALUE klass, ID mid, const rb_method_entry_t *me, rb_method_flag_t noex)
+rb_method_entry_set(VALUE klass, ID mid, const rb_method_entry_t *me, rb_method_flag_t noex)
{
rb_method_type_t type = me->def ? me->def->type : VM_METHOD_TYPE_UNDEF;
- rb_method_entry_t *newme = rb_add_method_def(klass, mid, type, me->def, noex);
+ rb_method_entry_t *newme = rb_method_entry_make(klass, mid, type, me->def, noex);
method_added(klass, mid);
return newme;
}
@@ -380,13 +383,13 @@ search_method(VALUE klass, ID id)
}
/*
- * search method entry without method cache.
+ * search method entry without the method cache.
*
- * if you need method entry with method cache, use
- * rb_method_entry()
+ * if you need method entry with method cache (normal case), use
+ * rb_method_entry() simply.
*/
rb_method_entry_t *
-rb_get_method_entry(VALUE klass, ID id)
+rb_method_entry_get_without_cache(VALUE klass, ID id)
{
rb_method_entry_t *me = search_method(klass, id);
@@ -419,7 +422,7 @@ rb_method_entry(VALUE klass, ID id)
return ent->me;
}
- return rb_get_method_entry(klass, id);
+ return rb_method_entry_get_without_cache(klass, id);
}
static void
@@ -913,7 +916,7 @@ rb_alias(VALUE klass, ID name, ID def)
}
if (flag == NOEX_UNDEF) flag = orig_me->flag;
- rb_add_method_me(target_klass, name, orig_me, flag);
+ rb_method_entry_set(target_klass, name, orig_me, flag);
}
/*
@@ -1176,7 +1179,7 @@ rb_mod_modfunc(int argc, VALUE *argv, VALUE module)
if (!m)
break;
}
- rb_add_method_me(rb_singleton_class(module), id, me, NOEX_PUBLIC);
+ rb_method_entry_set(rb_singleton_class(module), id, me, NOEX_PUBLIC);
}
return module;
}