Skip to content

Commit 98efae8

Browse files
committed
Auto merge of rust-lang#74482 - alexcrichton:update-stdarch, r=hanna-kruppe
Update stdarch submodule This commit updates the src/stdarch submodule primarily to include rust-lang/stdarch#874 which updated and revamped WebAssembly SIMD intrinsics and renamed WebAssembly atomics intrinsics. This is all unstable surface area of the standard library so the changes should be ok here. The SIMD updates also enable SIMD intrinsics to be used by any program any any time, yay! cc rust-lang#74372, a tracking issue I've opened for the stabilization of SIMD intrinsics
2 parents 7b3a781 + 83b4930 commit 98efae8

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

Diff for: library/std/src/sys/wasm/condvar_atomics.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ impl Condvar {
4242

4343
pub unsafe fn notify_one(&self) {
4444
self.cnt.fetch_add(1, SeqCst);
45-
wasm32::atomic_notify(self.ptr(), 1);
45+
wasm32::memory_atomic_notify(self.ptr(), 1);
4646
}
4747

4848
#[inline]
4949
pub unsafe fn notify_all(&self) {
5050
self.cnt.fetch_add(1, SeqCst);
51-
wasm32::atomic_notify(self.ptr(), u32::MAX); // -1 == "wake everyone"
51+
wasm32::memory_atomic_notify(self.ptr(), u32::MAX); // -1 == "wake everyone"
5252
}
5353

5454
pub unsafe fn wait(&self, mutex: &Mutex) {
@@ -62,7 +62,7 @@ impl Condvar {
6262
// wake us up once we're asleep.
6363
let ticket = self.cnt.load(SeqCst) as i32;
6464
mutex.unlock();
65-
let val = wasm32::i32_atomic_wait(self.ptr(), ticket, -1);
65+
let val = wasm32::memory_atomic_wait32(self.ptr(), ticket, -1);
6666
// 0 == woken, 1 == not equal to `ticket`, 2 == timeout (shouldn't happen)
6767
debug_assert!(val == 0 || val == 1);
6868
mutex.lock();
@@ -76,7 +76,7 @@ impl Condvar {
7676

7777
// If the return value is 2 then a timeout happened, so we return
7878
// `false` as we weren't actually notified.
79-
let ret = wasm32::i32_atomic_wait(self.ptr(), ticket, nanos as i64) != 2;
79+
let ret = wasm32::memory_atomic_wait32(self.ptr(), ticket, nanos as i64) != 2;
8080
mutex.lock();
8181
return ret;
8282
}

Diff for: library/std/src/sys/wasm/mutex_atomics.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl Mutex {
2626

2727
pub unsafe fn lock(&self) {
2828
while !self.try_lock() {
29-
let val = wasm32::i32_atomic_wait(
29+
let val = wasm32::memory_atomic_wait32(
3030
self.ptr(),
3131
1, // we expect our mutex is locked
3232
-1, // wait infinitely
@@ -40,7 +40,7 @@ impl Mutex {
4040
pub unsafe fn unlock(&self) {
4141
let prev = self.locked.swap(0, SeqCst);
4242
debug_assert_eq!(prev, 1);
43-
wasm32::atomic_notify(self.ptr(), 1); // wake up one waiter, if any
43+
wasm32::memory_atomic_notify(self.ptr(), 1); // wake up one waiter, if any
4444
}
4545

4646
#[inline]
@@ -91,7 +91,7 @@ impl ReentrantMutex {
9191
pub unsafe fn lock(&self) {
9292
let me = thread::my_id();
9393
while let Err(owner) = self._try_lock(me) {
94-
let val = wasm32::i32_atomic_wait(self.ptr(), owner as i32, -1);
94+
let val = wasm32::memory_atomic_wait32(self.ptr(), owner as i32, -1);
9595
debug_assert!(val == 0 || val == 1);
9696
}
9797
}
@@ -130,7 +130,7 @@ impl ReentrantMutex {
130130
match *self.recursions.get() {
131131
0 => {
132132
self.owner.swap(0, SeqCst);
133-
wasm32::atomic_notify(self.ptr() as *mut i32, 1); // wake up one waiter, if any
133+
wasm32::memory_atomic_notify(self.ptr() as *mut i32, 1); // wake up one waiter, if any
134134
}
135135
ref mut n => *n -= 1,
136136
}

Diff for: library/std/src/sys/wasm/thread.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl Thread {
4040
while nanos > 0 {
4141
let amt = cmp::min(i64::MAX as u128, nanos);
4242
let mut x = 0;
43-
let val = unsafe { wasm32::i32_atomic_wait(&mut x, 0, amt as i64) };
43+
let val = unsafe { wasm32::memory_atomic_wait32(&mut x, 0, amt as i64) };
4444
debug_assert_eq!(val, 2);
4545
nanos -= amt;
4646
}

Diff for: library/stdarch

Submodule stdarch updated 42 files

0 commit comments

Comments
 (0)