Skip to content

Commit b4646f5

Browse files
committed
---
yaml --- r: 85449 b: refs/heads/dist-snap c: 418e1eb h: refs/heads/master i: 85447: ba2ff0b v: v3
1 parent 4506506 commit b4646f5

Some content is hidden

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

45 files changed

+792
-188
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 0983ebe5310d4eb6d289f636f7ed0536c08bbc0e
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: a4d171e009813a4fef8aebeb3c6c7759064aafe2
9+
refs/heads/dist-snap: 418e1ebae6ed543b1a78c3e987d42bf0bf25f310
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/mk/rt.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ RUNTIME_CXXS_$(1)_$(2) := \
6868
rt/sync/rust_thread.cpp \
6969
rt/rust_builtin.cpp \
7070
rt/rust_run_program.cpp \
71+
rt/rust_env.cpp \
7172
rt/rust_rng.cpp \
73+
rt/rust_stack.cpp \
7274
rt/rust_upcall.cpp \
7375
rt/rust_uv.cpp \
7476
rt/rust_crate_map.cpp \

branches/dist-snap/src/libextra/arc.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ mod tests {
762762
do 10.times {
763763
let tmp = *num;
764764
*num = -1;
765-
task::yield();
765+
task::deschedule();
766766
*num = tmp + 1;
767767
}
768768
c.send(());
@@ -913,17 +913,17 @@ mod tests {
913913
do read_mode.read |state| {
914914
// if writer mistakenly got in, make sure it mutates state
915915
// before we assert on it
916-
do 5.times { task::yield(); }
916+
do 5.times { task::deschedule(); }
917917
// make sure writer didn't get in.
918918
assert!(*state);
919919
}
920920
}
921921
}
922922
#[test]
923923
fn test_rw_write_cond_downgrade_read_race() {
924-
// Ideally the above test case would have yield statements in it that
924+
// Ideally the above test case would have deschedule statements in it that
925925
// helped to expose the race nearly 100% of the time... but adding
926-
// yields in the intuitively-right locations made it even less likely,
926+
// deschedules in the intuitively-right locations made it even less likely,
927927
// and I wasn't sure why :( . This is a mediocre "next best" option.
928928
do 8.times { test_rw_write_cond_downgrade_read_race_helper() }
929929
}

branches/dist-snap/src/libextra/sync.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ impl<Q:Send> Sem<Q> {
112112
}
113113
}
114114
// Uncomment if you wish to test for sem races. Not valgrind-friendly.
115-
/* do 1000.times { task::yield(); } */
115+
/* do 1000.times { task::deschedule(); } */
116116
// Need to wait outside the exclusive.
117117
if waiter_nobe.is_some() {
118118
let _ = waiter_nobe.unwrap().recv();
@@ -225,7 +225,7 @@ impl<'self> Condvar<'self> {
225225
}
226226
}
227227

228-
// If yield checks start getting inserted anywhere, we can be
228+
// If deschedule checks start getting inserted anywhere, we can be
229229
// killed before or after enqueueing. Deciding whether to
230230
// unkillably reacquire the lock needs to happen atomically
231231
// wrt enqueuing.
@@ -731,11 +731,11 @@ mod tests {
731731
let s2 = ~s.clone();
732732
do task::spawn || {
733733
do s2.access {
734-
do 5.times { task::yield(); }
734+
do 5.times { task::deschedule(); }
735735
}
736736
}
737737
do s.access {
738-
do 5.times { task::yield(); }
738+
do 5.times { task::deschedule(); }
739739
}
740740
}
741741
#[test]
@@ -748,7 +748,7 @@ mod tests {
748748
s2.acquire();
749749
c.send(());
750750
}
751-
do 5.times { task::yield(); }
751+
do 5.times { task::deschedule(); }
752752
s.release();
753753
let _ = p.recv();
754754

@@ -757,7 +757,7 @@ mod tests {
757757
let s = ~Semaphore::new(0);
758758
let s2 = ~s.clone();
759759
do task::spawn || {
760-
do 5.times { task::yield(); }
760+
do 5.times { task::deschedule(); }
761761
s2.release();
762762
let _ = p.recv();
763763
}
@@ -800,7 +800,7 @@ mod tests {
800800
c.send(());
801801
}
802802
let _ = p.recv(); // wait for child to come alive
803-
do 5.times { task::yield(); } // let the child contend
803+
do 5.times { task::deschedule(); } // let the child contend
804804
}
805805
let _ = p.recv(); // wait for child to be done
806806
}
@@ -837,7 +837,7 @@ mod tests {
837837
do n.times {
838838
do m.lock {
839839
let oldval = *sharedstate;
840-
task::yield();
840+
task::deschedule();
841841
*sharedstate = oldval + 1;
842842
}
843843
}
@@ -948,7 +948,7 @@ mod tests {
948948
let (p,c) = comm::stream();
949949
do task::spawn || { // linked
950950
let _ = p.recv(); // wait for sibling to get in the mutex
951-
task::yield();
951+
task::deschedule();
952952
fail!();
953953
}
954954
do m2.lock_cond |cond| {
@@ -1114,7 +1114,7 @@ mod tests {
11141114
do n.times {
11151115
do lock_rwlock_in_mode(x, mode) {
11161116
let oldval = *sharedstate;
1117-
task::yield();
1117+
task::deschedule();
11181118
*sharedstate = oldval + 1;
11191119
}
11201120
}

branches/dist-snap/src/librustc/middle/lang_items.rs

Lines changed: 48 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -57,27 +57,28 @@ pub enum LangItem {
5757

5858
StrEqFnLangItem, // 19
5959
UniqStrEqFnLangItem, // 20
60-
LogTypeFnLangItem, // 21
61-
FailFnLangItem, // 22
62-
FailBoundsCheckFnLangItem, // 23
63-
ExchangeMallocFnLangItem, // 24
64-
ClosureExchangeMallocFnLangItem, // 25
65-
ExchangeFreeFnLangItem, // 26
66-
MallocFnLangItem, // 27
67-
FreeFnLangItem, // 28
68-
BorrowAsImmFnLangItem, // 29
69-
BorrowAsMutFnLangItem, // 30
70-
ReturnToMutFnLangItem, // 31
71-
CheckNotBorrowedFnLangItem, // 32
72-
StrDupUniqFnLangItem, // 33
73-
RecordBorrowFnLangItem, // 34
74-
UnrecordBorrowFnLangItem, // 35
75-
76-
StartFnLangItem, // 36
77-
78-
TyDescStructLangItem, // 37
79-
TyVisitorTraitLangItem, // 38
80-
OpaqueStructLangItem, // 39
60+
AnnihilateFnLangItem, // 21
61+
LogTypeFnLangItem, // 22
62+
FailFnLangItem, // 23
63+
FailBoundsCheckFnLangItem, // 24
64+
ExchangeMallocFnLangItem, // 25
65+
ClosureExchangeMallocFnLangItem, // 26
66+
ExchangeFreeFnLangItem, // 27
67+
MallocFnLangItem, // 28
68+
FreeFnLangItem, // 29
69+
BorrowAsImmFnLangItem, // 30
70+
BorrowAsMutFnLangItem, // 31
71+
ReturnToMutFnLangItem, // 32
72+
CheckNotBorrowedFnLangItem, // 33
73+
StrDupUniqFnLangItem, // 34
74+
RecordBorrowFnLangItem, // 35
75+
UnrecordBorrowFnLangItem, // 36
76+
77+
StartFnLangItem, // 37
78+
79+
TyDescStructLangItem, // 38
80+
TyVisitorTraitLangItem, // 39
81+
OpaqueStructLangItem, // 40
8182
}
8283

8384
pub struct LanguageItems {
@@ -121,27 +122,28 @@ impl LanguageItems {
121122

122123
19 => "str_eq",
123124
20 => "uniq_str_eq",
124-
21 => "log_type",
125-
22 => "fail_",
126-
23 => "fail_bounds_check",
127-
24 => "exchange_malloc",
128-
25 => "closure_exchange_malloc",
129-
26 => "exchange_free",
130-
27 => "malloc",
131-
28 => "free",
132-
29 => "borrow_as_imm",
133-
30 => "borrow_as_mut",
134-
31 => "return_to_mut",
135-
32 => "check_not_borrowed",
136-
33 => "strdup_uniq",
137-
34 => "record_borrow",
138-
35 => "unrecord_borrow",
139-
140-
36 => "start",
141-
142-
37 => "ty_desc",
143-
38 => "ty_visitor",
144-
39 => "opaque",
125+
21 => "annihilate",
126+
22 => "log_type",
127+
23 => "fail_",
128+
24 => "fail_bounds_check",
129+
25 => "exchange_malloc",
130+
26 => "closure_exchange_malloc",
131+
27 => "exchange_free",
132+
28 => "malloc",
133+
29 => "free",
134+
30 => "borrow_as_imm",
135+
31 => "borrow_as_mut",
136+
32 => "return_to_mut",
137+
33 => "check_not_borrowed",
138+
34 => "strdup_uniq",
139+
35 => "record_borrow",
140+
36 => "unrecord_borrow",
141+
142+
37 => "start",
143+
144+
38 => "ty_desc",
145+
39 => "ty_visitor",
146+
40 => "opaque",
145147

146148
_ => "???"
147149
}
@@ -224,6 +226,9 @@ impl LanguageItems {
224226
pub fn uniq_str_eq_fn(&self) -> Option<def_id> {
225227
self.items[UniqStrEqFnLangItem as uint]
226228
}
229+
pub fn annihilate_fn(&self) -> Option<def_id> {
230+
self.items[AnnihilateFnLangItem as uint]
231+
}
227232
pub fn log_type_fn(&self) -> Option<def_id> {
228233
self.items[LogTypeFnLangItem as uint]
229234
}
@@ -322,6 +327,7 @@ impl<'self> LanguageItemCollector<'self> {
322327

323328
item_refs.insert(@"str_eq", StrEqFnLangItem as uint);
324329
item_refs.insert(@"uniq_str_eq", UniqStrEqFnLangItem as uint);
330+
item_refs.insert(@"annihilate", AnnihilateFnLangItem as uint);
325331
item_refs.insert(@"log_type", LogTypeFnLangItem as uint);
326332
item_refs.insert(@"fail_", FailFnLangItem as uint);
327333
item_refs.insert(@"fail_bounds_check",

branches/dist-snap/src/librustc/middle/trans/base.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2906,12 +2906,24 @@ pub fn fill_crate_map(ccx: @mut CrateContext, map: ValueRef) {
29062906
}
29072907
subcrates.push(C_int(ccx, 0));
29082908

2909+
let llannihilatefn = match ccx.tcx.lang_items.annihilate_fn() {
2910+
Some(annihilate_def_id) => {
2911+
if annihilate_def_id.crate == ast::LOCAL_CRATE {
2912+
get_item_val(ccx, annihilate_def_id.node)
2913+
} else {
2914+
let annihilate_fn_type = csearch::get_type(ccx.tcx,
2915+
annihilate_def_id).ty;
2916+
trans_external_path(ccx, annihilate_def_id, annihilate_fn_type)
2917+
}
2918+
}
2919+
None => { C_null(Type::i8p()) }
2920+
};
2921+
29092922
unsafe {
29102923
let mod_map = create_module_map(ccx);
29112924
llvm::LLVMSetInitializer(map, C_struct(
29122925
[C_i32(1),
2913-
// FIXME #8431 This used to be the annihilate function, now it's nothing
2914-
C_null(Type::i8p()),
2926+
lib::llvm::llvm::LLVMConstPointerCast(llannihilatefn, Type::i8p().to_ref()),
29152927
p2i(ccx, mod_map),
29162928
C_array(ccx.int_type, subcrates)]));
29172929
}

branches/dist-snap/src/libstd/rt/kill.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ pub struct Death {
141141
on_exit: Option<~fn(bool)>,
142142
// nesting level counter for task::unkillable calls (0 == killable).
143143
unkillable: int,
144-
// nesting level counter for unstable::atomically calls (0 == can yield).
144+
// nesting level counter for unstable::atomically calls (0 == can deschedule).
145145
wont_sleep: int,
146146
// A "spare" handle to the kill flag inside the kill handle. Used during
147147
// blocking/waking as an optimization to avoid two xadds on the refcount.
@@ -572,16 +572,16 @@ impl Death {
572572
}
573573

574574
/// Enter a possibly-nested "atomic" section of code. Just for assertions.
575-
/// All calls must be paired with a subsequent call to allow_yield.
575+
/// All calls must be paired with a subsequent call to allow_deschedule.
576576
#[inline]
577-
pub fn inhibit_yield(&mut self) {
577+
pub fn inhibit_deschedule(&mut self) {
578578
self.wont_sleep += 1;
579579
}
580580

581581
/// Exit a possibly-nested "atomic" section of code. Just for assertions.
582-
/// All calls must be paired with a preceding call to inhibit_yield.
582+
/// All calls must be paired with a preceding call to inhibit_deschedule.
583583
#[inline]
584-
pub fn allow_yield(&mut self) {
584+
pub fn allow_deschedule(&mut self) {
585585
rtassert!(self.wont_sleep != 0);
586586
self.wont_sleep -= 1;
587587
}

branches/dist-snap/src/libstd/select.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ mod test {
250250
let (c2, p3, c4) = x.take();
251251
p3.recv(); // handshake parent
252252
c4.send(()); // normal receive
253-
task::yield();
253+
task::deschedule();
254254
c2.send(()); // select receive
255255
}
256256

@@ -294,7 +294,7 @@ mod test {
294294
if send_on_chans.contains(&i) {
295295
let c = Cell::new(c);
296296
do spawntask_random {
297-
task::yield();
297+
task::deschedule();
298298
c.take().send(());
299299
}
300300
}

0 commit comments

Comments
 (0)