Skip to content

Commit e7c7fdf

Browse files
doygraydon
authored andcommitted
---
yaml --- r: 56623 b: refs/heads/auto c: 0583462 h: refs/heads/master i: 56621: e157c0b 56619: 05edadb 56615: c0eb2c9 56607: a3d83e3 v: v3
1 parent c6c50cb commit e7c7fdf

File tree

5 files changed

+124
-31
lines changed

5 files changed

+124
-31
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: c64471ab8624e256c745dfd5d5e89ea6aa9e8228
17+
refs/heads/auto: 058346219a48ff6ac4c9c2fd38e8f478599ab078
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

branches/auto/src/libcore/libc.rs

Lines changed: 106 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ pub use libc::funcs::posix88::unistd::*;
104104

105105
pub use libc::funcs::posix01::stat_::*;
106106
pub use libc::funcs::posix01::unistd::*;
107+
pub use libc::funcs::posix01::glob::*;
107108
pub use libc::funcs::posix08::unistd::*;
108109

109110
pub use libc::funcs::bsd44::*;
@@ -210,7 +211,21 @@ pub mod types {
210211
#[cfg(target_os = "android")]
211212
pub mod os {
212213
pub mod common {
213-
pub mod posix01 {}
214+
pub mod posix01 {
215+
use libc::types::common::c95::{c_void};
216+
use libc::types::os::arch::c95::{c_char, size_t};
217+
pub struct glob_t {
218+
gl_pathc: size_t,
219+
gl_pathv: **c_char,
220+
gl_offs: size_t,
221+
222+
__unused1: *c_void,
223+
__unused2: *c_void,
224+
__unused3: *c_void,
225+
__unused4: *c_void,
226+
__unused5: *c_void,
227+
}
228+
}
214229
}
215230

216231
#[cfg(target_arch = "x86")]
@@ -369,7 +384,25 @@ pub mod types {
369384
#[cfg(target_os = "freebsd")]
370385
pub mod os {
371386
pub mod common {
372-
pub mod posix01 {}
387+
pub mod posix01 {
388+
use libc::types::common::c95::{c_void};
389+
use libc::types::os::arch::c95::{c_char, c_int, size_t};
390+
struct glob_t {
391+
gl_pathc: size_t,
392+
__unused1: size_t,
393+
gl_offs: size_t,
394+
__unused2: c_int,
395+
gl_pathv: **c_char,
396+
397+
__unused3: *c_void,
398+
399+
__unused4: *c_void,
400+
__unused5: *c_void,
401+
__unused6: *c_void,
402+
__unused7: *c_void,
403+
__unused8: *c_void,
404+
}
405+
}
373406
}
374407

375408
#[cfg(target_arch = "x86_64")]
@@ -571,6 +604,23 @@ pub mod types {
571604
pub mod os {
572605
pub mod common {
573606
pub mod posix01 {
607+
use libc::types::common::c95::{c_void};
608+
use libc::types::os::arch::c95::{c_char, c_int, size_t};
609+
struct glob_t {
610+
gl_pathc: size_t,
611+
__unused1: c_int,
612+
gl_offs: size_t,
613+
__unused2: c_int,
614+
gl_pathv: **c_char,
615+
616+
__unused3: *c_void,
617+
618+
__unused4: *c_void,
619+
__unused5: *c_void,
620+
__unused6: *c_void,
621+
__unused7: *c_void,
622+
__unused8: *c_void,
623+
}
574624
}
575625
}
576626

@@ -877,6 +927,18 @@ pub mod consts {
877927
}
878928
pub mod posix01 {
879929
pub static SIGTRAP : int = 5;
930+
931+
pub static GLOB_ERR : int = 1 << 0;
932+
pub static GLOB_MARK : int = 1 << 1;
933+
pub static GLOB_NOSORT : int = 1 << 2;
934+
pub static GLOB_DOOFFS : int = 1 << 3;
935+
pub static GLOB_NOCHECK : int = 1 << 4;
936+
pub static GLOB_APPEND : int = 1 << 5;
937+
pub static GLOB_NOESCAPE : int = 1 << 6;
938+
939+
pub static GLOB_NOSPACE : int = 1;
940+
pub static GLOB_ABORTED : int = 2;
941+
pub static GLOB_NOMATCH : int = 3;
880942
}
881943
pub mod posix08 {
882944
}
@@ -956,6 +1018,18 @@ pub mod consts {
9561018
}
9571019
pub mod posix01 {
9581020
pub static SIGTRAP : int = 5;
1021+
1022+
pub static GLOB_APPEND : int = 0x0001;
1023+
pub static GLOB_DOOFFS : int = 0x0002;
1024+
pub static GLOB_ERR : int = 0x0004;
1025+
pub static GLOB_MARK : int = 0x0008;
1026+
pub static GLOB_NOCHECK : int = 0x0010;
1027+
pub static GLOB_NOSORT : int = 0x0020;
1028+
pub static GLOB_NOESCAPE : int = 0x2000;
1029+
1030+
pub static GLOB_NOSPACE : int = -1;
1031+
pub static GLOB_ABORTED : int = -2;
1032+
pub static GLOB_NOMATCH : int = -3;
9591033
}
9601034
pub mod posix08 {
9611035
}
@@ -1036,6 +1110,18 @@ pub mod consts {
10361110
}
10371111
pub mod posix01 {
10381112
pub static SIGTRAP : int = 5;
1113+
1114+
pub static GLOB_APPEND : int = 0x0001;
1115+
pub static GLOB_DOOFFS : int = 0x0002;
1116+
pub static GLOB_ERR : int = 0x0004;
1117+
pub static GLOB_MARK : int = 0x0008;
1118+
pub static GLOB_NOCHECK : int = 0x0010;
1119+
pub static GLOB_NOSORT : int = 0x0020;
1120+
pub static GLOB_NOESCAPE : int = 0x2000;
1121+
1122+
pub static GLOB_NOSPACE : int = -1;
1123+
pub static GLOB_ABORTED : int = -2;
1124+
pub static GLOB_NOMATCH : int = -3;
10391125
}
10401126
pub mod posix08 {
10411127
}
@@ -1606,6 +1692,21 @@ pub mod funcs {
16061692
-> pid_t;
16071693
}
16081694
}
1695+
1696+
#[nolink]
1697+
#[abi = "cdecl"]
1698+
pub mod glob {
1699+
use libc::types::common::c95::{c_void};
1700+
use libc::types::os::arch::c95::{c_char, c_int};
1701+
use libc::types::os::common::posix01::{glob_t};
1702+
1703+
pub extern {
1704+
unsafe fn glob(pattern: *c_char, flags: c_int,
1705+
errfunc: *c_void, // XXX callback
1706+
pglob: *mut glob_t);
1707+
unsafe fn globfree(pglob: *mut glob_t);
1708+
}
1709+
}
16091710
}
16101711

16111712
#[cfg(target_os = "win32")]
@@ -1615,6 +1716,9 @@ pub mod funcs {
16151716

16161717
pub mod unistd {
16171718
}
1719+
1720+
pub mod glob {
1721+
}
16181722
}
16191723

16201724

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,6 @@ pub static n_tydesc_fields: uint = 8u;
5757
pub static fn_field_code: uint = 0u;
5858
pub static fn_field_box: uint = 1u;
5959

60-
// The three fields of a trait object/trait instance: vtable, box, and type
61-
// description.
62-
pub static trt_field_vtable: uint = 0u;
63-
pub static trt_field_box: uint = 1u;
64-
// This field is only present in unique trait objects, so it comes last.
65-
pub static trt_field_tydesc: uint = 2u;
66-
6760
pub static vec_elt_fill: uint = 0u;
6861

6962
pub static vec_elt_alloc: uint = 1u;

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -549,12 +549,12 @@ pub fn make_drop_glue(bcx: block, v0: ValueRef, t: ty::t) {
549549
closure::make_closure_glue(bcx, v0, t, drop_ty)
550550
}
551551
ty::ty_trait(_, _, ty::BoxTraitStore, _) => {
552-
let llbox = Load(bcx, GEPi(bcx, v0, [0u, abi::trt_field_box]));
552+
let llbox = Load(bcx, GEPi(bcx, v0, [0u, 1u]));
553553
decr_refcnt_maybe_free(bcx, llbox, ty::mk_opaque_box(ccx.tcx))
554554
}
555555
ty::ty_trait(_, _, ty::UniqTraitStore, _) => {
556-
let lluniquevalue = GEPi(bcx, v0, [0, abi::trt_field_box]);
557-
let lltydesc = Load(bcx, GEPi(bcx, v0, [0, abi::trt_field_tydesc]));
556+
let lluniquevalue = GEPi(bcx, v0, [0, 1]);
557+
let lltydesc = Load(bcx, GEPi(bcx, v0, [0, 2]));
558558
call_tydesc_glue_full(bcx, lluniquevalue, lltydesc,
559559
abi::tydesc_field_free_glue, None);
560560
bcx
@@ -613,13 +613,13 @@ pub fn make_take_glue(bcx: block, v: ValueRef, t: ty::t) {
613613
closure::make_closure_glue(bcx, v, t, take_ty)
614614
}
615615
ty::ty_trait(_, _, ty::BoxTraitStore, _) => {
616-
let llbox = Load(bcx, GEPi(bcx, v, [0u, abi::trt_field_box]));
616+
let llbox = Load(bcx, GEPi(bcx, v, [0u, 1u]));
617617
incr_refcnt_of_boxed(bcx, llbox);
618618
bcx
619619
}
620620
ty::ty_trait(_, _, ty::UniqTraitStore, _) => {
621-
let llval = GEPi(bcx, v, [0, abi::trt_field_box]);
622-
let lltydesc = Load(bcx, GEPi(bcx, v, [0, abi::trt_field_tydesc]));
621+
let llval = GEPi(bcx, v, [0, 1]);
622+
let lltydesc = Load(bcx, GEPi(bcx, v, [0, 2]));
623623
call_tydesc_glue_full(bcx, llval, lltydesc,
624624
abi::tydesc_field_take_glue, None);
625625
bcx

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

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -637,15 +637,14 @@ pub fn trans_trait_callee_from_llval(bcx: block,
637637
val_str(bcx.ccx().tn, llpair));
638638
let llvtable = Load(bcx,
639639
PointerCast(bcx,
640-
GEPi(bcx, llpair,
641-
[0u, abi::trt_field_vtable]),
640+
GEPi(bcx, llpair, [0u, 0u]),
642641
T_ptr(T_ptr(T_vtable()))));
643642
644643
// Load the box from the @Trait pair and GEP over the box header if
645644
// necessary:
646645
let mut llself;
647646
debug!("(translating trait callee) loading second index from pair");
648-
let llbox = Load(bcx, GEPi(bcx, llpair, [0u, abi::trt_field_box]));
647+
let llbox = Load(bcx, GEPi(bcx, llpair, [0u, 1u]));
649648
650649
// Munge `llself` appropriately for the type of `self` in the method.
651650
let self_mode;
@@ -846,30 +845,27 @@ pub fn trans_trait_cast(bcx: block,
846845

847846
match store {
848847
ty::RegionTraitStore(_) | ty::BoxTraitStore => {
849-
let mut llboxdest = GEPi(bcx, lldest, [0u, abi::trt_field_box]);
850-
// Just store the pointer into the pair. (Region/borrowed
851-
// and boxed trait objects are represented as pairs, and
852-
// have no type descriptor field.)
848+
let mut llboxdest = GEPi(bcx, lldest, [0u, 1u]);
849+
// Just store the pointer into the pair.
853850
llboxdest = PointerCast(bcx,
854851
llboxdest,
855852
T_ptr(type_of(bcx.ccx(), v_ty)));
856853
bcx = expr::trans_into(bcx, val, SaveIn(llboxdest));
857854
}
858855
ty::UniqTraitStore => {
859-
// Translate the uniquely-owned value in the
860-
// triple. (Unique trait objects are represented as
861-
// triples.)
862-
let mut llvaldest = GEPi(bcx, lldest, [0, abi::trt_field_box]);
856+
// Translate the uniquely-owned value into the second element of
857+
// the triple. (The first element is the vtable.)
858+
let mut llvaldest = GEPi(bcx, lldest, [0, 1]);
863859
llvaldest = PointerCast(bcx,
864860
llvaldest,
865861
T_ptr(type_of(bcx.ccx(), v_ty)));
866862
bcx = expr::trans_into(bcx, val, SaveIn(llvaldest));
867863

868-
// Get the type descriptor of the wrapped value and store
869-
// it in the triple as well.
864+
// Get the type descriptor of the wrapped value and store it into
865+
// the third element of the triple as well.
870866
let tydesc = get_tydesc(bcx.ccx(), v_ty);
871867
glue::lazily_emit_all_tydesc_glue(bcx.ccx(), tydesc);
872-
let lltydescdest = GEPi(bcx, lldest, [0, abi::trt_field_tydesc]);
868+
let lltydescdest = GEPi(bcx, lldest, [0, 2]);
873869
Store(bcx, tydesc.tydesc, lltydescdest);
874870
}
875871
}
@@ -879,7 +875,7 @@ pub fn trans_trait_cast(bcx: block,
879875
let orig = resolve_vtable_in_fn_ctxt(bcx.fcx, orig);
880876
let vtable = get_vtable(bcx.ccx(), orig);
881877
Store(bcx, vtable, PointerCast(bcx,
882-
GEPi(bcx, lldest, [0u, abi::trt_field_vtable]),
878+
GEPi(bcx, lldest, [0u, 0u]),
883879
T_ptr(val_ty(vtable))));
884880

885881
bcx

0 commit comments

Comments
 (0)