Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wasm support? (Compilation fails on wasm) #86

Open
Boscop opened this issue Mar 11, 2020 · 2 comments
Open

Wasm support? (Compilation fails on wasm) #86

Boscop opened this issue Mar 11, 2020 · 2 comments

Comments

@Boscop
Copy link

Boscop commented Mar 11, 2020

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
@Boscop Boscop changed the title Compilation fails on wasm Wasm support? (Compilation fails on wasm) Mar 11, 2020
@glalonde
Copy link

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
Copy link

I ran into the same problem building for wasm. Is there any solution yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants