diff options
author | nari <nari@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-10-05 07:20:49 +0000 |
---|---|---|
committer | nari <nari@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-10-05 07:20:49 +0000 |
commit | 271f069c7f07391fe9626ca01f4d4a8076fb6c04 (patch) | |
tree | d9c7f31770a19f7895719b7250f82d8cd27a722e | |
parent | 42fcb804f458ae8f3db787f26574fdbddcba2823 (diff) |
* gc.c (chain_finalized_object): remove to check a mark flag and
marking since all objects are certainly unmarked with rest_sweep.
* gc.c (rb_objspace_call_finalizer): remove to mark finalizable
objects. The sweeping doesn't push T_ZOMBIE objects to the
freelist.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | gc.c | 10 |
2 files changed, 12 insertions, 7 deletions
@@ -1,3 +1,12 @@ +Fri Oct 5 16:04:33 2012 Narihiro Nakamura <authornari@gmail.com> + + * gc.c (chain_finalized_object): remove to check a mark flag and + marking since all objects are certainly unmarked with rest_sweep. + + * gc.c (rb_objspace_call_finalizer): remove to mark finalizable + objects. The sweeping doesn't push T_ZOMBIE objects to the + freelist. + Thu Oct 4 23:40:04 2012 Narihiro Nakamura <authornari@gmail.com> * gc.c (init_heap): call init_mark_stack before to allocate @@ -1442,8 +1442,7 @@ static int chain_finalized_object(st_data_t key, st_data_t val, st_data_t arg) { RVALUE *p = (RVALUE *)key, **final_list = (RVALUE **)arg; - if ((p->as.basic.flags & FL_FINALIZE) == FL_FINALIZE && - !MARKED_IN_BITMAP(GET_HEAP_BITMAP(p), p)) { + if ((p->as.basic.flags & FL_FINALIZE) == FL_FINALIZE) { if (BUILTIN_TYPE(p) != T_ZOMBIE) { p->as.free.flags = T_ZOMBIE; RDATA(p)->dfree = 0; @@ -1485,20 +1484,17 @@ rb_objspace_call_finalizer(rb_objspace_t *objspace) RVALUE *final_list = 0; size_t i; - /* run finalizers */ rest_sweep(objspace); if (ATOMIC_EXCHANGE(finalizing, 1)) return; + /* run finalizers */ do { - /* XXX: this loop will make no sense */ - /* because mark will not be removed */ finalize_deferred(objspace); - mark_tbl(objspace, finalizer_table); - gc_mark_stacked_objects(objspace); st_foreach(finalizer_table, chain_finalized_object, (st_data_t)&deferred_final_list); } while (deferred_final_list); + /* force to run finalizer */ while (finalizer_table->num_entries) { struct force_finalize_list *list = 0; |