Skip to content

Commit 663f727

Browse files
committed
---
yaml --- r: 50403 b: refs/heads/auto c: 9bbf384 h: refs/heads/master i: 50401: 0ad8c9d 50399: 69c9c38 v: v3
1 parent e0fb3c5 commit 663f727

Some content is hidden

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

86 files changed

+1066
-1616
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: fbd8eae26de23cf00081229176fd7efd80943905
17+
refs/heads/auto: 9bbf384058f93f2a36889bb11fd5332e5e02eb61
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167

branches/auto/src/libcore/cast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
pub mod rusti {
1414
#[abi = "rust-intrinsic"]
1515
#[link_name = "rusti"]
16-
pub extern "rust-intrinsic" {
16+
pub extern {
1717
fn forget<T>(+x: T);
1818
fn reinterpret_cast<T, U>(&&e: T) -> U;
1919
}

branches/auto/src/libcore/hashmap.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,10 +393,16 @@ pub mod linear {
393393
}
394394
}
395395
396-
pub impl<K:Hash + IterBytes + Eq,V> LinearMap<K, V> {
396+
pub impl<K: Hash + IterBytes + Eq, V> LinearMap<K, V> {
397397
/// Create an empty LinearMap
398398
fn new() -> LinearMap<K, V> {
399-
linear_map_with_capacity(INITIAL_CAPACITY)
399+
LinearMap::with_capacity(INITIAL_CAPACITY)
400+
}
401+
402+
/// Create an empty LinearMap with space for at least `n` elements in
403+
/// the hash table.
404+
fn with_capacity(capacity: uint) -> LinearMap<K, V> {
405+
linear_map_with_capacity(capacity)
400406
}
401407
402408
/// Reserve space for at least `n` elements in the hash table.
@@ -652,7 +658,15 @@ pub mod linear {
652658

653659
pub impl <T:Hash + IterBytes + Eq> LinearSet<T> {
654660
/// Create an empty LinearSet
655-
fn new() -> LinearSet<T> { LinearSet{map: LinearMap::new()} }
661+
fn new() -> LinearSet<T> {
662+
LinearSet::with_capacity(INITIAL_CAPACITY)
663+
}
664+
665+
/// Create an empty LinearSet with space for at least `n` elements in
666+
/// the hash table.
667+
fn with_capacity(capacity: uint) -> LinearSet<T> {
668+
LinearSet { map: LinearMap::with_capacity(capacity) }
669+
}
656670

657671
/// Reserve space for at least `n` elements in the hash table.
658672
fn reserve_at_least(&mut self, n: uint) {

branches/auto/src/libcore/libc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1617,7 +1617,7 @@ pub mod funcs {
16171617
use libc::types::os::arch::extra::{HANDLE};
16181618

16191619
#[abi = "stdcall"]
1620-
pub extern "stdcall" {
1620+
pub extern {
16211621
unsafe fn GetEnvironmentVariableW(n: LPCWSTR,
16221622
v: LPWSTR,
16231623
nsize: DWORD)

branches/auto/src/libcore/os.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ pub fn errno() -> uint {
942942
943943
#[link_name = "kernel32"]
944944
#[abi = "stdcall"]
945-
extern "stdcall" {
945+
extern {
946946
unsafe fn GetLastError() -> DWORD;
947947
}
948948
@@ -1004,7 +1004,7 @@ pub fn last_os_error() -> ~str {
10041004
10051005
#[link_name = "kernel32"]
10061006
#[abi = "stdcall"]
1007-
extern "stdcall" {
1007+
extern {
10081008
unsafe fn FormatMessageA(flags: DWORD, lpSrc: LPVOID,
10091009
msgId: DWORD, langId: DWORD,
10101010
buf: LPSTR, nsize: DWORD,
@@ -1118,15 +1118,15 @@ type LPCWSTR = *u16;
11181118
#[cfg(windows)]
11191119
#[link_name="kernel32"]
11201120
#[abi="stdcall"]
1121-
extern "stdcall" {
1121+
extern {
11221122
fn GetCommandLineW() -> LPCWSTR;
11231123
fn LocalFree(ptr: *c_void);
11241124
}
11251125
11261126
#[cfg(windows)]
11271127
#[link_name="shell32"]
11281128
#[abi="stdcall"]
1129-
extern "stdcall" {
1129+
extern {
11301130
fn CommandLineToArgvW(lpCmdLine: LPCWSTR, pNumArgs: *mut c_int) -> **u16;
11311131
}
11321132

branches/auto/src/libcore/ptr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub mod libc_ {
4343

4444
pub mod rusti {
4545
#[abi = "rust-intrinsic"]
46-
pub extern "rust-intrinsic" {
46+
pub extern {
4747
fn addr_of<T>(&&val: T) -> *T;
4848
}
4949
}

branches/auto/src/libcore/rt/thread_local_storage.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pub unsafe fn get(key: Key) -> *mut c_void {
7373

7474
#[cfg(windows)]
7575
#[abi = "stdcall"]
76-
extern "stdcall" {
76+
extern {
7777
fn TlsAlloc() -> DWORD;
7878
fn TlsSetValue(dwTlsIndex: DWORD, lpTlsvalue: LPVOID) -> BOOL;
7979
fn TlsGetValue(dwTlsIndex: DWORD) -> LPVOID;

branches/auto/src/libcore/stackwalk.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pub mod rustrt {
9494

9595
pub mod rusti {
9696
#[abi = "rust-intrinsic"]
97-
pub extern "rust-intrinsic" {
97+
pub extern {
9898
pub fn frame_address(f: &once fn(x: *u8));
9999
}
100100
}

branches/auto/src/libcore/sys.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub struct Closure {
3939

4040
pub mod rusti {
4141
#[abi = "rust-intrinsic"]
42-
pub extern "rust-intrinsic" {
42+
pub extern {
4343
fn get_tydesc<T>() -> *();
4444
fn size_of<T>() -> uint;
4545
fn pref_align_of<T>() -> uint;

branches/auto/src/libcore/unstable/intrinsics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The intrinsics are defined in librustc/middle/trans/foreign.rs.
1515
*/
1616

1717
#[abi = "rust-intrinsic"]
18-
pub extern "rust-intrinsic" {
18+
pub extern {
1919
pub fn atomic_cxchg(dst: &mut int, old: int, src: int) -> int;
2020
pub fn atomic_cxchg_acq(dst: &mut int, old: int, src: int) -> int;
2121
pub fn atomic_cxchg_rel(dst: &mut int, old: int, src: int) -> int;

branches/auto/src/libcore/vec.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,28 @@ pub fn consume<T>(mut v: ~[T], f: &fn(uint, v: T)) {
560560
}
561561
}
562562
563+
pub fn consume_reverse<T>(mut v: ~[T], f: &fn(uint, v: T)) {
564+
unsafe {
565+
do as_mut_buf(v) |p, ln| {
566+
let mut i = ln;
567+
while i > 0 {
568+
i -= 1;
569+
570+
// NB: This unsafe operation counts on init writing 0s to the
571+
// holes we create in the vector. That ensures that, if the
572+
// iterator fails then we won't try to clean up the consumed
573+
// elements during unwinding
574+
let mut x = intrinsics::init();
575+
let p = ptr::mut_offset(p, i);
576+
x <-> *p;
577+
f(i, x);
578+
}
579+
}
580+
581+
raw::set_len(&mut v, 0);
582+
}
583+
}
584+
563585
/// Remove the last element from a vector and return it
564586
pub fn pop<T>(v: &mut ~[T]) -> T {
565587
let ln = v.len();
@@ -1985,6 +2007,7 @@ pub trait OwnedVector<T> {
19852007
fn truncate(&mut self, newlen: uint);
19862008
fn retain(&mut self, f: &fn(t: &T) -> bool);
19872009
fn consume(self, f: &fn(uint, v: T));
2010+
fn consume_reverse(self, f: &fn(uint, v: T));
19882011
fn filter(self, f: &fn(t: &T) -> bool) -> ~[T];
19892012
fn partition(self, f: &fn(&T) -> bool) -> (~[T], ~[T]);
19902013
fn grow_fn(&mut self, n: uint, op: iter::InitOp<T>);
@@ -2046,6 +2069,11 @@ impl<T> OwnedVector<T> for ~[T] {
20462069
consume(self, f)
20472070
}
20482071

2072+
#[inline]
2073+
fn consume_reverse(self, f: &fn(uint, v: T)) {
2074+
consume_reverse(self, f)
2075+
}
2076+
20492077
#[inline]
20502078
fn filter(self, f: &fn(&T) -> bool) -> ~[T] {
20512079
filter(self, f)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ pub mod jit {
9797
pub mod rusti {
9898
#[nolink]
9999
#[abi = "rust-intrinsic"]
100-
pub extern "rust-intrinsic" {
100+
pub extern {
101101
pub fn morestack_addr() -> *();
102102
}
103103
}

branches/auto/src/librustc/driver/driver.rs

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ use std::getopts::groups::{optopt, optmulti, optflag, optflagopt, getopts};
3333
use std::getopts::{opt_present};
3434
use std::getopts;
3535
use syntax::ast;
36-
use syntax::abi;
3736
use syntax::attr;
3837
use syntax::codemap;
3938
use syntax::diagnostic;
@@ -86,10 +85,10 @@ pub fn default_configuration(sess: Session, +argv0: ~str, input: input) ->
8685
// ARM is bi-endian, however using NDK seems to default
8786
// to little-endian unless a flag is provided.
8887
let (end,arch,wordsz) = match sess.targ_cfg.arch {
89-
abi::X86 => (~"little",~"x86",~"32"),
90-
abi::X86_64 => (~"little",~"x86_64",~"64"),
91-
abi::Arm => (~"little",~"arm",~"32"),
92-
abi::Mips => (~"little",~"arm",~"32")
88+
session::arch_x86 => (~"little",~"x86",~"32"),
89+
session::arch_x86_64 => (~"little",~"x86_64",~"64"),
90+
session::arch_arm => (~"little",~"arm",~"32"),
91+
session::arch_mips => (~"little",~"arm",~"32")
9392
};
9493

9594
return ~[ // Target bindings.
@@ -309,7 +308,7 @@ pub fn compile_rest(sess: Session, cfg: ast::crate_cfg,
309308
};
310309

311310
// NOTE: Android hack
312-
if sess.targ_cfg.arch == abi::Arm &&
311+
if sess.targ_cfg.arch == session::arch_arm &&
313312
(sess.opts.output_type == link::output_type_object ||
314313
sess.opts.output_type == link::output_type_exe) {
315314
let output_type = link::output_type_assembly;
@@ -454,20 +453,20 @@ pub fn get_os(triple: &str) -> Option<session::os> {
454453
} else { None }
455454
}
456455

457-
pub fn get_arch(triple: &str) -> Option<abi::Architecture> {
456+
pub fn get_arch(triple: &str) -> Option<session::arch> {
458457
if str::contains(triple, ~"i386") ||
459458
str::contains(triple, ~"i486") ||
460459
str::contains(triple, ~"i586") ||
461460
str::contains(triple, ~"i686") ||
462461
str::contains(triple, ~"i786") {
463-
Some(abi::X86)
462+
Some(session::arch_x86)
464463
} else if str::contains(triple, ~"x86_64") {
465-
Some(abi::X86_64)
464+
Some(session::arch_x86_64)
466465
} else if str::contains(triple, ~"arm") ||
467466
str::contains(triple, ~"xscale") {
468-
Some(abi::Arm)
467+
Some(session::arch_arm)
469468
} else if str::contains(triple, ~"mips") {
470-
Some(abi::Mips)
469+
Some(session::arch_mips)
471470
} else { None }
472471
}
473472

@@ -484,16 +483,16 @@ pub fn build_target_config(sopts: @session::options,
484483
~"unknown architecture: " + sopts.target_triple)
485484
};
486485
let (int_type, uint_type, float_type) = match arch {
487-
abi::X86 => (ast::ty_i32, ast::ty_u32, ast::ty_f64),
488-
abi::X86_64 => (ast::ty_i64, ast::ty_u64, ast::ty_f64),
489-
abi::Arm => (ast::ty_i32, ast::ty_u32, ast::ty_f64),
490-
abi::Mips => (ast::ty_i32, ast::ty_u32, ast::ty_f64)
486+
session::arch_x86 => (ast::ty_i32, ast::ty_u32, ast::ty_f64),
487+
session::arch_x86_64 => (ast::ty_i64, ast::ty_u64, ast::ty_f64),
488+
session::arch_arm => (ast::ty_i32, ast::ty_u32, ast::ty_f64),
489+
session::arch_mips => (ast::ty_i32, ast::ty_u32, ast::ty_f64)
491490
};
492491
let target_strs = match arch {
493-
abi::X86 => x86::get_target_strs(os),
494-
abi::X86_64 => x86_64::get_target_strs(os),
495-
abi::Arm => arm::get_target_strs(os),
496-
abi::Mips => mips::get_target_strs(os)
492+
session::arch_x86 => x86::get_target_strs(os),
493+
session::arch_x86_64 => x86_64::get_target_strs(os),
494+
session::arch_arm => arm::get_target_strs(os),
495+
session::arch_mips => mips::get_target_strs(os)
497496
};
498497
let target_cfg = @session::config {
499498
os: os,

branches/auto/src/librustc/driver/session.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,19 @@ use syntax::codemap::span;
2525
use syntax::diagnostic;
2626
use syntax::parse::ParseSess;
2727
use syntax::{ast, codemap};
28-
use syntax::abi;
2928
use syntax;
3029

3130
#[deriving(Eq)]
3231
pub enum os { os_win32, os_macos, os_linux, os_android, os_freebsd, }
3332

33+
#[deriving(Eq)]
34+
pub enum arch { arch_x86, arch_x86_64, arch_arm, arch_mips, }
35+
3436
pub enum crate_type { bin_crate, lib_crate, unknown_crate, }
3537

3638
pub struct config {
3739
os: os,
38-
arch: abi::Architecture,
40+
arch: arch,
3941
target_strs: target_strs::t,
4042
int_type: int_ty,
4143
uint_type: uint_ty,

branches/auto/src/librustc/front/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ fn fold_foreign_mod(
9292
nm.view_items.filter_mapped(|a| filter_view_item(cx, *a));
9393
ast::foreign_mod {
9494
sort: nm.sort,
95-
abis: nm.abis,
95+
abi: nm.abi,
9696
view_items: vec::map(filtered_view_items, |x| fld.fold_view_item(*x)),
9797
items: filtered_items
9898
}

branches/auto/src/librustc/front/intrinsic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ pub mod intrinsic {
126126
use super::{TyDesc, TyVisitor};
127127

128128
#[abi = "rust-intrinsic"]
129-
pub extern "rust-intrinsic" {
129+
pub extern {
130130
pub fn get_tydesc<T>() -> *();
131131
pub fn visit_tydesc(++td: *TyDesc, &&tv: @TyVisitor);
132132
}

branches/auto/src/librustc/front/test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ fn fold_item(cx: @mut TestCtxt, &&i: @ast::item, fld: @fold::ast_fold)
146146

147147
if is_test_fn(i) || is_bench_fn(i) {
148148
match i.node {
149-
ast::item_fn(_, purity, _, _, _) if purity == ast::unsafe_fn => {
149+
ast::item_fn(_, purity, _, _) if purity == ast::unsafe_fn => {
150150
let sess = cx.sess;
151151
sess.span_fatal(
152152
i.span,
@@ -178,7 +178,7 @@ fn is_test_fn(i: @ast::item) -> bool {
178178

179179
fn has_test_signature(i: @ast::item) -> bool {
180180
match &i.node {
181-
&ast::item_fn(ref decl, _, _, ref generics, _) => {
181+
&ast::item_fn(ref decl, _, ref generics, _) => {
182182
let no_output = match decl.output.node {
183183
ast::ty_nil => true,
184184
_ => false
@@ -200,7 +200,7 @@ fn is_bench_fn(i: @ast::item) -> bool {
200200

201201
fn has_test_signature(i: @ast::item) -> bool {
202202
match i.node {
203-
ast::item_fn(ref decl, _, _, ref generics, _) => {
203+
ast::item_fn(ref decl, _, ref generics, _) => {
204204
let input_cnt = vec::len(decl.inputs);
205205
let no_output = match decl.output.node {
206206
ast::ty_nil => true,

branches/auto/src/librustc/metadata/creader.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,12 @@ fn visit_view_item(e: @mut Env, i: @ast::view_item) {
156156
fn visit_item(e: @mut Env, i: @ast::item) {
157157
match i.node {
158158
ast::item_foreign_mod(ref fm) => {
159-
if fm.abis.is_rust() || fm.abis.is_intrinsic() {
160-
return;
159+
match attr::foreign_abi(i.attrs) {
160+
either::Right(abi) => {
161+
if abi != ast::foreign_abi_cdecl &&
162+
abi != ast::foreign_abi_stdcall { return; }
163+
}
164+
either::Left(ref msg) => e.diag.span_fatal(i.span, (*msg))
161165
}
162166

163167
let cstore = e.cstore;

branches/auto/src/librustc/metadata/encoder.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ use core::uint;
3535
use core::vec;
3636
use std::serialize::Encodable;
3737
use std;
38-
use syntax::abi::AbiSet;
3938
use syntax::ast::*;
4039
use syntax::ast;
4140
use syntax::ast_map;
@@ -654,7 +653,7 @@ fn encode_info_for_item(ecx: @EncodeContext, ebml_w: writer::Encoder,
654653
(ecx.encode_inlined_item)(ecx, ebml_w, path, ii_item(item));
655654
ebml_w.end_tag();
656655
}
657-
item_fn(_, purity, _, ref generics, _) => {
656+
item_fn(_, purity, ref generics, _) => {
658657
add_to_index();
659658
ebml_w.start_tag(tag_items_data_item);
660659
encode_def_id(ebml_w, local_def(item.id));
@@ -980,7 +979,7 @@ fn encode_info_for_foreign_item(ecx: @EncodeContext,
980979
nitem: @foreign_item,
981980
index: @mut ~[entry<int>],
982981
+path: ast_map::path,
983-
abi: AbiSet) {
982+
abi: foreign_abi) {
984983
if !reachable(ecx, nitem.id) { return; }
985984
index.push(entry { val: nitem.id, pos: ebml_w.writer.tell() });
986985
@@ -991,7 +990,7 @@ fn encode_info_for_foreign_item(ecx: @EncodeContext,
991990
encode_family(ebml_w, purity_fn_family(purity));
992991
encode_type_param_bounds(ebml_w, ecx, &generics.ty_params);
993992
encode_type(ecx, ebml_w, node_id_to_type(ecx.tcx, nitem.id));
994-
if abi.is_intrinsic() {
993+
if abi == foreign_abi_rust_intrinsic {
995994
(ecx.encode_inlined_item)(ecx, ebml_w, path, ii_foreign(nitem));
996995
} else {
997996
encode_symbol(ecx, ebml_w, nitem.id);

0 commit comments

Comments
 (0)