@@ -134,6 +134,7 @@ fn run(repl: Repl, input: ~str) -> Repl {
134
134
crate_type: session::unknown_crate,
135
135
binary: repl.binary,
136
136
addl_lib_search_paths: repl.lib_search_paths.map(|p| Path(*p)),
137
+ jit: true,
137
138
.. *session::basic_options()
138
139
};
139
140
@@ -153,8 +154,12 @@ fn run(repl: Repl, input: ~str) -> Repl {
153
154
repl.binary,
154
155
wrapped);
155
156
156
- debug!("parsing");
157
- let mut crate = driver::parse_input(sess, cfg, wrapped);
157
+ let outputs = driver::build_output_filenames(wrapped, &None, &None, sess);
158
+ debug!("calling compile_upto");
159
+ let {crate: crate, tcx: _} = driver::compile_upto(sess, cfg, wrapped,
160
+ driver::cu_everything,
161
+ Some(outputs));
162
+
158
163
let mut opt = None;
159
164
160
165
for crate.node.module.items.each |item| {
@@ -177,114 +182,6 @@ fn run(repl: Repl, input: ~str) -> Repl {
177
182
}
178
183
_ => fail
179
184
};
180
-
181
- debug!("configuration");
182
- crate = front::config::strip_unconfigured_items(crate);
183
-
184
- debug!("maybe building test harness");
185
- crate = front::test::modify_for_testing(sess, crate);
186
-
187
- debug!("expansion");
188
- crate = syntax::ext::expand::expand_crate(sess.parse_sess,
189
- sess.opts.cfg,
190
- crate);
191
-
192
- debug!("intrinsic injection");
193
- crate = front::intrinsic_inject::inject_intrinsic(sess, crate);
194
-
195
- debug!("core injection");
196
- crate = front::core_inject::maybe_inject_libcore_ref(sess, crate);
197
-
198
- debug!("building lint settings table");
199
- lint::build_settings_crate(sess, crate);
200
-
201
- debug!("ast indexing");
202
- let ast_map = syntax::ast_map::map_crate(sess.diagnostic(), *crate);
203
-
204
- debug!("external crate/lib resolution");
205
- creader::read_crates(sess.diagnostic(), *crate, sess.cstore,
206
- sess.filesearch,
207
- session::sess_os_to_meta_os(sess.targ_cfg.os),
208
- sess.opts.static, sess.parse_sess.interner);
209
-
210
- debug!("language item collection");
211
- let lang_items = middle::lang_items::collect_language_items(crate, sess);
212
-
213
- debug!("resolution");
214
- let {def_map: def_map,
215
- exp_map2: exp_map2,
216
- trait_map: trait_map} = middle::resolve::resolve_crate(sess,
217
- lang_items,
218
- crate);
219
-
220
- debug!("freevar finding");
221
- let freevars = freevars::annotate_freevars(def_map, crate);
222
-
223
- debug!("region_resolution");
224
- let region_map = middle::region::resolve_crate(sess, def_map, crate);
225
-
226
- debug!("region paramaterization inference");
227
- let rp_set = middle::region::determine_rp_in_crate(sess, ast_map,
228
- def_map, crate);
229
-
230
- debug!("typechecking");
231
- let ty_cx = ty::mk_ctxt(sess, def_map, ast_map, freevars,
232
- region_map, rp_set, move lang_items, crate);
233
- let (method_map, vtable_map) = typeck::check_crate(ty_cx, trait_map,
234
- crate);
235
-
236
- debug!("const marking");
237
- middle::const_eval::process_crate(crate, def_map, ty_cx);
238
-
239
- debug!("const checking");
240
- middle::check_const::check_crate(sess, crate, ast_map, def_map,
241
- method_map, ty_cx);
242
-
243
- debug!("privacy checking");
244
- middle::privacy::check_crate(ty_cx, &method_map, crate);
245
-
246
- debug!("loop checking");
247
- middle::check_loop::check_crate(ty_cx, crate);
248
-
249
- debug!("mode computation");
250
- middle::mode::compute_modes(ty_cx, method_map, crate);
251
-
252
- debug!("alt checking");
253
- middle::check_alt::check_crate(ty_cx, method_map, crate);
254
-
255
- debug!("liveness checking");
256
- let last_use_map = middle::liveness::check_crate(ty_cx,
257
- method_map, crate);
258
-
259
- debug!("borrow checking");
260
- let (root_map, mutbl_map) = middle::borrowck::check_crate(ty_cx,
261
- method_map,
262
- last_use_map,
263
- crate);
264
-
265
- debug!("kind checking");
266
- kind::check_crate(ty_cx, method_map, last_use_map, crate);
267
-
268
- debug!("lint checking");
269
- lint::check_crate(ty_cx, crate);
270
-
271
- let maps = {mutbl_map: mutbl_map,
272
- root_map: root_map,
273
- last_use_map: last_use_map,
274
- method_map: method_map,
275
- vtable_map: vtable_map};
276
-
277
- debug!("translation");
278
- let path = ~path::GenericPath::from_str("<repl>");
279
- let (llmod, _) = trans::base::trans_crate(sess, crate, ty_cx,
280
- path,
281
- exp_map2, maps);
282
- let pm = llvm::LLVMCreatePassManager();
283
-
284
- debug!("executing jit");
285
- back::link::jit::exec(sess, pm, llmod, 0, false);
286
- llvm::LLVMDisposePassManager(pm);
287
-
288
185
debug!("recording input into repl history");
289
186
record(repl, blk, sess.parse_sess.interner)
290
187
}
@@ -380,7 +277,7 @@ fn run_cmd(repl: &mut Repl, _in: io::Reader, _out: io::Writer,
380
277
io::println(
381
278
~":{\\n ..lines.. \\n:}\\n - execute multiline command\n" +
382
279
~":load <crate> ... - \
383
- loads given crates as dynamic libraries" +
280
+ loads given crates as dynamic libraries\n " +
384
281
~":clear - clear the screen\n" +
385
282
~":exit - exit from the repl\n" +
386
283
~":help - show this message");
0 commit comments