From 67e60bf283fbfb4b6b93b41e3e45e9fba835386c Mon Sep 17 00:00:00 2001 From: Ariel Ben-Yehuda Date: Thu, 17 Sep 2015 12:30:04 +0300 Subject: [PATCH] remove unneeded tags from metadata stage1 release rlib sizes: 580890 liballoc-bb943c5a.rlib 1425558 liballoc_jemalloc-bb943c5a.rlib 10514 liballoc_system-bb943c5a.rlib 157192 libarena-bb943c5a.rlib 4316234 libcollections-bb943c5a.rlib 19580128 libcore-bb943c5a.rlib 199498 libflate-bb943c5a.rlib 249328 libfmt_macros-bb943c5a.rlib 560406 libgetopts-bb943c5a.rlib 233620 libgraphviz-bb943c5a.rlib 442964 liblibc-bb943c5a.rlib 190178 liblog-bb943c5a.rlib 778488 librand-bb943c5a.rlib 621972 librbml-bb943c5a.rlib 1415040 librustc_back-bb943c5a.rlib 38849082 librustc-bb943c5a.rlib 12862 librustc_bitflags-bb943c5a.rlib 2331690 librustc_borrowck-bb943c5a.rlib 616880 librustc_data_structures-bb943c5a.rlib 9386582 librustc_driver-bb943c5a.rlib 9600440 librustc_front-bb943c5a.rlib 1615058 librustc_lint-bb943c5a.rlib 79218480 librustc_llvm-bb943c5a.rlib 5020974 librustc_mir-bb943c5a.rlib 3535448 librustc_platform_intrinsics-bb943c5a.rlib 603640 librustc_privacy-bb943c5a.rlib 3163628 librustc_resolve-bb943c5a.rlib 14326646 librustc_trans-bb943c5a.rlib 12033174 librustc_typeck-bb943c5a.rlib 1838202 librustc_unicode-bb943c5a.rlib 15611582 librustdoc-bb943c5a.rlib 3056280 libserialize-bb943c5a.rlib 8954312 libstd-bb943c5a.rlib 30906736 libsyntax-bb943c5a.rlib 925480 libterm-bb943c5a.rlib 1377952 libtest-bb943c5a.rlib --- src/librustc/metadata/common.rs | 26 +++++++---------------- src/librustc/metadata/csearch.rs | 6 ------ src/librustc/metadata/decoder.rs | 12 ----------- src/librustc/metadata/encoder.rs | 36 ++++---------------------------- 4 files changed, 11 insertions(+), 69 deletions(-) diff --git a/src/librustc/metadata/common.rs b/src/librustc/metadata/common.rs index a6cbb4ec5049..5523c2840987 100644 --- a/src/librustc/metadata/common.rs +++ b/src/librustc/metadata/common.rs @@ -74,8 +74,6 @@ pub const tag_crate_dep_crate_name: usize = 0x36; pub const tag_crate_dep_hash: usize = 0x37; pub const tag_crate_dep_explicitly_linked: usize = 0x38; // top-level only -pub const tag_mod_impl: usize = 0x39; - pub const tag_item_trait_item: usize = 0x3a; pub const tag_item_trait_ref: usize = 0x3b; @@ -89,7 +87,6 @@ pub const tag_path_len: usize = 0x3e; pub const tag_path_elem_mod: usize = 0x3f; pub const tag_path_elem_name: usize = 0x40; pub const tag_item_field: usize = 0x41; -pub const tag_item_field_origin: usize = 0x42; pub const tag_item_variances: usize = 0x43; /* @@ -119,8 +116,7 @@ enum_from_u32! { tag_tree = 0x51, - tag_id_range = 0x52, - + // GAP 0x52 tag_table = 0x53, // GAP 0x54, 0x55 tag_table_def = 0x56, @@ -129,19 +125,15 @@ enum_from_u32! { tag_table_freevars = 0x59, tag_table_tcache = 0x5a, tag_table_param_defs = 0x5b, - tag_table_mutbl = 0x5c, - tag_table_last_use = 0x5d, - tag_table_spill = 0x5e, + // GAP 0x5c, 0x5d, 0x5e tag_table_method_map = 0x5f, - tag_table_vtable_map = 0x60, + // GAP 0x60 tag_table_adjustments = 0x61, - tag_table_moves_map = 0x62, - tag_table_capture_map = 0x63, + // GAP 0x62, 0x63 tag_table_closure_tys = 0x64, tag_table_closure_kinds = 0x65, tag_table_upvar_capture_map = 0x66, - tag_table_capture_modes = 0x67, - // GAP 0x68 + // GAP 0x67, 0x68 tag_table_const_qualif = 0x69, tag_table_cast_kinds = 0x6a, } @@ -149,10 +141,6 @@ enum_from_u32! { pub const tag_item_trait_item_sort: usize = 0x70; -pub const tag_item_trait_parent_sort: usize = 0x71; - -pub const tag_item_impl_type_basename: usize = 0x72; - pub const tag_crate_triple: usize = 0x105; // top-level only pub const tag_dylib_dependency_formats: usize = 0x106; // top-level only @@ -173,7 +161,7 @@ pub const tag_lang_items_missing: usize = 0x76; pub const tag_item_unnamed_field: usize = 0x77; pub const tag_items_data_item_visibility: usize = 0x78; -pub const tag_item_method_tps: usize = 0x79; +// GAP 0x79 pub const tag_item_method_fty: usize = 0x7a; pub const tag_mod_child: usize = 0x7b; @@ -181,7 +169,7 @@ pub const tag_misc_info: usize = 0x108; // top-level only pub const tag_misc_info_crate_items: usize = 0x7c; // GAP 0x7d -pub const tag_item_impl_vtables: usize = 0x7e; +// GAP 0x7e pub const tag_impls: usize = 0x109; // top-level only pub const tag_impls_impl: usize = 0x7f; diff --git a/src/librustc/metadata/csearch.rs b/src/librustc/metadata/csearch.rs index 88d73b3feb39..dd6250d92aa6 100644 --- a/src/librustc/metadata/csearch.rs +++ b/src/librustc/metadata/csearch.rs @@ -171,12 +171,6 @@ pub fn get_associated_consts<'tcx>(tcx: &ty::ctxt<'tcx>, def: DefId) decoder::get_associated_consts(cstore.intr.clone(), &*cdata, def.node, tcx) } -pub fn get_type_name_if_impl(cstore: &cstore::CStore, def: DefId) - -> Option { - let cdata = cstore.get_crate_data(def.krate); - decoder::get_type_name_if_impl(&*cdata, def.node) -} - pub fn get_methods_if_impl(cstore: &cstore::CStore, def: DefId) -> Option > { diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs index 77863ee3c87a..be2fe7ddf7cd 100644 --- a/src/librustc/metadata/decoder.rs +++ b/src/librustc/metadata/decoder.rs @@ -979,18 +979,6 @@ pub fn get_associated_consts<'tcx>(intr: Rc, }).collect() } -pub fn get_type_name_if_impl(cdata: Cmd, - node_id: ast::NodeId) -> Option { - let item = cdata.lookup_item(node_id); - if item_family(item) != Impl { - return None; - } - - reader::tagged_docs(item, tag_item_impl_type_basename).nth(0).map(|doc| { - token::intern(doc.as_str_slice()) - }) -} - pub fn get_methods_if_impl(intr: Rc, cdata: Cmd, node_id: ast::NodeId) diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index 0d83103e0bb4..4da94213a30e 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -78,10 +78,6 @@ fn encode_name(rbml_w: &mut Encoder, name: Name) { rbml_w.wr_tagged_str(tag_paths_data_name, &name.as_str()); } -fn encode_impl_type_basename(rbml_w: &mut Encoder, name: Name) { - rbml_w.wr_tagged_str(tag_item_impl_type_basename, &name.as_str()); -} - fn encode_def_id(rbml_w: &mut Encoder, id: DefId) { rbml_w.wr_tagged_u64(tag_def_id, def_to_u64(id)); } @@ -253,8 +249,7 @@ fn encode_parent_item(rbml_w: &mut Encoder, id: DefId) { } fn encode_struct_fields(rbml_w: &mut Encoder, - variant: ty::VariantDef, - origin: DefId) { + variant: ty::VariantDef) { for f in &variant.fields { if f.name == special_idents::unnamed_field.name { rbml_w.start_tag(tag_item_unnamed_field); @@ -264,7 +259,6 @@ fn encode_struct_fields(rbml_w: &mut Encoder, } encode_struct_field_family(rbml_w, f.vis); encode_def_id(rbml_w, f.did); - rbml_w.wr_tagged_u64(tag_item_field_origin, def_to_u64(origin)); rbml_w.end_tag(); } } @@ -311,7 +305,7 @@ fn encode_enum_variant_info(ecx: &EncodeContext, let stab = stability::lookup(ecx.tcx, vid); encode_stability(rbml_w, stab); - encode_struct_fields(rbml_w, variant, vid); + encode_struct_fields(rbml_w, variant); let specified_disr_val = variant.disr_val; if specified_disr_val != disr_val { @@ -518,15 +512,6 @@ fn encode_info_for_mod(ecx: &EncodeContext, def_to_u64(DefId::local(auxiliary_node_id))); true }); - - if let hir::ItemImpl(..) = item.node { - let (name, did) = (item.name, item.id); - debug!("(encoding info for module) ... encoding impl {} ({}/{})", - name, - did, ecx.tcx.map.node_to_string(did)); - - rbml_w.wr_tagged_u64(tag_mod_impl, def_to_u64(DefId::local(did))); - } } encode_path(rbml_w, path.clone()); @@ -605,10 +590,6 @@ fn encode_item_sort(rbml_w: &mut Encoder, sort: char) { rbml_w.wr_tagged_u8(tag_item_trait_item_sort, sort as u8); } -fn encode_parent_sort(rbml_w: &mut Encoder, sort: char) { - rbml_w.wr_tagged_u8(tag_item_trait_parent_sort, sort as u8); -} - fn encode_field<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>, rbml_w: &mut Encoder, field: ty::FieldDef<'tcx>, @@ -1147,7 +1128,7 @@ fn encode_info_for_item(ecx: &EncodeContext, /* Encode def_ids for each field and method for methods, write all the stuff get_trait_method needs to know*/ - encode_struct_fields(rbml_w, variant, def_id); + encode_struct_fields(rbml_w, variant); encode_inlined_item(ecx, rbml_w, InlinedItemRef::Item(item)); @@ -1177,7 +1158,7 @@ fn encode_info_for_item(ecx: &EncodeContext, encode_trait_ref(rbml_w, ecx, trait_ref, tag_item_trait_ref); rbml_w.end_tag(); } - hir::ItemImpl(unsafety, polarity, _, _, ref ty, ref ast_items) => { + hir::ItemImpl(unsafety, polarity, _, _, _, ref ast_items) => { // We need to encode information about the default methods we // have inherited, so we drive this based on the impl structure. let impl_items = tcx.impl_items.borrow(); @@ -1202,13 +1183,6 @@ fn encode_info_for_item(ecx: &EncodeContext, None => {} } - match ty.node { - hir::TyPath(None, ref path) if path.segments.len() == 1 => { - let name = path.segments.last().unwrap().identifier.name; - encode_impl_type_basename(rbml_w, name); - } - _ => {} - } for &item_def_id in items { rbml_w.start_tag(tag_item_impl_item); match item_def_id { @@ -1412,8 +1386,6 @@ fn encode_info_for_item(ecx: &EncodeContext, } } - encode_parent_sort(rbml_w, 't'); - let trait_item = &*ms[i]; encode_attributes(rbml_w, &trait_item.attrs); match trait_item.node {