Skip to content

Commit 022f188

Browse files
committed
Don't ever compress metadata
1 parent 39e8cb6 commit 022f188

File tree

8 files changed

+7
-52
lines changed

8 files changed

+7
-52
lines changed

Makefile.in

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,6 @@ else
107107
CFG_GCCISH_CFLAGS += -DRUST_NDEBUG
108108
endif
109109

110-
ifndef CFG_ENABLE_COMPRESS_METADATA
111-
# XXX: After snapshots extend this to all stages
112-
RUSTFLAGS_STAGE1 += --no-compress-metadata
113-
RUSTFLAGS_STAGE2 += --no-compress-metadata
114-
endif
115-
116110
ifdef SAVE_TEMPS
117111
CFG_RUSTC_FLAGS += --save-temps
118112
endif

configure

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,6 @@ opt ccache 0 "invoke gcc/clang via ccache to reuse object files between builds"
383383
opt local-rust 0 "use an installed rustc rather than downloading a snapshot"
384384
opt pax-flags 0 "apply PaX flags to rustc binaries (required for GRSecurity/PaX-patched
385385
kernels)"
386-
opt compress-metadata 0 "compress crate metadata"
387386
valopt prefix "/usr/local" "set installation prefix"
388387
valopt local-rust-root "/usr/local" "set prefix for local rust binary"
389388
valopt llvm-root "" "set LLVM root"

src/librustc/driver/driver.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -718,8 +718,6 @@ pub fn build_session_options(binary: @str,
718718
let android_cross_path = getopts::opt_maybe_str(
719719
matches, "android-cross-path");
720720

721-
let no_compress_metadata = opt_present(matches, "no-compress-metadata");
722-
723721
let custom_passes = match getopts::opt_maybe_str(matches, "passes") {
724722
None => ~[],
725723
Some(s) => {
@@ -755,7 +753,6 @@ pub fn build_session_options(binary: @str,
755753
no_trans: no_trans,
756754
debugging_opts: debugging_opts,
757755
android_cross_path: android_cross_path,
758-
no_compress_metadata: no_compress_metadata
759756
};
760757
return sopts;
761758
}
@@ -873,8 +870,6 @@ pub fn optgroups() -> ~[getopts::groups::OptGroup] {
873870
for details)", "FEATURE"),
874871
optopt("", "android-cross-path",
875872
"The path to the Android NDK", "PATH"),
876-
optflag("", "no-compress-metadata",
877-
"Do not compress crate metadata (make builds a little faster)"),
878873
optflagopt("W", "warn",
879874
"Set lint warnings", "OPT"),
880875
optmulti("A", "allow",

src/librustc/driver/session.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ pub struct options {
166166
no_trans: bool,
167167
debugging_opts: uint,
168168
android_cross_path: Option<~str>,
169-
no_compress_metadata: bool
170169
}
171170

172171
pub struct crate_metadata {
@@ -351,7 +350,6 @@ pub fn basic_options() -> @options {
351350
no_trans: false,
352351
debugging_opts: 0u,
353352
android_cross_path: None,
354-
no_compress_metadata: false
355353
}
356354
}
357355

src/librustc/metadata/decoder.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use metadata::decoder;
2020
use metadata::tydecode::{parse_ty_data, parse_def_id,
2121
parse_type_param_def_data,
2222
parse_bare_fn_ty_data, parse_trait_ref_data};
23-
use metadata::loader::{MetadataSection, CopiedSection, UnsafeSection};
23+
use metadata::loader::{MetadataSection, UnsafeSection};
2424
use middle::ty;
2525
use middle::typeck;
2626
use middle::astencode::vtable_decoder_helpers;
@@ -1195,7 +1195,6 @@ pub fn get_crate_attributes(data: MetadataSection) -> ~[ast::Attribute] {
11951195

11961196
pub fn section_to_ebml_doc(data: MetadataSection) -> ebml::Doc {
11971197
match data {
1198-
CopiedSection(data) => reader::Doc(data),
11991198
UnsafeSection(_, buf, len) => reader::unsafe_Doc(buf, len)
12001199
}
12011200
}

src/librustc/metadata/encoder.rs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use std::hashmap::{HashMap, HashSet};
2626
use std::io;
2727
use std::str;
2828
use std::vec;
29-
use extra::flate;
3029
use extra::serialize::Encodable;
3130
use extra;
3231
use syntax::abi::AbiSet;
@@ -64,7 +63,6 @@ pub struct EncodeParams<'self> {
6463
cstore: @mut cstore::CStore,
6564
encode_inlined_item: encode_inlined_item<'self>,
6665
reachable: @mut HashSet<ast::NodeId>,
67-
compress: bool
6866
}
6967

7068
struct Stats {
@@ -1595,7 +1593,6 @@ pub fn encode_metadata(parms: EncodeParams, crate: &Crate) -> ~[u8] {
15951593
encode_inlined_item,
15961594
link_meta,
15971595
reachable,
1598-
compress,
15991596
_
16001597
} = parms;
16011598
let type_abbrevs = @mut HashMap::new();
@@ -1681,17 +1678,8 @@ pub fn encode_metadata(parms: EncodeParams, crate: &Crate) -> ~[u8] {
16811678
wr.write(&[0u8, 0u8, 0u8, 0u8]);
16821679

16831680
let writer_bytes: &mut ~[u8] = wr.bytes;
1684-
let compression_flag = if compress { [1u8] } else { [0u8] };
1685-
1686-
if compress {
1687-
metadata_encoding_version.to_owned() +
1688-
compression_flag.to_owned() +
1689-
flate::deflate_bytes(*writer_bytes)
1690-
} else {
1691-
metadata_encoding_version.to_owned() +
1692-
compression_flag.to_owned() +
1693-
*writer_bytes
1694-
}
1681+
1682+
return metadata_encoding_version.to_owned() + *writer_bytes;
16951683
}
16961684

16971685
// Get the encoded string for a type

src/librustc/metadata/loader.rs

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ use std::os::consts::{macos, freebsd, linux, android, win32};
3232
use std::ptr;
3333
use std::str;
3434
use std::vec;
35-
use extra::flate;
3635

3736
pub enum os {
3837
os_macos,
@@ -56,7 +55,8 @@ pub struct Context {
5655

5756
#[deriving(Clone)]
5857
pub enum MetadataSection {
59-
CopiedSection(@~[u8]),
58+
// A pointer to the object file metadata section, along with
59+
// the ObjectFile handle that keeps it from being destructed
6060
UnsafeSection(@ObjectFile, *u8, uint)
6161
}
6262

@@ -221,7 +221,6 @@ fn get_metadata_section(os: os,
221221
if name == read_meta_section_name(os) {
222222
let cbuf = llvm::LLVMGetSectionContents(si.llsi);
223223
let csz = llvm::LLVMGetSectionSize(si.llsi) as uint;
224-
let mut found = None;
225224
let cvbuf: *u8 = cast::transmute(cbuf);
226225
let vlen = encoder::metadata_encoding_version.len();
227226
debug!("checking %u bytes of metadata-version stamp",
@@ -234,25 +233,9 @@ fn get_metadata_section(os: os,
234233
}
235234
if !version_ok { return None; }
236235

237-
assert!(csz >= vlen + 1);
236+
let cvbuf1 = ptr::offset(cvbuf, vlen as int);
238237

239-
let must_decompress = *ptr::offset(cvbuf, vlen as int) == 1;
240-
let cvbuf1 = ptr::offset(cvbuf, vlen as int + 1);
241-
242-
if must_decompress {
243-
do vec::raw::buf_as_slice(cvbuf1, csz-vlen-1) |bytes| {
244-
debug!("inflating %u bytes of compressed metadata",
245-
csz - vlen);
246-
let inflated = flate::inflate_bytes(bytes);
247-
found = Some(CopiedSection(@inflated));
248-
}
249-
} else {
250-
found = Some(UnsafeSection(of, cvbuf1, csz-vlen-1))
251-
}
252-
253-
if !found.is_none() {
254-
return found;
255-
}
238+
return Some(UnsafeSection(of, cvbuf1, csz-vlen))
256239
}
257240
llvm::LLVMMoveToNextSection(si.llsi);
258241
}

src/librustc/middle/trans/base.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2907,7 +2907,6 @@ pub fn crate_ctxt_to_encode_parms<'r>(cx: &'r CrateContext, ie: encoder::encode_
29072907
cstore: cx.sess.cstore,
29082908
encode_inlined_item: ie,
29092909
reachable: cx.reachable,
2910-
compress: !cx.sess.opts.no_compress_metadata
29112910
}
29122911
}
29132912

0 commit comments

Comments
 (0)