ruby-changes:32088
From: nobu <ko1@a...>
Date: Fri, 13 Dec 2013 12:23:47 +0900 (JST)
Subject: [ruby-changes:32088] nobu:r44167 (trunk): vm.c: reduce clearing method cache
nobu 2013-12-13 12:23:42 +0900 (Fri, 13 Dec 2013) New Revision: 44167 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44167 Log: vm.c: reduce clearing method cache * vm_method.c (rb_add_method, rb_alias): rb_method_entry_set() already clears method cache. * vm_method.c (rb_export_method): ditto by rb_add_method(). * vm_method.c (set_method_visibility): ditto by rb_export_method(). * vm.c (vm_define_method): ditto by rb_add_method(). * vm.c (m_core_undef_method): ditto by rb_add_method() in rb_undef(). Modified files: trunk/vm.c trunk/vm_method.c Index: vm_method.c =================================================================== --- vm_method.c (revision 44166) +++ vm_method.c (revision 44167) @@ -478,7 +478,6 @@ rb_add_method(VALUE klass, ID mid, rb_me https://github.com/ruby/ruby/blob/trunk/vm_method.c#L478 if (type != VM_METHOD_TYPE_UNDEF && type != VM_METHOD_TYPE_REFINED) { method_added(klass, mid); } - rb_clear_method_cache_by_class(klass); return me; } @@ -799,6 +798,7 @@ rb_export_method(VALUE klass, ID name, r https://github.com/ruby/ruby/blob/trunk/vm_method.c#L798 if (me->def->type == VM_METHOD_TYPE_REFINED) { me->def->body.orig_me->flag = noex; } + rb_clear_method_cache_by_class(klass); } else { rb_add_method(klass, name, VM_METHOD_TYPE_ZSUPER, 0, noex); @@ -1246,7 +1246,6 @@ rb_alias(VALUE klass, ID name, ID def) https://github.com/ruby/ruby/blob/trunk/vm_method.c#L1246 if (flag == NOEX_UNDEF) flag = orig_me->flag; rb_method_entry_set(target_klass, name, orig_me, flag); - rb_clear_method_cache_by_class(target_klass); } /* @@ -1301,7 +1300,6 @@ set_method_visibility(VALUE self, int ar https://github.com/ruby/ruby/blob/trunk/vm_method.c#L1300 } rb_export_method(self, id, ex); } - rb_clear_method_cache_by_class(self); } static VALUE Index: vm.c =================================================================== --- vm.c (revision 44166) +++ vm.c (revision 44167) @@ -2153,12 +2153,10 @@ vm_define_method(rb_thread_t *th, VALUE https://github.com/ruby/ruby/blob/trunk/vm.c#L2153 OBJ_WRITE(miseq->self, &miseq->klass, klass); miseq->defined_method_id = id; rb_add_method(klass, id, VM_METHOD_TYPE_ISEQ, miseq, noex); - rb_clear_method_cache_by_class(klass); if (!is_singleton && noex == NOEX_MODFUNC) { klass = rb_singleton_class(klass); rb_add_method(klass, id, VM_METHOD_TYPE_ISEQ, miseq, NOEX_PUBLIC); - rb_clear_method_cache_by_class(klass); } } @@ -2208,7 +2206,6 @@ m_core_undef_method(VALUE self, VALUE cb https://github.com/ruby/ruby/blob/trunk/vm.c#L2206 { REWIND_CFP({ rb_undef(cbase, SYM2ID(sym)); - rb_clear_method_cache_by_class(cbase); rb_clear_method_cache_by_class(self); }); return Qnil; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/