From 89b8502257d29015c2f401f899bfd56a6bbf5d76 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 12 Dec 2013 07:43:36 +0000 Subject: [PATCH] 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44149 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- gc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gc.c b/gc.c index 5cc39c90cb..934f97a7d8 100644 --- a/gc.c +++ b/gc.c @@ -6229,6 +6229,9 @@ struct weakmap { 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 val, st_data_t arg) 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); }