diff --git a/ChangeLog b/ChangeLog index a897ae5cc2..296bdbe576 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Tue Jul 07 11:25:57 2015 Koichi Sasada + + * iseq.c, internal.h (rb_iseq_clone): removed because we don't need to + clone iseq any more. + + * class.c (clone_method): share iseq between cloned methods. All of + method dependent information are able to refer from method entry. + Tue Jul 7 04:42:25 2015 Eric Wong * string.c (Init_String): use rb_str_freeze for String#freeze diff --git a/class.c b/class.c index 0521cf96c3..46a0d617ad 100644 --- a/class.c +++ b/class.c @@ -244,11 +244,9 @@ static void clone_method(VALUE old_klass, VALUE new_klass, ID mid, const rb_method_entry_t *me) { 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, new_klass); rb_vm_rewrite_cref(me->def->body.iseq.cref, old_klass, new_klass, &new_cref); - rb_add_method_iseq(new_klass, mid, newiseqval, new_cref, METHOD_ENTRY_VISI(me)); + rb_add_method_iseq(new_klass, mid, me->def->body.iseq.iseqptr->self, new_cref, METHOD_ENTRY_VISI(me)); } else { rb_method_entry_set(new_klass, mid, me, METHOD_ENTRY_VISI(me)); diff --git a/internal.h b/internal.h index 268d655c1c..b4bd9a937e 100644 --- a/internal.h +++ b/internal.h @@ -847,7 +847,6 @@ VALUE rb_io_flush_raw(VALUE, int); size_t rb_io_memsize(const rb_io_t *); /* iseq.c */ -VALUE rb_iseq_clone(VALUE iseqval, VALUE newcbase); VALUE rb_iseq_path(VALUE iseqval); VALUE rb_iseq_absolute_path(VALUE iseqval); VALUE rb_iseq_label(VALUE iseqval); diff --git a/iseq.c b/iseq.c index d071815353..ee66e48e1d 100644 --- a/iseq.c +++ b/iseq.c @@ -1930,30 +1930,6 @@ iseq_data_to_ary(rb_iseq_t *iseq) return val; } -VALUE -rb_iseq_clone(VALUE iseqval, VALUE newcbase) -{ - VALUE newiseq = iseq_alloc(rb_cISeq); - rb_iseq_t *iseq0, *iseq1; - - GetISeqPtr(iseqval, iseq0); - GetISeqPtr(newiseq, iseq1); - - MEMCPY(iseq1, iseq0, rb_iseq_t, 1); - - iseq1->self = newiseq; - if (!iseq1->orig) { - RB_OBJ_WRITE(iseq1->self, &iseq1->orig, iseqval); - } - if (iseq0->local_iseq == iseq0) { - iseq1->local_iseq = iseq1; - } - - RB_GC_GUARD(iseqval); /* seems necessary iff RGenGC is disabled */ - - return newiseq; -} - VALUE rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc) {