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

ruby-changes:28853

From: ko1 <ko1@a...>
Date: Fri, 24 May 2013 03:01:58 +0900 (JST)
Subject: [ruby-changes:28853] ko1:r40905 (trunk): * object.c (rb_obj_clone): should not propagate OLDGEN status.

ko1	2013-05-24 03:01:46 +0900 (Fri, 24 May 2013)

  New Revision: 40905

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

  Log:
    * object.c (rb_obj_clone): should not propagate OLDGEN status.
      This propagation had caused WB miss for class.

  Modified files:
    trunk/ChangeLog
    trunk/object.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 40904)
+++ ChangeLog	(revision 40905)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri May 24 02:57:17 2013  Koichi Sasada  <ko1@a...>
+
+	* object.c (rb_obj_clone): should not propagate OLDGEN status.
+	  This propagation had caused WB miss for class.
+
 Thu May 23 17:35:30 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* load.c (loaded_feature_path): fix invalid read by index underflow.
Index: object.c
===================================================================
--- object.c	(revision 40904)
+++ object.c	(revision 40905)
@@ -335,13 +335,15 @@ rb_obj_clone(VALUE obj) https://github.com/ruby/ruby/blob/trunk/object.c#L335
         rb_raise(rb_eTypeError, "can't clone %s", rb_obj_classname(obj));
     }
     clone = rb_obj_alloc(rb_obj_class(obj));
+    RBASIC(clone)->flags &= (FL_TAINT|FL_UNTRUSTED);
+    RBASIC(clone)->flags |= RBASIC(obj)->flags & ~(FL_OLDGEN|FL_FREEZE|FL_FINALIZE);
+
     singleton = rb_singleton_class_clone_and_attach(obj, clone);
     RBASIC_SET_CLASS(clone, singleton);
     if (FL_TEST(singleton, FL_SINGLETON)) {
 	rb_singleton_class_attached(singleton, clone);
     }
-    RBASIC(clone)->flags &= (FL_TAINT|FL_UNTRUSTED);
-    RBASIC(clone)->flags |= RBASIC(obj)->flags & ~(FL_FREEZE|FL_FINALIZE);
+
     init_copy(clone, obj);
     rb_funcall(clone, id_init_clone, 1, obj);
     RBASIC(clone)->flags |= RBASIC(obj)->flags & FL_FREEZE;

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

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