mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Don't ever compress metadata
This commit is contained in:
parent
39e8cb6df3
commit
022f188a08
@ -107,12 +107,6 @@ else
|
|||||||
CFG_GCCISH_CFLAGS += -DRUST_NDEBUG
|
CFG_GCCISH_CFLAGS += -DRUST_NDEBUG
|
||||||
endif
|
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
|
ifdef SAVE_TEMPS
|
||||||
CFG_RUSTC_FLAGS += --save-temps
|
CFG_RUSTC_FLAGS += --save-temps
|
||||||
endif
|
endif
|
||||||
|
1
configure
vendored
1
configure
vendored
@ -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 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
|
opt pax-flags 0 "apply PaX flags to rustc binaries (required for GRSecurity/PaX-patched
|
||||||
kernels)"
|
kernels)"
|
||||||
opt compress-metadata 0 "compress crate metadata"
|
|
||||||
valopt prefix "/usr/local" "set installation prefix"
|
valopt prefix "/usr/local" "set installation prefix"
|
||||||
valopt local-rust-root "/usr/local" "set prefix for local rust binary"
|
valopt local-rust-root "/usr/local" "set prefix for local rust binary"
|
||||||
valopt llvm-root "" "set LLVM root"
|
valopt llvm-root "" "set LLVM root"
|
||||||
|
@ -718,8 +718,6 @@ pub fn build_session_options(binary: @str,
|
|||||||
let android_cross_path = getopts::opt_maybe_str(
|
let android_cross_path = getopts::opt_maybe_str(
|
||||||
matches, "android-cross-path");
|
matches, "android-cross-path");
|
||||||
|
|
||||||
let no_compress_metadata = opt_present(matches, "no-compress-metadata");
|
|
||||||
|
|
||||||
let custom_passes = match getopts::opt_maybe_str(matches, "passes") {
|
let custom_passes = match getopts::opt_maybe_str(matches, "passes") {
|
||||||
None => ~[],
|
None => ~[],
|
||||||
Some(s) => {
|
Some(s) => {
|
||||||
@ -755,7 +753,6 @@ pub fn build_session_options(binary: @str,
|
|||||||
no_trans: no_trans,
|
no_trans: no_trans,
|
||||||
debugging_opts: debugging_opts,
|
debugging_opts: debugging_opts,
|
||||||
android_cross_path: android_cross_path,
|
android_cross_path: android_cross_path,
|
||||||
no_compress_metadata: no_compress_metadata
|
|
||||||
};
|
};
|
||||||
return sopts;
|
return sopts;
|
||||||
}
|
}
|
||||||
@ -873,8 +870,6 @@ pub fn optgroups() -> ~[getopts::groups::OptGroup] {
|
|||||||
for details)", "FEATURE"),
|
for details)", "FEATURE"),
|
||||||
optopt("", "android-cross-path",
|
optopt("", "android-cross-path",
|
||||||
"The path to the Android NDK", "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",
|
optflagopt("W", "warn",
|
||||||
"Set lint warnings", "OPT"),
|
"Set lint warnings", "OPT"),
|
||||||
optmulti("A", "allow",
|
optmulti("A", "allow",
|
||||||
|
@ -166,7 +166,6 @@ pub struct options {
|
|||||||
no_trans: bool,
|
no_trans: bool,
|
||||||
debugging_opts: uint,
|
debugging_opts: uint,
|
||||||
android_cross_path: Option<~str>,
|
android_cross_path: Option<~str>,
|
||||||
no_compress_metadata: bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct crate_metadata {
|
pub struct crate_metadata {
|
||||||
@ -351,7 +350,6 @@ pub fn basic_options() -> @options {
|
|||||||
no_trans: false,
|
no_trans: false,
|
||||||
debugging_opts: 0u,
|
debugging_opts: 0u,
|
||||||
android_cross_path: None,
|
android_cross_path: None,
|
||||||
no_compress_metadata: false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ use metadata::decoder;
|
|||||||
use metadata::tydecode::{parse_ty_data, parse_def_id,
|
use metadata::tydecode::{parse_ty_data, parse_def_id,
|
||||||
parse_type_param_def_data,
|
parse_type_param_def_data,
|
||||||
parse_bare_fn_ty_data, parse_trait_ref_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::ty;
|
||||||
use middle::typeck;
|
use middle::typeck;
|
||||||
use middle::astencode::vtable_decoder_helpers;
|
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 {
|
pub fn section_to_ebml_doc(data: MetadataSection) -> ebml::Doc {
|
||||||
match data {
|
match data {
|
||||||
CopiedSection(data) => reader::Doc(data),
|
|
||||||
UnsafeSection(_, buf, len) => reader::unsafe_Doc(buf, len)
|
UnsafeSection(_, buf, len) => reader::unsafe_Doc(buf, len)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,6 @@ use std::hashmap::{HashMap, HashSet};
|
|||||||
use std::io;
|
use std::io;
|
||||||
use std::str;
|
use std::str;
|
||||||
use std::vec;
|
use std::vec;
|
||||||
use extra::flate;
|
|
||||||
use extra::serialize::Encodable;
|
use extra::serialize::Encodable;
|
||||||
use extra;
|
use extra;
|
||||||
use syntax::abi::AbiSet;
|
use syntax::abi::AbiSet;
|
||||||
@ -64,7 +63,6 @@ pub struct EncodeParams<'self> {
|
|||||||
cstore: @mut cstore::CStore,
|
cstore: @mut cstore::CStore,
|
||||||
encode_inlined_item: encode_inlined_item<'self>,
|
encode_inlined_item: encode_inlined_item<'self>,
|
||||||
reachable: @mut HashSet<ast::NodeId>,
|
reachable: @mut HashSet<ast::NodeId>,
|
||||||
compress: bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Stats {
|
struct Stats {
|
||||||
@ -1595,7 +1593,6 @@ pub fn encode_metadata(parms: EncodeParams, crate: &Crate) -> ~[u8] {
|
|||||||
encode_inlined_item,
|
encode_inlined_item,
|
||||||
link_meta,
|
link_meta,
|
||||||
reachable,
|
reachable,
|
||||||
compress,
|
|
||||||
_
|
_
|
||||||
} = parms;
|
} = parms;
|
||||||
let type_abbrevs = @mut HashMap::new();
|
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]);
|
wr.write(&[0u8, 0u8, 0u8, 0u8]);
|
||||||
|
|
||||||
let writer_bytes: &mut ~[u8] = wr.bytes;
|
let writer_bytes: &mut ~[u8] = wr.bytes;
|
||||||
let compression_flag = if compress { [1u8] } else { [0u8] };
|
|
||||||
|
|
||||||
if compress {
|
return metadata_encoding_version.to_owned() + *writer_bytes;
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the encoded string for a type
|
// Get the encoded string for a type
|
||||||
|
@ -32,7 +32,6 @@ use std::os::consts::{macos, freebsd, linux, android, win32};
|
|||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::str;
|
use std::str;
|
||||||
use std::vec;
|
use std::vec;
|
||||||
use extra::flate;
|
|
||||||
|
|
||||||
pub enum os {
|
pub enum os {
|
||||||
os_macos,
|
os_macos,
|
||||||
@ -56,7 +55,8 @@ pub struct Context {
|
|||||||
|
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub enum MetadataSection {
|
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)
|
UnsafeSection(@ObjectFile, *u8, uint)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,7 +221,6 @@ fn get_metadata_section(os: os,
|
|||||||
if name == read_meta_section_name(os) {
|
if name == read_meta_section_name(os) {
|
||||||
let cbuf = llvm::LLVMGetSectionContents(si.llsi);
|
let cbuf = llvm::LLVMGetSectionContents(si.llsi);
|
||||||
let csz = llvm::LLVMGetSectionSize(si.llsi) as uint;
|
let csz = llvm::LLVMGetSectionSize(si.llsi) as uint;
|
||||||
let mut found = None;
|
|
||||||
let cvbuf: *u8 = cast::transmute(cbuf);
|
let cvbuf: *u8 = cast::transmute(cbuf);
|
||||||
let vlen = encoder::metadata_encoding_version.len();
|
let vlen = encoder::metadata_encoding_version.len();
|
||||||
debug!("checking %u bytes of metadata-version stamp",
|
debug!("checking %u bytes of metadata-version stamp",
|
||||||
@ -234,25 +233,9 @@ fn get_metadata_section(os: os,
|
|||||||
}
|
}
|
||||||
if !version_ok { return None; }
|
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;
|
return Some(UnsafeSection(of, cvbuf1, csz-vlen))
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
llvm::LLVMMoveToNextSection(si.llsi);
|
llvm::LLVMMoveToNextSection(si.llsi);
|
||||||
}
|
}
|
||||||
|
@ -2907,7 +2907,6 @@ pub fn crate_ctxt_to_encode_parms<'r>(cx: &'r CrateContext, ie: encoder::encode_
|
|||||||
cstore: cx.sess.cstore,
|
cstore: cx.sess.cstore,
|
||||||
encode_inlined_item: ie,
|
encode_inlined_item: ie,
|
||||||
reachable: cx.reachable,
|
reachable: cx.reachable,
|
||||||
compress: !cx.sess.opts.no_compress_metadata
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user