1
Fork 0

Improve logging in drop paths.

This commit is contained in:
Graydon Hoare 2010-07-04 00:45:35 -07:00
parent 818fbfb325
commit 51c38d5903

View file

@ -2434,6 +2434,7 @@ let trans_visitor
match ty with match ty with
Ast.TY_fn _ -> Ast.TY_fn _ ->
note_drop_step ty "drop_ty: fn path";
let binding = get_element_ptr cell Abi.binding_field_binding in let binding = get_element_ptr cell Abi.binding_field_binding in
let null_jmp = null_check binding in let null_jmp = null_check binding in
(* Drop non-null bindings. *) (* Drop non-null bindings. *)
@ -2442,9 +2443,11 @@ let trans_visitor
* and will leak closures with box substructure. * and will leak closures with box substructure.
*) *)
drop_ty ty_params binding (Ast.TY_box Ast.TY_int) curr_iso; drop_ty ty_params binding (Ast.TY_box Ast.TY_int) curr_iso;
patch null_jmp patch null_jmp;
note_drop_step ty "drop_ty: done fn path";
| Ast.TY_obj _ -> | Ast.TY_obj _ ->
note_drop_step ty "drop_ty: obj path";
let binding = get_element_ptr cell Abi.binding_field_binding in let binding = get_element_ptr cell Abi.binding_field_binding in
let null_jmp = null_check binding in let null_jmp = null_check binding in
let obj = deref binding in let obj = deref binding in
@ -2460,30 +2463,34 @@ let trans_visitor
in in
let null_dtor_jmp = null_check dtor in let null_dtor_jmp = null_check dtor in
(* Call any dtor, if present. *) (* Call any dtor, if present. *)
note_drop_step ty "drop_ty: calling obj dtor";
trans_call_dynamic_glue tydesc trans_call_dynamic_glue tydesc
Abi.tydesc_field_obj_drop_glue None [| binding |]; Abi.tydesc_field_obj_drop_glue None [| binding |];
patch null_dtor_jmp; patch null_dtor_jmp;
(* Drop the body. *) (* Drop the body. *)
note_drop_step ty "drop_ty: dropping obj body";
trans_call_dynamic_glue tydesc trans_call_dynamic_glue tydesc
Abi.tydesc_field_drop_glue None [| ty_params; alias body |]; Abi.tydesc_field_drop_glue None [| ty_params; alias body |];
(* FIXME: this will fail if the user has lied about the (* FIXME: this will fail if the user has lied about the
* state-ness of their obj. We need to store state-ness in the * state-ness of their obj. We need to store state-ness in the
* captured tydesc, and use that. *) * captured tydesc, and use that. *)
note_drop_step ty "drop_ty: freeing obj body";
trans_free binding (type_has_state ty); trans_free binding (type_has_state ty);
mov binding zero; mov binding zero;
patch rc_jmp; patch rc_jmp;
patch null_jmp patch null_jmp;
note_drop_step ty "drop_ty: done obj path";
| Ast.TY_param (i, _) -> | Ast.TY_param (i, _) ->
iflog (fun _ -> annotate note_drop_step ty "drop_ty: parametric-ty path";
(Printf.sprintf "drop_ty: parametric drop %#d" i));
aliasing false cell aliasing false cell
begin begin
fun cell -> fun cell ->
trans_call_simple_dynamic_glue trans_call_simple_dynamic_glue
i Abi.tydesc_field_drop_glue ty_params cell i Abi.tydesc_field_drop_glue ty_params cell
end end;
note_drop_step ty "drop_ty: done parametric-ty path";
| _ -> | _ ->
match mctrl with match mctrl with
@ -2491,7 +2498,7 @@ 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"; note_drop_step ty "drop_ty: box-drop path";
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
@ -2511,15 +2518,18 @@ let trans_visitor
*) *)
mov cell zero; mov cell zero;
patch j; patch j;
patch null_jmp patch null_jmp;
note_drop_step ty "drop_ty: done box-drop path";
| 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"; note_drop_step ty "drop:ty structured-interior path";
iter_ty_parts ty_params cell ty iter_ty_parts ty_params cell ty
(drop_ty ty_params) curr_iso (drop_ty ty_params) curr_iso;
note_drop_step ty "drop_ty: done structured-interior path";
| MEM_interior -> | MEM_interior ->
note_drop_step ty "in simple-interior path of drop_ty"; note_drop_step ty "drop_ty: no-op simple-interior path";
(* Interior allocation of all-interior value not caught above: (* Interior allocation of all-interior value not caught above:
* nothing to do. * nothing to do.
*) *)