Skip to content

Commit fad2406

Browse files
committed
---
yaml --- r: 144595 b: refs/heads/try2 c: 8d12673 h: refs/heads/master i: 144593: 24f261e 144591: 758366f v: v3
1 parent 9036e18 commit fad2406

File tree

100 files changed

+921
-2638
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+921
-2638
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 29449e355a68d2b878af1cdb65b97454e645206f
8+
refs/heads/try2: 8d12673c825c2785e375e12295a7bdc24a625114
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/doc/rust.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ break
209209
do
210210
else enum extern
211211
false fn for
212-
if impl in
212+
if impl
213213
let loop
214214
match mod mut
215215
priv pub

branches/try2/mk/tests.mk

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -476,15 +476,15 @@ RFAIL_RC := $(wildcard $(S)src/test/run-fail/*.rc)
476476
RFAIL_RS := $(wildcard $(S)src/test/run-fail/*.rs)
477477
CFAIL_RC := $(wildcard $(S)src/test/compile-fail/*.rc)
478478
CFAIL_RS := $(wildcard $(S)src/test/compile-fail/*.rs)
479-
BENCH_RS := $(wildcard $(S)src/test/bench/*.rs)
479+
BENCH_RS := $(wildcard $(S)src/test/bench/rt/*.rs $(S)src/test/bench/shootout/*.rs $(S)src/test/bench/std/*.rs $(S)src/test/bench/*.rs)
480480
PRETTY_RS := $(wildcard $(S)src/test/pretty/*.rs)
481481
DEBUGINFO_RS := $(wildcard $(S)src/test/debug-info/*.rs)
482482
CODEGEN_RS := $(wildcard $(S)src/test/codegen/*.rs)
483483
CODEGEN_CC := $(wildcard $(S)src/test/codegen/*.cc)
484484

485485
# perf tests are the same as bench tests only they run under
486486
# a performance monitor.
487-
PERF_RS := $(wildcard $(S)src/test/bench/*.rs)
487+
PERF_RS := $(BENCH_RS)
488488

489489
RPASS_TESTS := $(RPASS_RC) $(RPASS_RS)
490490
RPASS_FULL_TESTS := $(RPASS_FULL_RC) $(RPASS_FULL_RS)
@@ -516,7 +516,7 @@ CTEST_BUILD_BASE_cfail = compile-fail
516516
CTEST_MODE_cfail = compile-fail
517517
CTEST_RUNTOOL_cfail = $(CTEST_RUNTOOL)
518518

519-
CTEST_SRC_BASE_bench = bench
519+
CTEST_SRC_BASE_bench = bench bench/rt bench/shootout bench/std
520520
CTEST_BUILD_BASE_bench = bench
521521
CTEST_MODE_bench = run-pass
522522
CTEST_RUNTOOL_bench = $(CTEST_RUNTOOL)
@@ -610,7 +610,8 @@ define DEF_RUN_COMPILETEST
610610

611611
CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4) := \
612612
$$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
613-
--src-base $$(S)src/test/$$(CTEST_SRC_BASE_$(4))/ \
613+
$(foreach base,$$(CTEST_SRC_BASE_$(4)), \
614+
--src-base $$(S)src/test/$$(base))/ \
614615
--build-base $(3)/test/$$(CTEST_BUILD_BASE_$(4))/ \
615616
--ratchet-metrics $(call TEST_RATCHET_FILE,$(1),$(2),$(3),$(4)) \
616617
--mode $$(CTEST_MODE_$(4)) \

branches/try2/src/compiletest/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub struct config {
3636
llvm_bin_path: Option<Path>,
3737

3838
// The directory containing the tests to run
39-
src_base: Path,
39+
src_base: ~[Path],
4040

4141
// The directory where programs should be built
4242
build_base: Path,

branches/try2/src/compiletest/compiletest.rs

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use std::os;
1919
use std::f64;
2020

2121
use extra::getopts;
22-
use extra::getopts::groups::{optopt, optflag, reqopt};
22+
use extra::getopts::groups::{optopt, optflag, reqopt, optmulti};
2323
use extra::test;
2424

2525
use common::config;
@@ -49,19 +49,19 @@ pub fn main() {
4949
pub fn parse_config(args: ~[~str]) -> config {
5050

5151
let groups : ~[getopts::groups::OptGroup] =
52-
~[reqopt("", "compile-lib-path", "path to host shared libraries", "PATH"),
53-
reqopt("", "run-lib-path", "path to target shared libraries", "PATH"),
54-
reqopt("", "rustc-path", "path to rustc to use for compiling", "PATH"),
55-
optopt("", "clang-path", "path to executable for codegen tests", "PATH"),
56-
optopt("", "llvm-bin-path", "path to directory holding llvm binaries", "DIR"),
57-
reqopt("", "src-base", "directory to scan for test files", "PATH"),
58-
reqopt("", "build-base", "directory to deposit test outputs", "PATH"),
59-
reqopt("", "aux-base", "directory to find auxiliary test files", "PATH"),
60-
reqopt("", "stage-id", "the target-stage identifier", "stageN-TARGET"),
61-
reqopt("", "mode", "which sort of compile tests to run",
62-
"(compile-fail|run-fail|run-pass|pretty|debug-info)"),
63-
optflag("", "ignored", "run tests marked as ignored / xfailed"),
64-
optopt("", "runtool", "supervisor program to run tests under \
52+
~[reqopt ("", "compile-lib-path", "path to host shared libraries", "PATH"),
53+
reqopt ("", "run-lib-path", "path to target shared libraries", "PATH"),
54+
reqopt ("", "rustc-path", "path to rustc to use for compiling", "PATH"),
55+
optopt ("", "clang-path", "path to executable for codegen tests", "PATH"),
56+
optopt ("", "llvm-bin-path", "path to directory holding llvm binaries", "DIR"),
57+
optmulti ("", "src-base", "directory to scan for test files", "PATH"),
58+
reqopt ("", "build-base", "directory to deposit test outputs", "PATH"),
59+
reqopt ("", "aux-base", "directory to find auxiliary test files", "PATH"),
60+
reqopt ("", "stage-id", "the target-stage identifier", "stageN-TARGET"),
61+
reqopt ("", "mode", "which sort of compile tests to run",
62+
" (compile-fail|run-fail|run-pass|pretty|debug-info)"),
63+
optflag ("", "ignored", "run tests marked as ignored / xfailed"),
64+
optopt ("", "runtool", "supervisor program to run tests under \
6565
(eg. emulator, valgrind)", "PROGRAM"),
6666
optopt("", "rustcflags", "flags to pass to rustc", "FLAGS"),
6767
optflag("", "verbose", "run tests verbosely, showing all output"),
@@ -105,13 +105,15 @@ pub fn parse_config(args: ~[~str]) -> config {
105105
Path(getopts::opt_str(m, nm))
106106
}
107107

108+
let src_base = getopts::opt_strs(matches, "src-base");
109+
108110
config {
109111
compile_lib_path: getopts::opt_str(matches, "compile-lib-path"),
110112
run_lib_path: getopts::opt_str(matches, "run-lib-path"),
111113
rustc_path: opt_path(matches, "rustc-path"),
112114
clang_path: getopts::opt_maybe_str(matches, "clang-path").map_move(|s| Path(s)),
113115
llvm_bin_path: getopts::opt_maybe_str(matches, "llvm-bin-path").map_move(|s| Path(s)),
114-
src_base: opt_path(matches, "src-base"),
116+
src_base: src_base.iter().map(|x| Path(x.clone())).collect(),
115117
build_base: opt_path(matches, "build-base"),
116118
aux_base: opt_path(matches, "aux-base"),
117119
stage_id: getopts::opt_str(matches, "stage-id"),
@@ -245,7 +247,7 @@ pub fn make_tests(config: &config) -> ~[test::TestDescAndFn] {
245247
debug!("making tests from %s",
246248
config.src_base.to_str());
247249
let mut tests = ~[];
248-
let dirs = os::list_dir_path(&config.src_base);
250+
let dirs = config.src_base.iter().flat_map(|x| os::list_dir_path(x).move_iter()).to_owned_vec();
249251
for file in dirs.iter() {
250252
let file = file.clone();
251253
debug!("inspecting file %s", file.to_str());

branches/try2/src/etc/emacs/rust-mode.el

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
;; Url: https://github.com/mozilla/rust
66

77
(eval-when-compile (require 'cl))
8-
(eval-when-compile (require 'misc))
98

109
;; Syntax definitions and helpers
1110
(defvar rust-mode-syntax-table
@@ -58,39 +57,19 @@
5857
;; A closing brace is 1 level unindended
5958
((looking-at "}") (* rust-indent-offset (- level 1)))
6059

61-
; Doc comments in /** style with leading * indent to line up the *s
62-
((and (nth 4 (syntax-ppss)) (looking-at "*"))
63-
(+ 1 (* rust-indent-offset level)))
64-
6560
;; If we're in any other token-tree / sexp, then:
6661
;; - [ or ( means line up with the opening token
6762
;; - { means indent to either nesting-level * rust-indent-offset,
6863
;; or one further indent from that if either current line
6964
;; begins with 'else', or previous line didn't end in
70-
;; semi, comma or brace (other than whitespace and line
71-
;; comments) , and wasn't an attribute. But if we have
72-
;; something after the open brace and ending with a comma,
73-
;; treat it as fields and align them. PHEW.
65+
;; semi, comma or brace, and wasn't an attribute. PHEW.
7466
((> level 0)
7567
(let ((pt (point)))
7668
(rust-rewind-irrelevant)
7769
(backward-up-list)
78-
(cond
79-
((and
80-
(looking-at "[[(]")
81-
; We don't want to indent out to the open bracket if the
82-
; open bracket ends the line
83-
(save-excursion
84-
(forward-char)
85-
(not (looking-at "[[:space:]]*\\(?://.*\\)?$"))))
86-
(+ 1 (current-column)))
87-
;; Check for fields on the same line as the open curly brace:
88-
((looking-at "{[[:blank:]]*[^}\n]*,[[:space:]]*$")
70+
(if (looking-at "[[(]")
71+
(+ 1 (current-column))
8972
(progn
90-
(forward-char)
91-
(forward-to-word 1)
92-
(current-column)))
93-
(t (progn
9473
(goto-char pt)
9574
(back-to-indentation)
9675
(if (looking-at "\\<else\\>")
@@ -100,12 +79,12 @@
10079
(beginning-of-line)
10180
(rust-rewind-irrelevant)
10281
(end-of-line)
103-
(if (looking-back "[,;{}(][[:space:]]*\\(?://.*\\)?")
82+
(if (looking-back "[{};,]")
10483
(* rust-indent-offset level)
10584
(back-to-indentation)
10685
(if (looking-at "#")
10786
(* rust-indent-offset level)
108-
(* rust-indent-offset (+ 1 level)))))))))))
87+
(* rust-indent-offset (+ 1 level))))))))))
10988

11089
;; Otherwise we're in a column-zero definition
11190
(t 0))))))

branches/try2/src/libextra/dlist.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ impl<A: Eq> Eq for DList<A> {
594594
}
595595

596596
fn ne(&self, other: &DList<A>) -> bool {
597-
self.len() != other.len() ||
597+
self.len() != other.len() &&
598598
iterator::order::ne(self.iter(), other.iter())
599599
}
600600
}
@@ -978,10 +978,6 @@ mod tests {
978978
assert!(n != m);
979979
m.push_back(1);
980980
assert_eq!(&n, &m);
981-
982-
let n = list_from([2,3,4]);
983-
let m = list_from([1,2,3]);
984-
assert!(n != m);
985981
}
986982

987983
#[test]

branches/try2/src/libextra/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ fn get_concurrency() -> uint {
745745
let opt_n: Option<uint> = FromStr::from_str(s);
746746
match opt_n {
747747
Some(n) if n > 0 => n,
748-
_ => fail!("RUST_TEST_TASKS is `%s`, should be a positive integer.", s)
748+
_ => fail!("RUST_TEST_TASKS is `%s`, should be a non-negative integer.", s)
749749
}
750750
}
751751
None => {

branches/try2/src/librustc/back/link.rs

Lines changed: 75 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ pub mod write {
216216
use lib;
217217

218218
use std::c_str::ToCStr;
219-
use std::libc::c_uint;
219+
use std::libc::{c_uint, c_int};
220220
use std::path::Path;
221221
use std::run;
222222
use std::str;
@@ -257,17 +257,7 @@ pub mod write {
257257
}
258258
}
259259

260-
// Copy what clan does by turning on loop vectorization at O2 and
261-
// slp vectorization at O3
262-
let vectorize_loop = !sess.no_vectorize_loops() &&
263-
(sess.opts.optimize == session::Default ||
264-
sess.opts.optimize == session::Aggressive);
265-
let vectorize_slp = !sess.no_vectorize_slp() &&
266-
sess.opts.optimize == session::Aggressive;
267-
llvm::LLVMRustSetLLVMOptions(sess.print_llvm_passes(),
268-
vectorize_loop,
269-
vectorize_slp,
270-
sess.time_llvm_passes());
260+
configure_llvm(sess);
271261

272262
let OptLevel = match sess.opts.optimize {
273263
session::No => lib::llvm::CodeGenLevelNone,
@@ -293,12 +283,9 @@ pub mod write {
293283
// Create the two optimizing pass managers. These mirror what clang
294284
// does, and are by populated by LLVM's default PassManagerBuilder.
295285
// Each manager has a different set of passes, but they also share
296-
// some common passes. Each one is initialized with the analyis
297-
// passes the target requires, and then further passes are added.
286+
// some common passes.
298287
let fpm = llvm::LLVMCreateFunctionPassManagerForModule(llmod);
299288
let mpm = llvm::LLVMCreatePassManager();
300-
llvm::LLVMRustAddAnalysisPasses(tm, fpm, llmod);
301-
llvm::LLVMRustAddAnalysisPasses(tm, mpm, llmod);
302289

303290
// If we're verifying or linting, add them to the function pass
304291
// manager.
@@ -308,32 +295,11 @@ pub mod write {
308295
if !sess.no_verify() { assert!(addpass("verify")); }
309296
if sess.lint_llvm() { assert!(addpass("lint")); }
310297

311-
// Create the PassManagerBuilder for LLVM. We configure it with
312-
// reasonable defaults and prepare it to actually populate the pass
313-
// manager.
314-
let builder = llvm::LLVMPassManagerBuilderCreate();
315-
match sess.opts.optimize {
316-
session::No => {
317-
// Don't add lifetime intrinsics add O0
318-
llvm::LLVMRustAddAlwaysInlinePass(builder, false);
319-
}
320-
// numeric values copied from clang
321-
session::Less => {
322-
llvm::LLVMPassManagerBuilderUseInlinerWithThreshold(builder,
323-
225);
324-
}
325-
session::Default | session::Aggressive => {
326-
llvm::LLVMPassManagerBuilderUseInlinerWithThreshold(builder,
327-
275);
328-
}
298+
if !sess.no_prepopulate_passes() {
299+
llvm::LLVMRustAddAnalysisPasses(tm, fpm, llmod);
300+
llvm::LLVMRustAddAnalysisPasses(tm, mpm, llmod);
301+
populate_llvm_passess(fpm, mpm, llmod, OptLevel);
329302
}
330-
llvm::LLVMPassManagerBuilderSetOptLevel(builder, OptLevel as c_uint);
331-
llvm::LLVMRustAddBuilderLibraryInfo(builder, llmod);
332-
333-
// Use the builder to populate the function/module pass managers.
334-
llvm::LLVMPassManagerBuilderPopulateFunctionPassManager(builder, fpm);
335-
llvm::LLVMPassManagerBuilderPopulateModulePassManager(builder, mpm);
336-
llvm::LLVMPassManagerBuilderDispose(builder);
337303

338304
for pass in sess.opts.custom_passes.iter() {
339305
do pass.with_c_str |s| {
@@ -424,6 +390,74 @@ pub mod write {
424390
sess.abort_if_errors();
425391
}
426392
}
393+
394+
unsafe fn configure_llvm(sess: Session) {
395+
// Copy what clan does by turning on loop vectorization at O2 and
396+
// slp vectorization at O3
397+
let vectorize_loop = !sess.no_vectorize_loops() &&
398+
(sess.opts.optimize == session::Default ||
399+
sess.opts.optimize == session::Aggressive);
400+
let vectorize_slp = !sess.no_vectorize_slp() &&
401+
sess.opts.optimize == session::Aggressive;
402+
403+
let mut llvm_c_strs = ~[];
404+
let mut llvm_args = ~[];
405+
let add = |arg: &str| {
406+
let s = arg.to_c_str();
407+
llvm_args.push(s.with_ref(|p| p));
408+
llvm_c_strs.push(s);
409+
};
410+
add("rustc"); // fake program name
411+
add("-arm-enable-ehabi");
412+
add("-arm-enable-ehabi-descriptors");
413+
if vectorize_loop { add("-vectorize-loops"); }
414+
if vectorize_slp { add("-vectorize-slp"); }
415+
if sess.time_llvm_passes() { add("-time-passes"); }
416+
if sess.print_llvm_passes() { add("-debug-pass=Structure"); }
417+
418+
for arg in sess.opts.llvm_args.iter() {
419+
add(*arg);
420+
}
421+
422+
do llvm_args.as_imm_buf |p, len| {
423+
llvm::LLVMRustSetLLVMOptions(len as c_int, p);
424+
}
425+
}
426+
427+
unsafe fn populate_llvm_passess(fpm: lib::llvm::PassManagerRef,
428+
mpm: lib::llvm::PassManagerRef,
429+
llmod: ModuleRef,
430+
opt: lib::llvm::CodeGenOptLevel) {
431+
// Create the PassManagerBuilder for LLVM. We configure it with
432+
// reasonable defaults and prepare it to actually populate the pass
433+
// manager.
434+
let builder = llvm::LLVMPassManagerBuilderCreate();
435+
match opt {
436+
lib::llvm::CodeGenLevelNone => {
437+
// Don't add lifetime intrinsics add O0
438+
llvm::LLVMRustAddAlwaysInlinePass(builder, false);
439+
}
440+
lib::llvm::CodeGenLevelLess => {
441+
llvm::LLVMRustAddAlwaysInlinePass(builder, true);
442+
}
443+
// numeric values copied from clang
444+
lib::llvm::CodeGenLevelDefault => {
445+
llvm::LLVMPassManagerBuilderUseInlinerWithThreshold(builder,
446+
225);
447+
}
448+
lib::llvm::CodeGenLevelAggressive => {
449+
llvm::LLVMPassManagerBuilderUseInlinerWithThreshold(builder,
450+
275);
451+
}
452+
}
453+
llvm::LLVMPassManagerBuilderSetOptLevel(builder, opt as c_uint);
454+
llvm::LLVMRustAddBuilderLibraryInfo(builder, llmod);
455+
456+
// Use the builder to populate the function/module pass managers.
457+
llvm::LLVMPassManagerBuilderPopulateFunctionPassManager(builder, fpm);
458+
llvm::LLVMPassManagerBuilderPopulateModulePassManager(builder, mpm);
459+
llvm::LLVMPassManagerBuilderDispose(builder);
460+
}
427461
}
428462

429463

0 commit comments

Comments
 (0)