-
Notifications
You must be signed in to change notification settings - Fork 470
Implement import/export of tables, memories, globals #324
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
Conversation
I rethought the export syntax and settled for a nicer shorthand. You can see the difference in the test diffs of commit 930b78d (e.g. 930b78d#diff-a9bee80497844ab6f0450df04af9f8f3). Original comment updated with new description. Please let me know if you do not like this better. :) |
New export syntax is a nice improvement I think. |
Yes, the syntax looks nice and symmetric. I'm afraid I don't have time to read through all the impl changes but feel free to merge when you're ready. When we update and execute the updated test suite, that will help to identify discrepancies. |
Could you make |
@AndrewScheidecker, that's in PR #331. This one is more than large enough already. But I gonna land them together anyway. |
Merge upstream funcref + main repo
This patch implements imports/exports as of of WebAssembly/design#682 and removes
call_import
.This change required a lot of refactoring in the interpreter:
Instance
representing module instances.[Update: made export syntax nicer.]
The patch also changes and extends the S-expr syntax of modules significantly, as follows:
To avoid repetition, there are also convenient shorthands to specify exports inline (and write imports symmetrically):
These forms generalise the previous inline string name syntax for functions, which I removed -- the new forms is somewhat more verbose but also more searchable and symmetric.
Furthermore, it is now forbidden to put an import after a real definition, in order to avoid confusion about the merged index space.
The "spectest" pseudo module now defines a couple of table/memory/global objects for testing imports. Furthermore, there is a new
assert_unlinkable
command that verifies that linking fails (at module instantiation time).Unfortunately, that still doesn't give a good way of testing the import/export semantics. I'd like to extend script syntax in a follow-up to allow more meaningful tests with multiple modules, and ways to observe non-function exports.