diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-03 11:10:16 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-03 11:10:16 +0000 |
commit | ec2a2894672403037c1c916edc1bad308a4dffc1 (patch) | |
tree | 1e32deac9ee694c480fd5e81bcb4e6327776e73b | |
parent | d9be3209cbf7f2c4015c1f909d48c3b9a407911b (diff) | |
download | ruby-ec2a2894672403037c1c916edc1bad308a4dffc1.tar.gz |
* class.c (clone_method): remove redundant check for me->def != NULL.
Now, all `me` have `me->def`.
* proc.c (rb_method_entry_location): ditto.
* vm.c (rb_vm_check_redefinition_opt_method): ditto.
* vm.c (add_opt_method): ditto.
* vm_eval.c (vm_call0_body): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | class.c | 21 | ||||
-rw-r--r-- | proc.c | 2 | ||||
-rw-r--r-- | vm.c | 5 | ||||
-rw-r--r-- | vm_eval.c | 3 |
5 files changed, 24 insertions, 20 deletions
@@ -1,3 +1,16 @@ +Wed Jun 3 20:07:07 2015 Koichi Sasada <ko1@atdot.net> + + * class.c (clone_method): remove redundant check for me->def != NULL. + Now, all `me` have `me->def`. + + * proc.c (rb_method_entry_location): ditto. + + * vm.c (rb_vm_check_redefinition_opt_method): ditto. + + * vm.c (add_opt_method): ditto. + + * vm_eval.c (vm_call0_body): ditto. + Wed Jun 3 19:24:12 2015 Koichi Sasada <ko1@atdot.net> * vm_core.h: rename enum missing_reason to enum method_missing_reason. @@ -243,21 +243,16 @@ rb_class_new(VALUE super) static void clone_method(VALUE klass, ID mid, const rb_method_entry_t *me) { - if (me->def) { - if (me->def->type == VM_METHOD_TYPE_ISEQ) { - VALUE newiseqval; - rb_cref_t *new_cref; - newiseqval = rb_iseq_clone(me->def->body.iseq.iseqptr->self, klass); - rb_vm_rewrite_cref_stack(me->def->body.iseq.cref, me->klass, klass, &new_cref); - rb_add_method_iseq(klass, mid, newiseqval, new_cref, me->def->flags.visi); - RB_GC_GUARD(newiseqval); - } - else { - rb_method_entry_set(klass, mid, me, me->def->flags.visi); - } + if (me->def->type == VM_METHOD_TYPE_ISEQ) { + VALUE newiseqval; + rb_cref_t *new_cref; + newiseqval = rb_iseq_clone(me->def->body.iseq.iseqptr->self, klass); + rb_vm_rewrite_cref_stack(me->def->body.iseq.cref, me->klass, klass, &new_cref); + rb_add_method_iseq(klass, mid, newiseqval, new_cref, me->def->flags.visi); + RB_GC_GUARD(newiseqval); } else { - rb_bug("clone_method: unsupported"); + rb_method_entry_set(klass, mid, me, me->def->flags.visi); } } @@ -2239,7 +2239,7 @@ method_def_location(const rb_method_definition_t *def) VALUE rb_method_entry_location(const rb_method_entry_t *me) { - if (!me || !me->def) return Qnil; + if (!me) return Qnil; return method_def_location(me->def); } @@ -1237,7 +1237,7 @@ static void rb_vm_check_redefinition_opt_method(const rb_method_entry_t *me, VALUE klass) { st_data_t bop; - if (!me->def || me->def->type == VM_METHOD_TYPE_CFUNC) { + if (me->def->type == VM_METHOD_TYPE_CFUNC) { if (st_lookup(vm_opt_method_table, (st_data_t)me, &bop)) { int flag = vm_redefinition_check_flag(klass); @@ -1272,8 +1272,7 @@ add_opt_method(VALUE klass, ID mid, VALUE bop) { rb_method_entry_t *me = rb_method_entry_at(klass, mid); - if (me && me->def && - me->def->type == VM_METHOD_TYPE_CFUNC) { + if (me && me->def->type == VM_METHOD_TYPE_CFUNC) { st_insert(vm_opt_method_table, (st_data_t)me, (st_data_t)bop); } else { @@ -153,8 +153,6 @@ vm_call0_body(rb_thread_t* th, rb_call_info_t *ci, const VALUE *argv) { VALUE ret; - if (!ci->me->def) return Qnil; - if (th->passed_block) { ci->blockptr = (rb_block_t *)th->passed_block; th->passed_block = 0; @@ -213,7 +211,6 @@ vm_call0_body(rb_thread_t* th, rb_call_info_t *ci, const VALUE *argv) goto success; } RUBY_VM_CHECK_INTS(th); - if (!ci->me->def) return Qnil; goto again; } case VM_METHOD_TYPE_ALIAS: |