Skip to content

Commit d0ac9f8

Browse files
committed
---
yaml --- r: 34876 b: refs/heads/master c: ed447a7 h: refs/heads/master v: v3
1 parent 57b6cec commit d0ac9f8

Some content is hidden

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

53 files changed

+342
-1478
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: e0a9d41b04f16b7771315dcbfcb4e1fa4c347c33
2+
refs/heads/master: ed447a744717faf1ef83869851003ccb93a1591b
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: eb8fd119c65c67f3b1b8268cc7341c22d39b7b61
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024

trunk/AUTHORS.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ Erick Tryzelaar <[email protected]>
4141
Erik Rose <[email protected]>
4242
Evan McClanahan <[email protected]>
4343
Francisco Souza <[email protected]>
44-
4544
Gareth Daniel Smith <[email protected]>
4645
Glenn Willen <[email protected]>
4746
Gonçalo Cabrita <[email protected]>

trunk/configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ then
595595
need_ok "git failed"
596596

597597
msg "git: submodule foreach sync"
598-
"${CFG_GIT}" submodule --quiet foreach --recursive 'if test -e .gitmodules; then git submodule sync; fi'
598+
"${CFG_GIT}" submodule --quiet foreach --recursive git submodule sync
599599
need_ok "git failed"
600600

601601
msg "git: submodule foreach update"

trunk/doc/rust.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2475,6 +2475,7 @@ assert (i == 3);
24752475
~~~~
24762476

24772477
All accessible elements of a vector are always initialized, and access to a vector is always bounds-checked.
2478+
In the case of a definite-
24782479

24792480

24802481
### Structure types

trunk/src/cargo/cargo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1491,7 +1491,7 @@ fn print_pkg(s: @Source, p: &Package) {
14911491
fn print_source(s: @Source) {
14921492
info(s.name + ~" (" + s.url + ~")");
14931493

1494-
let pks = sort::merge_sort(s.packages.get(), sys::shape_lt);
1494+
let pks = sort::merge_sort(sys::shape_lt, s.packages.get());
14951495
let l = vec::len(pks);
14961496

14971497
print(io::with_str_writer(|writer| {

trunk/src/libcore/private.rs

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
#[doc(hidden)];
77

8-
use compare_and_swap = rustrt::rust_compare_and_swap_ptr;
98
use task::TaskBuilder;
109
use task::atomically;
1110

@@ -14,14 +13,6 @@ extern mod rustrt {
1413
fn rust_task_weaken(ch: rust_port_id);
1514
fn rust_task_unweaken(ch: rust_port_id);
1615

17-
#[rust_stack]
18-
fn rust_atomic_increment(p: &mut libc::intptr_t)
19-
-> libc::intptr_t;
20-
21-
#[rust_stack]
22-
fn rust_atomic_decrement(p: &mut libc::intptr_t)
23-
-> libc::intptr_t;
24-
2516
#[rust_stack]
2617
fn rust_compare_and_swap_ptr(address: &mut libc::uintptr_t,
2718
oldval: libc::uintptr_t,
@@ -33,11 +24,36 @@ extern mod rustrt {
3324
fn rust_unlock_little_lock(lock: rust_little_lock);
3425
}
3526

27+
#[abi = "rust-intrinsic"]
28+
extern mod rusti {
29+
30+
#[cfg(stage1)] #[cfg(stage2)] #[cfg(stage3)]
31+
fn atomic_cxchg(dst: &mut int, old: int, src: int) -> int;
32+
fn atomic_xadd(dst: &mut int, src: int) -> int;
33+
fn atomic_xsub(dst: &mut int, src: int) -> int;
34+
}
35+
3636
#[allow(non_camel_case_types)] // runtime type
3737
type rust_port_id = uint;
3838

3939
type GlobalPtr = *libc::uintptr_t;
4040

41+
// TODO: Remove once snapshots have atomic_cxchg
42+
#[cfg(stage0)]
43+
fn compare_and_swap(address: &mut libc::uintptr_t,
44+
oldval: libc::uintptr_t,
45+
newval: libc::uintptr_t) -> bool {
46+
rustrt::rust_compare_and_swap_ptr(address, oldval, newval)
47+
}
48+
49+
#[cfg(stage1)]
50+
#[cfg(stage2)]
51+
#[cfg(stage3)]
52+
fn compare_and_swap(address: &mut int, oldval: int, newval: int) -> bool {
53+
let old = rusti::atomic_cxchg(address, oldval, newval);
54+
old == oldval
55+
}
56+
4157
/**
4258
* Atomically gets a channel from a pointer to a pointer-sized memory location
4359
* or, if no channel exists creates and installs a new channel and sets up a
@@ -85,7 +101,7 @@ pub unsafe fn chan_from_global_ptr<T: Send>(
85101
log(debug,~"BEFORE COMPARE AND SWAP");
86102
let swapped = compare_and_swap(
87103
cast::reinterpret_cast(&global),
88-
0u, cast::reinterpret_cast(&ch));
104+
0, cast::reinterpret_cast(&ch));
89105
log(debug,fmt!("AFTER .. swapped? %?", swapped));
90106

91107
if swapped {
@@ -305,7 +321,7 @@ struct ArcDestruct<T> {
305321
}
306322
do task::unkillable {
307323
let data: ~ArcData<T> = cast::reinterpret_cast(&self.data);
308-
let new_count = rustrt::rust_atomic_decrement(&mut data.count);
324+
let new_count = rusti::atomic_xsub(&mut data.count, 1) - 1;
309325
assert new_count >= 0;
310326
if new_count == 0 {
311327
// Were we really last, or should we hand off to an unwrapper?
@@ -373,8 +389,8 @@ pub unsafe fn unwrap_shared_mutable_state<T: Send>(rc: SharedMutableState<T>)
373389
// Got in. Step 0: Tell destructor not to run. We are now it.
374390
rc.data = ptr::null();
375391
// Step 1 - drop our own reference.
376-
let new_count = rustrt::rust_atomic_decrement(&mut ptr.count);
377-
// assert new_count >= 0;
392+
let new_count = rusti::atomic_xsub(&mut ptr.count, 1) - 1;
393+
//assert new_count >= 0;
378394
if new_count == 0 {
379395
// We were the last owner. Can unwrap immediately.
380396
// Also we have to free the server endpoints.
@@ -452,7 +468,7 @@ pub unsafe fn clone_shared_mutable_state<T: Send>(rc: &SharedMutableState<T>)
452468
-> SharedMutableState<T> {
453469
unsafe {
454470
let ptr: ~ArcData<T> = cast::reinterpret_cast(&(*rc).data);
455-
let new_count = rustrt::rust_atomic_increment(&mut ptr.count);
471+
let new_count = rusti::atomic_xadd(&mut ptr.count, 1) + 1;
456472
assert new_count >= 2;
457473
cast::forget(move ptr);
458474
}

0 commit comments

Comments
 (0)