Skip to content

Commit 2e2f03c

Browse files
committed
---
yaml --- r: 144347 b: refs/heads/try2 c: bb9c71f h: refs/heads/master i: 144345: 0ad1d63 144343: 4dce95f v: v3
1 parent de31367 commit 2e2f03c

31 files changed

+159
-938
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 2fb5c49abbab97820f24b8574e574dde1f344249
8+
refs/heads/try2: bb9c71fe82005d2d85f459988d9986f7c817717e
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/mk/rt.mk

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ endif
6363
endif
6464

6565
RUNTIME_CXXS_$(1)_$(2) := \
66-
rt/sync/timer.cpp \
6766
rt/sync/lock_and_signal.cpp \
6867
rt/sync/rust_thread.cpp \
6968
rt/rust_builtin.cpp \
@@ -72,13 +71,9 @@ RUNTIME_CXXS_$(1)_$(2) := \
7271
rt/rust_upcall.cpp \
7372
rt/rust_uv.cpp \
7473
rt/rust_crate_map.cpp \
75-
rt/rust_gc_metadata.cpp \
76-
rt/rust_util.cpp \
7774
rt/rust_log.cpp \
78-
rt/rust_exchange_alloc.cpp \
7975
rt/isaac/randport.cpp \
8076
rt/miniz.cpp \
81-
rt/rust_abi.cpp \
8277
rt/memory_region.cpp \
8378
rt/boxed_region.cpp \
8479
rt/arch/$$(HOST_$(1))/context.cpp \

branches/try2/src/libextra/time.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ pub struct Tm {
121121
}
122122

123123
pub fn empty_tm() -> Tm {
124+
// 64 is the max size of the timezone buffer allocated on windows
125+
// in rust_localtime. In glibc the max timezone size is supposedly 3.
126+
let zone = str::with_capacity(64);
124127
Tm {
125128
tm_sec: 0_i32,
126129
tm_min: 0_i32,
@@ -132,7 +135,7 @@ pub fn empty_tm() -> Tm {
132135
tm_yday: 0_i32,
133136
tm_isdst: 0_i32,
134137
tm_gmtoff: 0_i32,
135-
tm_zone: ~"",
138+
tm_zone: zone,
136139
tm_nsec: 0_i32,
137140
}
138141
}

branches/try2/src/libextra/uuid.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ mod bench {
787787
pub fn parse_str(bh: &mut BenchHarness) {
788788
let s = "urn:uuid:F9168C5E-CEB2-4faa-B6BF-329BF39FA1E4";
789789
do bh.iter {
790-
let u = Uuid::parse_string(s);
790+
Uuid::parse_string(s);
791791
}
792792
}
793793
}

branches/try2/src/librustc/middle/trans/base.rs

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1710,7 +1710,8 @@ pub fn new_fn_ctxt(ccx: @mut CrateContext,
17101710
// field of the fn_ctxt with
17111711
pub fn create_llargs_for_fn_args(cx: @mut FunctionContext,
17121712
self_arg: self_arg,
1713-
args: &[ast::arg])
1713+
args: &[ast::arg],
1714+
arg_tys: &[ty::t])
17141715
-> ~[ValueRef] {
17151716
let _icx = push_ctxt("create_llargs_for_fn_args");
17161717

@@ -1727,26 +1728,31 @@ pub fn create_llargs_for_fn_args(cx: @mut FunctionContext,
17271728

17281729
// Return an array containing the ValueRefs that we get from
17291730
// llvm::LLVMGetParam for each argument.
1730-
vec::from_fn(args.len(), |i| {
1731-
unsafe {
1732-
let arg_n = cx.arg_pos(i);
1733-
let arg = &args[i];
1734-
let llarg = llvm::LLVMGetParam(cx.llfn, arg_n as c_uint);
1735-
1736-
// FIXME #7260: aliasing should be determined by monomorphized ty::t
1737-
match arg.ty.node {
1738-
// `~` pointers never alias other parameters, because ownership was transferred
1739-
ast::ty_uniq(_) => {
1740-
llvm::LLVMAddAttribute(llarg, lib::llvm::NoAliasAttribute as c_uint);
1731+
do vec::from_fn(args.len()) |i| {
1732+
let arg_n = cx.arg_pos(i);
1733+
let arg_ty = arg_tys[i];
1734+
let llarg = unsafe {llvm::LLVMGetParam(cx.llfn, arg_n as c_uint) };
1735+
1736+
match ty::get(arg_ty).sty {
1737+
// `~` pointers never alias other parameters, because
1738+
// ownership was transferred
1739+
ty::ty_uniq(*) |
1740+
ty::ty_evec(_, ty::vstore_uniq) |
1741+
ty::ty_closure(ty::ClosureTy {sigil: ast::OwnedSigil, _}) => {
1742+
unsafe {
1743+
llvm::LLVMAddAttribute(
1744+
llarg, lib::llvm::NoAliasAttribute as c_uint);
17411745
}
1742-
// FIXME: #6785: `&mut` can only alias `&const` and `@mut`, we should check for
1743-
// those in the other parameters and then mark it as `noalias` if there aren't any
1744-
_ => {}
17451746
}
1746-
1747-
llarg
1747+
// FIXME: #6785: `&mut` can only alias `&const` and
1748+
// `@mut`, we should check for those in the other
1749+
// parameters and then mark it as `noalias` if there
1750+
// aren't any
1751+
_ => {}
17481752
}
1749-
})
1753+
1754+
llarg
1755+
}
17501756
}
17511757

17521758
pub fn copy_args_to_allocas(fcx: @mut FunctionContext,
@@ -1881,7 +1887,6 @@ pub fn trans_closure(ccx: @mut CrateContext,
18811887
debug!("trans_closure(..., param_substs=%s)",
18821888
param_substs.repr(ccx.tcx));
18831889

1884-
// Set up arguments to the function.
18851890
let fcx = new_fn_ctxt_w_id(ccx,
18861891
path,
18871892
llfndecl,
@@ -1892,21 +1897,23 @@ pub fn trans_closure(ccx: @mut CrateContext,
18921897
body.info(),
18931898
Some(body.span));
18941899

1895-
let raw_llargs = create_llargs_for_fn_args(fcx, self_arg, decl.inputs);
1896-
1897-
// Set the fixed stack segment flag if necessary.
1898-
if attr::contains_name(attributes, "fixed_stack_segment") {
1899-
set_no_inline(fcx.llfn);
1900-
set_fixed_stack_segment(fcx.llfn);
1901-
}
1902-
19031900
// Create the first basic block in the function and keep a handle on it to
19041901
// pass to finish_fn later.
19051902
let bcx_top = fcx.entry_bcx.unwrap();
19061903
let mut bcx = bcx_top;
19071904
let block_ty = node_id_type(bcx, body.id);
19081905

1906+
// Set up arguments to the function.
19091907
let arg_tys = ty::ty_fn_args(node_id_type(bcx, id));
1908+
let raw_llargs = create_llargs_for_fn_args(fcx, self_arg,
1909+
decl.inputs, arg_tys);
1910+
1911+
// Set the fixed stack segment flag if necessary.
1912+
if attr::contains_name(attributes, "fixed_stack_segment") {
1913+
set_no_inline(fcx.llfn);
1914+
set_fixed_stack_segment(fcx.llfn);
1915+
}
1916+
19101917
bcx = copy_args_to_allocas(fcx, bcx, decl.inputs, raw_llargs, arg_tys);
19111918

19121919
maybe_load_env(fcx);
@@ -2108,10 +2115,11 @@ pub fn trans_enum_variant_or_tuple_like_struct<A:IdAndTy>(
21082115
None,
21092116
None);
21102117

2111-
let raw_llargs = create_llargs_for_fn_args(fcx, no_self, fn_args);
2118+
let arg_tys = ty::ty_fn_args(ctor_ty);
2119+
2120+
let raw_llargs = create_llargs_for_fn_args(fcx, no_self, fn_args, arg_tys);
21122121

21132122
let bcx = fcx.entry_bcx.unwrap();
2114-
let arg_tys = ty::ty_fn_args(ctor_ty);
21152123

21162124
insert_synthetic_type_entries(bcx, fn_args, arg_tys);
21172125
let bcx = copy_args_to_allocas(fcx, bcx, fn_args, raw_llargs, arg_tys);

branches/try2/src/librustc/middle/trans/monomorphize.rs

Lines changed: 2 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,13 @@ use middle::trans::type_of;
2626
use middle::trans::type_use;
2727
use middle::trans::intrinsic;
2828
use middle::ty;
29-
use middle::ty::{FnSig};
3029
use middle::typeck;
3130
use util::ppaux::{Repr,ty_to_str};
3231

3332
use syntax::ast;
3433
use syntax::ast_map;
3534
use syntax::ast_map::path_name;
3635
use syntax::ast_util::local_def;
37-
use syntax::opt_vec;
38-
use syntax::abi::AbiSet;
3936

4037
pub fn monomorphic_fn(ccx: @mut CrateContext,
4138
fn_id: ast::def_id,
@@ -61,17 +58,10 @@ pub fn monomorphic_fn(ccx: @mut CrateContext,
6158
let _icx = push_ctxt("monomorphic_fn");
6259
let mut must_cast = false;
6360

64-
let do_normalize = |t: &ty::t| {
65-
match normalize_for_monomorphization(ccx.tcx, *t) {
66-
Some(t) => { must_cast = true; t }
67-
None => *t
68-
}
69-
};
70-
7161
let psubsts = @param_substs {
72-
tys: real_substs.tps.map(|x| do_normalize(x)),
62+
tys: real_substs.tps.to_owned(),
7363
vtables: vtables,
74-
self_ty: real_substs.self_ty.map(|x| do_normalize(x)),
64+
self_ty: real_substs.self_ty.clone(),
7565
self_vtables: self_vtables
7666
};
7767

@@ -305,61 +295,6 @@ pub fn monomorphic_fn(ccx: @mut CrateContext,
305295
(lldecl, must_cast)
306296
}
307297

308-
pub fn normalize_for_monomorphization(tcx: ty::ctxt,
309-
ty: ty::t) -> Option<ty::t> {
310-
// FIXME[mono] could do this recursively. is that worthwhile? (#2529)
311-
return match ty::get(ty).sty {
312-
ty::ty_box(*) => {
313-
Some(ty::mk_opaque_box(tcx))
314-
}
315-
ty::ty_bare_fn(_) => {
316-
Some(ty::mk_bare_fn(
317-
tcx,
318-
ty::BareFnTy {
319-
purity: ast::impure_fn,
320-
abis: AbiSet::Rust(),
321-
sig: FnSig {bound_lifetime_names: opt_vec::Empty,
322-
inputs: ~[],
323-
output: ty::mk_nil()}}))
324-
}
325-
ty::ty_closure(ref fty) => {
326-
Some(normalized_closure_ty(tcx, fty.sigil))
327-
}
328-
ty::ty_trait(_, _, ref store, _, _) => {
329-
let sigil = match *store {
330-
ty::UniqTraitStore => ast::OwnedSigil,
331-
ty::BoxTraitStore => ast::ManagedSigil,
332-
ty::RegionTraitStore(_) => ast::BorrowedSigil,
333-
};
334-
335-
// Traits have the same runtime representation as closures.
336-
Some(normalized_closure_ty(tcx, sigil))
337-
}
338-
ty::ty_ptr(_) => {
339-
Some(ty::mk_uint())
340-
}
341-
_ => {
342-
None
343-
}
344-
};
345-
346-
fn normalized_closure_ty(tcx: ty::ctxt,
347-
sigil: ast::Sigil) -> ty::t
348-
{
349-
ty::mk_closure(
350-
tcx,
351-
ty::ClosureTy {
352-
purity: ast::impure_fn,
353-
sigil: sigil,
354-
onceness: ast::Many,
355-
region: ty::re_static,
356-
bounds: ty::EmptyBuiltinBounds(),
357-
sig: ty::FnSig {bound_lifetime_names: opt_vec::Empty,
358-
inputs: ~[],
359-
output: ty::mk_nil()}})
360-
}
361-
}
362-
363298
pub fn make_mono_id(ccx: @mut CrateContext,
364299
item: ast::def_id,
365300
substs: &param_substs,

branches/try2/src/libstd/repr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ fn test_repr() {
590590
exact_test(&(~"he\u10f3llo"), "~\"he\\u10f3llo\"");
591591

592592
exact_test(&(@10), "@10");
593-
exact_test(&(@mut 10), "@10"); // FIXME: #4210: incorrect
593+
exact_test(&(@mut 10), "@mut 10");
594594
exact_test(&((@mut 10, 2)), "(@mut 10, 2)");
595595
exact_test(&(~10), "~10");
596596
exact_test(&(&10), "&10");

branches/try2/src/libstd/rt/local_heap.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,10 @@ impl LocalHeap {
4040
#[fixed_stack_segment] #[inline(never)]
4141
pub fn new() -> LocalHeap {
4242
unsafe {
43-
// Don't need synchronization for the single-threaded local heap
44-
let synchronized = false as uintptr_t;
4543
// XXX: These usually come from the environment
4644
let detailed_leaks = false as uintptr_t;
4745
let poison_on_free = false as uintptr_t;
48-
let region = rust_new_memory_region(synchronized, detailed_leaks, poison_on_free);
46+
let region = rust_new_memory_region(detailed_leaks, poison_on_free);
4947
assert!(region.is_not_null());
5048
let boxed = rust_new_boxed_region(region, poison_on_free);
5149
assert!(boxed.is_not_null());
@@ -109,8 +107,7 @@ pub fn live_allocs() -> *raw::Box<()> {
109107

110108
extern {
111109
#[fast_ffi]
112-
fn rust_new_memory_region(synchronized: uintptr_t,
113-
detailed_leaks: uintptr_t,
110+
fn rust_new_memory_region(detailed_leaks: uintptr_t,
114111
poison_on_free: uintptr_t) -> *MemoryRegion;
115112
#[fast_ffi]
116113
fn rust_delete_memory_region(region: *MemoryRegion);

branches/try2/src/libstd/rt/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,7 @@ pub fn init(argc: int, argv: **u8, crate_map: *u8) {
224224
args::init(argc, argv);
225225
env::init();
226226
logging::init(crate_map);
227-
rust_update_gc_metadata(crate_map);
228227
}
229-
230-
externfn!(fn rust_update_gc_metadata(crate_map: *u8));
231228
}
232229

233230
/// One-time runtime cleanup.

branches/try2/src/libstd/rt/util.rs

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use libc;
1414
use option::{Some, None};
1515
use os;
1616
use str::StrSlice;
17+
use unstable::atomics::{AtomicInt, INIT_ATOMIC_INT, SeqCst};
1718

1819
#[cfg(target_os="macos")]
1920
use unstable::running_on_valgrind;
@@ -129,24 +130,12 @@ memory and partly incapable of presentation to others.",
129130
}
130131
}
131132

132-
pub fn set_exit_status(code: int) {
133-
#[fixed_stack_segment]; #[inline(never)];
134-
unsafe {
135-
return rust_set_exit_status_newrt(code as libc::uintptr_t);
136-
}
133+
static mut EXIT_STATUS: AtomicInt = INIT_ATOMIC_INT;
137134

138-
extern {
139-
fn rust_set_exit_status_newrt(code: libc::uintptr_t);
140-
}
135+
pub fn set_exit_status(code: int) {
136+
unsafe { EXIT_STATUS.store(code, SeqCst) }
141137
}
142138

143139
pub fn get_exit_status() -> int {
144-
#[fixed_stack_segment]; #[inline(never)];
145-
unsafe {
146-
return rust_get_exit_status_newrt() as int;
147-
}
148-
149-
extern {
150-
fn rust_get_exit_status_newrt() -> libc::uintptr_t;
151-
}
140+
unsafe { EXIT_STATUS.load(SeqCst) }
152141
}

branches/try2/src/libstd/run.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,7 @@ fn waitpid(pid: pid_t) -> int {
949949
#[cfg(test)]
950950
mod tests {
951951
use io;
952-
use libc::{c_int, uintptr_t};
952+
use libc::c_int;
953953
use option::{Option, None, Some};
954954
use os;
955955
use path::Path;

0 commit comments

Comments
 (0)