* gc.c (gc_mark_children, obj_free): T_DEFERRED should not be appear.

* gc.c (gc_sweep, finalize_list): fix to decrement heap_slot#limit
  after executing finalizer.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2008-07-27 13:08:02 +00:00
Родитель 60be3dc560
Коммит 845e5766dc
2 изменённых файлов: 17 добавлений и 8 удалений

Просмотреть файл

@ -1,3 +1,10 @@
Sun Jul 27 21:45:59 2008 Koichi Sasada <ko1@atdot.net>
* gc.c (gc_mark_children, obj_free): T_DEFERRED should not be appear.
* gc.c (gc_sweep, finalize_list): fix to decrement heap_slot#limit
after executing finalizer.
Sun Jul 27 14:48:37 2008 Koichi Sasada <ko1@atdot.net>
* include/ruby/ruby.h: add a type T_DEFERRED.

18
gc.c
Просмотреть файл

@ -1315,9 +1315,6 @@ gc_mark_children(rb_objspace_t *objspace, VALUE ptr, int lev)
}
break;
case T_DEFERRED:
break;
default:
rb_bug("rb_gc_mark(): unknown data type 0x%lx(%p) %s",
BUILTIN_TYPE(obj), obj,
@ -1345,6 +1342,10 @@ finalize_list(rb_objspace_t *objspace, RVALUE *p)
if (!FL_TEST(p, FL_SINGLETON)) { /* not freeing page */
add_freelist(objspace, p);
}
else {
struct heaps_slot *slot = (struct heaps_slot *)RDATA(p)->dmark;
slot->limit--;
}
p = tmp;
}
}
@ -1439,11 +1440,15 @@ gc_sweep(rb_objspace_t *objspace)
}
if (n == heaps[i].limit && freed > do_heap_free) {
RVALUE *pp;
int f_count = 0;
heaps[i].limit = 0;
for (pp = final_list; pp != final; pp = pp->as.free.next) {
p->as.free.flags |= FL_SINGLETON; /* freeing page mark */
f_count++;
RDATA(pp)->dmark = (void *)&heaps[i];
pp->as.free.flags |= FL_SINGLETON; /* freeing page mark */
}
heaps[i].limit = f_count;
freelist = free; /* cancel this page from freelist */
}
else {
@ -1605,9 +1610,6 @@ obj_free(rb_objspace_t *objspace, VALUE obj)
}
break;
case T_DEFERRED:
break;
default:
rb_bug("gc_sweep(): unknown data type 0x%lx(%p)",
BUILTIN_TYPE(obj), (void*)obj);