Skip to content

Conversation

dcodeIO
Copy link
Member

@dcodeIO dcodeIO commented Dec 10, 2019

Adds an --exportTable option to export the function table to the host. Background: We are currently not exporting it by default (unlike memory) do allow Binaryen to "directize" indirect calls, which exporting the table prohibits since the table can be modified externally.

fixes #1000

jtenner referenced this pull request in as-pect/as-pect Dec 10, 2019
cli/asc.json Outdated
"default": false
},
"exportTable": {
"description": "Exports the function table.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps mention that it will be at the top level namespace and the other imports are in the env namespace.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exports don't have namespaces, like imports, but I can mention that it becomes exported as table. Is that what you meant?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that you could do the following: @external("env", "foo")
So that the instance will have the namespace env. I didn't mean the typescript namespace, rather just instance.env.table and imports.env.table.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, one can do that on imports, which have a module name and a name, but exports just have a name without nesting. As such, there's no exports.env.table by design, only our mangling like exports["env.table"] as the loader understands it.

@dcodeIO dcodeIO merged commit e2804df into master Dec 18, 2019
@dcodeIO dcodeIO deleted the export-table branch January 1, 2020 14:22
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

Successfully merging this pull request may close these issues.

[Feature] Add Table Export Option
2 participants