wasm64 build with target-feature=+simd128,+atomics · model-checking/verify-rust-std@0c4a661

4 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -30,6 +30,8 @@ where

3030

use core::arch::arm::{uint8x8_t, vtbl1_u8};

3131

#[cfg(target_arch = "wasm32")]

3232

use core::arch::wasm32 as wasm;

33+

#[cfg(target_arch = "wasm64")]

34+

use core::arch::wasm64 as wasm;

3335

#[cfg(target_arch = "x86")]

3436

use core::arch::x86;

3537

#[cfg(target_arch = "x86_64")]

Original file line numberDiff line numberDiff line change

@@ -266,6 +266,7 @@

266266

)]

267267

#![cfg_attr(any(windows, target_os = "uefi"), feature(round_char_boundary))]

268268

#![cfg_attr(target_family = "wasm", feature(stdarch_wasm_atomic_wait))]

269+

#![cfg_attr(target_arch = "wasm64", feature(simd_wasm64))]

269270

#![cfg_attr(

270271

all(any(target_arch = "x86_64", target_arch = "x86"), target_os = "uefi"),

271272

feature(stdarch_x86_has_cpuid)

Original file line numberDiff line numberDiff line change

@@ -1,4 +1,8 @@

1-

use crate::arch::wasm32;

1+

#[cfg(target_arch = "wasm32")]

2+

use core::arch::wasm32 as wasm;

3+

#[cfg(target_arch = "wasm64")]

4+

use core::arch::wasm64 as wasm;

5+
26

use crate::sync::atomic::AtomicU32;

37

use crate::time::Duration;

48

@@ -10,11 +14,8 @@ use crate::time::Duration;

1014

pub fn futex_wait(futex: &AtomicU32, expected: u32, timeout: Option<Duration>) -> bool {

1115

let timeout = timeout.and_then(|t| t.as_nanos().try_into().ok()).unwrap_or(-1);

1216

unsafe {

13-

wasm32::memory_atomic_wait32(

14-

futex as *const AtomicU32 as *mut i32,

15-

expected as i32,

16-

timeout,

17-

) < 2

17+

wasm::memory_atomic_wait32(futex as *const AtomicU32 as *mut i32, expected as i32, timeout)

18+

< 2

1819

}

1920

}

2021

@@ -23,12 +24,12 @@ pub fn futex_wait(futex: &AtomicU32, expected: u32, timeout: Option<Duration>) -

2324

/// Returns true if this actually woke up such a thread,

2425

/// or false if no thread was waiting on this futex.

2526

pub fn futex_wake(futex: &AtomicU32) -> bool {

26-

unsafe { wasm32::memory_atomic_notify(futex as *const AtomicU32 as *mut i32, 1) > 0 }

27+

unsafe { wasm::memory_atomic_notify(futex as *const AtomicU32 as *mut i32, 1) > 0 }

2728

}

2829
2930

/// Wake up all threads that are waiting on futex_wait on this futex.

3031

pub fn futex_wake_all(futex: &AtomicU32) {

3132

unsafe {

32-

wasm32::memory_atomic_notify(futex as *const AtomicU32 as *mut i32, i32::MAX as u32);

33+

wasm::memory_atomic_notify(futex as *const AtomicU32 as *mut i32, i32::MAX as u32);

3334

}

3435

}

Original file line numberDiff line numberDiff line change

@@ -19,7 +19,11 @@ impl Thread {

1919

pub fn set_name(_name: &CStr) {}

2020
2121

pub fn sleep(dur: Duration) {

22-

use crate::arch::wasm32;

22+

#[cfg(target_arch = "wasm32")]

23+

use core::arch::wasm32 as wasm;

24+

#[cfg(target_arch = "wasm64")]

25+

use core::arch::wasm64 as wasm;

26+
2327

use crate::cmp;

2428
2529

// Use an atomic wait to block the current thread artificially with a

@@ -31,7 +35,7 @@ impl Thread {

3135

while nanos > 0 {

3236

let amt = cmp::min(i64::MAX as u128, nanos);

3337

let mut x = 0;

34-

let val = unsafe { wasm32::memory_atomic_wait32(&mut x, 0, amt as i64) };

38+

let val = unsafe { wasm::memory_atomic_wait32(&mut x, 0, amt as i64) };

3539

debug_assert_eq!(val, 2);

3640

nanos -= amt;

3741

}