-
Notifications
You must be signed in to change notification settings - Fork 764
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
wasm-opt: tables cannot be declared after functions #1108
Comments
The spec for the text format is here: http://webassembly.github.io/spec/text/index.html. In general, the text format allows everything to be specified in any order. The only constraint is that imports must be specified before any non-imports. |
@binji wow I hadn't even seen that site before 😱 looks like the draft spec you all have been working on. Thanks much! |
Yep :-) @rossberg-chromium discussed it at the most recent WebAssembly CG meeting earlier this week. It is basically feature-complete, minus a few minor appendices. |
@binji I don't have a ton of cycles, but if the fix is rather quick I'm happy to do it--though it seems like the correct way would be to refactor things to not parse function bodies until after parsing the rest of the file. Cc/ @dschuff since I believe he authored that particular check. Edit: I also just remembered that I'm no longer apart of the CG because my involvement in wasm is not related to my employer and I cannot join without it representing them (by W3C rules). I think that prevents me from contributing code entirely |
@jayphelps I see. I don't really know much about binaryen, but it looks like it could just be added as another pre-parse, e.g. |
wasm-opt appears to expect tables in textual wast to be declared before any function bodies, but some utilities such as wabt's wasm2wast always places it after, near the bottom of the file.
binaryen/src/wasm/wasm-s-parser.cpp
Line 1356 in b2c17a1
If I move the table text above the functions, the issue resolves.
I recall seeing a rough spec for the textual format but can't seem to find it right now to see whether binaryen or wabt is at fault or if this is just undefined behavior. I only see the super high level Text Format page.
The text was updated successfully, but these errors were encountered: