[前][次][番号順一覧][スレッド一覧]

ruby-changes:39090

From: ko1 <ko1@a...>
Date: Tue, 7 Jul 2015 11:28:05 +0900 (JST)
Subject: [ruby-changes:39090] ko1:r51171 (trunk): * iseq.c, internal.h (rb_iseq_clone): removed because we don't need to

ko1	2015-07-07 11:27:41 +0900 (Tue, 07 Jul 2015)

  New Revision: 51171

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51171

  Log:
    * 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.

  Modified files:
    trunk/ChangeLog
    trunk/class.c
    trunk/internal.h
    trunk/iseq.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 51170)
+++ ChangeLog	(revision 51171)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Jul 07 11:25:57 2015  Koichi Sasada  <ko1@a...>
+
+	* 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@8...>
 
 	* string.c (Init_String): use rb_str_freeze for String#freeze
Index: iseq.c
===================================================================
--- iseq.c	(revision 51170)
+++ iseq.c	(revision 51171)
@@ -1931,30 +1931,6 @@ iseq_data_to_ary(rb_iseq_t *iseq) https://github.com/ruby/ruby/blob/trunk/iseq.c#L1931
 }
 
 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;
Index: class.c
===================================================================
--- class.c	(revision 51170)
+++ class.c	(revision 51171)
@@ -244,11 +244,9 @@ static void https://github.com/ruby/ruby/blob/trunk/class.c#L244
 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));
Index: internal.h
===================================================================
--- internal.h	(revision 51170)
+++ internal.h	(revision 51171)
@@ -847,7 +847,6 @@ VALUE rb_io_flush_raw(VALUE, int); https://github.com/ruby/ruby/blob/trunk/internal.h#L847
 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);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]