Fix marking logic.

This commit is contained in:
Graydon Hoare 2010-06-25 19:56:29 -07:00
parent 34dc7053eb
commit 968ec14527

View File

@ -2639,13 +2639,15 @@ let trans_visitor
(* if this has been marked already, jump to exit.*) (* if this has been marked already, jump to exit.*)
note_gc_step slot "mark GC slot: check for mark:"; note_gc_step slot "mark GC slot: check for mark:";
emit (Il.binary Il.AND tmp (Il.Cell gc_word) one); emit (Il.binary Il.AND tmp (Il.Cell gc_word) one);
let already_marked_jump = mark () in trace_word cx.ctxt_sess.Session.sess_trace_gc tmp;
emit (Il.jmp Il.JZ Il.CodeNone);
let already_marked_jump =
trans_compare Il.JNE (Il.Cell tmp) zero;
in
(* Set mark bit in allocation header. *) (* Set mark bit in allocation header. *)
note_gc_step slot "mark GC slot: mark:";
emit (Il.binary Il.OR gc_word (Il.Cell gc_word) one); emit (Il.binary Il.OR gc_word (Il.Cell gc_word) one);
note_gc_step slot "mark GC slot: set mark";
(* Iterate over exterior slots marking outgoing links. *) (* Iterate over exterior slots marking outgoing links. *)
log cx "slot rty: %s" (cell_str cell);
let (body_mem, _) = let (body_mem, _) =
need_mem_cell need_mem_cell
(get_element_ptr (deref cell) (get_element_ptr (deref cell)
@ -2658,7 +2660,7 @@ let trans_visitor
(get_mark_glue ty curr_iso) (get_mark_glue ty curr_iso)
ty_params tmp; ty_params tmp;
patch null_cell_jump; patch null_cell_jump;
patch already_marked_jump; List.iter patch already_marked_jump;
note_gc_step slot "mark GC slot: done marking:"; note_gc_step slot "mark GC slot: done marking:";
| MEM_interior when type_is_structured ty -> | MEM_interior when type_is_structured ty ->