Wasm support? (Compilation fails on wasm)
Boscop opened this issue · 2 comments
Boscop commented
I'd really like to use SliceDeque
on wasm instead of VecDeque because it has a better API and supports splice
. But it fails to build:
error[E0425]: cannot find function `allocation_granularity` in this scope
--> C:\Users\me\.cargo\registry\src\github.com-1ecc6299db9ec823\slice-deque-0.3.0\src\mirrored\buffer.rs:7:14
|
7 | let ag = allocation_granularity();
| ^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
error[E0425]: cannot find function `allocation_granularity` in this scope
--> C:\Users\me\.cargo\registry\src\github.com-1ecc6299db9ec823\slice-deque-0.3.0\src\mirrored\buffer.rs:112:15
|
112 | * allocation_granularity();
| ^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
error[E0425]: cannot find function `allocation_granularity` in this scope
--> C:\Users\me\.cargo\registry\src\github.com-1ecc6299db9ec823\slice-deque-0.3.0\src\mirrored\buffer.rs:135:41
|
135 | assert!(mem::align_of::<T>() <= allocation_granularity());
| ^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
error[E0425]: cannot find function `allocation_granularity` in this scope
--> C:\Users\me\.cargo\registry\src\github.com-1ecc6299db9ec823\slice-deque-0.3.0\src\mirrored\buffer.rs:148:36
|
148 | debug_assert!(alloc_size % allocation_granularity() == 0);
| ^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
error[E0425]: cannot find function `allocate_mirrored` in this scope
--> C:\Users\me\.cargo\registry\src\github.com-1ecc6299db9ec823\slice-deque-0.3.0\src\mirrored\buffer.rs:151:19
|
151 | let ptr = allocate_mirrored(alloc_size)?;
| ^^^^^^^^^^^^^^^^^ not found in this scope
error[E0425]: cannot find function `deallocate_mirrored` in this scope
--> C:\Users\me\.cargo\registry\src\github.com-1ecc6299db9ec823\slice-deque-0.3.0\src\mirrored\buffer.rs:172:18
|
172 | unsafe { deallocate_mirrored(first_half_ptr, buffer_size_in_bytes) };
| ^^^^^^^^^^^^^^^^^^^ not found in this scope
error: aborting due to 6 previous errors
glalonde commented
After a brief look, It appears the issue here is that wasm doesn't have a function for 'mirroring' a region of memory. The allocate_mirrored
function makes two allocations contiguously and maps them to the same logical file so that writes to one are reflected in reads to the other using mmap.
It seems wasm doesn't have this yet because it doesn't have a notion of memory mapped files?
simeonexo commented
I ran into the same problem building for wasm. Is there any solution yet?