Skip to content

Commit

Permalink
Update stdarch submodule
Browse files Browse the repository at this point in the history
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
  • Loading branch information
alexcrichton committed Jul 28, 2020
1 parent 2c28244 commit 83b4930
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions library/std/src/sys/wasm/condvar_atomics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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();
Expand All @@ -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;
}
Expand Down
8 changes: 4 additions & 4 deletions library/std/src/sys/wasm/mutex_atomics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]
Expand Down Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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,
}
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/wasm/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion library/stdarch
Submodule stdarch updated 42 files
+2 −2 .github/workflows/main.yml
+0 −25 ci/docker/wasm32-unknown-unknown/Dockerfile
+0 −15 ci/docker/wasm32-unknown-unknown/wasm-entrypoint.sh
+16 −0 ci/docker/wasm32-wasi/Dockerfile
+16 −15 ci/run.sh
+8 −7 crates/assert-instr-macro/src/lib.rs
+0 −3 crates/core_arch/Cargo.toml
+14 −0 crates/core_arch/build.rs
+57 −0 crates/core_arch/src/aarch64/neon/mod.rs
+118 −0 crates/core_arch/src/arm/neon/mod.rs
+8 −5 crates/core_arch/src/lib.rs
+5 −5 crates/core_arch/src/mips/msa.rs
+104 −1 crates/core_arch/src/mod.rs
+16 −0 crates/core_arch/src/simd.rs
+9 −11 crates/core_arch/src/wasm32/atomic.rs
+0 −2 crates/core_arch/src/wasm32/memory.rs
+0 −4 crates/core_arch/src/wasm32/mod.rs
+1,720 −1,037 crates/core_arch/src/wasm32/simd128.rs
+27 −11 crates/core_arch/src/x86/avx.rs
+8 −3 crates/core_arch/src/x86/avx2.rs
+3,246 −201 crates/core_arch/src/x86/avx512f.rs
+124 −0 crates/core_arch/src/x86/macros.rs
+63 −0 crates/core_arch/src/x86/mod.rs
+21 −2 crates/core_arch/src/x86/sse.rs
+64 −10 crates/core_arch/src/x86/sse2.rs
+34 −7 crates/core_arch/src/x86/sse41.rs
+14 −0 crates/core_arch/src/x86/test.rs
+7 −1 crates/core_arch/src/x86_64/avx.rs
+7 −2 crates/core_arch/src/x86_64/avx2.rs
+640 −20 crates/core_arch/src/x86_64/avx512f.rs
+10 −3 crates/core_arch/src/x86_64/sse41.rs
+2 −0 crates/std_detect/src/detect/mod.rs
+1 −0 crates/std_detect/src/detect/os/other.rs
+7 −4 crates/stdarch-test/Cargo.toml
+0 −12 crates/stdarch-test/src/lib.rs
+8 −40 crates/stdarch-test/src/wasm.rs
+1 −0 crates/stdarch-verify/src/lib.rs
+26 −7 crates/stdarch-verify/tests/x86-intel.rs
+112,205 −99,231 crates/stdarch-verify/x86-intel.xml
+2 −4 examples/Cargo.toml
+67 −22 examples/hex.rs
+1 −3 examples/wasm.rs

0 comments on commit 83b4930

Please sign in to comment.