mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
8920ac2972
commit
89b8502257
1 changed files with 6 additions and 0 deletions
6
gc.c
6
gc.c
|
@ -6229,6 +6229,9 @@ struct weakmap {
|
||||||
VALUE final;
|
VALUE final;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define WMAP_DELETE_DEAD_OBJECT_IN_MARK 0
|
||||||
|
|
||||||
|
#if WMAP_DELETE_DEAD_OBJECT_IN_MARK
|
||||||
static int
|
static int
|
||||||
wmap_mark_map(st_data_t key, st_data_t val, st_data_t arg)
|
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;
|
if (!is_live_object(objspace, obj)) return ST_DELETE;
|
||||||
return ST_CONTINUE;
|
return ST_CONTINUE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wmap_mark(void *ptr)
|
wmap_mark(void *ptr)
|
||||||
{
|
{
|
||||||
struct weakmap *w = 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);
|
if (w->obj2wmap) st_foreach(w->obj2wmap, wmap_mark_map, (st_data_t)&rb_objspace);
|
||||||
|
#endif
|
||||||
rb_gc_mark(w->final);
|
rb_gc_mark(w->final);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue