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

[WIP] wasm2c: group imports for a given module into a struct type. #1911

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sbc100
Copy link
Member

@sbc100 sbc100 commented Apr 29, 2022

Rather than given each import a magic name we can group imports into a
single struct and pass that struct into the init function.

This means that in the generated code all access to imported elements
now goes via the g_imports struct. Note that this is not a pointer
but a copy of the passed in struct, to avoid adding any extra
indirection.

This can be considered one step towards module instancing.

It also avoids the need for name mangling since individual imports no
longer live in the global namespace.

@sbc100
Copy link
Member Author

sbc100 commented Apr 29, 2022

@keithw .. this is just a WIP .. but perhaps it makes a good stepping stone to #1814.

Rather than given each import a magic name we can group imports into a
single struct and pass that struct into the init function.

This means that in the generated code all access to imported elements
now goes via the `g_imports` struct.  Note that this is not a pointer
but a copy of the passed in struct, to avoid adding any extra
indirection.

This can be considered one step towards module instancing.

It also avoids the need for name mangling since individual imports no
longer live in the global namespace.
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.

1 participant