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

OCaml's Bigarray module can't handle large linear memory sizes #80

Closed
sunfishcode opened this issue Sep 18, 2015 · 3 comments
Closed

OCaml's Bigarray module can't handle large linear memory sizes #80

sunfishcode opened this issue Sep 18, 2015 · 3 comments

Comments

@sunfishcode
Copy link
Member

memory.ml is currently using OCaml's Bigarray module, specifically Bigarray.Array1, to represent linear memory.

Bigarray's interfaces all use OCaml's int type for array extents and index values. While int has a host-dependent size, it is 31 bits on some common systems. It is also signed, so it can only hold values less than 1<<30.

Consequently, on 32-bit hosts, it seems the WebAssembly reference interpreter is limited to linear memory sizes less than 1 GiB, even when the underlying host is capable of allocating that much memory.

Am I understanding everything here correctly? And if so, are there any alternatives to Bigarray which allow for bigger sizes?

@sunfishcode
Copy link
Member Author

One more note: I noticed this while working on wasm's integer operator semantics, and noticed that address_of_value currently does Int32.to_int i, which silently wraps if the value is outside the OCaml int range, which is not the intended semantics.

@rossberg
Copy link
Member

rossberg commented Sep 21, 2015 via email

@lukewagner
Copy link
Member

I consider this basically resolved by #108 which at least confines the hand waving to one well-commented block.

littledan pushed a commit to littledan/spec that referenced this issue Mar 4, 2018
Revert "Update docs to allow import/export mut globals (WebAssembly#81)"

This reverts commit 5d2ad6e.

Revert "Support import/export mut globals in interpreter (WebAssembly#80)"

This reverts commit 07a6fb2.
eqrion pushed a commit to eqrion/wasm-spec that referenced this issue Jul 18, 2019
The data count section has a count that must match the number of data segments. If the data count section isn't present, then `memory.init` and `data.drop` cannot be used.

Fixes issue WebAssembly#73.
alexcrichton pushed a commit to alexcrichton/spec that referenced this issue Nov 19, 2019
awendland pushed a commit to awendland/webassembly-spec-abstypes that referenced this issue Mar 26, 2020
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