ruby-changes:32034
From: ko1 <ko1@a...>
Date: Tue, 10 Dec 2013 15:47:21 +0900 (JST)
Subject: [ruby-changes:32034] ko1:r44113 (trunk): * gc.c (allrefs_add): push obj only if allrefs table doesn't have
ko1 2013-12-10 15:47:15 +0900 (Tue, 10 Dec 2013) New Revision: 44113 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44113 Log: * gc.c (allrefs_add): push obj only if allrefs table doesn't have obj. * gc.c (allrefs_roots_i): ditto. Modified files: trunk/ChangeLog trunk/gc.c Index: ChangeLog =================================================================== --- ChangeLog (revision 44112) +++ ChangeLog (revision 44113) @@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Dec 10 15:46:03 2013 Koichi Sasada <ko1@a...> + + * gc.c (allrefs_add): push obj only if allrefs table doesn't have + obj. + + * gc.c (allrefs_roots_i): ditto. + Tue Dec 10 15:28:10 2013 Koichi Sasada <ko1@a...> * gc.c (RGENGC_CHECK_MODE): separate checkers to different modes. Index: gc.c =================================================================== --- gc.c (revision 44112) +++ gc.c (revision 44113) @@ -4231,7 +4231,8 @@ allrefs_add(struct allrefs *data, VALUE https://github.com/ruby/ruby/blob/trunk/gc.c#L4231 struct reflist *refs; if (st_lookup(data->references, obj, (st_data_t *)&refs)) { - return reflist_add(refs, data->root_obj); + reflist_add(refs, data->root_obj); + return 0; } else { refs = reflist_create(data->root_obj); @@ -4244,9 +4245,11 @@ static void https://github.com/ruby/ruby/blob/trunk/gc.c#L4245 allrefs_i(VALUE obj, void *ptr) { struct allrefs *data = (struct allrefs *)ptr; - if (allrefs_add(data, obj)) /* follow new reference */ + + if (allrefs_add(data, obj)) { push_mark_stack(&data->objspace->mark_stack, obj); } +} static void allrefs_roots_i(VALUE obj, void *ptr) @@ -4254,9 +4257,11 @@ allrefs_roots_i(VALUE obj, void *ptr) https://github.com/ruby/ruby/blob/trunk/gc.c#L4257 struct allrefs *data = (struct allrefs *)ptr; if (strlen(data->category) == 0) rb_bug("!!!"); data->root_obj = MAKE_ROOTSIG(data->category); - allrefs_add(data, obj); + + if (allrefs_add(data, obj)) { push_mark_stack(&data->objspace->mark_stack, obj); } +} static st_table * objspace_allrefs(rb_objspace_t *objspace) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/