aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-07 02:27:41 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-07 02:27:41 +0000
commit3af0c9fe2362531a55979d77a23d12a895456582 (patch)
tree842f782ad31311302595371b3bfb78311fd9fedd
parentbbf740aea21ee3f5ea8bee2081eea1067e7e76bc (diff)
downloadruby-3af0c9fe2362531a55979d77a23d12a895456582.tar.gz
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--class.c4
-rw-r--r--internal.h1
-rw-r--r--iseq.c24
4 files changed, 9 insertions, 28 deletions
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 <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
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
@@ -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;