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

ruby-changes:33794

From: nobu <ko1@a...>
Date: Thu, 8 May 2014 14:45:03 +0900 (JST)
Subject: [ruby-changes:33794] nobu:r45875 (trunk): object.c: no longer copy tables of classes/modules

nobu	2014-05-08 14:45:00 +0900 (Thu, 08 May 2014)

  New Revision: 45875

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

  Log:
    object.c: no longer copy tables of classes/modules
    
    * object.c (init_copy): no longer copy tables of classes/modules,
      since r45874 rb_mod_init_copy() does it instead.

  Modified files:
    trunk/object.c
Index: object.c
===================================================================
--- object.c	(revision 45874)
+++ object.c	(revision 45875)
@@ -265,8 +265,7 @@ init_copy(VALUE dest, VALUE obj) https://github.com/ruby/ruby/blob/trunk/object.c#L265
     RBASIC(dest)->flags |= RBASIC(obj)->flags & (T_MASK|FL_EXIVAR|FL_TAINT);
     rb_copy_generic_ivar(dest, obj);
     rb_gc_copy_finalizer(dest, obj);
-    switch (TYPE(obj)) {
-      case T_OBJECT:
+    if (RB_TYPE_P(obj, T_OBJECT)) {
         if (!(RBASIC(dest)->flags & ROBJECT_EMBED) && ROBJECT_IVPTR(dest)) {
             xfree(ROBJECT_IVPTR(dest));
             ROBJECT(dest)->as.heap.ivptr = 0;
@@ -286,21 +285,6 @@ init_copy(VALUE dest, VALUE obj) https://github.com/ruby/ruby/blob/trunk/object.c#L285
             ROBJECT(dest)->as.heap.iv_index_tbl = ROBJECT(obj)->as.heap.iv_index_tbl;
             RBASIC(dest)->flags &= ~ROBJECT_EMBED;
         }
-        break;
-      case T_CLASS:
-      case T_MODULE:
-	if (RCLASS_IV_TBL(dest)) {
-	    st_free_table(RCLASS_IV_TBL(dest));
-	    RCLASS_IV_TBL(dest) = 0;
-	}
-	if (RCLASS_CONST_TBL(dest)) {
-	    rb_free_const_table(RCLASS_CONST_TBL(dest));
-	    RCLASS_CONST_TBL(dest) = 0;
-	}
-	if (RCLASS_IV_TBL(obj)) {
-	    RCLASS_IV_TBL(dest) = rb_st_copy(dest, RCLASS_IV_TBL(obj));
-	}
-        break;
     }
 }
 

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

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