Improve drop-path logging and simplify box_rc_cell.

This commit is contained in:
Graydon Hoare 2010-07-02 09:45:24 -07:00
parent b2692ef2ec
commit d9037af22d

View File

@ -2249,9 +2249,7 @@ let trans_visitor
(tydesc_rty abi)) (tydesc_rty abi))
and box_rc_cell (cell:Il.cell) : Il.cell = and box_rc_cell (cell:Il.cell) : Il.cell =
let off = Abi.box_rc_slot_field_refcnt in get_element_ptr (deref cell) Abi.box_rc_slot_field_refcnt
let (mem, _) = need_mem_cell (deref_imm cell (word_n off)) in
word_at mem
and box_allocation_size and box_allocation_size
(ty:Ast.ty) (ty:Ast.ty)
@ -2499,6 +2497,8 @@ let trans_visitor
| MEM_rc_opaque | MEM_rc_opaque
| MEM_rc_struct -> | MEM_rc_struct ->
note_drop_step ty "in box-drop path of drop_ty";
let _ = check_box_rty cell in let _ = check_box_rty cell in
let null_jmp = null_check cell in let null_jmp = null_check cell in
let rc = box_rc_cell cell in let rc = box_rc_cell cell in
@ -2524,6 +2524,7 @@ let trans_visitor
patch null_jmp patch null_jmp
| MEM_interior when type_is_structured ty -> | MEM_interior when type_is_structured ty ->
note_drop_step ty "in structured-interior path of drop_ty";
(iflog (fun _ -> (iflog (fun _ ->
annotate ("drop interior memory " ^ annotate ("drop interior memory " ^
(Fmt.fmt_to_str Ast.fmt_ty ty)))); (Fmt.fmt_to_str Ast.fmt_ty ty))));
@ -2535,6 +2536,7 @@ let trans_visitor
ty_params vr ty_params vr
| MEM_interior -> | MEM_interior ->
note_drop_step ty "in simple-interior path of drop_ty";
(* Interior allocation of all-interior value not caught above: (* Interior allocation of all-interior value not caught above:
* nothing to do. * nothing to do.
*) *)
@ -2729,8 +2731,15 @@ let trans_visitor
if cx.ctxt_sess.Session.sess_trace_drop || if cx.ctxt_sess.Session.sess_trace_drop ||
cx.ctxt_sess.Session.sess_log_trans cx.ctxt_sess.Session.sess_log_trans
then then
let slotstr = Fmt.fmt_to_str Ast.fmt_ty ty in let mctrl_str =
let str = step ^ " " ^ slotstr in match ty_mem_ctrl ty with
MEM_gc -> "MEM_gc"
| MEM_rc_struct -> "MEM_rc_struct"
| MEM_rc_opaque -> "MEM_rc_opaque"
| MEM_interior -> "MEM_interior"
in
let tystr = Fmt.fmt_to_str Ast.fmt_ty ty in
let str = step ^ " " ^ mctrl_str ^ " " ^ tystr in
begin begin
annotate str; annotate str;
trace_str cx.ctxt_sess.Session.sess_trace_drop str trace_str cx.ctxt_sess.Session.sess_trace_drop str