Don't ever compress metadata

This commit is contained in:
Brian Anderson 2013-08-24 20:57:35 -07:00
parent 39e8cb6df3
commit 022f188a08
8 changed files with 6 additions and 51 deletions

View File

@ -107,12 +107,6 @@ else
CFG_GCCISH_CFLAGS += -DRUST_NDEBUG
endif
ifndef CFG_ENABLE_COMPRESS_METADATA
# XXX: After snapshots extend this to all stages
RUSTFLAGS_STAGE1 += --no-compress-metadata
RUSTFLAGS_STAGE2 += --no-compress-metadata
endif
ifdef SAVE_TEMPS
CFG_RUSTC_FLAGS += --save-temps
endif

1
configure vendored
View File

@ -383,7 +383,6 @@ opt ccache 0 "invoke gcc/clang via ccache to reuse object files between builds"
opt local-rust 0 "use an installed rustc rather than downloading a snapshot"
opt pax-flags 0 "apply PaX flags to rustc binaries (required for GRSecurity/PaX-patched
kernels)"
opt compress-metadata 0 "compress crate metadata"
valopt prefix "/usr/local" "set installation prefix"
valopt local-rust-root "/usr/local" "set prefix for local rust binary"
valopt llvm-root "" "set LLVM root"

View File

@ -718,8 +718,6 @@ pub fn build_session_options(binary: @str,
let android_cross_path = getopts::opt_maybe_str(
matches, "android-cross-path");
let no_compress_metadata = opt_present(matches, "no-compress-metadata");
let custom_passes = match getopts::opt_maybe_str(matches, "passes") {
None => ~[],
Some(s) => {
@ -755,7 +753,6 @@ pub fn build_session_options(binary: @str,
no_trans: no_trans,
debugging_opts: debugging_opts,
android_cross_path: android_cross_path,
no_compress_metadata: no_compress_metadata
};
return sopts;
}
@ -873,8 +870,6 @@ pub fn optgroups() -> ~[getopts::groups::OptGroup] {
for details)", "FEATURE"),
optopt("", "android-cross-path",
"The path to the Android NDK", "PATH"),
optflag("", "no-compress-metadata",
"Do not compress crate metadata (make builds a little faster)"),
optflagopt("W", "warn",
"Set lint warnings", "OPT"),
optmulti("A", "allow",

View File

@ -166,7 +166,6 @@ pub struct options {
no_trans: bool,
debugging_opts: uint,
android_cross_path: Option<~str>,
no_compress_metadata: bool
}
pub struct crate_metadata {
@ -351,7 +350,6 @@ pub fn basic_options() -> @options {
no_trans: false,
debugging_opts: 0u,
android_cross_path: None,
no_compress_metadata: false
}
}

View File

@ -20,7 +20,7 @@ use metadata::decoder;
use metadata::tydecode::{parse_ty_data, parse_def_id,
parse_type_param_def_data,
parse_bare_fn_ty_data, parse_trait_ref_data};
use metadata::loader::{MetadataSection, CopiedSection, UnsafeSection};
use metadata::loader::{MetadataSection, UnsafeSection};
use middle::ty;
use middle::typeck;
use middle::astencode::vtable_decoder_helpers;
@ -1195,7 +1195,6 @@ pub fn get_crate_attributes(data: MetadataSection) -> ~[ast::Attribute] {
pub fn section_to_ebml_doc(data: MetadataSection) -> ebml::Doc {
match data {
CopiedSection(data) => reader::Doc(data),
UnsafeSection(_, buf, len) => reader::unsafe_Doc(buf, len)
}
}

View File

@ -26,7 +26,6 @@ use std::hashmap::{HashMap, HashSet};
use std::io;
use std::str;
use std::vec;
use extra::flate;
use extra::serialize::Encodable;
use extra;
use syntax::abi::AbiSet;
@ -64,7 +63,6 @@ pub struct EncodeParams<'self> {
cstore: @mut cstore::CStore,
encode_inlined_item: encode_inlined_item<'self>,
reachable: @mut HashSet<ast::NodeId>,
compress: bool
}
struct Stats {
@ -1595,7 +1593,6 @@ pub fn encode_metadata(parms: EncodeParams, crate: &Crate) -> ~[u8] {
encode_inlined_item,
link_meta,
reachable,
compress,
_
} = parms;
let type_abbrevs = @mut HashMap::new();
@ -1681,17 +1678,8 @@ pub fn encode_metadata(parms: EncodeParams, crate: &Crate) -> ~[u8] {
wr.write(&[0u8, 0u8, 0u8, 0u8]);
let writer_bytes: &mut ~[u8] = wr.bytes;
let compression_flag = if compress { [1u8] } else { [0u8] };
if compress {
metadata_encoding_version.to_owned() +
compression_flag.to_owned() +
flate::deflate_bytes(*writer_bytes)
} else {
metadata_encoding_version.to_owned() +
compression_flag.to_owned() +
*writer_bytes
}
return metadata_encoding_version.to_owned() + *writer_bytes;
}
// Get the encoded string for a type

View File

@ -32,7 +32,6 @@ use std::os::consts::{macos, freebsd, linux, android, win32};
use std::ptr;
use std::str;
use std::vec;
use extra::flate;
pub enum os {
os_macos,
@ -56,7 +55,8 @@ pub struct Context {
#[deriving(Clone)]
pub enum MetadataSection {
CopiedSection(@~[u8]),
// A pointer to the object file metadata section, along with
// the ObjectFile handle that keeps it from being destructed
UnsafeSection(@ObjectFile, *u8, uint)
}
@ -221,7 +221,6 @@ fn get_metadata_section(os: os,
if name == read_meta_section_name(os) {
let cbuf = llvm::LLVMGetSectionContents(si.llsi);
let csz = llvm::LLVMGetSectionSize(si.llsi) as uint;
let mut found = None;
let cvbuf: *u8 = cast::transmute(cbuf);
let vlen = encoder::metadata_encoding_version.len();
debug!("checking %u bytes of metadata-version stamp",
@ -234,25 +233,9 @@ fn get_metadata_section(os: os,
}
if !version_ok { return None; }
assert!(csz >= vlen + 1);
let cvbuf1 = ptr::offset(cvbuf, vlen as int);
let must_decompress = *ptr::offset(cvbuf, vlen as int) == 1;
let cvbuf1 = ptr::offset(cvbuf, vlen as int + 1);
if must_decompress {
do vec::raw::buf_as_slice(cvbuf1, csz-vlen-1) |bytes| {
debug!("inflating %u bytes of compressed metadata",
csz - vlen);
let inflated = flate::inflate_bytes(bytes);
found = Some(CopiedSection(@inflated));
}
} else {
found = Some(UnsafeSection(of, cvbuf1, csz-vlen-1))
}
if !found.is_none() {
return found;
}
return Some(UnsafeSection(of, cvbuf1, csz-vlen))
}
llvm::LLVMMoveToNextSection(si.llsi);
}

View File

@ -2907,7 +2907,6 @@ pub fn crate_ctxt_to_encode_parms<'r>(cx: &'r CrateContext, ie: encoder::encode_
cstore: cx.sess.cstore,
encode_inlined_item: ie,
reachable: cx.reachable,
compress: !cx.sess.opts.no_compress_metadata
}
}