Avoid iterating ty parts on drop when there are no heap pointers in ty. Wins several tens of kb on rustc.
This commit is contained in:
parent
b5255b4534
commit
87c9a9e25d
@ -947,12 +947,38 @@ let type_is_structured (t:Ast.ty) : bool =
|
||||
let fold = { fold with
|
||||
ty_fold_tup = (fun _ -> true);
|
||||
ty_fold_vec = (fun _ -> true);
|
||||
ty_fold_str = (fun _ -> true);
|
||||
ty_fold_rec = (fun _ -> true);
|
||||
ty_fold_tag = (fun _ -> true);
|
||||
ty_fold_iso = (fun _ -> true);
|
||||
ty_fold_idx = (fun _ -> true);
|
||||
ty_fold_fn = (fun _ -> true);
|
||||
ty_fold_obj = (fun _ -> true) }
|
||||
ty_fold_obj = (fun _ -> true);
|
||||
|
||||
ty_fold_chan = (fun _ -> true);
|
||||
ty_fold_port = (fun _ -> true);
|
||||
ty_fold_box = (fun _ -> true);
|
||||
ty_fold_task = (fun _ -> true);
|
||||
}
|
||||
|
||||
in
|
||||
fold_ty fold t
|
||||
;;
|
||||
|
||||
|
||||
let type_points_to_heap (t:Ast.ty) : bool =
|
||||
let fold = ty_fold_bool_or false in
|
||||
let fold = { fold with
|
||||
ty_fold_vec = (fun _ -> true);
|
||||
ty_fold_str = (fun _ -> true);
|
||||
ty_fold_fn = (fun _ -> true);
|
||||
ty_fold_obj = (fun _ -> true);
|
||||
|
||||
ty_fold_chan = (fun _ -> true);
|
||||
ty_fold_port = (fun _ -> true);
|
||||
ty_fold_box = (fun _ -> true);
|
||||
ty_fold_task = (fun _ -> true);
|
||||
}
|
||||
in
|
||||
fold_ty fold t
|
||||
;;
|
||||
|
@ -2738,11 +2738,11 @@ let trans_visitor
|
||||
patch null_jmp;
|
||||
note_drop_step ty "drop_ty: done box-drop path";
|
||||
|
||||
| MEM_interior when type_is_structured ty ->
|
||||
note_drop_step ty "drop_ty structured-interior path";
|
||||
| MEM_interior when type_points_to_heap ty ->
|
||||
note_drop_step ty "drop_ty heap-referencing path";
|
||||
iter_ty_parts ty_params cell ty
|
||||
(drop_ty ty_params) curr_iso;
|
||||
note_drop_step ty "drop_ty: done structured-interior path";
|
||||
note_drop_step ty "drop_ty: done heap-referencing path";
|
||||
|
||||
|
||||
| MEM_interior ->
|
||||
@ -2785,7 +2785,7 @@ let trans_visitor
|
||||
MEM_gc ->
|
||||
sever_box cell
|
||||
|
||||
| MEM_interior when type_is_structured ty ->
|
||||
| MEM_interior when type_points_to_heap ty ->
|
||||
iter_ty_parts ty_params cell ty
|
||||
(sever_ty ty_params) curr_iso
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user