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

ruby-changes:45542

From: normal <ko1@a...>
Date: Mon, 13 Feb 2017 11:04:30 +0900 (JST)
Subject: [ruby-changes:45542] normal:r57615 (trunk): array.c (ary_recycle_hash): use rb_gc_force_recycle

normal	2017-02-13 11:04:26 +0900 (Mon, 13 Feb 2017)

  New Revision: 57615

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

  Log:
    array.c (ary_recycle_hash): use rb_gc_force_recycle
    
    Hidden objects (RBASIC_CLASS(hash) == 0) can never become
    visible to other threads or signal handlers via
    ObjectSpace.each_object or similar means.  Thus it is safe to
    forcibly recycle the object slot for future use, here.

  Modified files:
    trunk/array.c
Index: array.c
===================================================================
--- array.c	(revision 57614)
+++ array.c	(revision 57615)
@@ -4095,12 +4095,12 @@ ary_make_hash_by(VALUE ary) https://github.com/ruby/ruby/blob/trunk/array.c#L4095
 static inline void
 ary_recycle_hash(VALUE hash)
 {
+    assert(RBASIC_CLASS(hash) == 0);
     if (RHASH(hash)->ntbl) {
 	st_table *tbl = RHASH(hash)->ntbl;
-	RHASH(hash)->ntbl = 0;
 	st_free_table(tbl);
     }
-    RB_GC_GUARD(hash);
+    rb_gc_force_recycle(hash);
 }
 
 /*

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

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