Skip to content

Commit 9c037d2

Browse files
committed
Revert "rustc: Add a workaround for a segfault with --time-passes (issue #1005)."
This reverts commit 100e026.
1 parent 8ee017a commit 9c037d2

File tree

1 file changed

+9
-24
lines changed

1 file changed

+9
-24
lines changed

src/comp/driver/rustc.rs

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -98,19 +98,6 @@ fn time<@T>(do_it: bool, what: str, thunk: fn() -> T) -> T {
9898
ret rv;
9999
}
100100

101-
// FIXME (issue #1005): Needed to work around a segfault. If |time| is used
102-
// instead, we crash.
103-
fn time_unit(do_it: bool, what: str, thunk: fn()) {
104-
if !do_it { ret thunk(); }
105-
let start = std::time::precise_time_s();
106-
let rv = thunk();
107-
let end = std::time::precise_time_s();
108-
log_err #fmt["time: %s took %s s", what,
109-
common::float_to_str(end - start, 3u)];
110-
ret rv;
111-
}
112-
113-
114101
fn compile_input(sess: session::session, cfg: ast::crate_cfg, input: str,
115102
output: str) {
116103
let time_passes = sess.get_opts().time_passes;
@@ -132,38 +119,36 @@ fn compile_input(sess: session::session, cfg: ast::crate_cfg, input: str,
132119
let ast_map =
133120
time(time_passes, "ast indexing",
134121
bind middle::ast_map::map_crate(*crate));
135-
time_unit(time_passes, "external crate/lib resolution",
136-
bind creader::read_crates(sess, *crate));
122+
time(time_passes, "external crate/lib resolution",
123+
bind creader::read_crates(sess, *crate));
137124
let {def_map: def_map, ext_map: ext_map} =
138125
time(time_passes, "resolution",
139126
bind resolve::resolve_crate(sess, ast_map, crate));
140127
let freevars =
141128
time(time_passes, "freevar finding",
142129
bind freevars::annotate_freevars(def_map, crate));
143130
let ty_cx = ty::mk_ctxt(sess, def_map, ext_map, ast_map, freevars);
144-
time_unit(time_passes, "typechecking", bind
145-
typeck::check_crate(ty_cx, crate));
146-
time_unit(time_passes, "alt checking",
131+
time(time_passes, "typechecking", bind typeck::check_crate(ty_cx, crate));
132+
time(time_passes, "alt checking",
147133
bind middle::check_alt::check_crate(ty_cx, crate));
148134
if sess.get_opts().run_typestate {
149-
time_unit(time_passes, "typestate checking",
150-
bind middle::tstate::ck::check_crate(ty_cx, crate));
135+
time(time_passes, "typestate checking",
136+
bind middle::tstate::ck::check_crate(ty_cx, crate));
151137
}
152138
let mut_map =
153139
time(time_passes, "mutability checking",
154140
bind middle::mut::check_crate(ty_cx, crate));
155141
let copy_map =
156142
time(time_passes, "alias checking",
157143
bind middle::alias::check_crate(ty_cx, crate));
158-
time_unit(time_passes, "kind checking",
159-
bind kind::check_crate(ty_cx, crate));
144+
time(time_passes, "kind checking", bind kind::check_crate(ty_cx, crate));
160145
if sess.get_opts().no_trans { ret; }
161146
let llmod =
162147
time(time_passes, "translation",
163148
bind trans::trans_crate(sess, crate, ty_cx, output, ast_map,
164149
mut_map, copy_map));
165-
time_unit(time_passes, "LLVM passes",
166-
bind link::write::run_passes(sess, llmod, output));
150+
time(time_passes, "LLVM passes",
151+
bind link::write::run_passes(sess, llmod, output));
167152
}
168153

169154
fn pretty_print_input(sess: session::session, cfg: ast::crate_cfg, input: str,

0 commit comments

Comments
 (0)