1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
ko1 2010-05-04 20:25:09 +00:00
parent 7a17dca09f
commit b4d7d616d9
5 changed files with 34 additions and 19 deletions

View file

@ -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.

View file

@ -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;
}

View file

@ -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 */

2
proc.c
View file

@ -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;

View file

@ -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;
}