Skip to content

Use workers and atomic in the VM #1

@FranklinWaller

Description

@FranklinWaller

Is your feature request related to a problem? Please describe.
Currently, all WASI calls are synchronous. This is due to the current nature of WebAssembly. But this prevents PlayOS from lazy loading files (which is required to not crash mobile devices)

Describe the solution you'd like
The only option we currently have is using the disabled SharedArrayBuffer & Atomics. It used to be disabled due to the meltdown bug. Some browsers (Chrome, Opera and Edge) have re-enabled this feature. Mobile devices and firefox are still working on this.
We could just implement this feature now and have it be Chrome & Electron only. This should be fine for now since we expect most people to run the Electron client.

Describe alternatives you've considered
We tried using the Asyncify from Binyaren. But the binary is too big and too slow to be able to handle each .wasm file on the fly. This would suffer the experience.

Additional context
We need to keep in mind when we use atomics that files are fetched as a whole and not piped. This is perfectly fine for small files but not for big files. We may need to find a way to be able to pipe the file into the program (Check how Linux/Unix is doing this).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions