-
Notifications
You must be signed in to change notification settings - Fork 58
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
Allow reference types as long as not used by the initialization function? #98
Comments
We do this sort of thing for bulk memory already. We do an extra validation pass over the Wasm and fail if we statically see any Adding support for doing these checks dynamically is a little more involved. I think we could do this by inserting calls to a new |
Could we perhaps check if there are any live references at the end of wizening? It seems like everything else wouldn't really matter, right? |
If we limit this to So basically, I think allowing support for But
See #29 for more ideas about full table support. |
See bytecodealliance#98 for more context.
See bytecodealliance#98 for more context.
See bytecodealliance#98 for more context.
See bytecodealliance#98 for more context.
See bytecodealliance#98 for more context.
Rust 1.82 seems to have enabled reference types by default, so Wizer fails on Wasm files produced by a Rust 1.82 compiler. |
Ah, that's unfortunate :( I'm not sure any of the maintainers have the bandwidth to take this on currently, I'm afraid. If you're able to look into it yourself, we'd definitely be very happy to support you in doing so. Otherwise, I don't think we can give a realistic timeline for when this will be fixed. |
I briefly talked to @fitzgen about this a few weeks ago; if I recall correctly we agreed that it was fine to enable this alongside the existing checks that there are no table-mutating instructions, because given the lack of such instructions, no refs can be live other than the initial table elements (which wizer preserves); and this should be sufficient for new LLVM usage. I had a quick hack to enable this but unfortunately have wiped and returned the laptop that was on; but IIRC I had updated around here and similarly below that to make the feature-flag a wizer command-line option (and then one would want to add a test with a handwritten module in wat). |
#124 I hope this is useful :) |
I am not sure why the tests on windows failed or what else is missing but I'd like to help get this merged any way I can |
I have a WASM module that uses reference types, but the initialization function (some pure precomputation) doesn't use them. Currently, wizer categorically fails with
However, when I apply this patch
everything works fine, both initialization and later usage of the WASM module (including reference types).
Would it make sense to allow reference types a priori, and instead error when instructions related to reference types are encountered during initialization? I could take a stab at a PR if this makes sense.
The text was updated successfully, but these errors were encountered: