Skip to content

Commit 4dce95f

Browse files
committed
---
yaml --- r: 144343 b: refs/heads/try2 c: c96b1d8 h: refs/heads/master i: 144341: 4001619 144339: 6dd10e3 144335: ad4732f v: v3
1 parent 5859201 commit 4dce95f

28 files changed

+120
-907
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: 347943640e9ea1db18d5a7401c0b50a44544599d
8+
refs/heads/try2: c96b1d89c490807b7ecdc9929a445dd82987275c
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/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/rt/memory_region.cpp

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// except according to those terms.
1010

1111

12-
#include "sync/sync.h"
1312
#include "memory_region.h"
1413

1514
#if RUSTRT_TRACK_ALLOCATIONS >= 3
@@ -42,30 +41,25 @@ inline void memory_region::maybe_print_backtrace(const alloc_header *header) con
4241
# endif
4342
}
4443

45-
memory_region::memory_region(bool synchronized,
46-
bool detailed_leaks,
44+
memory_region::memory_region(bool detailed_leaks,
4745
bool poison_on_free) :
4846
_parent(NULL), _live_allocations(0),
4947
_detailed_leaks(detailed_leaks),
50-
_poison_on_free(poison_on_free),
51-
_synchronized(synchronized) {
48+
_poison_on_free(poison_on_free) {
5249
}
5350

5451
memory_region::memory_region(memory_region *parent) :
5552
_parent(parent), _live_allocations(0),
5653
_detailed_leaks(parent->_detailed_leaks),
57-
_poison_on_free(parent->_poison_on_free),
58-
_synchronized(parent->_synchronized) {
54+
_poison_on_free(parent->_poison_on_free) {
5955
}
6056

6157
void memory_region::add_alloc() {
62-
//_live_allocations++;
63-
sync::increment(_live_allocations);
58+
_live_allocations++;
6459
}
6560

6661
void memory_region::dec_alloc() {
67-
//_live_allocations--;
68-
sync::decrement(_live_allocations);
62+
_live_allocations--;
6963
}
7064

7165
void memory_region::free(void *mem) {
@@ -112,7 +106,6 @@ memory_region::realloc(void *mem, size_t orig_size) {
112106
# endif
113107

114108
# if RUSTRT_TRACK_ALLOCATIONS >= 2
115-
if (_synchronized) { _lock.lock(); }
116109
if (_allocation_list[newMem->index] != alloc) {
117110
printf("at index %d, found %p, expected %p\n",
118111
alloc->index, _allocation_list[alloc->index], alloc);
@@ -125,7 +118,6 @@ memory_region::realloc(void *mem, size_t orig_size) {
125118
// printf("realloc: stored %p at index %d, replacing %p\n",
126119
// newMem, index, mem);
127120
}
128-
if (_synchronized) { _lock.unlock(); }
129121
# endif
130122

131123
return get_data(newMem);
@@ -160,9 +152,7 @@ memory_region::malloc(size_t size, const char *tag) {
160152
}
161153

162154
memory_region::~memory_region() {
163-
if (_synchronized) { _lock.lock(); }
164155
if (_live_allocations == 0 && !_detailed_leaks) {
165-
if (_synchronized) { _lock.unlock(); }
166156
return;
167157
}
168158
char msg[128];
@@ -193,7 +183,6 @@ memory_region::~memory_region() {
193183
fprintf(stderr, "%s\n", msg);
194184
assert(false);
195185
}
196-
if (_synchronized) { _lock.unlock(); }
197186
}
198187

199188
void
@@ -204,7 +193,6 @@ memory_region::release_alloc(void *mem) {
204193
# endif
205194

206195
# if RUSTRT_TRACK_ALLOCATIONS >= 2
207-
if (_synchronized) { _lock.lock(); }
208196
if (((size_t) alloc->index) >= _allocation_list.size()) {
209197
printf("free: ptr 0x%" PRIxPTR " (%s) index %d is beyond allocation_list of size %zu\n",
210198
(uintptr_t) get_data(alloc), alloc->tag, alloc->index, _allocation_list.size());
@@ -222,7 +210,6 @@ memory_region::release_alloc(void *mem) {
222210
_allocation_list[alloc->index] = NULL;
223211
alloc->index = -1;
224212
}
225-
if (_synchronized) { _lock.unlock(); }
226213
# endif
227214

228215
dec_alloc();
@@ -236,9 +223,7 @@ memory_region::claim_alloc(void *mem) {
236223
# endif
237224

238225
# if RUSTRT_TRACK_ALLOCATIONS >= 2
239-
if (_synchronized) { _lock.lock(); }
240226
alloc->index = _allocation_list.append(alloc);
241-
if (_synchronized) { _lock.unlock(); }
242227
# endif
243228

244229
# if RUSTRT_TRACK_ALLOCATIONS >= 3

branches/try2/src/rt/memory_region.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ class memory_region {
5959
array_list<alloc_header *> _allocation_list;
6060
const bool _detailed_leaks;
6161
const bool _poison_on_free;
62-
const bool _synchronized;
6362
lock_and_signal _lock;
6463

6564
void add_alloc();
@@ -77,8 +76,7 @@ class memory_region {
7776
memory_region& operator=(const memory_region& rhs);
7877

7978
public:
80-
memory_region(bool synchronized,
81-
bool detailed_leaks, bool poison_on_free);
79+
memory_region(bool detailed_leaks, bool poison_on_free);
8280
memory_region(memory_region *parent);
8381
void *malloc(size_t size, const char *tag);
8482
void *realloc(void *mem, size_t size);

0 commit comments

Comments
 (0)