diff options
| author | Graydon Hoare <[email protected]> | 2010-09-21 00:13:59 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2010-09-21 00:13:59 -0700 |
| commit | 71d49a20a7f76602501e274cc089758b58d225ce (patch) | |
| tree | ee1e08c262ddaedd951d48ed1006a110c16b39a9 /src/boot | |
| parent | Bind pattern slots with ?, drop parens from 0-ary tag constructors, translate... (diff) | |
| download | rust-71d49a20a7f76602501e274cc089758b58d225ce.tar.xz rust-71d49a20a7f76602501e274cc089758b58d225ce.zip | |
Skip 0-ary tag ctors in Trans.iter_tag_parts. Rustc loses 150kb.
Diffstat (limited to 'src/boot')
| -rw-r--r-- | src/boot/me/trans.ml | 28 |
1 files changed, 17 insertions, 11 deletions
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 = |