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 #74372, a tracking issue I've opened for the stabilization of SIMD
intrinsics
This commit is contained in:
Alex Crichton 2020-07-18 08:43:09 -07:00
parent 2c28244cf0
commit 83b493018a
4 changed files with 10 additions and 10 deletions

View File

@ -42,13 +42,13 @@ impl Condvar {
pub unsafe fn notify_one(&self) {
self.cnt.fetch_add(1, SeqCst);
wasm32::atomic_notify(self.ptr(), 1);
wasm32::memory_atomic_notify(self.ptr(), 1);
}
#[inline]
pub unsafe fn notify_all(&self) {
self.cnt.fetch_add(1, SeqCst);
wasm32::atomic_notify(self.ptr(), u32::MAX); // -1 == "wake everyone"
wasm32::memory_atomic_notify(self.ptr(), u32::MAX); // -1 == "wake everyone"
}
pub unsafe fn wait(&self, mutex: &Mutex) {
@ -62,7 +62,7 @@ impl Condvar {
// wake us up once we're asleep.
let ticket = self.cnt.load(SeqCst) as i32;
mutex.unlock();
let val = wasm32::i32_atomic_wait(self.ptr(), ticket, -1);
let val = wasm32::memory_atomic_wait32(self.ptr(), ticket, -1);
// 0 == woken, 1 == not equal to `ticket`, 2 == timeout (shouldn't happen)
debug_assert!(val == 0 || val == 1);
mutex.lock();
@ -76,7 +76,7 @@ impl Condvar {
// If the return value is 2 then a timeout happened, so we return
// `false` as we weren't actually notified.
let ret = wasm32::i32_atomic_wait(self.ptr(), ticket, nanos as i64) != 2;
let ret = wasm32::memory_atomic_wait32(self.ptr(), ticket, nanos as i64) != 2;
mutex.lock();
return ret;
}

View File

@ -26,7 +26,7 @@ impl Mutex {
pub unsafe fn lock(&self) {
while !self.try_lock() {
let val = wasm32::i32_atomic_wait(
let val = wasm32::memory_atomic_wait32(
self.ptr(),
1, // we expect our mutex is locked
-1, // wait infinitely
@ -40,7 +40,7 @@ impl Mutex {
pub unsafe fn unlock(&self) {
let prev = self.locked.swap(0, SeqCst);
debug_assert_eq!(prev, 1);
wasm32::atomic_notify(self.ptr(), 1); // wake up one waiter, if any
wasm32::memory_atomic_notify(self.ptr(), 1); // wake up one waiter, if any
}
#[inline]
@ -91,7 +91,7 @@ impl ReentrantMutex {
pub unsafe fn lock(&self) {
let me = thread::my_id();
while let Err(owner) = self._try_lock(me) {
let val = wasm32::i32_atomic_wait(self.ptr(), owner as i32, -1);
let val = wasm32::memory_atomic_wait32(self.ptr(), owner as i32, -1);
debug_assert!(val == 0 || val == 1);
}
}
@ -130,7 +130,7 @@ impl ReentrantMutex {
match *self.recursions.get() {
0 => {
self.owner.swap(0, SeqCst);
wasm32::atomic_notify(self.ptr() as *mut i32, 1); // wake up one waiter, if any
wasm32::memory_atomic_notify(self.ptr() as *mut i32, 1); // wake up one waiter, if any
}
ref mut n => *n -= 1,
}

View File

@ -40,7 +40,7 @@ impl Thread {
while nanos > 0 {
let amt = cmp::min(i64::MAX as u128, nanos);
let mut x = 0;
let val = unsafe { wasm32::i32_atomic_wait(&mut x, 0, amt as i64) };
let val = unsafe { wasm32::memory_atomic_wait32(&mut x, 0, amt as i64) };
debug_assert_eq!(val, 2);
nanos -= amt;
}

@ -1 +1 @@
Subproject commit 45340c0e2fdadf2f131ef43cb683b5cafab0ff15
Subproject commit 311d56cd91609c1c1c0370cbd2ece8e3048653a5