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

ruby-changes:32070

From: nobu <ko1@a...>
Date: Thu, 12 Dec 2013 16:43:43 +0900 (JST)
Subject: [ruby-changes:32070] nobu:r44149 (trunk): gc.c: no deletion in wmap_mark

nobu	2013-12-12 16:43:36 +0900 (Thu, 12 Dec 2013)

  New Revision: 44149

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

  Log:
    gc.c: no deletion in wmap_mark
    
    * gc.c (wmap_mark): disable deletion of dead objects by default,
      so that WeakMap can be non-shady.

  Modified files:
    trunk/gc.c
Index: gc.c
===================================================================
--- gc.c	(revision 44148)
+++ gc.c	(revision 44149)
@@ -6229,6 +6229,9 @@ struct weakmap { https://github.com/ruby/ruby/blob/trunk/gc.c#L6229
     VALUE final;
 };
 
+#define WMAP_DELETE_DEAD_OBJECT_IN_MARK 0
+
+#if WMAP_DELETE_DEAD_OBJECT_IN_MARK
 static int
 wmap_mark_map(st_data_t key, st_data_t val, st_data_t arg)
 {
@@ -6237,12 +6240,15 @@ wmap_mark_map(st_data_t key, st_data_t v https://github.com/ruby/ruby/blob/trunk/gc.c#L6240
     if (!is_live_object(objspace, obj)) return ST_DELETE;
     return ST_CONTINUE;
 }
+#endif
 
 static void
 wmap_mark(void *ptr)
 {
     struct weakmap *w = ptr;
+#if WMAP_DELETE_DEAD_OBJECT_IN_MARK
     if (w->obj2wmap) st_foreach(w->obj2wmap, wmap_mark_map, (st_data_t)&rb_objspace);
+#endif
     rb_gc_mark(w->final);
 }
 

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

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