librustc: Disable borrow check debugging even when rustc is compiled with -O0.

This improves -O0 compile times dramatically.
This commit is contained in:
Patrick Walton 2013-05-15 14:01:54 -07:00
parent ca9bb2d9ac
commit 08e561ae70
3 changed files with 16 additions and 5 deletions

View File

@ -122,6 +122,10 @@ endif
ifdef TRACE
CFG_RUSTC_FLAGS += -Z trace
endif
ifndef DEBUG_BORROWS
RUSTFLAGS_STAGE1 += -Z no-debug-borrows
RUSTFLAGS_STAGE2 += -Z no-debug-borrows
endif
# platform-specific auto-configuration
include $(CFG_SRC_DIR)mk/platform.mk

View File

@ -66,6 +66,7 @@ pub static debug_info: uint = 1 << 20;
pub static extra_debug_info: uint = 1 << 21;
pub static statik: uint = 1 << 22;
pub static print_link_args: uint = 1 << 23;
pub static no_debug_borrows: uint = 1 << 24;
pub fn debugging_opts_map() -> ~[(~str, ~str, uint)] {
~[(~"verbose", ~"in general, enable more debug printouts", verbose),
@ -100,7 +101,10 @@ pub fn debugging_opts_map() -> ~[(~str, ~str, uint)] {
extra_debug_info),
(~"debug-info", ~"Produce debug info (experimental)", debug_info),
(~"static", ~"Use or produce static libraries or binaries " +
"(experimental)", statik)
"(experimental)", statik),
(~"no-debug-borrows",
~"do not show where borrow checks fail",
no_debug_borrows),
]
}
@ -141,7 +145,7 @@ pub struct options {
parse_only: bool,
no_trans: bool,
debugging_opts: uint,
android_cross_path: Option<~str>
android_cross_path: Option<~str>,
}
pub struct crate_metadata {
@ -271,6 +275,9 @@ pub impl Session_ {
fn no_monomorphic_collapse(@self) -> bool {
self.debugging_opt(no_monomorphic_collapse)
}
fn debug_borrows(@self) -> bool {
self.opts.optimize == No && !self.debugging_opt(no_debug_borrows)
}
fn str_of(@self, id: ast::ident) -> @~str {
self.parse_sess.interner.get(id)
@ -308,7 +315,7 @@ pub fn basic_options() -> @options {
parse_only: false,
no_trans: false,
debugging_opts: 0u,
android_cross_path: None
android_cross_path: None,
}
}

View File

@ -74,7 +74,7 @@ pub fn return_to_mut(mut bcx: block,
let bits_val =
Load(bcx, bits_val_ref);
if bcx.tcx().sess.opts.optimize == session::No {
if bcx.tcx().sess.debug_borrows() {
bcx = callee::trans_lang_call(
bcx,
bcx.tcx().lang_items.unrecord_borrow_fn(),
@ -160,7 +160,7 @@ fn root(datum: &Datum,
],
expr::SaveIn(scratch_bits.val));
if bcx.tcx().sess.opts.optimize == session::No {
if bcx.tcx().sess.debug_borrows() {
bcx = callee::trans_lang_call(
bcx,
bcx.tcx().lang_items.record_borrow_fn(),