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

Implement table64 extension #51

Closed
9 of 11 tasks
Tracked by #43
sbc100 opened this issue Apr 24, 2024 · 10 comments
Closed
9 of 11 tasks
Tracked by #43

Implement table64 extension #51

sbc100 opened this issue Apr 24, 2024 · 10 comments

Comments

@sbc100
Copy link
Member

sbc100 commented Apr 24, 2024

Now that #46 is decided we need get this extension implemented in various places:

External places:

@dschuff
Copy link
Member

dschuff commented Apr 24, 2024

Looks good, although I wouldn't consider wabt a blocker for phase 4 if we have support in Binaryen.

sbc100 added a commit that referenced this issue Apr 24, 2024
@alexcrichton
Copy link
Contributor

My understanding of ocaml is shaky at best but by my read the current implementation of the binary encoding of a table type is to use the third bit of the prefix byte is used to indicate whether the index type is i64 (where if it's 0 then it's i32, as-is today). This makes sense for memories where the second bit was already claimed for the shared bit by the threads proposal, but I wanted to raise a question here if this is the desired encoding for tables. That means that the second bit in the table type prefix byte is currently unused.

Given the shared-everything-threads proposal it seems like we'll get a shared table type one day so thinking about this I think it might make sense to leave the hole, but I wanted to be sure to flag this and ensure that it was intentional and not accidental (e.g. I can see how it would be easy to just reuse what was already in the interpreter)

@sbc100
Copy link
Member Author

sbc100 commented May 3, 2024

Yes, the idea is tie match the flags that we use for memories.

For example, in wabt we have: https://github.com/WebAssembly/wabt/blob/356931a867c7d642bc282fff46a1c95ab0e843f3/include/wabt/binary.h#L24-L29 and these flags are used for both memories and tables. It makes sense to me to re-use these, even though we don't currently have shared tables. Are there downsides to doing this that you are thinking of?

@alexcrichton
Copy link
Contributor

I don't think there's any downside to doing this, no. In Wasmtime we don't parse limits in the same way between tables/memories because for so long the encoding of tables/memories has diverged - for example for quite some times memories can be shared or 64-bit but tables can't be. Even with the table64 extension and a hypothetical shared table type the custom-page-sizes proposal still has different parsing of the flags byte which won't ever get mapped to tables.

Basically while the parsing of limits was trivially the same between memories/tables I don't think we should take it as a design guideline that they must match for all future proposals as well. The 64-bit-ness and shared-ness makes sense to match since we might as well, though.

@rossberg
Copy link
Member

rossberg commented May 4, 2024

Unless there is a strong reason to do otherwise (like running out of bits), I think it's preferable to keep them in sync. (We have been doing the same for elem/data segments.)

sbc100 added a commit to WebAssembly/binaryen that referenced this issue May 9, 2024
Tests is still very limited.  Hopefully we can use the upstream spec
tests soon and avoid having to write our own tests for
`.set/.set/.fill/etc`.

See WebAssembly/memory64#51
sbc100 added a commit to WebAssembly/binaryen that referenced this issue May 10, 2024
Tests is still very limited.  Hopefully we can use the upstream spec
tests soon and avoid having to write our own tests for
`.set/.set/.fill/etc`.

See WebAssembly/memory64#51
sbc100 added a commit to WebAssembly/binaryen that referenced this issue May 10, 2024
Tests is still very limited.  Hopefully we can use the upstream spec
tests soon and avoid having to write our own tests for
`.set/.set/.fill/etc`.

See WebAssembly/memory64#51
sbc100 added a commit to WebAssembly/binaryen that referenced this issue May 10, 2024
Tests is still very limited.  Hopefully we can use the upstream spec
tests soon and avoid having to write our own tests for
`.set/.set/.fill/etc`.

See WebAssembly/memory64#51
sbc100 added a commit to WebAssembly/binaryen that referenced this issue May 10, 2024
Tests is still very limited.  Hopefully we can use the upstream spec
tests soon and avoid having to write our own tests for
`.set/.set/.fill/etc`.

See WebAssembly/memory64#51
sbc100 added a commit to WebAssembly/binaryen that referenced this issue May 10, 2024
Tests is still very limited.  Hopefully we can use the upstream spec
tests soon and avoid having to write our own tests for
`.set/.set/.fill/etc`.

See WebAssembly/memory64#51
sbc100 added a commit to WebAssembly/binaryen that referenced this issue May 10, 2024
Tests is still very limited.  Hopefully we can use the upstream spec
tests soon and avoid having to write our own tests for
`.set/.set/.fill/etc`.

See WebAssembly/memory64#51
sbc100 added a commit to WebAssembly/wabt that referenced this issue May 13, 2024
sbc100 added a commit to WebAssembly/wabt that referenced this issue May 13, 2024
sbc100 added a commit to WebAssembly/wabt that referenced this issue May 13, 2024
sbc100 added a commit to WebAssembly/wabt that referenced this issue May 13, 2024
sbc100 added a commit to WebAssembly/wabt that referenced this issue May 13, 2024
sbc100 added a commit to WebAssembly/wabt that referenced this issue May 13, 2024
sbc100 added a commit to sbc100/llvm-project that referenced this issue May 13, 2024
sbc100 added a commit to WebAssembly/wabt that referenced this issue May 14, 2024
sbc100 added a commit to WebAssembly/wabt that referenced this issue May 14, 2024
sbc100 added a commit to sbc100/llvm-project that referenced this issue May 15, 2024
sbc100 added a commit to sbc100/llvm-project that referenced this issue May 15, 2024
sbc100 added a commit to WebAssembly/wabt that referenced this issue May 15, 2024
sbc100 added a commit to WebAssembly/wabt that referenced this issue May 15, 2024
sbc100 added a commit to WebAssembly/wabt that referenced this issue May 15, 2024
sbc100 added a commit to WebAssembly/wabt that referenced this issue May 15, 2024
sbc100 added a commit to sbc100/llvm-project that referenced this issue May 24, 2024
@bvisness
Copy link
Collaborator

The SpiderMonkey implementation has landed in Nightly: https://bugzilla.mozilla.org/show_bug.cgi?id=1893643

Aside from the concerns laid out in #68, our implementation is ready for phase 4.

@sbc100
Copy link
Member Author

sbc100 commented Jul 30, 2024

Fantastic. Thanks for all the work on this. I think #68 is now the only blocker.

@sbc100 sbc100 closed this as completed Jul 30, 2024
@sbc100
Copy link
Member Author

sbc100 commented Aug 6, 2024

@bvisness is there a command line flag I need to pass to spidermonkey to enable memory64? I'm trying to run some tests in emscripten CI.

@eqrion
Copy link
Contributor

eqrion commented Aug 6, 2024

In the shell it should get enabled with -P wasm_memory64 (-P enables prefs). In the browser, about:config it should be javascript.options.wasm_memory64. I believe nightly builds have it enabled by default.

@sbc100
Copy link
Member Author

sbc100 commented Aug 6, 2024

Hmm.. I can't seem to make -P work:

$ /usr/local/google/home/sbc/.jsvu/engines/spidermonkey/spidermonkey -P wasm_memory64
Error: Invalid short option: -P
$ /usr/local/google/home/sbc/.jsvu/engines/spidermonkey/spidermonkey -Pwasm_memory64
Error: Short option followed by junk: -Pwasm_memory64

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

6 participants