Skip to content

Commit 872a112

Browse files
committed
---
yaml --- r: 7379 b: refs/heads/master c: 93be00f h: refs/heads/master i: 7377: 9d9b920 7375: 145a80b v: v3
1 parent 808226f commit 872a112

Some content is hidden

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

63 files changed

+672
-1780
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: 4ac44492c4cbd0ed2523e43ea816caf2754da421
2+
refs/heads/master: 93be00f99594464fc753796395ce0cfb8ee790ea

trunk/configure

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -363,16 +363,6 @@ then
363363
err "either clang or gcc is required"
364364
fi
365365

366-
if [ ! -z "$CFG_PERF" ]
367-
then
368-
HAVE_PERF_LOGFD=`$CFG_PERF stat --log-fd 2>&1 | grep 'unknown option'`
369-
if [ -z "$HAVE_PERF_LOGFD" ];
370-
then
371-
CFG_PERF_WITH_LOGFD=1
372-
putvar CFG_PERF_WITH_LOGFD
373-
fi
374-
fi
375-
376366
step_msg "making directories"
377367

378368
for i in \

trunk/mk/platform.mk

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,7 @@ ifneq ($(findstring linux,$(CFG_OSTYPE)),)
5858
CFG_LDENV := LD_LIBRARY_PATH
5959
CFG_DEF_SUFFIX := .linux.def
6060
ifdef CFG_PERF
61-
ifneq ($(CFG_PERF_WITH_LOGFD),)
62-
CFG_PERF_TOOL := $(CFG_PERF) stat -r 3 --log-fd 2
63-
else
64-
CFG_PERF_TOOL := $(CFG_PERF) stat -r 3
65-
endif
61+
CFG_PERF_TOOL := $(CFG_PERF) stat -r 3
6662
else
6763
ifdef CFG_VALGRIND
6864
CFG_PERF_TOOL :=\

trunk/src/comp/back/link.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -445,10 +445,7 @@ fn build_link_meta(sess: session, c: ast::crate, output: str,
445445
let name =
446446
{
447447
let os = str::split(fs::basename(output), '.' as u8);
448-
if (vec::len(os) < 2u) {
449-
sess.fatal(#fmt("Output file name %s doesn't\
450-
appear to have an extension", output));
451-
}
448+
assert (vec::len(os) >= 2u);
452449
vec::pop(os);
453450
str::connect(os, ".")
454451
};

trunk/src/comp/back/upcall.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ type upcalls =
1616
free: ValueRef,
1717
shared_malloc: ValueRef,
1818
shared_free: ValueRef,
19-
memset: ValueRef,
2019
mark: ValueRef,
2120
create_shared_type_desc: ValueRef,
2221
free_shared_type_desc: ValueRef,
@@ -65,7 +64,6 @@ fn declare_upcalls(targ_cfg: @session::config,
6564
T_ptr(T_i8())),
6665
shared_free:
6766
dv("shared_free", [T_ptr(T_i8())]),
68-
memset: dv("memset", [T_ptr(T_i8()), T_i8(), T_i32(), T_i32()]),
6967
mark:
7068
d("mark", [T_ptr(T_i8())], int_t),
7169
create_shared_type_desc:

trunk/src/comp/driver/driver.rs

Lines changed: 50 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import back::{x86, x86_64};
2020

2121
tag pp_mode { ppm_normal; ppm_expanded; ppm_typed; ppm_identified; }
2222

23-
fn default_configuration(sess: session, argv0: str, input: str) ->
23+
fn default_configuration(sess: session::session, argv0: str, input: str) ->
2424
ast::crate_cfg {
2525
let libc =
2626
alt sess.targ_cfg.os {
@@ -48,7 +48,7 @@ fn default_configuration(sess: session, argv0: str, input: str) ->
4848
mk("build_input", input)];
4949
}
5050

51-
fn build_configuration(sess: session, argv0: str, input: str) ->
51+
fn build_configuration(sess: session::session, argv0: str, input: str) ->
5252
ast::crate_cfg {
5353
// Combine the configuration requested by the session (command line) with
5454
// some default and generated configuration items
@@ -76,27 +76,31 @@ fn parse_cfgspecs(cfgspecs: [str]) -> ast::crate_cfg {
7676

7777
fn input_is_stdin(filename: str) -> bool { filename == "-" }
7878

79-
fn parse_input(sess: session, cfg: ast::crate_cfg, input: str)
80-
-> {crate: @ast::crate, src: str} {
81-
let src = get_input_str(sess, input);
82-
let crate = if !input_is_stdin(input) {
79+
fn parse_input(sess: session::session, cfg: ast::crate_cfg, input: str) ->
80+
@ast::crate {
81+
if !input_is_stdin(input) {
8382
parser::parse_crate_from_file(input, cfg, sess.parse_sess)
84-
} else {
85-
parser::parse_crate_from_source_str(input, src, cfg, sess.parse_sess)
86-
};
87-
{crate: crate, src: src}
83+
} else { parse_input_src(sess, cfg, input).crate }
8884
}
8985

90-
fn get_input_str(sess: session, infile: str) -> str {
91-
let stream = if !input_is_stdin(infile) {
86+
fn parse_input_src(sess: session::session, cfg: ast::crate_cfg, infile: str)
87+
-> {crate: @ast::crate, src: str} {
88+
let src_stream = if infile != "-" {
9289
alt io::file_reader(infile) {
9390
result::ok(reader) { reader }
9491
result::err(e) {
9592
sess.fatal(e)
9693
}
9794
}
98-
} else { io::stdin() };
99-
str::unsafe_from_bytes(stream.read_whole_stream())
95+
} else {
96+
io::stdin()
97+
};
98+
let srcbytes = src_stream.read_whole_stream();
99+
let src = str::unsafe_from_bytes(srcbytes);
100+
let crate =
101+
parser::parse_crate_from_source_str(infile, src, cfg,
102+
sess.parse_sess);
103+
ret {crate: crate, src: src};
100104
}
101105

102106
fn time<T>(do_it: bool, what: str, thunk: fn@() -> T) -> T {
@@ -109,7 +113,7 @@ fn time<T>(do_it: bool, what: str, thunk: fn@() -> T) -> T {
109113
ret rv;
110114
}
111115

112-
fn inject_libcore_reference(sess: session,
116+
fn inject_libcore_reference(sess: session::session,
113117
crate: @ast::crate) -> @ast::crate {
114118

115119
fn spanned<T: copy>(x: T) -> @ast::spanned<T> {
@@ -130,22 +134,14 @@ fn inject_libcore_reference(sess: session,
130134
with crate.node} with *crate }
131135
}
132136

133-
enum compile_upto {
134-
cu_parse;
135-
cu_expand;
136-
cu_typeck;
137-
cu_no_trans;
138-
cu_everything;
139-
}
140137

141-
fn compile_upto(sess: session, cfg: ast::crate_cfg,
142-
input: str, upto: compile_upto,
143-
outputs: option::t<output_filenames>)
144-
-> {crate: @ast::crate, tcx: option::t<ty::ctxt>, src: str} {
138+
fn compile_input(sess: session::session, cfg: ast::crate_cfg, input: str,
139+
outdir: option::t<str>, output: option::t<str>) {
140+
145141
let time_passes = sess.opts.time_passes;
146-
let {crate, src} =
142+
let crate =
147143
time(time_passes, "parsing", bind parse_input(sess, cfg, input));
148-
if upto == cu_parse { ret {crate: crate, tcx: none, src: src}; }
144+
if sess.opts.parse_only { ret; }
149145

150146
sess.building_library =
151147
session::building_library(sess.opts.crate_type, crate);
@@ -160,7 +156,6 @@ fn compile_upto(sess: session, cfg: ast::crate_cfg,
160156
time(time_passes, "expansion",
161157
bind syntax::ext::expand::expand_crate(sess, crate));
162158

163-
if upto == cu_expand { ret {crate: crate, tcx: none, src: src}; }
164159
if sess.opts.libcore {
165160
crate = inject_libcore_reference(sess, crate);
166161
}
@@ -182,9 +177,6 @@ fn compile_upto(sess: session, cfg: ast::crate_cfg,
182177
let (method_map, dict_map) =
183178
time(time_passes, "typechecking",
184179
bind typeck::check_crate(ty_cx, impl_map, crate));
185-
186-
if upto == cu_typeck { ret {crate: crate, tcx: some(ty_cx), src: src}; }
187-
188180
time(time_passes, "block-use checking",
189181
bind middle::block_use::check_crate(ty_cx, crate));
190182
time(time_passes, "function usage",
@@ -203,9 +195,9 @@ fn compile_upto(sess: session, cfg: ast::crate_cfg,
203195
bind last_use::find_last_uses(crate, def_map, ref_map, ty_cx));
204196
time(time_passes, "kind checking",
205197
bind kind::check_crate(ty_cx, method_map, last_uses, crate));
198+
if sess.opts.no_trans { ret; }
206199

207-
if upto == cu_no_trans { ret {crate: crate, tcx: some(ty_cx), src: src}; }
208-
let outputs = option::get(outputs);
200+
let outputs = build_output_filenames(input, outdir, output, sess);
209201

210202
let (llmod, link_meta) =
211203
time(time_passes, "translation",
@@ -220,25 +212,14 @@ fn compile_upto(sess: session, cfg: ast::crate_cfg,
220212
sess.opts.output_type != link::output_type_exe ||
221213
sess.opts.static && sess.building_library;
222214

223-
if stop_after_codegen { ret {crate: crate, tcx: some(ty_cx), src: src}; }
215+
if stop_after_codegen { ret; }
224216

225217
time(time_passes, "Linking",
226218
bind link::link_binary(sess, outputs.obj_filename,
227219
outputs.out_filename, link_meta));
228-
ret {crate: crate, tcx: some(ty_cx), src: src};
229220
}
230221

231-
fn compile_input(sess: session, cfg: ast::crate_cfg, input: str,
232-
outdir: option::t<str>, output: option::t<str>) {
233-
234-
let upto = if sess.opts.parse_only { cu_parse }
235-
else if sess.opts.no_trans { cu_no_trans }
236-
else { cu_everything };
237-
let outputs = build_output_filenames(input, outdir, output, sess);
238-
compile_upto(sess, cfg, input, upto, some(outputs));
239-
}
240-
241-
fn pretty_print_input(sess: session, cfg: ast::crate_cfg, input: str,
222+
fn pretty_print_input(sess: session::session, cfg: ast::crate_cfg, input: str,
242223
ppm: pp_mode) {
243224
fn ann_paren_for_expr(node: pprust::ann_node) {
244225
alt node { pprust::node_expr(s, expr) { pprust::popen(s); } _ { } }
@@ -279,23 +260,30 @@ fn pretty_print_input(sess: session, cfg: ast::crate_cfg, input: str,
279260
// to collect comments and literals, and we need to support reading
280261
// from stdin, we're going to just suck the source into a string
281262
// so both the parser and pretty-printer can use it.
282-
let upto = alt ppm {
283-
ppm_expanded. { cu_expand }
284-
ppm_typed. { cu_typeck }
285-
_ { cu_parse }
286-
};
287-
let {crate, tcx, src} = compile_upto(sess, cfg, input, upto, none);
263+
let crate_src = parse_input_src(sess, cfg, input);
264+
let crate = crate_src.crate;
265+
let src = crate_src.src;
288266

289-
let ann: pprust::pp_ann = pprust::no_ann();
267+
let ann;
290268
alt ppm {
269+
ppm_expanded. {
270+
crate = syntax::ext::expand::expand_crate(sess, crate);
271+
ann = pprust::no_ann();
272+
}
291273
ppm_typed. {
292-
ann = {pre: ann_paren_for_expr,
293-
post: bind ann_typed_post(option::get(tcx), _)};
274+
crate = syntax::ext::expand::expand_crate(sess, crate);
275+
let amap = middle::ast_map::map_crate(*crate);
276+
let {def_map, impl_map, _} =
277+
resolve::resolve_crate(sess, amap, crate);
278+
let freevars = freevars::annotate_freevars(def_map, crate);
279+
let ty_cx = ty::mk_ctxt(sess, def_map, amap, freevars);
280+
typeck::check_crate(ty_cx, impl_map, crate);
281+
ann = {pre: ann_paren_for_expr, post: bind ann_typed_post(ty_cx, _)};
294282
}
295283
ppm_identified. {
296284
ann = {pre: ann_paren_for_expr, post: ann_identified_post};
297285
}
298-
ppm_expanded. | ppm_normal. {}
286+
ppm_normal. { ann = pprust::no_ann(); }
299287
}
300288
pprust::print_crate(sess.codemap, sess.diagnostic, crate, input,
301289
io::string_reader(src), io::stdout(), ann);
@@ -465,7 +453,7 @@ fn build_session_options(match: getopts::match,
465453
}
466454

467455
fn build_session(sopts: @session::options, input: str,
468-
demitter: diagnostic::emitter) -> session {
456+
demitter: diagnostic::emitter) -> session::session {
469457
let target_cfg = build_target_config(sopts, demitter);
470458
let cstore = cstore::mk_cstore();
471459
let filesearch = filesearch::mk_filesearch(
@@ -492,7 +480,7 @@ fn build_session(sopts: @session::options, input: str,
492480
working_dir: fs::dirname(input)}
493481
}
494482

495-
fn parse_pretty(sess: session, &&name: str) -> pp_mode {
483+
fn parse_pretty(sess: session::session, &&name: str) -> pp_mode {
496484
if str::eq(name, "normal") {
497485
ret ppm_normal;
498486
} else if str::eq(name, "expanded") {
@@ -521,13 +509,11 @@ fn opts() -> [getopts::opt] {
521509
optflag("warn-unused-imports")];
522510
}
523511

524-
type output_filenames = @{out_filename: str, obj_filename:str};
525-
526512
fn build_output_filenames(ifile: str,
527513
odir: option::t<str>,
528514
ofile: option::t<str>,
529-
sess: session)
530-
-> output_filenames {
515+
sess: session::session)
516+
-> @{out_filename: str, obj_filename:str} {
531517
let obj_path = "";
532518
let out_path: str = "";
533519
let sopts = sess.opts;
@@ -613,7 +599,7 @@ fn early_error(emitter: diagnostic::emitter, msg: str) -> ! {
613599
fail;
614600
}
615601

616-
fn list_metadata(sess: session, path: str, out: io::writer) {
602+
fn list_metadata(sess: session::session, path: str, out: io::writer) {
617603
metadata::creader::list_file_metadata(sess, path, out);
618604
}
619605

trunk/src/comp/front/attr.rs

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ export get_meta_item_name;
2020
export get_meta_item_value_str;
2121
export get_meta_item_value_str_by_name;
2222
export get_meta_item_list;
23-
export meta_item_value_from_list;
24-
export meta_item_list_from_list;
25-
export name_value_str_pair;
2623
export mk_name_value_item_str;
2724
export mk_name_value_item;
2825
export mk_list_item;
@@ -220,53 +217,6 @@ fn native_abi(attrs: [ast::attribute]) -> either::t<str, ast::native_abi> {
220217
};
221218
}
222219

223-
fn meta_item_from_list(
224-
items: [@ast::meta_item],
225-
name: str
226-
) -> option<@ast::meta_item> {
227-
let items = attr::find_meta_items_by_name(items, name);
228-
vec::last(items)
229-
}
230-
231-
fn meta_item_value_from_list(
232-
items: [@ast::meta_item],
233-
name: str
234-
) -> option<str> {
235-
alt meta_item_from_list(items, name) {
236-
some(item) {
237-
alt attr::get_meta_item_value_str(item) {
238-
some(value) { some(value) }
239-
none. { none }
240-
}
241-
}
242-
none. { none }
243-
}
244-
}
245-
246-
fn meta_item_list_from_list(
247-
items: [@ast::meta_item],
248-
name: str
249-
) -> option<[@ast::meta_item]> {
250-
alt meta_item_from_list(items, name) {
251-
some(item) {
252-
attr::get_meta_item_list(item)
253-
}
254-
none. { none }
255-
}
256-
}
257-
258-
fn name_value_str_pair(
259-
item: @ast::meta_item
260-
) -> option<(str, str)> {
261-
alt attr::get_meta_item_value_str(item) {
262-
some(value) {
263-
let name = attr::get_meta_item_name(item);
264-
some((name, value))
265-
}
266-
none. { none }
267-
}
268-
}
269-
270220
fn span<T: copy>(item: T) -> ast::spanned<T> {
271221
ret {node: item, span: ast_util::dummy_sp()};
272222
}

trunk/src/comp/metadata/decoder.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ fn get_tag_variants(cdata: cmd, id: ast::node_id, tcx: ty::ctxt)
246246
for did: ast::def_id in variant_ids {
247247
let item = find_item(did.node, items);
248248
let ctor_ty = item_type(item, tcx, cdata);
249-
let name = item_name(item);
250249
let arg_tys: [ty::t] = [];
251250
alt ty::struct(tcx, ctor_ty) {
252251
ty::ty_fn(f) {
@@ -258,8 +257,8 @@ fn get_tag_variants(cdata: cmd, id: ast::node_id, tcx: ty::ctxt)
258257
some(val) { disr_val = val; }
259258
_ { /* empty */ }
260259
}
261-
infos += [@{args: arg_tys, ctor_ty: ctor_ty, name: name,
262-
id: did, disr_val: disr_val}];
260+
infos += [@{args: arg_tys, ctor_ty: ctor_ty, id: did,
261+
disr_val: disr_val}];
263262
disr_val += 1;
264263
}
265264
ret infos;

trunk/src/comp/metadata/encoder.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ fn encode_tag_variant_info(ecx: @encode_ctxt, ebml_w: ebml::writer,
239239
ebml::start_tag(ebml_w, tag_items_data_item);
240240
encode_def_id(ebml_w, local_def(variant.node.id));
241241
encode_family(ebml_w, 'v' as u8);
242-
encode_name(ebml_w, variant.node.name);
243242
encode_tag_id(ebml_w, local_def(id));
244243
encode_type(ecx, ebml_w,
245244
node_id_to_monotype(ecx.ccx.tcx, variant.node.id));

0 commit comments

Comments
 (0)