Skip to content

Commit 59fc3d8

Browse files
committed
Avoid LLVM intrinsics in favor of core::arch
The `core::arch` module is intended to contain various architecture-specific intrinsics, so use that instead of going directly to LLVM!
1 parent dd07a78 commit 59fc3d8

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

wee_alloc/src/imp_wasm32.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
use super::{assert_is_word_aligned, PAGE_SIZE, unchecked_unwrap};
22
use const_init::ConstInit;
33
use core::alloc::AllocErr;
4+
use core::arch::wasm32;
45
use core::cell::UnsafeCell;
56
use core::ptr::NonNull;
67
use memory_units::Pages;
78

8-
extern "C" {
9-
#[link_name = "llvm.wasm.grow.memory.i32"]
10-
fn grow_memory(pages: usize) -> i32;
11-
}
12-
139
pub(crate) unsafe fn alloc_pages(n: Pages) -> Result<NonNull<u8>, AllocErr> {
14-
let ptr = grow_memory(n.0);
10+
let ptr = wasm32::grow_memory(n.0 as i32);
1511
if -1 != ptr {
1612
let ptr = (ptr as usize * PAGE_SIZE.0) as *mut u8;
1713
assert_is_word_aligned(ptr as *mut u8);

wee_alloc/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ for hacking!
226226
#![deny(missing_docs)]
227227
#![cfg_attr(not(feature = "use_std_for_test_debugging"), no_std)]
228228
#![feature(alloc, allocator_api, core_intrinsics)]
229-
#![cfg_attr(target_arch = "wasm32", feature(link_llvm_intrinsics))]
229+
#![cfg_attr(target_arch = "wasm32", feature(stdsimd))]
230230

231231
#[macro_use]
232232
extern crate cfg_if;

0 commit comments

Comments
 (0)