Skip to content

Commit 321ef9f

Browse files
committed
---
yaml --- r: 56198 b: refs/heads/auto c: a089c6f h: refs/heads/master v: v3
1 parent 3dea010 commit 321ef9f

Some content is hidden

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

67 files changed

+1383
-770
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ 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: 128e95b89df851fdecec348a40c49feb61a7bee7
17+
refs/heads/auto: a089c6f8fc93c9a914bd5cfd2445f4e184d4e670
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

branches/auto/mk/rt.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ RUNTIME_CXXS_$(1) := \
7676
rt/boxed_region.cpp \
7777
rt/arch/$$(HOST_$(1))/context.cpp \
7878
rt/arch/$$(HOST_$(1))/gpr.cpp \
79-
rt/rust_android_dummy.cpp
79+
rt/rust_android_dummy.cpp \
80+
rt/rust_test_helpers.cpp
8081

8182
RUNTIME_CS_$(1) := rt/linenoise/linenoise.c rt/linenoise/utf8.c
8283

branches/auto/src/libcore/rt/uv/net.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,6 @@ impl NativeHandle<*uvll::uv_write_t> for WriteRequest {
356356

357357

358358
#[test]
359-
#[ignore(reason = "ffi struct issues")]
360359
fn connect_close() {
361360
do run_in_bare_thread() {
362361
let mut loop_ = Loop::new();
@@ -409,7 +408,6 @@ fn connect_read() {
409408
}
410409
411410
#[test]
412-
#[ignore(reason = "ffi struct issues")]
413411
fn listen() {
414412
do run_in_bare_thread() {
415413
static MAX: int = 10;

branches/auto/src/librustc/lib/llvm.rs

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -125,27 +125,25 @@ pub enum RealPredicate {
125125
RealPredicateTrue = 15,
126126
}
127127

128-
// enum for the LLVM TypeKind type - must stay in sync with the def of
128+
// The LLVM TypeKind type - must stay in sync with the def of
129129
// LLVMTypeKind in llvm/include/llvm-c/Core.h
130-
#[deriving(Eq)]
131-
pub enum TypeKind {
132-
Void = 0,
133-
Half = 1,
134-
Float = 2,
135-
Double = 3,
136-
X86_FP80 = 4,
137-
FP128 = 5,
138-
PPC_FP128 = 6,
139-
Label = 7,
140-
Integer = 8,
141-
Function = 9,
142-
Struct = 10,
143-
Array = 11,
144-
Pointer = 12,
145-
Vector = 13,
146-
Metadata = 14,
147-
X86_MMX = 15
148-
}
130+
pub type TypeKind = u32;
131+
pub static Void: TypeKind = 0;
132+
pub static Half: TypeKind = 1;
133+
pub static Float: TypeKind = 2;
134+
pub static Double: TypeKind = 3;
135+
pub static X86_FP80: TypeKind = 4;
136+
pub static FP128: TypeKind = 5;
137+
pub static PPC_FP128: TypeKind = 6;
138+
pub static Label: TypeKind = 7;
139+
pub static Integer: TypeKind = 8;
140+
pub static Function: TypeKind = 9;
141+
pub static Struct: TypeKind = 10;
142+
pub static Array: TypeKind = 11;
143+
pub static Pointer: TypeKind = 12;
144+
pub static Vector: TypeKind = 13;
145+
pub static Metadata: TypeKind = 14;
146+
pub static X86_MMX: TypeKind = 15;
149147

150148
pub enum AtomicBinOp {
151149
Xchg = 0,
@@ -1582,7 +1580,8 @@ pub fn type_to_str_inner(names: @TypeNames, +outer0: &[TypeRef], ty: TypeRef)
15821580
}
15831581
Vector => return @"Vector",
15841582
Metadata => return @"Metadata",
1585-
X86_MMX => return @"X86_MMAX"
1583+
X86_MMX => return @"X86_MMAX",
1584+
_ => fail!()
15861585
}
15871586
}
15881587
}

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,9 @@ fn parse_ty(st: @mut PState, conv: conv_did) -> ty::t {
313313
let def = parse_def(st, NominalType, conv);
314314
let substs = parse_substs(st, conv);
315315
let store = parse_trait_store(st);
316+
let mt = parse_mutability(st);
316317
assert!(next(st) == ']');
317-
return ty::mk_trait(st.tcx, def, substs, store);
318+
return ty::mk_trait(st.tcx, def, substs, store, mt);
318319
}
319320
'p' => {
320321
let did = parse_def(st, TypeParameter, conv);
@@ -396,13 +397,16 @@ fn parse_ty(st: @mut PState, conv: conv_did) -> ty::t {
396397
}
397398
}
398399

399-
fn parse_mt(st: @mut PState, conv: conv_did) -> ty::mt {
400-
let mut m;
400+
fn parse_mutability(st: @mut PState) -> ast::mutability {
401401
match peek(st) {
402-
'm' => { next(st); m = ast::m_mutbl; }
403-
'?' => { next(st); m = ast::m_const; }
404-
_ => { m = ast::m_imm; }
402+
'm' => { next(st); ast::m_mutbl }
403+
'?' => { next(st); ast::m_const }
404+
_ => { ast::m_imm }
405405
}
406+
}
407+
408+
fn parse_mt(st: @mut PState, conv: conv_did) -> ty::mt {
409+
let m = parse_mutability(st);
406410
ty::mt { ty: parse_ty(st, conv), mutbl: m }
407411
}
408412

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use core::io;
2222
use core::uint;
2323
use core::vec;
2424
use syntax::abi::AbiSet;
25+
use syntax::ast;
2526
use syntax::ast::*;
2627
use syntax::diagnostic::span_handler;
2728
use syntax::print::pprust::*;
@@ -113,12 +114,17 @@ pub fn enc_ty(w: @io::Writer, cx: @ctxt, t: ty::t) {
113114
}
114115
}
115116
}
116-
fn enc_mt(w: @io::Writer, cx: @ctxt, mt: ty::mt) {
117-
match mt.mutbl {
117+
118+
fn enc_mutability(w: @io::Writer, mt: ast::mutability) {
119+
match mt {
118120
m_imm => (),
119121
m_mutbl => w.write_char('m'),
120122
m_const => w.write_char('?')
121123
}
124+
}
125+
126+
fn enc_mt(w: @io::Writer, cx: @ctxt, mt: ty::mt) {
127+
enc_mutability(w, mt.mutbl);
122128
enc_ty(w, cx, mt.ty);
123129
}
124130

@@ -269,12 +275,13 @@ fn enc_sty(w: @io::Writer, cx: @ctxt, +st: ty::sty) {
269275
enc_substs(w, cx, (*substs));
270276
w.write_char(']');
271277
}
272-
ty::ty_trait(def, ref substs, store) => {
278+
ty::ty_trait(def, ref substs, store, mt) => {
273279
w.write_str(&"x[");
274280
w.write_str((cx.ds)(def));
275281
w.write_char('|');
276282
enc_substs(w, cx, (*substs));
277283
enc_trait_store(w, cx, store);
284+
enc_mutability(w, mt);
278285
w.write_char(']');
279286
}
280287
ty::ty_tup(ts) => {

branches/auto/src/librustc/middle/kind.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ pub fn check_cast_for_escaping_regions(
589589
pub fn check_kind_bounds_of_cast(cx: Context, source: @expr, target: @expr) {
590590
let target_ty = ty::expr_ty(cx.tcx, target);
591591
match ty::get(target_ty).sty {
592-
ty::ty_trait(_, _, ty::UniqTraitStore) => {
592+
ty::ty_trait(_, _, ty::UniqTraitStore, _) => {
593593
let source_ty = ty::expr_ty(cx.tcx, source);
594594
if !ty::type_is_owned(cx.tcx, source_ty) {
595595
cx.tcx.sess.span_err(

branches/auto/src/librustc/middle/trans/cabi.rs

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -180,37 +180,3 @@ pub impl FnType {
180180
Ret(bcx, llretval);
181181
}
182182
}
183-
184-
enum LLVM_ABIInfo { LLVM_ABIInfo }
185-
186-
impl ABIInfo for LLVM_ABIInfo {
187-
fn compute_info(&self,
188-
atys: &[TypeRef],
189-
rty: TypeRef,
190-
_ret_def: bool) -> FnType {
191-
let arg_tys = do atys.map |a| {
192-
LLVMType { cast: false, ty: *a }
193-
};
194-
let ret_ty = LLVMType {
195-
cast: false,
196-
ty: rty
197-
};
198-
let attrs = do atys.map |_| {
199-
option::None
200-
};
201-
let sret = false;
202-
203-
return FnType {
204-
arg_tys: arg_tys,
205-
ret_ty: ret_ty,
206-
attrs: attrs,
207-
sret: sret
208-
};
209-
}
210-
}
211-
212-
pub fn llvm_abi_info() -> @ABIInfo {
213-
return @LLVM_ABIInfo as @ABIInfo;
214-
}
215-
216-

branches/auto/src/librustc/middle/trans/cabi_mips.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,6 @@ impl ABIInfo for MIPS_ABIInfo {
227227
}
228228
}
229229

230-
pub fn mips_abi_info() -> @ABIInfo {
230+
pub fn abi_info() -> @ABIInfo {
231231
return @MIPS_ABIInfo as @ABIInfo;
232232
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use driver::session::os_win32;
12+
use core::option::*;
13+
use lib::llvm::*;
14+
use lib::llvm::llvm::*;
15+
use super::cabi::*;
16+
use super::common::*;
17+
use super::machine::*;
18+
19+
struct X86_ABIInfo {
20+
ccx: @CrateContext
21+
}
22+
23+
impl ABIInfo for X86_ABIInfo {
24+
fn compute_info(&self,
25+
atys: &[TypeRef],
26+
rty: TypeRef,
27+
ret_def: bool) -> FnType {
28+
let mut arg_tys = do atys.map |a| {
29+
LLVMType { cast: false, ty: *a }
30+
};
31+
let mut ret_ty = LLVMType {
32+
cast: false,
33+
ty: rty
34+
};
35+
let mut attrs = do atys.map |_| {
36+
None
37+
};
38+
39+
// Rules for returning structs taken from
40+
// http://www.angelcode.com/dev/callconv/callconv.html
41+
let sret = {
42+
let returning_a_struct = unsafe { LLVMGetTypeKind(rty) == Struct && ret_def };
43+
let big_struct = if self.ccx.sess.targ_cfg.os != os_win32 {
44+
true
45+
} else {
46+
llsize_of_alloc(self.ccx, rty) > 8
47+
};
48+
returning_a_struct && big_struct
49+
};
50+
51+
if sret {
52+
let ret_ptr_ty = LLVMType {
53+
cast: false,
54+
ty: T_ptr(ret_ty.ty)
55+
};
56+
arg_tys = ~[ret_ptr_ty] + arg_tys;
57+
attrs = ~[Some(StructRetAttribute)] + attrs;
58+
ret_ty = LLVMType {
59+
cast: false,
60+
ty: T_void(),
61+
};
62+
}
63+
64+
return FnType {
65+
arg_tys: arg_tys,
66+
ret_ty: ret_ty,
67+
attrs: attrs,
68+
sret: sret
69+
};
70+
}
71+
}
72+
73+
pub fn abi_info(ccx: @CrateContext) -> @ABIInfo {
74+
return @X86_ABIInfo {
75+
ccx: ccx
76+
} as @ABIInfo;
77+
}

branches/auto/src/librustc/middle/trans/cabi_x86_64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,6 @@ impl ABIInfo for X86_64_ABIInfo {
410410
}
411411
}
412412

413-
pub fn x86_64_abi_info() -> @ABIInfo {
413+
pub fn abi_info() -> @ABIInfo {
414414
return @X86_64_ABIInfo as @ABIInfo;
415415
}

branches/auto/src/librustc/middle/trans/debuginfo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ fn create_ty(cx: @CrateContext, t: ty::t, span: span)
671671
ty::ty_closure(ref _closurety) => {
672672
cx.sess.span_bug(span, ~"debuginfo for closure NYI")
673673
},
674-
ty::ty_trait(_did, ref _substs, ref _vstore) => {
674+
ty::ty_trait(_did, ref _substs, ref _vstore, _) => {
675675
cx.sess.span_bug(span, ~"debuginfo for trait NYI")
676676
},
677677
ty::ty_struct(did, ref substs) => {

branches/auto/src/librustc/middle/trans/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ fn trans_rvalue_dps_unadjusted(bcx: block, expr: @ast::expr,
667667
}
668668
ast::expr_cast(val, _) => {
669669
match ty::get(node_id_type(bcx, expr.id)).sty {
670-
ty::ty_trait(_, _, store) => {
670+
ty::ty_trait(_, _, store, _) => {
671671
return meth::trans_trait_cast(bcx, val, expr.id, dest,
672672
store);
673673
}

branches/auto/src/librustc/middle/trans/foreign.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ use lib::llvm::{TypeRef, ValueRef};
1616
use lib;
1717
use middle::trans::base::*;
1818
use middle::trans::cabi;
19-
use middle::trans::cabi_x86_64::*;
19+
use middle::trans::cabi_x86;
20+
use middle::trans::cabi_x86_64;
2021
use middle::trans::cabi_arm;
21-
use middle::trans::cabi_mips::*;
22+
use middle::trans::cabi_mips;
2223
use middle::trans::build::*;
2324
use middle::trans::callee::*;
2425
use middle::trans::common::*;
@@ -42,12 +43,12 @@ use syntax::abi::{Architecture, X86, X86_64, Arm, Mips};
4243
use syntax::abi::{RustIntrinsic, Rust, Stdcall, Fastcall,
4344
Cdecl, Aapcs, C};
4445

45-
fn abi_info(arch: Architecture) -> @cabi::ABIInfo {
46-
return match arch {
47-
X86_64 => x86_64_abi_info(),
46+
fn abi_info(ccx: @CrateContext) -> @cabi::ABIInfo {
47+
return match ccx.sess.targ_cfg.arch {
48+
X86 => cabi_x86::abi_info(ccx),
49+
X86_64 => cabi_x86_64::abi_info(),
4850
Arm => cabi_arm::abi_info(),
49-
Mips => mips_abi_info(),
50-
X86 => cabi::llvm_abi_info()
51+
Mips => cabi_mips::abi_info(),
5152
}
5253
}
5354

@@ -112,7 +113,7 @@ fn shim_types(ccx: @CrateContext, id: ast::node_id) -> ShimTypes {
112113
!ty::type_is_bot(fn_sig.output) &&
113114
!ty::type_is_nil(fn_sig.output);
114115
let fn_ty =
115-
abi_info(ccx.sess.targ_cfg.arch).compute_info(
116+
abi_info(ccx).compute_info(
116117
llsig.llarg_tys,
117118
llsig.llret_ty,
118119
ret_def);

branches/auto/src/librustc/middle/trans/glue.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -551,11 +551,11 @@ pub fn make_drop_glue(bcx: block, v0: ValueRef, t: ty::t) {
551551
ty::ty_closure(_) => {
552552
closure::make_closure_glue(bcx, v0, t, drop_ty)
553553
}
554-
ty::ty_trait(_, _, ty::BoxTraitStore) => {
554+
ty::ty_trait(_, _, ty::BoxTraitStore, _) => {
555555
let llbox = Load(bcx, GEPi(bcx, v0, [0u, 1u]));
556556
decr_refcnt_maybe_free(bcx, llbox, ty::mk_opaque_box(ccx.tcx))
557557
}
558-
ty::ty_trait(_, _, ty::UniqTraitStore) => {
558+
ty::ty_trait(_, _, ty::UniqTraitStore, _) => {
559559
let lluniquevalue = GEPi(bcx, v0, [0, 1]);
560560
let lltydesc = Load(bcx, GEPi(bcx, v0, [0, 2]));
561561
call_tydesc_glue_full(bcx, lluniquevalue, lltydesc,
@@ -617,12 +617,12 @@ pub fn make_take_glue(bcx: block, v: ValueRef, t: ty::t) {
617617
ty::ty_closure(_) => {
618618
closure::make_closure_glue(bcx, v, t, take_ty)
619619
}
620-
ty::ty_trait(_, _, ty::BoxTraitStore) => {
620+
ty::ty_trait(_, _, ty::BoxTraitStore, _) => {
621621
let llbox = Load(bcx, GEPi(bcx, v, [0u, 1u]));
622622
incr_refcnt_of_boxed(bcx, llbox);
623623
bcx
624624
}
625-
ty::ty_trait(_, _, ty::UniqTraitStore) => {
625+
ty::ty_trait(_, _, ty::UniqTraitStore, _) => {
626626
let llval = GEPi(bcx, v, [0, 1]);
627627
let lltydesc = Load(bcx, GEPi(bcx, v, [0, 2]));
628628
call_tydesc_glue_full(bcx, llval, lltydesc,

0 commit comments

Comments
 (0)