@@ -98,19 +98,6 @@ fn time<@T>(do_it: bool, what: str, thunk: fn() -> T) -> T {
98
98
ret rv;
99
99
}
100
100
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, 3 u) ] ;
110
- ret rv;
111
- }
112
-
113
-
114
101
fn compile_input ( sess : session:: session , cfg : ast:: crate_cfg , input : str ,
115
102
output : str ) {
116
103
let time_passes = sess. get_opts ( ) . time_passes ;
@@ -132,38 +119,36 @@ fn compile_input(sess: session::session, cfg: ast::crate_cfg, input: str,
132
119
let ast_map =
133
120
time ( time_passes, "ast indexing" ,
134
121
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 ) ) ;
137
124
let { def_map: def_map , ext_map : ext_map } =
138
125
time ( time_passes, "resolution" ,
139
126
bind resolve:: resolve_crate ( sess, ast_map, crate ) ) ;
140
127
let freevars =
141
128
time ( time_passes, "freevar finding" ,
142
129
bind freevars:: annotate_freevars ( def_map, crate ) ) ;
143
130
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" ,
147
133
bind middle:: check_alt:: check_crate ( ty_cx, crate ) ) ;
148
134
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 ) ) ;
151
137
}
152
138
let mut_map =
153
139
time ( time_passes, "mutability checking" ,
154
140
bind middle:: mut:: check_crate ( ty_cx, crate ) ) ;
155
141
let copy_map =
156
142
time ( time_passes, "alias checking" ,
157
143
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 ) ) ;
160
145
if sess. get_opts ( ) . no_trans { ret; }
161
146
let llmod =
162
147
time ( time_passes, "translation" ,
163
148
bind trans:: trans_crate ( sess, crate , ty_cx, output, ast_map,
164
149
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) ) ;
167
152
}
168
153
169
154
fn pretty_print_input ( sess : session:: session , cfg : ast:: crate_cfg , input : str ,
0 commit comments