diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | class.c | 4 | ||||
-rw-r--r-- | internal.h | 1 | ||||
-rw-r--r-- | iseq.c | 24 |
4 files changed, 9 insertions, 28 deletions
@@ -1,3 +1,11 @@ +Tue Jul 07 11:25:57 2015 Koichi Sasada <ko1@atdot.net> + + * 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 <e@80x24.org> * string.c (Init_String): use rb_str_freeze for String#freeze @@ -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); @@ -1931,30 +1931,6 @@ iseq_data_to_ary(rb_iseq_t *iseq) } 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) { int i, r; |