Skip to content

[FEATURE REQUEST] ShareArrayBuffer & Atomics #1930

@cometkim

Description

@cometkim

Hi. I recently compiled the entire ReScript compiler to WebAssembly using wasm_of_ocaml and am interested in further experimentation.

I'm exploring whether ReScript could replace the PPX toolchain inherited from OCaml with a WASM-based plugin system. And I'm wondering if there is a way to use shared memory to avoid transferring the entire syntax structure via channel of file IO.

Specifically, JS has SharedArrayBuffer and Atomics API, supported in major browsers with crossOriginIsolated: true policy. And the WebAssembly Atomics operations allow it to interact with the JS side.

If both the compiler and plugins are based on OCaml and thus share the same object layout, I think it would be easy to achieve a zero-copy deserialization model based on the shared memory.

I'm very interested in how this could be expressed and supported by the OCaml API. Could the thread & atomics API possibly be integrated with effects? Curious about your thoughts.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions