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

ruby-changes:29192

From: nobu <ko1@a...>
Date: Wed, 12 Jun 2013 12:00:49 +0900 (JST)
Subject: [ruby-changes:29192] nobu:r41245 (trunk): array.c: fix false assertion

nobu	2013-06-12 12:00:24 +0900 (Wed, 12 Jun 2013)

  New Revision: 41245

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

  Log:
    array.c: fix false assertion
    
    * array.c (FL_SET_EMBED): shared object is frozen even when get
      unshared.
    * array.c (rb_ary_modify): ARY_SET_CAPA needs unshared array.

  Modified files:
    trunk/ChangeLog
    trunk/array.c

Index: array.c
===================================================================
--- array.c	(revision 41244)
+++ array.c	(revision 41245)
@@ -65,7 +65,6 @@ memfill(register VALUE *mem, register lo https://github.com/ruby/ruby/blob/trunk/array.c#L65
 #define ARY_OWNS_HEAP_P(a) (!FL_TEST((a), ELTS_SHARED|RARRAY_EMBED_FLAG))
 #define FL_SET_EMBED(a) do { \
     assert(!ARY_SHARED_P(a)); \
-    assert(!OBJ_FROZEN(a)); \
     FL_SET((a), RARRAY_EMBED_FLAG); \
 } while (0)
 #define FL_UNSET_EMBED(ary) FL_UNSET((ary), RARRAY_EMBED_FLAG|RARRAY_EMBED_LEN_MASK)
@@ -279,10 +278,10 @@ rb_ary_modify(VALUE ary) https://github.com/ruby/ruby/blob/trunk/array.c#L278
         }
 	else if (ARY_SHARED_NUM(shared) == 1 && len > (RARRAY_LEN(shared)>>1)) {
 	    long shift = RARRAY_PTR(ary) - RARRAY_PTR(shared);
+	    FL_UNSET_SHARED(ary);
 	    ARY_SET_PTR(ary, RARRAY_PTR(shared));
 	    ARY_SET_CAPA(ary, RARRAY_LEN(shared));
 	    MEMMOVE(RARRAY_PTR(ary), RARRAY_PTR(ary)+shift, VALUE, len);
-	    FL_UNSET_SHARED(ary);
 	    FL_SET_EMBED(shared);
 	    rb_ary_decrement_share(shared);
 	}
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41244)
+++ ChangeLog	(revision 41245)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Jun 12 12:00:15 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* array.c (FL_SET_EMBED): shared object is frozen even when get
+	  unshared.
+
+	* array.c (rb_ary_modify): ARY_SET_CAPA needs unshared array.
+
 Wed Jun 12 07:32:01 2013  Tanaka Akira  <akr@f...>
 
 	* random.c (rand_int): Use rb_big_uminus.

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

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