From 71d49a20a7f76602501e274cc089758b58d225ce Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Tue, 21 Sep 2010 00:13:59 -0700 Subject: Skip 0-ary tag ctors in Trans.iter_tag_parts. Rustc loses 150kb. --- src/boot/me/trans.ml | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/boot/me/trans.ml b/src/boot/me/trans.ml index ba0c4771..e70c3196 100644 --- a/src/boot/me/trans.ml +++ b/src/boot/me/trans.ml @@ -2715,18 +2715,24 @@ let trans_visitor mov tmp (Il.Cell src_tag); for i = 0 to n-1 do - (iflog (fun _ -> - annotate (Printf.sprintf "tag case #%i" i))); - let jmps = - trans_compare_simple Il.JNE (Il.Cell tmp) (imm (Int64.of_int i)) - in let ttup = get_nth_tag_tup cx ttag i in - iter_tup_parts - (get_element_ptr_dyn ty_params) - (get_variant_ptr dst_union i) - (get_variant_ptr src_union i) - ttup f; - List.iter patch jmps + if Array.length ttup <> 0 + then + begin + (iflog (fun _ -> + annotate (Printf.sprintf "tag case #%i" i))); + let jmps = + trans_compare_simple Il.JNE + (Il.Cell tmp) (imm (Int64.of_int i)) + in + let ttup = get_nth_tag_tup cx ttag i in + iter_tup_parts + (get_element_ptr_dyn ty_params) + (get_variant_ptr dst_union i) + (get_variant_ptr src_union i) + ttup f; + List.iter patch jmps + end done; and seq_unit_ty (seq:Ast.ty) : Ast.ty = -- cgit v1.2.3