Skip to content

Commit 43f86ae

Browse files
author
Eric Holk
committed
---
yaml --- r: 3127 b: refs/heads/master c: 89ba649 h: refs/heads/master i: 3125: 9ed50af 3123: ab1120a 3119: 89f72a6 v: v3
1 parent 2a8b63b commit 43f86ae

31 files changed

+756
-1005
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: b8a5440b2de600c47ed9c9c3d7a376807b57a579
2+
refs/heads/master: 89ba649c3a4f61d6f33c9f5541a92f44e46eb69c

trunk/mk/stage3.mk

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
stage3/$(CFG_STDLIB): $(STDLIB_CRATE) $(STDLIB_INPUTS) \
1+
stage3/std.o: $(STDLIB_CRATE) $(STDLIB_INPUTS) \
22
stage2/rustc$(X) stage2/$(CFG_STDLIB) stage2/intrinsics.bc \
33
$(LREQ) $(MKFILES)
4-
@$(call E, compile_and_link: $@)
5-
$(STAGE2) --shared -o $@ $<
4+
@$(call E, compile: $@)
5+
$(STAGE2) -c --shared -o $@ $<
6+
7+
stage3/$(CFG_STDLIB): stage2/std.o stage2/glue.o
8+
@$(call E, link: $@)
9+
$(Q)gcc $(CFG_GCCISH_CFLAGS) stage2/glue.o $(CFG_GCCISH_LINK_FLAGS) -o \
10+
$@ $< -Lstage2 -Lrt -lrustrt
611

712
stage3/librustc.o: $(COMPILER_CRATE) $(COMPILER_INPUTS) $(SREQ2)
813
@$(call E, compile: $@)

trunk/src/comp/back/abi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ const int closure_elt_bindings = 2;
104104

105105
const int closure_elt_ty_params = 3;
106106

107-
const uint ivec_default_length = 4u;
107+
const uint ivec_default_length = 8u;
108108

109109
const uint ivec_elt_len = 0u;
110110

trunk/src/comp/back/link.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ mod write {
209209
*
210210
* There are a few issues to handle:
211211
*
212-
* - Linnkers operate on a flat namespace, so we have to flatten names.
212+
* - Linkers operate on a flat namespace, so we have to flatten names.
213213
* We do this using the C++ namespace-mangling technique. Foo::bar
214214
* symbols and such.
215215
*
@@ -221,15 +221,15 @@ mod write {
221221
* symbols in the same process before you're even hitting birthday-paradox
222222
* collision probability.
223223
*
224-
* - Symbols in different crates but with same names "within" the crate need
224+
* - Symbols in dirrerent crates but with same names "within" the crate need
225225
* to get different linkage-names.
226226
*
227227
* So here is what we do:
228228
*
229229
* - Separate the meta tags into two sets: exported and local. Only work with
230230
* the exported ones when considering linkage.
231231
*
232-
* - Consider two exported tags as special (and mandatory): name and vers.
232+
* - Consider two exported tags as special (and madatory): name and vers.
233233
* Every crate gets them; if it doesn't name them explicitly we infer them
234234
* as basename(crate) and "0.1", respectively. Call these CNAME, CVERS.
235235
*

trunk/src/comp/driver/rustc.rs

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,18 @@ fn compile_input(session::session sess, eval::env env, str input,
8181
auto crate =
8282
time(time_passes, "parsing", bind parse_input(sess, p, input));
8383
if (sess.get_opts().output_type == link::output_type_none) { ret; }
84-
auto d =
84+
auto def_map =
8585
time(time_passes, "resolution",
8686
bind resolve::resolve_crate(sess, crate));
87-
auto ty_cx = ty::mk_ctxt(sess, d._0, d._1);
87+
auto ty_cx = ty::mk_ctxt(sess, def_map);
8888
time[()](time_passes, "typechecking",
8989
bind typeck::check_crate(ty_cx, crate));
9090
if (sess.get_opts().run_typestate) {
9191
time(time_passes, "typestate checking",
9292
bind middle::tstate::ck::check_crate(ty_cx, crate));
9393
}
9494
time(time_passes, "alias checking",
95-
bind middle::alias::check_crate(@ty_cx, crate));
95+
bind middle::alias::check_crate(@ty_cx, def_map, crate));
9696
auto llmod =
9797
time[llvm::llvm::ModuleRef](time_passes, "translation",
9898
bind trans::trans_crate(sess, crate,
@@ -109,8 +109,8 @@ fn pretty_print_input(session::session sess, eval::env env, str input,
109109
auto mode;
110110
alt (ppm) {
111111
case (ppm_typed) {
112-
auto d = resolve::resolve_crate(sess, crate);
113-
auto ty_cx = ty::mk_ctxt(sess, d._0, d._1);
112+
auto def_map = resolve::resolve_crate(sess, crate);
113+
auto ty_cx = ty::mk_ctxt(sess, def_map);
114114
typeck::check_crate(ty_cx, crate);
115115
mode = ppaux::mo_typed(ty_cx);
116116
}
@@ -399,34 +399,37 @@ fn main(vec[str] args) {
399399
let str prog = "gcc";
400400
// The invocations of gcc share some flags across platforms
401401

402-
let vec[str] common_args = [stage, "-Lrt", "-lrustrt",
403-
"-fno-strict-aliasing", "-fPIC", "-Wall",
404-
"-fno-rtti", "-fno-exceptions", "-g", glu, "-o",
405-
saved_out_filename, saved_out_filename + ".o"];
406-
407-
auto shared_cmd;
408-
402+
let vec[str] common_cflags =
403+
["-fno-strict-aliasing", "-fPIC", "-Wall", "-fno-rtti",
404+
"-fno-exceptions", "-g"];
405+
let vec[str] common_libs =
406+
[stage, "-Lrustllvm", "-Lrt", "-lrustrt", "-lrustllvm", "-lstd",
407+
"-lm"];
409408
alt (sess.get_targ_cfg().os) {
410409
case (session::os_win32) {
411-
shared_cmd = "-shared";
412-
gcc_args = common_args + ["-march=i686", "-O2"];
410+
gcc_args =
411+
common_cflags +
412+
["-march=i686", "-O2", glu, main, "-o",
413+
saved_out_filename, saved_out_filename + ".o"] +
414+
common_libs;
413415
}
414416
case (session::os_macos) {
415-
shared_cmd = "-dynamiclib";
416-
gcc_args = common_args + ["-arch i386", "-O0", "-m32"];
417+
gcc_args =
418+
common_cflags +
419+
["-arch i386", "-O0", "-m32", glu, main, "-o",
420+
saved_out_filename, saved_out_filename + ".o"] +
421+
common_libs;
417422
}
418423
case (session::os_linux) {
419-
shared_cmd = "-shared";
420-
gcc_args = common_args + ["-march=i686", "-O2", "-m32"];
424+
gcc_args =
425+
common_cflags +
426+
["-march=i686", "-O2", "-m32", glu, main, "-o",
427+
saved_out_filename, saved_out_filename + ".o"] +
428+
common_libs;
421429
}
422430
}
423-
if (sopts.shared) {
424-
gcc_args += [shared_cmd];
425-
} else {
426-
gcc_args += ["-Lrustllvm", "-lrustllvm", "-lstd", "-lm", main];
427-
}
428-
429431
// We run 'gcc' here
432+
430433
run::run_program(prog, gcc_args);
431434
// Clean up on Darwin
432435

trunk/src/comp/front/ast.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -359,17 +359,19 @@ tag constr_arg_general_[T] { carg_base; carg_ident(T); carg_lit(@lit); }
359359
360360
type constr_arg = constr_arg_general[uint];
361361
362+
type constr_arg_use = constr_arg_general[ident];
363+
362364
type constr_arg_general[T] = spanned[constr_arg_general_[T]];
363365
364-
type constr_ = rec(path path,
365-
vec[@constr_arg_general[uint]] args,
366-
ann ann);
367366
368-
type constr = spanned[constr_];
367+
// The ann field is there so that using the def_map in the type
368+
// context, we can get the def_id for the path.
369+
type constr_general[T] =
370+
rec(path path, vec[@constr_arg_general[T]] args, ann ann);
371+
372+
type constr = spanned[constr_general[uint]];
369373
370-
/* The parser generates ast::constrs; resolve generates
371-
a mapping from each function to a list of ty::constr_defs,
372-
corresponding to these. */
374+
type constr_use = spanned[constr_general[ident]];
373375
374376
type arg = rec(mode mode, @ty ty, ident ident, def_id id);
375377

trunk/src/comp/front/creader.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ fn parse_ty_or_bang(@pstate st, str_def sd) -> ty_or_bang {
7878
}
7979
}
8080

81-
fn parse_constrs(@pstate st, str_def sd) -> vec[@ty::constr_def] {
82-
let vec[@ty::constr_def] res = [];
81+
fn parse_constrs(@pstate st, str_def sd) -> vec[@ast::constr] {
82+
let vec[@ast::constr] res = [];
8383
alt (peek(st) as char) {
8484
case (':') {
8585
do {
@@ -92,7 +92,7 @@ fn parse_constrs(@pstate st, str_def sd) -> vec[@ty::constr_def] {
9292
ret res;
9393
}
9494

95-
fn parse_constr(@pstate st, str_def sd) -> @ty::constr_def {
95+
fn parse_constr(@pstate st, str_def sd) -> @ast::constr {
9696
st.tcx.sess.unimpl("Reading constraints " + " isn't implemented");
9797
/*
9898
let vec[@ast::constr_arg] args = [];
@@ -318,7 +318,7 @@ fn parse_hex(@pstate st) -> uint {
318318
}
319319

320320
fn parse_ty_fn(@pstate st, str_def sd) ->
321-
tup(vec[ty::arg], ty::t, ast::controlflow, vec[@ty::constr_def]) {
321+
tup(vec[ty::arg], ty::t, ast::controlflow, vec[@ast::constr]) {
322322
assert (next(st) as char == '[');
323323
let vec[ty::arg] inputs = [];
324324
while (peek(st) as char != ']') {

trunk/src/comp/front/parser.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2181,7 +2181,13 @@ fn parse_crate_directive(&parser p) -> ast::crate_directive {
21812181
auto hi = p.get_hi_pos();
21822182
expect(p, token::RBRACE);
21832183
ret spanned(lo, hi, ast::cdir_let(id, x, v));
2184-
} else if (is_view_item(p)) {
2184+
} else if (is_word(p, "use")) {
2185+
auto vi = parse_view_item(p);
2186+
ret spanned(lo, vi.span.hi, ast::cdir_view_item(vi));
2187+
} else if (is_word(p, "import")) {
2188+
auto vi = parse_view_item(p);
2189+
ret spanned(lo, vi.span.hi, ast::cdir_view_item(vi));
2190+
} else if (is_word(p, "export")) {
21852191
auto vi = parse_view_item(p);
21862192
ret spanned(lo, vi.span.hi, ast::cdir_view_item(vi));
21872193
} else {

0 commit comments

Comments
 (0)