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

Automatic handling for Wasm modules that export memory and tables #12 #13

Merged
merged 1 commit into from
Mar 5, 2024

Conversation

shravanrn
Copy link
Contributor

@shravanrn shravanrn commented Mar 5, 2024

Currently RLBox only Wasm modules that import memory and tables (-Wl,--import-memory -Wl,--import-table) . With this PR, RLBox also supports Wasm modules that export memory and tables (-Wl,--export-all -Wl,--export-table). The handling is completely automatic (via metaprogramming) and rlbox_wasm2c does not have to be "told" whether a particular Wasm module transpiled with wasm2c is importing or exporting its tables.

Caveats

  1. While exported memories are now supported, note that this will not be as efficient as Wasm modules that use imported memories created by RLBox --- this is because RLBox creates memories with alignment properties which make its internal operations (such as pointer swizzling) faster. Without this optimization, we have to fallback to simpler pointer swizzling.
  2. rlbox_wasm2c assumes that the memory and table are both exported or both imported. We don't handle mixing and matching.

@shravanrn shravanrn merged commit 7b78c78 into master Mar 5, 2024
3 checks passed
@shravanrn shravanrn deleted the export_memtable_support branch March 5, 2024 09:39
@squk
Copy link

squk commented Mar 5, 2024

Thank you!

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.

3 participants