Skip to content

Commit dba3368

Browse files
committed
---
yaml --- r: 64768 b: refs/heads/snap-stage3 c: 4a85b08 h: refs/heads/master v: v3
1 parent 6b3415b commit dba3368

File tree

11 files changed

+292
-296
lines changed

11 files changed

+292
-296
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 413446c85b44a7d9269a0723ed043e16d09e2324
4+
refs/heads/snap-stage3: 4a85b08e08456920f07cf8bb583064f84c23575d
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustc/driver/driver.rs

Lines changed: 224 additions & 243 deletions
Large diffs are not rendered by default.

branches/snap-stage3/src/librustc/middle/trans/base.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ use back::link::{mangle_exported_name};
2828
use back::{link, abi};
2929
use driver::session;
3030
use driver::session::Session;
31-
use driver::driver::{CrateAnalysis, CrateTranslation};
32-
use lib::llvm::{ModuleRef, ValueRef, BasicBlockRef};
31+
use lib::llvm::{ContextRef, ModuleRef, ValueRef, BasicBlockRef};
3332
use lib::llvm::{llvm, True};
3433
use lib;
3534
use metadata::common::LinkMeta;
3635
use metadata::{csearch, cstore, encoder};
3736
use middle::astencode;
3837
use middle::lang_items::{LangItem, ExchangeMallocFnLangItem, StartFnLangItem};
3938
use middle::lang_items::{MallocFnLangItem, ClosureExchangeMallocFnLangItem};
39+
use middle::resolve;
4040
use middle::trans::_match;
4141
use middle::trans::adt;
4242
use middle::trans::base;
@@ -66,7 +66,7 @@ use util::ppaux::{Repr, ty_to_str};
6666
use middle::trans::type_::Type;
6767

6868
use std::hash;
69-
use std::hashmap::HashMap;
69+
use std::hashmap::{HashMap, HashSet};
7070
use std::io;
7171
use std::libc::c_uint;
7272
use std::uint;
@@ -2957,8 +2957,12 @@ pub fn write_abi_version(ccx: &mut CrateContext) {
29572957

29582958
pub fn trans_crate(sess: session::Session,
29592959
crate: &ast::Crate,
2960-
analysis: &CrateAnalysis,
2961-
output: &Path) -> CrateTranslation {
2960+
tcx: ty::ctxt,
2961+
output: &Path,
2962+
emap2: resolve::ExportMap2,
2963+
reachable_map: @mut HashSet<ast::node_id>,
2964+
maps: astencode::Maps)
2965+
-> (ContextRef, ModuleRef, LinkMeta) {
29622966
// Before we touch LLVM, make sure that multithreading is enabled.
29632967
if unsafe { !llvm::LLVMRustStartMultithreading() } {
29642968
//sess.bug("couldn't enable multi-threaded LLVM");
@@ -2979,12 +2983,12 @@ pub fn trans_crate(sess: session::Session,
29792983

29802984
let ccx = @mut CrateContext::new(sess,
29812985
llmod_id,
2982-
analysis.ty_cx,
2983-
analysis.exp_map2,
2984-
analysis.maps,
2986+
tcx,
2987+
emap2,
2988+
maps,
29852989
symbol_hasher,
29862990
link_meta,
2987-
analysis.reachable);
2991+
reachable_map);
29882992

29892993
{
29902994
let _icx = push_ctxt("data");
@@ -3039,9 +3043,5 @@ pub fn trans_crate(sess: session::Session,
30393043
let link_meta = ccx.link_meta;
30403044
let llmod = ccx.llmod;
30413045

3042-
return CrateTranslation {
3043-
context: llcx,
3044-
module: llmod,
3045-
link: link_meta
3046-
};
3046+
return (llcx, llmod, link_meta);
30473047
}

branches/snap-stage3/src/librustc/middle/trans/consts.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,16 @@ pub fn const_expr(cx: @mut CrateContext, e: @ast::expr) -> ValueRef {
211211
}
212212
ty::AutoBorrowVec(ty::re_static, m) => {
213213
assert!(m != ast::m_mutbl);
214-
let size = machine::llsize_of(cx,
215-
val_ty(llconst));
216214
assert_eq!(abi::slice_elt_base, 0);
217215
assert_eq!(abi::slice_elt_len, 1);
218-
llconst = C_struct([llptr, size]);
216+
217+
match ty::get(ty).sty {
218+
ty::ty_evec(_, ty::vstore_fixed(*)) => {
219+
let size = machine::llsize_of(cx, val_ty(llconst));
220+
llconst = C_struct([llptr, size]);
221+
}
222+
_ => {}
223+
}
219224
}
220225
_ => {
221226
cx.sess.span_bug(e.span,

branches/snap-stage3/src/librusti/rusti.rs

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -223,15 +223,13 @@ fn run(mut program: ~Program, binary: ~str, lib_search_paths: ~[~str],
223223
debug!("testing with ^^^^^^ %?", (||{ println(test) })());
224224
let dinput = driver::str_input(test.to_managed());
225225
let cfg = driver::build_configuration(sess, binary, &dinput);
226-
227-
let crate = driver::phase_1_parse_input(sess, cfg.clone(), &dinput);
228-
let expanded_crate = driver::phase_2_configure_and_expand(sess, cfg, crate);
229-
let analysis = driver::phase_3_run_analysis_passes(sess, expanded_crate);
230-
226+
let outputs = driver::build_output_filenames(&dinput, &None, &None, [], sess);
227+
let (crate, tcx) = driver::compile_upto(sess, cfg.clone(), &dinput,
228+
driver::cu_typeck, Some(outputs));
231229
// Once we're typechecked, record the types of all local variables defined
232230
// in this input
233-
do find_main(crate, sess) |blk| {
234-
program.register_new_vars(blk, analysis.ty_cx);
231+
do find_main(crate.expect("crate after cu_typeck"), sess) |blk| {
232+
program.register_new_vars(blk, tcx.expect("tcx after cu_typeck"));
235233
}
236234

237235
//
@@ -244,12 +242,8 @@ fn run(mut program: ~Program, binary: ~str, lib_search_paths: ~[~str],
244242
let cfg = driver::build_configuration(sess, binary, &input);
245243
let outputs = driver::build_output_filenames(&input, &None, &None, [], sess);
246244
let sess = driver::build_session(options, diagnostic::emit);
247-
248-
let crate = driver::phase_1_parse_input(sess, cfg.clone(), &input);
249-
let expanded_crate = driver::phase_2_configure_and_expand(sess, cfg, crate);
250-
let analysis = driver::phase_3_run_analysis_passes(sess, expanded_crate);
251-
let trans = driver::phase_4_translate_to_llvm(sess, expanded_crate, &analysis, outputs);
252-
driver::phase_5_run_llvm_passes(sess, &trans, outputs);
245+
driver::compile_upto(sess, cfg, &input, driver::cu_everything,
246+
Some(outputs));
253247

254248
//
255249
// Stage 4: Inform the program that computation is done so it can update all
@@ -271,7 +265,10 @@ fn run(mut program: ~Program, binary: ~str, lib_search_paths: ~[~str],
271265
let code = fmt!("fn main() {\n %s \n}", input);
272266
let input = driver::str_input(code.to_managed());
273267
let cfg = driver::build_configuration(sess, binary, &input);
274-
driver::phase_1_parse_input(sess, cfg.clone(), &input)
268+
let outputs = driver::build_output_filenames(&input, &None, &None, [], sess);
269+
let (crate, _) = driver::compile_upto(sess, cfg, &input,
270+
driver::cu_parse, Some(outputs));
271+
crate.expect("parsing should return a crate")
275272
}
276273

277274
fn find_main(crate: @ast::Crate, sess: session::Session,
@@ -337,12 +334,9 @@ fn compile_crate(src_filename: ~str, binary: ~str) -> Option<bool> {
337334
None => { },
338335
}
339336
if (should_compile) {
340-
println(fmt!("compiling %s...", src_filename));
341-
let crate = driver::phase_1_parse_input(sess, cfg.clone(), &input);
342-
let expanded_crate = driver::phase_2_configure_and_expand(sess, cfg, crate);
343-
let analysis = driver::phase_3_run_analysis_passes(sess, expanded_crate);
344-
let trans = driver::phase_4_translate_to_llvm(sess, expanded_crate, &analysis, outputs);
345-
driver::phase_5_run_llvm_passes(sess, &trans, outputs);
337+
printfln!("compiling %s...", src_filename);
338+
driver::compile_upto(sess, cfg, &input, driver::cu_everything,
339+
Some(outputs));
346340
true
347341
} else { false }
348342
} {

branches/snap-stage3/src/librustpkg/rustpkg.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ impl<'self> PkgScript<'self> {
109109
let input = driver::file_input(script);
110110
let sess = driver::build_session(options, diagnostic::emit);
111111
let cfg = driver::build_configuration(sess, binary, &input);
112-
let crate = driver::phase_1_parse_input(sess, cfg.clone(), &input);
113-
let crate = driver::phase_2_configure_and_expand(sess, cfg.clone(), crate);
112+
let (crate, _) = driver::compile_upto(sess, cfg.clone(), &input, driver::cu_parse, None);
114113
let work_dir = build_pkg_id_in_workspace(id, workspace);
115114

116115
debug!("Returning package script with id %?", id);
@@ -120,7 +119,7 @@ impl<'self> PkgScript<'self> {
120119
input: input,
121120
sess: sess,
122121
cfg: cfg,
123-
crate: crate,
122+
crate: crate.unwrap(),
124123
build_dir: work_dir
125124
}
126125
}
@@ -143,10 +142,14 @@ impl<'self> PkgScript<'self> {
143142
let root = r.pop().pop().pop().pop(); // :-\
144143
debug!("Root is %s, calling compile_rest", root.to_str());
145144
let exe = self.build_dir.push(~"pkg" + util::exe_suffix());
145+
let binary = os::args()[0].to_managed();
146146
util::compile_crate_from_input(&self.input,
147147
&self.build_dir,
148148
sess,
149-
crate);
149+
crate,
150+
driver::build_configuration(sess,
151+
binary, &self.input),
152+
driver::cu_parse);
150153
debug!("Running program: %s %s %s %s", exe.to_str(),
151154
sysroot.to_str(), root.to_str(), "install");
152155
// FIXME #7401 should support commands besides `install`

branches/snap-stage3/src/librustpkg/util.rs

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use syntax::ext::base::ExtCtxt;
1818
use syntax::{ast, attr, codemap, diagnostic, fold};
1919
use syntax::attr::AttrMetaMethods;
2020
use rustc::back::link::output_type_exe;
21+
use rustc::driver::driver::compile_upto;
2122
use rustc::driver::session::{lib_crate, bin_crate};
2223
use context::Ctx;
2324
use package_id::PkgId;
@@ -219,8 +220,12 @@ pub fn compile_input(ctxt: &Ctx,
219220
// Infer dependencies that rustpkg needs to build, by scanning for
220221
// `extern mod` directives.
221222
let cfg = driver::build_configuration(sess, binary, &input);
222-
let mut crate = driver::phase_1_parse_input(sess, cfg.clone(), &input);
223-
crate = driver::phase_2_configure_and_expand(sess, cfg, crate);
223+
let (crate_opt, _) = driver::compile_upto(sess, cfg.clone(), &input, driver::cu_expand, None);
224+
225+
let mut crate = match crate_opt {
226+
Some(c) => c,
227+
None => fail!("compile_input expected...")
228+
};
224229

225230
// Not really right. Should search other workspaces too, and the installed
226231
// database (which doesn't exist yet)
@@ -252,7 +257,7 @@ pub fn compile_input(ctxt: &Ctx,
252257

253258
debug!("calling compile_crate_from_input, out_dir = %s,
254259
building_library = %?", out_dir.to_str(), sess.building_library);
255-
compile_crate_from_input(&input, out_dir, sess, crate);
260+
compile_crate_from_input(&input, out_dir, sess, crate, cfg.clone(), driver::cu_expand);
256261
true
257262
}
258263

@@ -264,7 +269,9 @@ pub fn compile_input(ctxt: &Ctx,
264269
pub fn compile_crate_from_input(input: &driver::input,
265270
build_dir: &Path,
266271
sess: session::Session,
267-
crate: @ast::Crate) {
272+
crate: @ast::Crate,
273+
cfg: ast::CrateConfig,
274+
compile_from: driver::compile_phase) {
268275
debug!("Calling build_output_filenames with %s, building library? %?",
269276
build_dir.to_str(), sess.building_library);
270277

@@ -277,13 +284,15 @@ pub fn compile_crate_from_input(input: &driver::input,
277284
for sess.opts.addl_lib_search_paths.iter().advance |lib| {
278285
debug!("an additional library: %s", lib.to_str());
279286
}
280-
let analysis = driver::phase_3_run_analysis_passes(sess, crate);
281-
let translation = driver::phase_4_translate_to_llvm(sess, crate,
282-
&analysis,
283-
outputs);
284-
driver::phase_5_run_llvm_passes(sess, &translation, outputs);
285-
if driver::stop_after_phase_5(sess) { return; }
286-
driver::phase_6_link_output(sess, &translation, outputs);
287+
288+
driver::compile_rest(sess,
289+
cfg,
290+
compile_upto {
291+
from: compile_from,
292+
to: driver::cu_everything
293+
},
294+
Some(outputs),
295+
Some(crate));
287296
}
288297

289298
#[cfg(windows)]

branches/snap-stage3/src/test/run-pass/issue-3168.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
// xfail-fast
12+
// xfail-win32 #7999
1213

1314
use std::comm;
1415
use std::task;

branches/snap-stage3/src/test/run-pass/issue-3176.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
// xfail-fast
12+
// xfail-win32 #7999
1213

1314
use std::comm::{Select2, Selectable};
1415
use std::comm;

branches/snap-stage3/src/test/run-pass/pipe-sleep.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// except according to those terms.
1212

1313
// xfail-test needs sleep
14+
// xfail-win32 #7999
1415

1516
extern mod extra;
1617

branches/snap-stage3/src/test/run-pass/unit-like-struct-drop-run.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
// Make sure the destructor is run for unit-like structs.
1212
// xfail-fast
13+
// xfail-win32 #7999
1314

1415
use std::task;
1516

0 commit comments

Comments
 (0)