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

Preprocess WASM to import memory #10

Merged
merged 8 commits into from
Nov 18, 2022
Merged

Preprocess WASM to import memory #10

merged 8 commits into from
Nov 18, 2022

Conversation

vgrichina
Copy link
Collaborator

@vgrichina vgrichina commented Nov 18, 2022

nearcore preprocesses WASM it's own way, so this code tries to match:
https://github.com/near/nearcore/blob/85563483db8f7655cbb45e856ba3fb99bbf463e3/runtime/near-vm-runner/src/prepare.rs#L143

This change allows to run WASM modules that don't export memory.

Binary format is manipulated directly, as otherwise is super slow (seconds) using @webassemblyjs/wasm-edit
https://coinexsmartchain.medium.com/wasm-introduction-part-1-binary-format-57895d851580

Direct manipulation is more like 10-20 ms for 1MB WASM file.

@vgrichina vgrichina merged commit c329258 into main Nov 18, 2022
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.

None yet

1 participant