summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-12 07:43:36 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-12 07:43:36 +0000
commit89b8502257d29015c2f401f899bfd56a6bbf5d76 (patch)
tree52ef3406afd3e321cec57b95752e52277a1bdbd1
parent8920ac29723f650101bb8306f5f55f925ec65b86 (diff)
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
-rw-r--r--gc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gc.c b/gc.c
index 5cc39c9..934f97a 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);
}