You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
OCaml's Bigarray module can't handle large linear memory sizes #80
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?
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.
I think you're correct. This is a limitation on 32-bit systems.
I suggest defining `address` and `size` to be `nativeint`. Then
`address_of_value` would no longer wrap.
Furthermore, the `create` function then needs to check whether the size
overflows an int, and if so, raise `Out_of_memory`. That way, sizes too
large are not observably different from OOM, which seems like suitable
behaviour.
Analogously, load & store functions in memory.ml need to check whether the
index overflows int range and raise `Bounds` in that case.
Activity
sunfishcode commentedon Sep 18, 2015
One more note: I noticed this while working on wasm's integer operator semantics, and noticed that
address_of_valuecurrently doesInt32.to_int i, which silently wraps if the value is outside the OCaml int range, which is not the intended semantics.rossberg commentedon Sep 21, 2015
lukewagner commentedon Oct 29, 2015
I consider this basically resolved by #108 which at least confines the hand waving to one well-commented block.
Support import/export mut globals in interpreter (WebAssembly#80)
Revert import/export mutable global changes
[spec] DataCount section, syntax, and validation (WebAssembly#80)
Merge pull request WebAssembly#80 from WebAssembly/instructions
[spec/interpreter] Fix missing multi table bulk cases (WebAssembly#80)
Merge pull request #80 from ngzhian/merge-upstream
Update repos (WebAssembly#80)
Support import/export mut globals in interpreter (WebAssembly#80)
Revert import/export mutable global changes