Skip to content

Commit a4f9689

Browse files
committed
Stabilize wasm32 memory-related intrinsics
This commit stabilizes the wasm32 memory-related intrinsics, as specified in rust-lang/rust#56292. The old intrinsics were removed and the current intrinsics were updated in place, but it's the last breaking change!
1 parent 5facdde commit a4f9689

File tree

3 files changed

+11
-26
lines changed

3 files changed

+11
-26
lines changed

coresimd/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,9 @@ pub mod arch {
9090
/// See the [module documentation](../index.html) for more details.
9191
#[cfg(any(target_arch = "wasm32", dox))]
9292
#[doc(cfg(target_arch = "wasm32"))]
93-
#[unstable(feature = "stdsimd", issue = "27731")]
93+
#[stable(feature = "simd_wasm32", since = "1.33.0")]
9494
pub mod wasm32 {
95+
#[stable(feature = "simd_wasm32", since = "1.33.0")]
9596
pub use coresimd::wasm32::*;
9697
}
9798

coresimd/wasm32/memory.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ extern "C" {
2424
#[inline]
2525
#[cfg_attr(test, assert_instr("memory.size", mem = 0))]
2626
#[rustc_args_required_const(0)]
27-
pub unsafe fn size(mem: i32) -> i32 {
27+
#[stable(feature = "simd_wasm32", since = "1.33.0")]
28+
pub unsafe fn memory_size(mem: u32) -> usize {
2829
if mem != 0 {
2930
::intrinsics::abort();
3031
}
31-
llvm_memory_size(0)
32+
llvm_memory_size(0) as usize
3233
}
3334

3435
/// Corresponding intrinsic to wasm's [`memory.grow` instruction][instr]
@@ -47,9 +48,10 @@ pub unsafe fn size(mem: i32) -> i32 {
4748
#[inline]
4849
#[cfg_attr(test, assert_instr("memory.grow", mem = 0))]
4950
#[rustc_args_required_const(0)]
50-
pub unsafe fn grow(mem: i32, delta: i32) -> i32 {
51+
#[stable(feature = "simd_wasm32", since = "1.33.0")]
52+
pub unsafe fn memory_grow(mem: u32, delta: usize) -> isize {
5153
if mem != 0 {
5254
::intrinsics::abort();
5355
}
54-
llvm_memory_grow(0, delta)
56+
llvm_memory_grow(0, delta as i32) as isize
5557
}

coresimd/wasm32/mod.rs

+3-21
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,10 @@ use stdsimd_test::assert_instr;
1616
#[cfg(test)]
1717
use wasm_bindgen_test::wasm_bindgen_test;
1818

19-
#[inline]
20-
#[cfg_attr(test, assert_instr("memory.size"))]
21-
#[rustc_deprecated(reason = "renamed to memory::size", since = "1.30.0")]
22-
#[unstable(feature = "stdsimd", issue = "27731")]
23-
#[allow(deprecated)]
24-
#[doc(hidden)]
25-
pub unsafe fn current_memory() -> i32 {
26-
memory::size(0)
27-
}
28-
29-
#[inline]
30-
#[cfg_attr(test, assert_instr("memory.grow"))]
31-
#[rustc_deprecated(reason = "renamed to memory::grow", since = "1.30.0")]
32-
#[unstable(feature = "stdsimd", issue = "27731")]
33-
#[allow(deprecated)]
34-
#[doc(hidden)]
35-
pub unsafe fn grow_memory(delta: i32) -> i32 {
36-
memory::grow(0, delta)
37-
}
38-
3919
pub mod atomic;
40-
pub mod memory;
20+
21+
mod memory;
22+
pub use self::memory::*;
4123

4224
/// Generates the trap instruction `UNREACHABLE`
4325
#[cfg_attr(test, assert_instr(unreachable))]

0 commit comments

Comments
 (0)