Skip to content

Commit ea46472

Browse files
committed
---
yaml --- r: 1652 b: refs/heads/master c: 7f5bffc h: refs/heads/master v: v3
1 parent 78b3038 commit ea46472

37 files changed

+1163
-264
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: bbb6836da003be71744b6e6ea7af1fd4674f8291
2+
refs/heads/master: 7f5bffc3ea8545be1916dd089e4f25a360c83950

trunk/src/Makefile

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ RUNTIME_CS := rt/sync/timer.cpp \
255255
rt/sync/lock_and_signal.cpp \
256256
rt/rust.cpp \
257257
rt/rust_builtin.cpp \
258+
rt/rust_run_program.cpp \
258259
rt/rust_crate.cpp \
259260
rt/rust_crate_cache.cpp \
260261
rt/rust_crate_reader.cpp \
@@ -573,8 +574,11 @@ TEST_XFAILS_RUSTC := $(addprefix test/run-pass/, \
573574
while-type-error.rs \
574575
wrong-ret-type.rs \
575576
), \
576-
$(wildcard test/*fail/*.rs test/*fail/*.rc))
577-
577+
$(wildcard test/*fail/*.rs test/*fail/*.rc)) \
578+
test/bench/shootout/fannkuchredux.rs \
579+
test/bench/shootout/fasta.rs \
580+
test/bench/shootout/binarytrees.rs \
581+
$(wildcard test/bench/99-bottles/*rs)
578582

579583
ifdef MINGW_CROSS
580584
TEST_XFAILS_BOOT += test/run-pass/native-mod.rc
@@ -585,8 +589,10 @@ TEST_XFAILS_BOOT += test/run-pass/native-mod.rc
585589
TEST_XFAILS_RUSTC += test/run-pass/native-mod.rc
586590
endif
587591

592+
BENCH_RS := $(wildcard test/bench/shootout/*rs) \
593+
$(wildcard test/bench/99-bottles/*rs)
588594
RPASS_RC := $(wildcard test/run-pass/*.rc)
589-
RPASS_RS := $(wildcard test/run-pass/*.rs)
595+
RPASS_RS := $(wildcard test/run-pass/*.rs) $(BENCH_RS)
590596
RFAIL_RC := $(wildcard test/run-fail/*.rc)
591597
RFAIL_RS := $(wildcard test/run-fail/*.rs)
592598
CFAIL_RC := $(wildcard test/compile-fail/*.rc)
@@ -730,6 +736,18 @@ test/run-pass/%.out.tmp: test/run-pass/%$(CFG_EXE_SUFFIX) $(CFG_RUNTIME)
730736
@$(call CFG_ECHO, run: $<)
731737
$(CFG_QUIET)$(call CFG_RUN_TARG, $<) > $@
732738

739+
test/bench/shootout/%.out.tmp: test/bench/shootout/%$(CFG_EXE_SUFFIX) \
740+
$(CFG_RUNTIME)
741+
$(CFG_QUIET)rm -f $<.tmp
742+
@$(call CFG_ECHO, run: $<)
743+
$(CFG_QUIET)$(call CFG_RUN_TARG, $<) > $@
744+
745+
test/bench/99-bottles/%.out.tmp: test/bench/99-bottles/%$(CFG_EXE_SUFFIX) \
746+
$(CFG_RUNTIME)
747+
$(CFG_QUIET)rm -f $<.tmp
748+
@$(call CFG_ECHO, run: $<)
749+
$(CFG_QUIET)$(call CFG_RUN_TARG, $<) > $@
750+
733751
test/run-fail/%.out.tmp: test/run-fail/%$(CFG_EXE_SUFFIX) \
734752
$(CFG_RUNTIME)
735753
$(CFG_QUIET)rm -f $<.tmp
@@ -758,14 +776,13 @@ test/compile-fail/%.rustc.out.tmp: test/compile-fail/%.rs $(SREQ)
758776
$(CFG_QUIET)grep --text --quiet \
759777
"$$(grep error-pattern $< | cut -d : -f 2- | tr -d '\n\r')" $@
760778

761-
test/run-pass/%.boot$(CFG_EXE_SUFFIX): test/run-pass/%.rc $(BREQ)
762-
@$(call CFG_ECHO, compile [boot]: $<)
763-
$(BOOT) -o $@ $<
779+
%.bc: %.rc $(SREQ)
780+
@$(call CFG_ECHO, compile [rustc]: $<)
781+
$(RUSTC) -o $@ $<
764782

765-
test/bench/shootout/%.boot$(CFG_EXE_SUFFIX): \
766-
test/bench/shootout/%.rs $(BREQ)
767-
@$(call CFG_ECHO, compile [boot]: $<)
768-
$(BOOT) -o $@ $<
783+
%.bc: %.rs $(SREQ)
784+
@$(call CFG_ECHO, compile [rustc]: $<)
785+
$(RUSTC) -o $@ $<
769786

770787
%.ll: %.bc
771788
@$(call CFG_ECHO, dis [llvm]: $<)
@@ -788,26 +805,14 @@ test/bench/shootout/%.boot$(CFG_EXE_SUFFIX): \
788805
@# programs, I\'ll live with the noise.
789806
-$(CFG_QUIET)$(DSYMUTIL) $@
790807

791-
test/run-pass/%.bc: test/run-pass/%.rc $(SREQ)
792-
@$(call CFG_ECHO, compile [rustc]: $<)
793-
$(RUSTC) -o $@ $<
794-
795-
test/run-pass/%.boot$(CFG_EXE_SUFFIX): test/run-pass/%.rs $(BREQ)
808+
%.boot$(CFG_EXE_SUFFIX): %.rs $(BREQ)
796809
@$(call CFG_ECHO, compile [boot]: $<)
797810
$(BOOT) -o $@ $<
798811

799-
test/run-pass/%.bc: test/run-pass/%.rs $(SREQ)
800-
@$(call CFG_ECHO, compile [rustc]: $<)
801-
$(RUSTC) -o $@ $<
802-
803-
test/run-fail/%.boot$(CFG_EXE_SUFFIX): test/run-fail/%.rs $(BREQ)
812+
%.boot$(CFG_EXE_SUFFIX): %.rc $(BREQ)
804813
@$(call CFG_ECHO, compile [boot]: $<)
805814
$(BOOT) -o $@ $<
806815

807-
test/run-fail/%.bc: test/run-fail/%.rs $(SREQ)
808-
@$(call CFG_ECHO, compile [rustc]: $<)
809-
$(RUSTC) -o $@ $<
810-
811816

812817
######################################################################
813818
# Auto-dependency

trunk/src/README

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@ test/ Testsuite (for both bootstrap and self-hosted)
2424
test/compile-fail - Tests that should fail to compile
2525
test/run-fail - Tests that should compile, run and fail
2626
test/run-pass - Tests that should compile, run and succeed
27+
test/bench - Benchmarks and miscellanea
2728

2829
Please be gentle, it's a work in progress.

trunk/src/comp/driver/rustc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impure fn pretty_print_input(session.session sess,
6868
auto def = tup(0, 0);
6969
auto p = front.parser.new_parser(sess, env, def, input);
7070
auto crate = front.parser.parse_crate_from_source_file(p);
71-
pretty.pprust.print_ast(crate.node.module, std.io.stdout_writer());
71+
pretty.pprust.print_ast(crate.node.module, std.io.stdout());
7272
}
7373

7474
fn warn_wrong_compiler() {

trunk/src/comp/front/ast.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ tag expr_ {
232232
expr_block(block, ann);
233233
expr_assign(@expr /* TODO: @expr|is_lval */, @expr, ann);
234234
expr_assign_op(binop, @expr /* TODO: @expr|is_lval */, @expr, ann);
235+
expr_send(@expr /* TODO: @expr|is_lval */, @expr, ann);
236+
expr_recv(@expr /* TODO: @expr|is_lval */, @expr, ann);
235237
expr_field(@expr, ident, ann);
236238
expr_index(@expr, @expr, ann);
237239
expr_path(path, option.t[def], ann);
@@ -242,6 +244,8 @@ tag expr_ {
242244
expr_be(@expr);
243245
expr_log(@expr);
244246
expr_check_expr(@expr);
247+
expr_port(ann);
248+
expr_chan(@expr, ann);
245249
}
246250

247251
type lit = spanned[lit_];
@@ -274,6 +278,8 @@ tag ty_ {
274278
ty_str;
275279
ty_box(@ty);
276280
ty_vec(@ty);
281+
ty_port(@ty);
282+
ty_chan(@ty);
277283
ty_tup(vec[@ty]);
278284
ty_rec(vec[ty_field]);
279285
ty_fn(proto, vec[ty_arg], @ty); // TODO: effect

trunk/src/comp/front/eval.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ impure fn eval_crate_directive(parser p,
384384
case (none[filename]) {}
385385
}
386386

387-
auto full_path = prefix + std.os.path_sep() + file_path;
387+
auto full_path = prefix + std.fs.path_sep() + file_path;
388388

389389
auto start_id = p.next_def_id();
390390
auto p0 = new_parser(p.get_session(), e, start_id, full_path);
@@ -407,7 +407,7 @@ impure fn eval_crate_directive(parser p,
407407
case (none[filename]) {}
408408
}
409409

410-
auto full_path = prefix + std.os.path_sep() + path;
410+
auto full_path = prefix + std.fs.path_sep() + path;
411411
auto m0 = eval_crate_directives_to_mod(p, e, cdirs, full_path);
412412
auto im = ast.item_mod(id, m0, p.next_def_id());
413413
auto i = @spanned(cdir.span, cdir.span, im);

trunk/src/comp/front/lexer.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import std.io.stdio_reader;
1+
import std.io;
22
import std._str;
33
import std.map;
44
import std.map.hashmap;
@@ -18,9 +18,9 @@ state type reader = state obj {
1818
fn get_reserved() -> hashmap[str,()];
1919
};
2020

21-
fn new_reader(stdio_reader rdr, str filename) -> reader
21+
impure fn new_reader(io.reader rdr, str filename) -> reader
2222
{
23-
state obj reader(stdio_reader rdr,
23+
state obj reader(io.reader rdr,
2424
str filename,
2525
mutable char c,
2626
mutable char n,
@@ -72,7 +72,7 @@ fn new_reader(stdio_reader rdr, str filename) -> reader
7272
col += 1u;
7373
}
7474

75-
n = rdr.getc() as char;
75+
n = rdr.read_char() as char;
7676
}
7777

7878
fn mark() {
@@ -200,8 +200,8 @@ fn new_reader(stdio_reader rdr, str filename) -> reader
200200
reserved.insert("m128", ()); // IEEE 754-2008 'decimal128'
201201
reserved.insert("dec", ()); // One of m32, m64, m128
202202

203-
ret reader(rdr, filename, rdr.getc() as char, rdr.getc() as char,
204-
1u, 0u, 1u, 0u, keywords, reserved);
203+
ret reader(rdr, filename, rdr.read_char() as char,
204+
rdr.read_char() as char, 1u, 0u, 1u, 0u, keywords, reserved);
205205
}
206206

207207

trunk/src/comp/front/parser.rs

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ impure fn new_parser(session.session sess,
115115
if (_str.ends_with(path, ".rc")) {
116116
ftype = CRATE_FILE;
117117
}
118-
auto srdr = io.new_stdio_reader(path);
118+
auto srdr = io.file_reader(path);
119119
auto rdr = lexer.new_reader(srdr, path);
120120
auto npos = rdr.get_curr_pos();
121121
ret stdio_parser(sess, env, ftype, lexer.next_token(rdr),
@@ -429,6 +429,22 @@ impure fn parse_ty(parser p) -> @ast.ty {
429429
t = parse_ty_obj(p, hi);
430430
}
431431

432+
case (token.PORT) {
433+
p.bump();
434+
expect(p, token.LBRACKET);
435+
t = ast.ty_port(parse_ty(p));
436+
hi = p.get_span();
437+
expect(p, token.RBRACKET);
438+
}
439+
440+
case (token.CHAN) {
441+
p.bump();
442+
expect(p, token.LBRACKET);
443+
t = ast.ty_chan(parse_ty(p));
444+
hi = p.get_span();
445+
expect(p, token.RBRACKET);
446+
}
447+
432448
case (token.IDENT(_)) {
433449
t = ast.ty_path(parse_path(p, GREEDY), none[ast.def]);
434450
}
@@ -799,6 +815,23 @@ impure fn parse_bottom_expr(parser p) -> @ast.expr {
799815
}
800816
}
801817

818+
case (token.PORT) {
819+
p.bump();
820+
expect(p, token.LPAREN);
821+
expect(p, token.RPAREN);
822+
hi = p.get_span();
823+
ex = ast.expr_port(ast.ann_none);
824+
}
825+
826+
case (token.CHAN) {
827+
p.bump();
828+
expect(p, token.LPAREN);
829+
auto e = parse_expr(p);
830+
hi = e.span;
831+
expect(p, token.RPAREN);
832+
ex = ast.expr_chan(e, ast.ann_none);
833+
}
834+
802835
case (_) {
803836
auto lit = parse_lit(p);
804837
hi = lit.span;
@@ -1080,6 +1113,18 @@ impure fn parse_assign_expr(parser p) -> @ast.expr {
10801113
ret @spanned(lo, rhs.span,
10811114
ast.expr_assign_op(aop, lhs, rhs, ast.ann_none));
10821115
}
1116+
case (token.SEND) {
1117+
p.bump();
1118+
auto rhs = parse_expr(p);
1119+
ret @spanned(lo, rhs.span,
1120+
ast.expr_send(lhs, rhs, ast.ann_none));
1121+
}
1122+
case (token.LARROW) {
1123+
p.bump();
1124+
auto rhs = parse_expr(p);
1125+
ret @spanned(lo, rhs.span,
1126+
ast.expr_recv(lhs, rhs, ast.ann_none));
1127+
}
10831128
case (_) { /* fall through */ }
10841129
}
10851130
ret lhs;
@@ -2365,7 +2410,7 @@ impure fn parse_crate_directives(parser p, token.token term)
23652410
impure fn parse_crate_from_crate_file(parser p) -> @ast.crate {
23662411
auto lo = p.get_span();
23672412
auto hi = lo;
2368-
auto prefix = std.path.dirname(lo.filename);
2413+
auto prefix = std.fs.dirname(lo.filename);
23692414
auto cdirs = parse_crate_directives(p, token.EOF);
23702415
auto m = eval.eval_crate_directives_to_mod(p, p.get_env(),
23712416
cdirs, prefix);

0 commit comments

Comments
 (0)