* gc.c (gc_mark_all_clear): don't call obj_free() in

gc_mark_all_clear(), because obj_free() may make T_ZOMBIE
  objects.

* gc.c (gc_clear_mark_on_sweep_slots): renamed.

* gc.c (rb_objspace_call_finalizer): call
  gc_clear_mark_on_sweep_slots() before calling mark_tbl().
  [ruby-dev:41459]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nari 2010-05-30 06:42:12 +00:00
Родитель 480b4d0a78
Коммит a8cd15c96c
2 изменённых файлов: 16 добавлений и 15 удалений

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

@ -1,3 +1,15 @@
Sun May 30 14:59:13 2010 Narihiro Nakamura <authorNari@gmail.com>
* gc.c (gc_mark_all_clear): don't call obj_free() in
gc_mark_all_clear(), because obj_free() may make T_ZOMBIE
objects.
* gc.c (gc_clear_mark_on_sweep_slots): renamed.
* gc.c (rb_objspace_call_finalizer): call
gc_clear_mark_on_sweep_slots() before calling mark_tbl().
[ruby-dev:41459]
Sun May 30 03:40:44 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (parser_tokadd_utf8, parser_tokadd_string): allow NUL

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

@ -2279,7 +2279,7 @@ mark_current_machine_context(rb_objspace_t *objspace, rb_thread_t *th)
void rb_gc_mark_encodings(void);
static void
gc_mark_all_clear(rb_objspace_t *objspace)
gc_clear_mark_on_sweep_slots(rb_objspace_t *objspace)
{
struct heaps_slot *scan;
RVALUE *p, *pend;
@ -2289,25 +2289,13 @@ gc_mark_all_clear(rb_objspace_t *objspace)
scan = objspace->heap.sweep_slots;
p = scan->slot; pend = p + scan->limit;
while (p < pend) {
if (!(RBASIC(p)->flags & FL_MARK)) {
if (p->as.basic.flags && !FL_TEST(p, FL_FINALIZE)) {
obj_free(objspace, (VALUE)p);
VALGRIND_MAKE_MEM_UNDEFINED((void*)p, sizeof(RVALUE));
p->as.free.flags = 0;
}
}
else if (RBASIC(p)->flags != FL_MARK) {
if (p->as.free.flags & FL_MARK && BUILTIN_TYPE(p) != T_ZOMBIE) {
p->as.basic.flags &= ~FL_MARK;
}
p++;
}
objspace->heap.sweep_slots = objspace->heap.sweep_slots->next;
}
p = deferred_final_list;
while(p) {
p->as.free.flags |= FL_MARK;
p = p->as.free.next;
}
}
}
@ -2322,7 +2310,7 @@ gc_marks(rb_objspace_t *objspace)
objspace->count++;
gc_mark_all_clear(objspace);
gc_clear_mark_on_sweep_slots(objspace);
SET_STACK_END;
@ -2858,6 +2846,7 @@ rb_objspace_call_finalizer(rb_objspace_t *objspace)
/* run finalizers */
if (finalizer_table) {
gc_clear_mark_on_sweep_slots(objspace);
do {
/* XXX: this loop will make no sense */
/* because mark will not be removed */